@axhub/acp 0.1.0 → 0.1.1
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.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +4 -0
- package/.next/build-manifest.json +3 -3
- package/.next/fallback-build-manifest.json +3 -3
- package/.next/next-minimal-server.js.nft.json +1 -1
- package/.next/next-server.js.nft.json +1 -1
- package/.next/routes-manifest.json +28 -0
- package/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/acp/capabilities/route.js +5 -3
- package/.next/server/app/api/acp/capabilities/route.js.nft.json +1 -1
- package/.next/server/app/api/acp/commands/route.js +1 -1
- package/.next/server/app/api/acp/commands/route.js.nft.json +1 -1
- package/.next/server/app/api/acp/runtime/route.js.nft.json +1 -1
- package/.next/server/app/api/chat/cancel/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/chat/cancel/route/build-manifest.json +9 -0
- package/.next/server/app/api/chat/cancel/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/chat/cancel/route.js +11 -0
- package/.next/server/app/api/chat/cancel/route.js.nft.json +1 -0
- package/.next/server/app/api/chat/cancel/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/chat/resume/[streamId]/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/chat/resume/[streamId]/route/build-manifest.json +9 -0
- package/.next/server/app/api/chat/resume/[streamId]/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/chat/resume/[streamId]/route.js +11 -0
- package/.next/server/app/api/chat/resume/[streamId]/route.js.nft.json +1 -0
- package/.next/server/app/api/chat/resume/[streamId]/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/chat/route.js +5 -3
- package/.next/server/app/api/chat/route.js.nft.json +1 -1
- package/.next/server/app/api/conversations/[threadId]/messages/route.js +4 -2
- package/.next/server/app/api/conversations/[threadId]/messages/route.js.nft.json +1 -1
- package/.next/server/app/api/conversations/[threadId]/route.js +2 -2
- package/.next/server/app/api/conversations/[threadId]/route.js.nft.json +1 -1
- package/.next/server/app/api/conversations/[threadId]/runtime/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/conversations/[threadId]/runtime/route/build-manifest.json +9 -0
- package/.next/server/app/api/conversations/[threadId]/runtime/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/conversations/[threadId]/runtime/route.js +11 -0
- package/.next/server/app/api/conversations/[threadId]/runtime/route.js.nft.json +1 -0
- package/.next/server/app/api/conversations/[threadId]/runtime/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/conversations/route.js +2 -2
- package/.next/server/app/api/conversations/route.js.nft.json +1 -1
- package/.next/server/app/api/local-files/image/route.js.nft.json +1 -1
- package/.next/server/app/api/local-files/open/route.js.nft.json +1 -1
- package/.next/server/app/api/output-artifacts/thread/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/output-artifacts/thread/route/build-manifest.json +9 -0
- package/.next/server/app/api/output-artifacts/thread/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/output-artifacts/thread/route.js +8 -0
- package/.next/server/app/api/output-artifacts/thread/route.js.nft.json +1 -0
- package/.next/server/app/api/output-artifacts/thread/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/output-artifacts/workspace/route.js +1 -1
- package/.next/server/app/api/output-artifacts/workspace/route.js.nft.json +1 -1
- package/.next/server/app/api/tools/image-generation/files/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/tools/image-generation/records/route.js.nft.json +1 -1
- package/.next/server/app/api/tools/user-choice/route.js.nft.json +1 -1
- package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
- package/.next/server/app/page.js +2 -2
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/session/[provider]/[sessionId]/page.js +1 -1
- package/.next/server/app/session/[provider]/[sessionId]/page.js.nft.json +1 -1
- package/.next/server/app/session/[provider]/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/thread/[threadId]/page.js +1 -1
- package/.next/server/app/thread/[threadId]/page.js.nft.json +1 -1
- package/.next/server/app/thread/[threadId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +4 -0
- package/.next/server/chunks/0zjb_server_app_api_conversations_[threadId]_runtime_route_actions_08lhdqs.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__04pn6ap._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0aovkxs._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0c.r6ru._.js +76 -0
- package/.next/server/chunks/[root-of-the-server]__0gmxr~m._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0iokgmz._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0j-lxr4._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0lbwo2g._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0ly6hop._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0ml.1wa._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0o2epta._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0os92l7._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0tmhg7j._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0txmfnw._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0wo0b8z._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0xh8d4~._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0zmyki-._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0zn3~pq._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__13xepwb._.js +3 -0
- package/.next/server/chunks/_0_9_730._.js +107 -0
- package/.next/server/chunks/_0gx~6n6._.js +107 -0
- package/.next/server/chunks/_next-internal_server_app_api_chat_cancel_route_actions_0hdg4o_.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_chat_resume_[streamId]_route_actions_12ynw6q.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_output-artifacts_thread_route_actions_04~2mo7.js +3 -0
- package/.next/server/chunks/lib_conversations_store_ts_0gzcj38._.js +4 -4
- package/.next/server/chunks/node_modules_0nyqhq8._.js +3 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__0piffp7._.js → [root-of-the-server]__09wwymw._.js} +2 -2
- package/.next/server/chunks/ssr/{[root-of-the-server]__0488vn3._.js → [root-of-the-server]__0n6oe29._.js} +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__0icm-_h._.js → [root-of-the-server]__0niwg81._.js} +2 -2
- package/.next/server/chunks/ssr/_03.pm1z._.js +18 -16
- package/.next/server/chunks/ssr/_0txwi90._.js +1 -1
- package/.next/server/chunks/ssr/lib_conversations_store_ts_0-pd6d3._.js +2 -2
- package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_forbidden_0ghu-f7.js +1 -1
- package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_02suzhc.js +2 -2
- package/.next/server/functions-config-manifest.json +3 -0
- package/.next/server/instrumentation.js.nft.json +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/static/chunks/0btc2281yau9i.js +104 -0
- package/.next/static/chunks/0c~b2_-vk17t5.css +1 -0
- package/README.md +2 -2
- package/dist/components/assistant-ui/acp-command-menu.mjs +42 -9
- package/dist/components/assistant-ui/acp-elicitation-option-list.mjs +1 -1
- package/dist/components/assistant-ui/file.mjs +2 -2
- package/dist/components/assistant-ui/image-generation-settings-dialog.mjs +25 -6
- package/dist/components/assistant-ui/image.mjs +2 -2
- package/dist/components/assistant-ui/markdown-text.mjs +3 -3
- package/dist/components/assistant-ui/thread/composer.d.ts +1 -1
- package/dist/components/assistant-ui/thread/composer.mjs +37 -3
- package/dist/components/assistant-ui/thread/context-chips.mjs +3 -2
- package/dist/components/assistant-ui/thread/index.mjs +1 -1
- package/dist/components/assistant-ui/thread/message-list.mjs +1 -1
- package/dist/components/assistant-ui/thread/messages.mjs +2 -2
- package/dist/components/assistant-ui/thread-list.d.ts +8 -2
- package/dist/components/assistant-ui/thread-list.mjs +80 -7
- package/dist/components/assistant-ui/threadlist-sidebar.d.ts +4 -1
- package/dist/components/assistant-ui/threadlist-sidebar.mjs +2 -2
- package/dist/components/assistant-ui/tool-fallback.d.ts +1 -1
- package/dist/components/assistant-ui/tool-fallback.mjs +48 -11
- package/dist/components/tool-ui/option-list.d.ts +2 -1
- package/dist/components/tool-ui/option-list.mjs +4 -4
- package/dist/lib/acp2aisdk/client-context.d.ts +6 -0
- package/dist/lib/acp2aisdk/client-context.mjs +43 -7
- package/dist/lib/acp2aisdk/commands.mjs +5 -20
- package/dist/lib/acp2aisdk/context.d.ts +4 -0
- package/dist/lib/acp2aisdk/errors.d.ts +2 -0
- package/dist/lib/acp2aisdk/errors.mjs +37 -0
- package/dist/lib/acp2aisdk/index.d.ts +7 -0
- package/dist/lib/acp2aisdk/index.mjs +110 -34
- package/dist/lib/acp2aisdk/provider-compat.mjs +4 -2
- package/dist/lib/acp2aisdk/resumable-ui-stream.d.ts +11 -0
- package/dist/lib/acp2aisdk/resumable-ui-stream.mjs +323 -0
- package/dist/lib/acp2aisdk/runtime-message-filter.d.ts +6 -0
- package/dist/lib/acp2aisdk/runtime-message-filter.mjs +22 -0
- package/dist/lib/acp2aisdk/runtime-persistence.d.ts +21 -0
- package/dist/lib/acp2aisdk/runtime-persistence.mjs +135 -0
- package/dist/lib/acp2aisdk/session-store.mjs +7 -1
- package/dist/lib/acp2aisdk/skill-command-cache.mjs +1 -1
- package/dist/lib/api/client.d.ts +51 -4
- package/dist/lib/api/client.mjs +35 -4
- package/dist/lib/api/cors.mjs +7 -1
- package/dist/lib/api/http-response.d.ts +2 -0
- package/dist/lib/api/http-response.mjs +22 -0
- package/dist/lib/conversations/client-adapter.d.ts +1 -0
- package/dist/lib/conversations/client-adapter.mjs +158 -51
- package/dist/lib/conversations/provider-message-loader.d.ts +7 -0
- package/dist/lib/conversations/provider-message-loader.mjs +99 -0
- package/dist/lib/conversations/runtime-message-recovery.d.ts +9 -0
- package/dist/lib/conversations/runtime-message-recovery.mjs +95 -0
- package/dist/lib/conversations/store.d.ts +2 -2
- package/dist/lib/conversations/store.mjs +49 -149
- package/dist/lib/conversations/title-text.d.ts +3 -0
- package/dist/lib/conversations/title-text.mjs +81 -0
- package/dist/lib/conversations/types.d.ts +12 -1
- package/dist/lib/local-image-files.mjs +9 -1
- package/dist/lib/local-image-paths.mjs +31 -6
- package/dist/lib/output-artifacts/thread.d.ts +22 -0
- package/dist/lib/output-artifacts/thread.mjs +47 -0
- package/dist/lib/output-artifacts/workspace.mjs +6 -2
- package/dist/lib/provider-history/codex.mjs +5 -30
- package/dist/public-api/server.d.ts +1 -1
- package/dist/public-api/server.mjs +1 -1
- package/dist/tools/image-generation/client.mjs +6 -4
- package/dist/tools/image-generation/server.mjs +3 -1
- package/dist/tools/image-generation/shared.d.ts +1 -0
- package/dist/tools/image-generation/shared.mjs +4 -0
- package/dist/tools/image-generation/ui-detail.mjs +66 -2
- package/dist/tools/user-choice/ui.mjs +66 -30
- package/package.json +2 -1
- package/.next/server/chunks/[root-of-the-server]__04xq..~._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__07sxz4_._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0dwg3fr._.js +0 -178
- package/.next/server/chunks/[root-of-the-server]__0eanzwb._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0gqx~5k._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0~mtsby._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__10-n4io._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__10g507v._.js +0 -3
- package/.next/static/chunks/0zftsky7gte_9.js +0 -102
- package/.next/static/chunks/1610ha42i.fl~.css +0 -1
- /package/.next/static/{mbk_N5Gs4ZJg3lciRL6ya → Kri5x_Y9TwyCw9FEY15ME}/_buildManifest.js +0 -0
- /package/.next/static/{mbk_N5Gs4ZJg3lciRL6ya → Kri5x_Y9TwyCw9FEY15ME}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{mbk_N5Gs4ZJg3lciRL6ya → Kri5x_Y9TwyCw9FEY15ME}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18566,(e,t,r)=>{t.exports=e.r(76562)},55838,(e,t,r)=>{"use strict";var n=e.r(71645),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=n.useState,o=n.useEffect,s=n.useLayoutEffect,l=n.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!i(e,r)}catch(e){return!0}}var d="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),n=a({inst:{value:r,getSnapshot:t}}),i=n[0].inst,d=n[1];return s(function(){i.value=r,i.getSnapshot=t,u(i)&&d({inst:i})},[e,r,t]),o(function(){return u(i)&&d({inst:i}),e(function(){u(i)&&d({inst:i})})},[e]),l(r),r};r.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:d},2239,(e,t,r)=>{"use strict";t.exports=e.r(55838)},67034,(e,t,r)=>{var n={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,a=l(e),o=a[0],s=a[1],u=new i((o+s)*3/4-s),d=0,c=s>0?o-4:o;for(r=0;r<c;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[d++]=t>>16&255,u[d++]=t>>8&255,u[d++]=255&t;return 2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[d++]=255&t),1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[d++]=t>>8&255,u[d++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],o=0,s=n-i;o<s;o+=16383)a.push(function(e,t,n){for(var i,a=[],o=t;o<n;o+=3)i=(e[o]<<16&0xff0000)+(e[o+1]<<8&65280)+(255&e[o+2]),a.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}(e,o,o+16383>s?s:o+16383));return 1===i?a.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&a.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),a.join("")};for(var r=[],n=[],i="u">typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=a.length;o<s;++o)r[o]=a[o],n[a.charCodeAt(o)]=o;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},72:function(e,t,r){"use strict";var n=r(675),i=r(783),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!s.isEncoding(i))throw TypeError("Unknown encoding: "+i);var a=0|m(n,i),l=o(a),u=l.write(n,i);return u!==a&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e))return c(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(T(e,ArrayBuffer)||e&&T(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(T(e,SharedArrayBuffer)||e&&T(e.buffer,SharedArrayBuffer)))return function(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),s.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var d=e.valueOf&&e.valueOf();if(null!=d&&d!==e)return s.from(d,t,r);var f=function(e){if(s.isBuffer(e)){var t=0|p(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?o(0):c(e):"Buffer"===e.type&&Array.isArray(e.data)?c(e.data):void 0}(e);if(f)return f;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return u(e),o(e<0?0:0|p(e))}function c(e){for(var t=e.length<0?0:0|p(e.length),r=o(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}t.Buffer=s,t.SlowBuffer=function(e){return+e!=e&&(e=0),s.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,s.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!s.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,r){return(u(e),e<=0)?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)},s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function p(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function m(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||T(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return S(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(i)return n?-1:S(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,r){var i,a,o,s=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=C[e[a]];return i}(this,t,r);case"utf8":case"utf-8":return y(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,a=t,o=r,0===a&&o===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(a,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}(this,t,r);default:if(s)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),s=!0}}function h(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){var a;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(a=r*=1)!=a&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return v(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){var a,o=1,s=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;o=2,s/=2,l/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var d=-1;for(a=r;a<s;a++)if(u(e,a)===u(t,-1===d?0:a-d)){if(-1===d&&(d=a),a-d+1===l)return d*o}else -1!==d&&(a-=a-d),d=-1}else for(r+l>s&&(r=s-l),a=r;a>=0;a--){for(var c=!0,p=0;p<l;p++)if(u(e,a+p)!==u(t,p)){c=!1;break}if(c)return a}return -1}s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(T(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),T(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=s.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(T(a,Uint8Array)&&(a=s.from(a)),!s.isBuffer(a))throw TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},s.byteLength=m,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)h(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)h(this,t,t+3),h(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)h(this,t,t+7),h(this,t+1,t+6),h(this,t+2,t+5),h(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?y(this,0,e):f.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},a&&(s.prototype[a]=s.prototype.inspect),s.prototype.compare=function(e,t,r,n,i){if(T(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var a=i-n,o=r-t,l=Math.min(a,o),u=this.slice(n,i),d=e.slice(t,r),c=0;c<l;++c)if(u[c]!==d[c]){a=u[c],o=d[c];break}return a<o?-1:+(o<a)},s.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)};function y(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,o,s,l,u=e[i],d=null,c=u>239?4:u>223?3:u>191?2:1;if(i+c<=r)switch(c){case 1:u<128&&(d=u);break;case 2:(192&(a=e[i+1]))==128&&(l=(31&u)<<6|63&a)>127&&(d=l);break;case 3:a=e[i+1],o=e[i+2],(192&a)==128&&(192&o)==128&&(l=(15&u)<<12|(63&a)<<6|63&o)>2047&&(l<55296||l>57343)&&(d=l);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],(192&a)==128&&(192&o)==128&&(192&s)==128&&(l=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&l<1114112&&(d=l)}null===d?(d=65533,c=1):d>65535&&(d-=65536,n.push(d>>>10&1023|55296),d=56320|1023&d),n.push(d),i+=c}var p=n,m=p.length;if(m<=4096)return String.fromCharCode.apply(String,p);for(var f="",h=0;h<m;)f+=String.fromCharCode.apply(String,p.slice(h,h+=4096));return f}function b(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function x(e,t,r,n,i,a){if(!s.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function w(e,t,r,n,i,a){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function _(e,t,r,n,a){return t*=1,r>>>=0,a||w(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function k(e,t,r,n,a){return t*=1,r>>>=0,a||w(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}s.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,a,o,s,l,u,d,c,p=this.length-t;if((void 0===r||r>p)&&(r=p),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var m=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s,l=parseInt(t.substr(2*o,2),16);if((s=l)!=s)break;e[r+o]=l}return o}(this,e,t,r);case"utf8":case"utf-8":return i=t,a=r,E(S(e,this.length-i),this,i,a);case"ascii":return o=t,s=r,E($(e),this,o,s);case"latin1":case"binary":return function(e,t,r,n){return E($(t),e,r,n)}(this,e,t,r);case"base64":return l=t,u=r,E(j(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d=t,c=r,E(function(e,t){for(var r,n,i=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,i.push(r%256),i.push(n);return i}(e,this.length-d),this,d,c);default:if(m)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),m=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},s.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,s.prototype),n},s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},s.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;x(this,e,t,r,i,0)}var a=1,o=0;for(this[t]=255&e;++o<r&&(a*=256);)this[t+o]=e/a&255;return t+r},s.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;x(this,e,t,r,i,0)}var a=r-1,o=1;for(this[t+a]=255&e;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);x(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);x(this,e,t,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return _(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return _(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return k(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return k(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var a=i-1;a>=0;--a)e[a+t]=this[a+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,a=e.charCodeAt(0);("utf8"===n&&a<128||"latin1"===n)&&(e=a)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var o=s.isBuffer(e)?e:s.from(e,n),l=o.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%l]}return this};var I=/[^+/0-9A-Za-z-_]/g;function S(e,t){t=t||1/0;for(var r,n=e.length,i=null,a=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319||o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return a}function $(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function j(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(I,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function E(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function T(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var C=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},783:function(e,t){t.read=function(e,t,r,n,i){var a,o,s=8*i-n-1,l=(1<<s)-1,u=l>>1,d=-7,c=r?i-1:0,p=r?-1:1,m=e[t+c];for(c+=p,a=m&(1<<-d)-1,m>>=-d,d+=s;d>0;a=256*a+e[t+c],c+=p,d-=8);for(o=a&(1<<-d)-1,a>>=-d,d+=n;d>0;o=256*o+e[t+c],c+=p,d-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:1/0*(m?-1:1);o+=Math.pow(2,n),a-=u}return(m?-1:1)*o*Math.pow(2,a-n)},t.write=function(e,t,r,n,i,a){var o,s,l,u=8*a-i-1,d=(1<<u)-1,c=d>>1,p=5960464477539062e-23*(23===i),m=n?0:a-1,f=n?1:-1,h=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(s=+!!isNaN(t),o=d):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+c>=1?t+=p/l:t+=p*Math.pow(2,1-c),t*l>=2&&(o++,l/=2),o+c>=d?(s=0,o=d):o+c>=1?(s=(t*l-1)*Math.pow(2,i),o+=c):(s=t*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;e[r+m]=255&s,m+=f,s/=256,i-=8);for(o=o<<i|s,u+=i;u>0;e[r+m]=255&o,m+=f,o/=256,u-=8);e[r+m-f]|=128*h}}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}},o=!0;try{n[e](r,r.exports,a),o=!1}finally{o&&delete i[e]}return r.exports}a.ab="/ROOT/node_modules/next/dist/compiled/buffer/",t.exports=a(72)},82579,(e,t,r)=>{"use strict";var n=e.i(67034);let i=void 0!==n.Buffer,a=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,o=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function s(e,t,r){null==r&&null!==t&&"object"==typeof t&&(r=t,t=void 0),i&&n.Buffer.isBuffer(e)&&(e=e.toString()),e&&65279===e.charCodeAt(0)&&(e=e.slice(1));let s=JSON.parse(e,t);if(null===s||"object"!=typeof s)return s;let u=r&&r.protoAction||"error",d=r&&r.constructorAction||"error";if("ignore"===u&&"ignore"===d)return s;if("ignore"!==u&&"ignore"!==d){if(!1===a.test(e)&&!1===o.test(e))return s}else if("ignore"!==u&&"ignore"===d){if(!1===a.test(e))return s}else if(!1===o.test(e))return s;return l(s,{protoAction:u,constructorAction:d,safe:r&&r.safe})}function l(e,{protoAction:t="error",constructorAction:r="error",safe:n}={}){let i=[e];for(;i.length;){let e=i;for(let a of(i=[],e)){if("ignore"!==t&&Object.prototype.hasOwnProperty.call(a,"__proto__")){if(!0===n)return null;if("error"===t)throw SyntaxError("Object contains forbidden prototype property");delete a.__proto__}if("ignore"!==r&&Object.prototype.hasOwnProperty.call(a,"constructor")&&null!==a.constructor&&"object"==typeof a.constructor&&Object.prototype.hasOwnProperty.call(a.constructor,"prototype")){if(!0===n)return null;if("error"===r)throw SyntaxError("Object contains forbidden prototype property");delete a.constructor}for(let e in a){let t=a[e];t&&"object"==typeof t&&i.push(t)}}}return e}function u(e,t,r){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return s(e,t,r)}finally{Error.stackTraceLimit=n}}t.exports=u,t.exports.default=u,t.exports.parse=u,t.exports.safeParse=function(e,t){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return s(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=r}},t.exports.scan=l},26568,(e,t,r)=>{"use strict";var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,a=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,d=/^\s+|\s+$/g;function c(e){return e?e.replace(d,""):""}t.exports=function(e,t){if("string"!=typeof e)throw TypeError("First argument must be a string");if(!e)return[];t=t||{};var r=1,d=1;function p(e){var t=e.match(i);t&&(r+=t.length);var n=e.lastIndexOf("\n");d=~n?e.length-n:d+e.length}function m(){var e={line:r,column:d};return function(t){return t.position=new f(e),g(a),t}}function f(e){this.start=e,this.end={line:r,column:d},this.source=t.source}function h(n){var i=Error(t.source+":"+r+":"+d+": "+n);if(i.reason=n,i.filename=t.source,i.line=r,i.column=d,i.source=e,t.silent);else throw i}function g(t){var r=t.exec(e);if(r){var n=r[0];return p(n),e=e.slice(n.length),r}}function v(e){var t;for(e=e||[];t=y();)!1!==t&&e.push(t);return e}function y(){var t=m();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var r=2;""!=e.charAt(r)&&("*"!=e.charAt(r)||"/"!=e.charAt(r+1));)++r;if(r+=2,""===e.charAt(r-1))return h("End of comment missing");var n=e.slice(2,r-2);return d+=2,p(n),e=e.slice(r),d+=2,t({type:"comment",comment:n})}}f.prototype.content=e,g(a);var b,x=[];for(v(x);b=function(){var e=m(),t=g(o);if(t){if(y(),!g(s))return h("property missing ':'");var r=g(l),i=e({type:"declaration",property:c(t[0].replace(n,"")),value:r?c(r[0].replace(n,"")):""});return g(u),i}}();)!1!==b&&(x.push(b),v(x));return x}},70454,(e,t,r)=>{"use strict";var n=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){let r=null;if(!e||"string"!=typeof e)return r;let n=(0,i.default)(e),a="function"==typeof t;return n.forEach(e=>{if("declaration"!==e.type)return;let{property:n,value:i}=e;a?t(n,i,e):i&&((r=r||{})[n]=i)}),r};let i=n(e.r(26568))},65185,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.camelCase=void 0;var n=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,a=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,l=function(e,t){return t.toUpperCase()},u=function(e,t){return"".concat(t,"-")};r.camelCase=function(e,t){var r;return(void 0===t&&(t={}),!(r=e)||a.test(r)||n.test(r))?e:(e=e.toLowerCase(),(e=t.reactCompat?e.replace(s,u):e.replace(o,u)).replace(i,l))}},15511,(e,t,r)=>{"use strict";var n=(e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(e.r(70454)),i=e.r(65185);function a(e,t){var r={};return e&&"string"==typeof e&&(0,n.default)(e,function(e,n){e&&n&&(r[(0,i.camelCase)(e,t)]=n)}),r}a.default=a,t.exports=a},4100,(e,t,r)=>{"use strict";var n=Object.prototype.hasOwnProperty,i=Object.prototype.toString,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===i.call(e)},l=function(e){if(!e||"[object Object]"!==i.call(e))return!1;var t,r=n.call(e,"constructor"),a=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!a)return!1;for(t in e);return void 0===t||n.call(e,t)},u=function(e,t){a&&"__proto__"===t.name?a(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},d=function(e,t){if("__proto__"===t){if(!n.call(e,t))return;else if(o)return o(e,t).value}return e[t]};t.exports=function e(){var t,r,n,i,a,o,c=arguments[0],p=1,m=arguments.length,f=!1;for("boolean"==typeof c&&(f=c,c=arguments[1]||{},p=2),(null==c||"object"!=typeof c&&"function"!=typeof c)&&(c={});p<m;++p)if(t=arguments[p],null!=t)for(r in t)n=d(c,r),c!==(i=d(t,r))&&(f&&i&&(l(i)||(a=s(i)))?(a?(a=!1,o=n&&s(n)?n:[]):o=n&&l(n)?n:{},u(c,{name:r,newValue:e(f,o,i)})):void 0!==i&&u(c,{name:r,newValue:i}));return c}},43794,(e,t,r)=>{!function(){"use strict";var r={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var a=arguments[t];a&&(e=i(e,function(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var a in e)r.call(e,a)&&e[a]&&(t=i(t,a));return t}(a)))}return e}function i(e,t){return t?e?e+" "+t:e+t:e}if(t.exports)n.default=n,t.exports=n;else if("function"==typeof define&&"object"==typeof define.amd&&define.amd)void 0!==n&&e.v(n);else window.classNames=n}()},99970,(e,t,r)=>{"use strict";var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s={},l={SYMBOL_FOR_REQ_CONTEXT:()=>d,getContext:()=>c};for(var u in l)n(s,u,{get:l[u],enumerable:!0});t.exports=((e,t,r,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of a(t))o.call(e,l)||l===r||n(e,l,{get:()=>t[l],enumerable:!(s=i(t,l))||s.enumerable});return e})(n({},"__esModule",{value:!0}),s);let d=Symbol.for("@vercel/request-context");function c(){let e=globalThis;return e[d]?.get?.()??{}}},91754,(e,t,r)=>{"use strict";var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s={},l={AccessTokenMissingError:()=>d,RefreshAccessTokenFailedError:()=>c};for(var u in l)n(s,u,{get:l[u],enumerable:!0});t.exports=((e,t,r,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of a(t))o.call(e,l)||l===r||n(e,l,{get:()=>t[l],enumerable:!(s=i(t,l))||s.enumerable});return e})(n({},"__esModule",{value:!0}),s);class d extends Error{constructor(){super("No authentication found. Please log in with the Vercel CLI (vercel login)."),this.name="AccessTokenMissingError"}}class c extends Error{constructor(e){super("Failed to refresh authentication token.",{cause:e}),this.name="RefreshAccessTokenFailedError"}}},25150,(e,t,r)=>{"use strict";var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s={},l={AccessTokenMissingError:()=>c.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>c.RefreshAccessTokenFailedError,getContext:()=>d.getContext,getVercelOidcToken:()=>p,getVercelOidcTokenSync:()=>m,getVercelToken:()=>f};for(var u in l)n(s,u,{get:l[u],enumerable:!0});t.exports=((e,t,r,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of a(t))o.call(e,l)||l===r||n(e,l,{get:()=>t[l],enumerable:!(s=i(t,l))||s.enumerable});return e})(n({},"__esModule",{value:!0}),s);var d=e.r(99970),c=e.r(91754);async function p(){return""}function m(){return""}async function f(){throw Error("getVercelToken is not supported in browser environments")}},61866,(e,t,r)=>{t.exports=function(e,t){let r;if("function"!=typeof e)throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let n=0;return function(...i){clearTimeout(r);let a=Date.now(),o=t-(a-n);o<=0?(n=a,e.apply(this,i)):r=setTimeout(()=>{n=Date.now(),e.apply(this,i)},o)}}},63454,e=>{"use strict";let t,r,n,i,a;var o,s,l,u,d,c,p,m,f,h,g,v,y,b,x,w,_,k,I,S,$,j,E,T,C,N,A,R,P,O,M,z,D,U,L,Z,F,B,V,q,W,J,H,K,G,Y,X,Q,ee,et,er,en,ei,ea,eo,es,el,eu,ed,ec,ep,em,ef,eh,eg,ev,ey,eb,ex,ew=e.i(18050),e_=e.i(47167),ek=e.i(71645);function eI(e){let t=[];for(let r of e.effectTasks)try{r()}catch(e){t.push(e)}if(t.length>0)if(1===t.length)throw t[0];else{for(let e of t)console.error(e);throw AggregateError(t,"Errors during commit")}}function eS(e){let t=[];for(let r of e.cells)if(r?.type==="effect"&&(r.deps=null,r.cleanup))try{r.cleanup?.()}catch(e){t.push(e)}finally{r.cleanup=void 0}if(t.length>0)if(1===t.length)throw t[0];else{for(let e of t)console.error(e);throw AggregateError(t,"Errors during cleanup")}}let e$=void 0!==e_.default&&!1,ej=null;function eE(){if(!ej)throw Error("No resource fiber available");return ej}let eT=Symbol("fnSymbol");function eC(e,t,r,n=function(e){return e$?ej?.devStrictMode?ej.isFirstRender?"child":"root":e?"root":null:null}(!1)){return{type:e,root:t,markDirty:r,devStrictMode:n,cells:[],currentIndex:0,renderContext:void 0,isFirstRender:!0,isMounted:!1,isNeverMounted:!0}}function eN(e){if(!e.isMounted)throw Error("Tried to unmount a fiber that is already unmounted");e.isMounted=!1,eS(e)}function eA(e,t){let r={effectTasks:[],props:t,output:void 0};e.currentIndex=0;let n=ej;ej=e;try{if((()=>{e.renderContext=r;try{r.output=function(e,t){let r=e[eT];if(!r)throw Error("ResourceElement.type is not a valid Resource");return r(t)}(e.type,t)}finally{e.renderContext=void 0}})(),e.isFirstRender=!1,e.cells.length!==e.currentIndex)throw Error(`Rendered ${e.currentIndex} hooks but expected ${e.cells.length}. Hooks must be called in the exact same order in every render.`)}finally{ej=n}return r}function eR(e,t){e.isMounted=!0,e$&&e.isNeverMounted&&"root"===e.devStrictMode&&(e.isNeverMounted=!1,eI(t),eS(e)),e.isNeverMounted=!1,eI(t)}let eP=e=>({version:0,committedVersion:0,dispatchUpdate:e,changelog:[],dirtyCells:[]}),eO=e=>{for(let t of e.dirtyCells)t.dirty=!1,t.queue.clear(),t.current=t.workInProgress;e.committedVersion=e.version,e.changelog.length=0,e.dirtyCells.length=0},eM=(e,t)=>{let r=e.version>t;if(e.version=t,r){for(let t of e.dirtyCells)t.dirty=!1,t.queue.clear(),t.workInProgress=t.current;if(e.dirtyCells.length=0,t===e.committedVersion)e.changelog.length=0;else{if(e.committedVersion>t)throw Error("Version is less than committed version");for(;e.committedVersion+e.changelog.length>t;)e.changelog.pop();e.changelog.forEach(e=>e()),eO(e)}}},ez=(e,t)=>{t.dirty||(t.dirty=!0,e.markDirty?.(),e.root.dirtyCells.push(t))};function eD(e){let t=(0,ek.useMemo)(()=>eP(e=>n(e)),[]),[r,n]=(0,ek.useReducer)((e,r)=>(eM(t,e),e+ +!!r()),0);eM(t,r);let i=(()=>{if(!e$)return null;let e=(0,ek.useRef)(0),t=0===e.current;return((0,ek.useState)(()=>e.current++),2!==e.current)?null:t?"child":"root"})(),a=(0,ek.useMemo)(()=>(e.key,eC(e.type,t,void 0,i)),[e.type,e.key,t,i]),o=eA(a,e.props);return(0,ek.useLayoutEffect)(()=>()=>eN(a),[a]),(0,ek.useLayoutEffect)(()=>{eO(t),eR(a,o)}),o.output}function eU(e){let t=e=>({type:t,props:e});return t[eT]=e,t}let eL=(e,t)=>{let r=eE(),n=r.currentIndex++;if(!r.isFirstRender&&n>=r.cells.length)throw Error("Rendered more hooks than during the previous render. Hooks must be called in the exact same order in every render.");let i=r.cells[n];if(i||(i=t(),r.cells[n]=i),i.type!==e)throw Error("Hook order changed between renders");return i};function eZ(e,t,r,n){let i=eL("reducer",()=>{let t=eE(),a=n?n(r):r;return e$&&t.devStrictMode&&n&&n(r),{type:"reducer",queue:new Set,dirty:!1,workInProgress:a,current:a,reducer:e,dispatch:r=>{let n={action:r,hasEagerState:!1,eagerState:void 0};if(t.renderContext)throw Error("Resource updated during render");if(t.isNeverMounted)throw Error("Resource updated before mount");t.root.dispatchUpdate(()=>{let a=0===t.root.dirtyCells.length&&!n.hasEagerState&&(n.eagerState=e(i.workInProgress,r),n.hasEagerState=!0,Object.is(i.current,n.eagerState))?null:()=>{ez(t,i),i.queue.add(n)};return!!a&&(a(),t.root.changelog.push(a),!0)})}}}),a=eE(),o=e===i.reducer;for(let t of(i.reducer=e,i.queue))t.hasEagerState&&o||(t.eagerState=e(i.workInProgress,t.action),t.hasEagerState=!0),e$&&a.devStrictMode&&e(i.workInProgress,t.action),i.workInProgress=t.eagerState;if(i.queue.clear(),t){let e=t(i.workInProgress);Object.is(e,i.workInProgress)||(ez(a,i),i.workInProgress=e)}return[i.workInProgress,i.dispatch]}let eF=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Object.is(e[r],t[r]))return!1;return!0},eB=()=>{throw Error("Memo reducer should not be called")},eV=(e,t)=>{let r=eE(),[n]=eZ(eB,n=>{if(n&&eF(n.deps,t))return n;let i=e();return e$&&r.devStrictMode&&e(),{value:i,deps:t}},null,void 0);return n.value},eq=()=>({type:"effect",cleanup:void 0,deps:null});function eW(e,t){let r=eL("effect",eq);if(!(t&&r.deps&&eF(r.deps,t))){if(null!==r.deps&&!!t!=!!r.deps)throw Error("tapEffect called with and without dependencies across re-renders");eE().renderContext.effectTasks.push(()=>{let n=[];try{r.cleanup?.()}catch(e){n.push(e)}finally{r.cleanup=void 0}try{let t=e();if(void 0!==t&&"function"!=typeof t)throw Error(`An effect function must either return a cleanup function or nothing. Received: ${typeof t}`);r.cleanup=t}catch(e){n.push(e)}if(r.deps=t,n.length>0)if(1===n.length)throw n[0];else{for(let e of n)console.error(e);throw AggregateError(n,"Errors during commit")}})}}let eJ=(e,t)=>eV(()=>e,t),eH=(e,t)=>"function"==typeof t?t(e):t,eK=e=>"function"==typeof e?e():e;function eG(e){return eZ(eH,void 0,e,eK)}function eY(e,t){let[r]=eG(e);return r}function eX(e){let[t]=eG(()=>({current:e}));return t}function eQ(e,t){let r=eX(0),n=r.current,i=eY(eE,[]),a=eY(()=>()=>{r.current++,i.markDirty?.()},[]),o=eY(()=>new Map,[]),s=t?eJ(e,t):e,l=eV(()=>{let e=s(),t=new Set,r=[],n=0;for(let s=0;s<e.length;s++){let l=e[s],u=l.key;if(void 0===u)throw Error(`tapResources did not provide a key for array at index ${s}`);if(t.has(u))throw Error(`Duplicate key ${u} in tapResources`);t.add(u);let d=o.get(u);if(d)if(d.fiber.type!==l.type){let e=eC(l.type,i.root,a),t=eA(e,l.props);d.next=[e,t],r.push(t.output)}else d.next=eA(d.fiber,l.props),r.push(d.next.output);else{let e=eC(l.type,i.root,a),t=eA(e,l.props);d={fiber:e,next:t},n++,o.set(u,d),r.push(t.output)}}if(o.size>r.length-n)for(let e of o.keys())t.has(e)||(o.get(e).next="delete");return r},[s,n]);return eW(()=>()=>{for(let e of o.keys())eN(o.get(e).fiber)},[]),eW(()=>{for(let[e,t]of o.entries())"delete"===t.next?(t.fiber.isMounted&&eN(t.fiber),o.delete(e)):Array.isArray(t.next)?(eN(t.fiber),t.fiber=t.next[0],eR(t.fiber,t.next[1])):eR(t.fiber,t.next)},[l]),l}function e0(e,t){let r=eE(),n=eX(0),i=eV(()=>(e.key,eC(e.type,r.root,()=>{n.current++,r.markDirty?.()})),[e.type,e.key,r]),a=t?eV(()=>eA(i,e.props),[i,...t,n.current]):eA(i,e.props);return eW(()=>()=>eN(i),[i]),eW(()=>{eR(i,a)},[i,a]),a.output}function e1(e,t){return{...t,key:e}}let e2={schedulers:new Set([]),isScheduled:!1};class e4{_task;_isDirty=!1;constructor(e){this._task=e}get isDirty(){return this._isDirty}markDirty(){this._isDirty=!0,e2.schedulers.add(this),e6()}runTask(){this._isDirty=!1,this._task()}}let e6=()=>{e2.isScheduled||(e2.isScheduled=!0,e3())},e5=()=>{try{let e=[],t=0;for(let r of e2.schedulers)if(e2.schedulers.delete(r),r.isDirty){if(++t>50)throw Error("Maximum update depth exceeded. This can happen when a resource repeatedly calls setState inside tapEffect.");try{r.runTask()}catch(t){e.push(t)}}if(e.length>0)if(1===e.length)throw e[0];else{for(let t of e)console.error(t);throw AggregateError(e,"Errors occurred during flushSync")}}finally{e2.schedulers.clear(),e2.isScheduled=!1}},e3=(()=>{if("u">typeof MessageChannel){let e=new MessageChannel;return e.port1.onmessage=e5,()=>e.port2.postMessage(null)}return()=>setTimeout(e5,0)})(),e9=e=>{let t=e2;e2={schedulers:new Set([]),isScheduled:!0};try{let t=e();return e5(),t}finally{e2=t}};function e8(e){let t=eX(e);eW(()=>{t.current=e});let r=eE();return eJ((...e)=>{if(e$&&r.renderContext)throw Error("tapEffectEvent cannot be called during render");return t.current(...e)},[r])}let e7=Symbol("tap.Context"),te=e=>({[e7]:e}),tt=(e,t,r)=>{let n=e[e7];e[e7]=t;try{return r()}finally{e[e7]=n}},tr=e=>e[e7],tn=Symbol("assistant-ui.store.clientIndex"),ti=te([]),ta=new Set(["$$typeof","nodeType","then"]),to=(e,t)=>e===Symbol.toStringTag?t:"symbol"==typeof e?void 0:"toJSON"===e?()=>t:!!ta.has(e)&&void 0;class ts{getOwnPropertyDescriptor(e,t){let r=this.get(e,t);if(void 0!==r)return{value:r,writable:!1,enumerable:!0,configurable:!1}}set(){return!1}setPrototypeOf(){return!1}defineProperty(){return!1}deleteProperty(){return!1}preventExtensions(){return!1}}let tl=e=>{let t=eU(e);return e=>{let r=t(e);return void 0===e.key?r:e1(e.key,r)}},tu=Symbol("assistant-ui.store.getValue"),td=new Map;class tc extends ts{outputRef;index;boundFns;cachedReceiver;constructor(e,t){super(),this.outputRef=e,this.index=t}get(e,t,r){if(t===tu)return this.outputRef.current;if(t===tn)return this.index;let n=to(t,"ClientProxy");if(!1!==n)return n;let i=this.outputRef.current[t];if("function"==typeof i){this.cachedReceiver!==r&&(this.boundFns=new Map,this.cachedReceiver=r);let e=this.boundFns.get(t);if(!e){let n;e=(!(n=td.get(t))&&(n=function(...e){if(!this||"object"!=typeof this)throw Error(`Method "${String(t)}" called without proper context. This may indicate the function was called incorrectly.`);let r=this[tu];if(!r)throw Error(`Method "${String(t)}" called on invalid client proxy. Ensure you are calling this method on a valid client instance.`);let n=r[t];if(!n)throw Error(`Method "${String(t)}" is not implemented.`);if("function"!=typeof n)throw Error(`"${String(t)}" is not a function.`);return n(...e)},td.set(t,n)),n).bind(r),this.boundFns.set(t,e)}return e}return i}ownKeys(){return Object.keys(this.outputRef.current)}has(e,t){return t===tu||t===tn||t in this.outputRef.current}}let tp=tl(e=>{var t;let r,n=eX(null),i=tr(ti).length,a=eV(()=>new Proxy({},new tc(n,i)),[i]),o=(t=()=>e0(e),r=tr(ti),tt(ti,eV(()=>[...r,a],[r,a]),t));return n.current||(n.current=o),eW(()=>{n.current=o}),{methods:a,state:o.getState?.(),key:e.key}}),tm=Symbol("assistant-ui.store.proxiedAssistantState"),tf=e=>"on"===e||"subscribe"===e||"symbol"==typeof e,th=e=>new Proxy({},new class extends ts{get(t,r){let n=to(r,"AssistantState");if(!1!==n)return n;if(!tf(r)){let t=e[r]()[tu];if(!t)throw Error("Client scope contains a non-client resource. Ensure your Derived get() returns a client created with tapClientResource(), not a plain resource.");return t.getState?.()}}ownKeys(){return Object.keys(e).filter(e=>!tf(e))}has(t,r){return!tf(r)&&r in e}}),tg=()=>()=>{},tv=e=>{let t=()=>{throw Error(e)};return t.source=null,t.query=null,t},ty=new Proxy({},new class extends ts{get(e,t){if("subscribe"===t||"on"===t)return tg;if(t===tm)return tb;let r=to(t,"DefaultAssistantClient");return!1!==r?r:tv("You are using a component or hook that requires an AuiProvider. Wrap your component in an <AuiProvider> component.")}ownKeys(){return["subscribe","on",tm]}has(e,t){return"subscribe"===t||"on"===t||t===tm}}),tb=th(ty),tx=(0,ek.createContext)(ty),tw=({value:e,children:t})=>(0,ew.jsx)(tx.Provider,{value:e,children:t}),t_=eU(e=>null),tk=Symbol("assistant-ui.transform-scopes");function tI(e,t){if(e[tk])throw Error("transformScopes is already attached to this resource");e[tk]=t}let tS=e=>eV(()=>e,[...Object.entries(e).flat()]),t$=e=>"string"==typeof e?{scope:e.split(".")[0],event:e}:{scope:e.scope,event:e.event},tj=eU(()=>eY(()=>{let e=new Map,t=new Set,r=new Set;return{on(r,n){if("*"===r)return t.add(n),()=>t.delete(n);let i=e.get(r);return i||(i=new Set,e.set(r,i)),i.add(n),()=>{i.delete(n),0===i.size&&e.delete(r)}},emit(r,n,i){let a=e.get(r);(a||0!==t.size)&&queueMicrotask(()=>{let e=[];if(a)for(let t of a)try{t(n,i)}catch(t){e.push(t)}if(t.size>0){let a={event:r,payload:n};for(let r of t)try{r(a,i)}catch(t){e.push(t)}}if(e.length>0)if(1===e.length)throw e[0];else{for(let t of e)console.error(t);throw AggregateError(e,"Errors occurred during event emission")}})},subscribe:e=>(r.add(e),()=>r.delete(e)),notifySubscribers(){for(let e of r)try{e()}catch(e){console.error("NotificationManager: subscriber callback error",e)}}}},[])),tE=te(null),tT=()=>{let e=tr(tE);if(!e)throw Error("AssistantTapContext is not available");return e},tC=()=>{let{emit:e}=tT(),t=tr(ti);return e8((r,n)=>{e(r,n,t)})},tN=e=>eV(()=>e,e),tA=eU(({element:e,emit:t,clientRef:r})=>{let{methods:n,state:i}=tt(tE,{clientRef:r,emit:t},()=>e0(tp(e)));return eV(()=>({state:i,methods:n}),[n,i])}),tR=eU(({element:e,notifications:t,clientRef:r,name:n})=>{var i;let a,o,s,l,u,d,c,p,m,f=(i=tA({element:e,emit:t.emit,clientRef:r}),a=eY(()=>new e4(()=>m(null)),[]),o=eY(()=>[],[]),eM((s=eV(()=>(i.key,eC(i.type,eP(e=>{(a.isDirty||e())&&(o.push(e),a.markDirty())}))),[i.type,i.key])).root,s.root.committedVersion),l=eA(s,i.props),u=eX(!1),d=eX(i.props),c=eX(l.output),p=eY(()=>new Set,[]),m=e8(e=>{if(null===e&&(eM(s.root,2),eM(s.root,1),o.forEach(e=>{e$&&s.devStrictMode&&e(),e()}),e$&&s.devStrictMode&&eA(s,d.current),e=eA(s,d.current)),a.isDirty)throw Error("Scheduler is dirty, this should never happen");eO(s.root),o.length=0,u.current&&eR(s,e),a.isDirty||c.current===e.output||(c.current=e.output,p.forEach(e=>e()))}),eW(()=>(u.current=!0,()=>{u.current=!1,eN(s)}),[s]),eW(()=>{d.current=l.props,eO(s.root),eR(s,l),a.isDirty||c.current===l.output||(c.current=l.output,p.forEach(e=>e()))}),eV(()=>({getValue:()=>c.current,subscribe:e=>(p.add(e),()=>p.delete(e))}),[]));return eW(()=>f.subscribe(t.notifySubscribers),[f,t]),eV(()=>{let e=()=>f.getValue().methods;return Object.defineProperties(e,{source:{value:"root",writable:!1},query:{value:{},writable:!1},name:{value:n,configurable:!0}}),e},[f,n])}),tP=eU(()=>eV(()=>({clients:[],subscribe:void 0,on:void 0}),[])),tO=eU(({clients:e,clientRef:t})=>{let r=e0(tj());eW(()=>t.parent.subscribe(r.notifySubscribers),[t,r]);let n=tN(eQ(()=>Object.keys(e).map(n=>e1(n,tR({element:e[n],notifications:r,clientRef:t,name:n}))),[e,r,t]));return eV(()=>({clients:n,subscribe:r.subscribe,on:function(e,n){if(!this)throw Error("const { on } = useAui() is not supported. Use aui.on() instead.");let{scope:i,event:a}=t$(e);if("*"!==i&&null===this[i].source)throw Error(`Scope "${i}" is not available. Use { scope: "*", event: "${a}" } to listen globally.`);let o=r.on(a,(e,t)=>{if("*"===i)return void n(e);let r=this[i](),a=r[tn];r===t[a]&&n(e)});if("*"!==i&&null===t.parent[i].source)return o;let s=t.parent.on(e,n);return()=>{o(),s()}}}),[n,r,t])}),tM=eU(({element:e,clientRef:t,name:r})=>{let n=eX(e.props);return n.current=e.props,eV(()=>{let e=()=>n.current.get(t.current);return Object.defineProperties(e,{source:{value:n.current.source},query:{value:n.current.query},name:{value:r,configurable:!0}}),e},[t,r])}),tz=eU(({clients:e,clientRef:t})=>tN(eQ(()=>Object.keys(e).map(r=>{let n=e[r];return e1(((e,t)=>{let r;try{let e={};for(let r of Object.keys(t.query).sort())e[r]=t.query[r];r=JSON.stringify(e)}catch{r=String(t.query)}return`${e}::${t.source}::${r}`})(r,n.props),tM({element:n,clientRef:t,name:r}))}),[e,t]))),tD=eU(({parent:e,clients:t})=>{let{rootClients:r,derivedClients:n}=((e,t)=>{let{rootClients:r,derivedClients:n}=function(e,t){let r={...e},n=new Set,i=!0;for(;i;)for(let e of(i=!1,Object.values(r))){if(e.type===t_||n.has(e.type))continue;n.add(e.type);let a=e.type[tk];if(a){a(r,t),i=!0;break}}let a={},o={};for(let[e,t]of Object.entries(r))t.type===t_?o[e]=t:a[e]=t;return{rootClients:a,derivedClients:o}}(e,t);return{rootClients:tS(r),derivedClients:tS(n)}})(t,e),i=eX({parent:e,current:null}).current;eW(()=>{i.current=s});let a=e0(Object.keys(r).length>0?tO({clients:r,clientRef:i}):tP()),o=e0(tz({clients:n,clientRef:i})),s=eV(()=>{let t=Object.create(e===ty?new Proxy({},{get(e,t){let r=to(t,"AssistantClient");return!1!==r?r:tv(`The current scope does not have a "${String(t)}" property.`)}}):e);for(let r of(Object.assign(t,{subscribe:a.subscribe??e.subscribe,on:a.on??e.on,[tm]:th(t)}),a.clients))t[r.name]=r;for(let e of o)t[e.name]=e;return t},[e,a,o]);return null===i.current&&(i.current=s),s});function tU(e,{parent:t}={parent:(0,ek.useContext)(tx)}){if(e)return eD(tD({parent:t??ty,clients:e}));if(null===t)throw Error("received null parent, this usage is not allowed");return t}let tL=tl(e=>{if(void 0===e.key)throw Error("tapClientResource: Element has no key");return e0(tp(e))});function tZ(e,t){let r=eQ(()=>e().map(e=>tL(e)),t),n=eV(()=>Object.keys(r),[r]),i=eV(()=>r.reduce((e,t,r)=>(e[t.key]=r,e),{}),[r]);return{state:eV(()=>r.map(e=>e.state),[r]),get:e=>{if("index"in e){if(e.index<0||e.index>=n.length)throw Error(`tapClientLookup: Index ${e.index} out of bounds (length: ${n.length})`);return r[e.index].methods}let t=i[e.key];if(void 0===t)throw Error(`tapClientLookup: Key "${e.key}" not found`);return r[t].methods}}}let tF=e=>{let[,t]=eG(e.getState);return eW(()=>(t(e.getState()),e.subscribe(()=>{t(e.getState())})),[e]),e.getState()},tB=eU(({runtime:e})=>{let t=tF(e),r=tC();return eW(()=>{let t=[];for(let n of["switchedTo","switchedAway"]){let i=e.unstable_on(n,()=>{r(`threadListItem.${n}`,{threadId:e.getState().id})});t.push(i)}return()=>{for(let e of t)e()}},[e,r]),{getState:()=>t,switchTo:e.switchTo,rename:e.rename,archive:e.archive,unarchive:e.unarchive,delete:e.delete,generateTitle:e.generateTitle,initialize:e.initialize,detach:e.detach,__internal_getRuntime:()=>e}}),tV=eU(({runtime:e})=>{let t=tF(e);return{getState:()=>t,remove:e.remove,__internal_getRuntime:()=>e}}),tq=eU(({runtime:e,index:t})=>e0(tV({runtime:eV(()=>e.getAttachmentByIndex(t),[e,t])}))),tW=eU(({threadIdRef:e,messageIdRef:t,runtime:r})=>{let n=tF(r),i=tC();eW(()=>{let n=[];for(let a of["send","attachmentAdd"]){let o=r.unstable_on(a,()=>{i(`composer.${a}`,{threadId:e.current,...t&&{messageId:t.current}})});n.push(o)}return n.push(r.unstable_on("attachmentAddError",r=>{i("composer.attachmentAddError",{threadId:e.current,...t&&{messageId:t.current},...r.attachmentId&&{attachmentId:r.attachmentId},reason:r.reason,message:r.message})})),()=>{for(let e of n)e()}},[r,i,e,t]);let a=tZ(()=>n.attachments.map((e,t)=>e1(e.id,tq({runtime:r,index:t}))),[n.attachments,r]),o=eV(()=>({text:n.text,role:n.role,attachments:a.state,runConfig:n.runConfig,isEditing:n.isEditing,canCancel:n.canCancel,canSend:n.canSend,attachmentAccept:n.attachmentAccept,isEmpty:n.isEmpty,type:n.type??"thread",dictation:n.dictation,quote:n.quote,queue:[]}),[n,a.state]);return{getState:()=>o,setText:r.setText,setRole:r.setRole,setRunConfig:r.setRunConfig,addAttachment:r.addAttachment,reset:r.reset,clearAttachments:r.clearAttachments,send:r.send,cancel:r.cancel,beginEdit:r.beginEdit??(()=>{throw Error("beginEdit is not supported in this runtime")}),startDictation:r.startDictation,stopDictation:r.stopDictation,setQuote:r.setQuote,attachment:e=>"id"in e?a.get({key:e.id}):a.get(e),queueItem:()=>{throw Error("Queue is not supported in this runtime")},__internal_getRuntime:()=>r}}),tJ=eU(({runtime:e})=>{let t=tF(e);return{getState:()=>t,addToolResult:t=>e.addToolResult(t),resumeToolCall:t=>e.resumeToolCall(t),__internal_getRuntime:()=>e}}),tH=eU(({runtime:e,index:t})=>e0(tV({runtime:eV(()=>e.getAttachmentByIndex(t),[e,t])}))),tK=eU(({runtime:e,index:t})=>e0(tJ({runtime:eV(()=>e.getMessagePartByIndex(t),[e,t])}))),tG=eU(({runtime:e,threadIdRef:t})=>{let r=tF(e),[n,i]=eG(!1),[a,o]=eG(!1),s=eV(()=>({get current(){return e.getState().id}}),[e]),l=e0(tp(tW({runtime:e.composer,threadIdRef:t,messageIdRef:s}))),u=tZ(()=>r.content.map((t,r)=>e1("toolCallId"in t&&null!=t.toolCallId?`toolCallId-${t.toolCallId}`:`index-${r}`,tK({runtime:e,index:r}))),[r.content,e]),d=tZ(()=>(r.attachments??[]).map((t,r)=>e1(t.id,tH({runtime:e,index:r}))),[r.attachments,e]),c=eV(()=>({...r,parts:u.state,composer:l.state,isCopied:n,isHovering:a}),[r,u.state,l.state,n,a]);return{getState:()=>c,composer:()=>l.methods,reload:t=>e.reload(t),speak:()=>e.speak(),stopSpeaking:()=>e.stopSpeaking(),submitFeedback:t=>e.submitFeedback(t),switchToBranch:t=>e.switchToBranch(t),getCopyText:()=>e.unstable_getCopyText(),part:e=>"index"in e?u.get({index:e.index}):u.get({key:`toolCallId-${e.toolCallId}`}),attachment:e=>"id"in e?d.get({key:e.id}):d.get(e),setIsCopied:i,setIsHovering:o,__internal_getRuntime:()=>e}}),tY=eU(({runtime:e,id:t,threadIdRef:r})=>e0(tG({runtime:eV(()=>e.getMessageById(t),[e,t]),threadIdRef:r}))),tX=eU(({runtime:e})=>{let t=tF(e),r=tC();eW(()=>{let t=[];for(let n of["runStart","runEnd","initialize","modelContextUpdate"]){let i=e.unstable_on(n,()=>{r(`thread.${n}`,{threadId:e.getState()?.threadId||"unknown"})});t.push(i)}return()=>{for(let e of t)e()}},[e,r]);let n=eV(()=>({get current(){return e.getState().threadId}}),[e]),i=e0(tp(tW({runtime:e.composer,threadIdRef:n}))),a=tZ(()=>t.messages.map(t=>e1(t.id,tY({runtime:e,id:t.id,threadIdRef:n}))),[t.messages,e,n]),o=eV(()=>({isEmpty:0===a.state.length&&!t.isLoading,isDisabled:t.isDisabled,isLoading:t.isLoading,isRunning:t.isRunning,capabilities:t.capabilities,state:t.state,suggestions:t.suggestions,extras:t.extras,speech:t.speech,voice:t.voice,composer:i.state,messages:a.state}),[t,a,i.state]);return{getState:()=>o,composer:()=>i.methods,append:e.append,startRun:e.startRun,resumeRun:e.resumeRun,cancelRun:e.cancelRun,getModelContext:e.getModelContext,export:e.export,import:e.import,reset:e.reset,stopSpeaking:e.stopSpeaking,connectVoice:e.connectVoice,disconnectVoice:e.disconnectVoice,getVoiceVolume:e.getVoiceVolume,subscribeVoiceVolume:e.subscribeVoiceVolume,muteVoice:e.muteVoice,unmuteVoice:e.unmuteVoice,message:e=>"id"in e?a.get({key:e.id}):a.get(e),__internal_getRuntime:()=>e}}),tQ=eU(({runtime:e,id:t})=>e0(tB({runtime:eV(()=>e.getItemById(t),[e,t])}))),t0=eU(({runtime:e,__internal_assistantRuntime:t})=>{let r=tF(e),n=e0(tp(tX({runtime:e.main}))),i=tZ(()=>Object.keys(r.threadItems).map(t=>e1(t,tQ({runtime:e,id:t}))),[r.threadItems,e]),a=eV(()=>({mainThreadId:r.mainThreadId,newThreadId:r.newThreadId??null,isLoading:r.isLoading,isLoadingMore:r.isLoadingMore,hasMore:r.hasMore,threadIds:r.threadIds,archivedThreadIds:r.archivedThreadIds,threadItems:i.state,main:n.state}),[r,i.state,n.state]);return{getState:()=>a,thread:()=>n.methods,item:e=>{if("main"===e)return i.get({key:a.mainThreadId});if("id"in e)return i.get({key:e.id});let{index:t,archived:r=!1}=e,n=r?a.archivedThreadIds[t]:a.threadIds[t];return i.get({key:n})},switchToThread:async t=>{await e.switchToThread(t)},switchToNewThread:async()=>{await e.switchToNewThread()},getLoadThreadsPromise:()=>e.getLoadThreadsPromise(),reload:()=>e.reload(),loadMore:()=>e.loadMore(),__internal_getAssistantRuntime:()=>t}});class t1{_providers=new Set;getModelContext(){return Array.from(this._providers).map(e=>e.getModelContext()).sort((e,t)=>(t.priority??0)-(e.priority??0)).reduce((e,t)=>{if(t.system&&(e.system?e.system+=`
|
|
2
|
+
|
|
3
|
+
${t.system}`:e.system=t.system),t.tools)for(let[r,n]of Object.entries(t.tools)){let t=e.tools?.[r];if(t&&t!==n)throw Error(`You tried to define a tool with the name ${r}, but it already exists.`);e.tools||(e.tools={}),e.tools[r]=n}return t.config&&(e.config={...e.config,...t.config}),t.callSettings&&(e.callSettings={...e.callSettings,...t.callSettings}),e},{})}registerModelContextProvider(e){this._providers.add(e);let t=e.subscribe?.(()=>{this.notifySubscribers()});return this.notifySubscribers(),()=>{this._providers.delete(e),t?.(),this.notifySubscribers()}}_subscribers=new Set;notifySubscribers(){for(let e of this._subscribers)e()}subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}}let t2=[],t4={modelName:void 0,toolNames:t2},t6=(e,t)=>{let r,n=e.getModelContext(),i=n.config?.modelName,a=n.tools?Object.keys(n.tools).sort():t2,o=a.length?a:t2;return i===t.modelName&&(o===(r=t.toolNames)||o.length===r.length&&o.every((e,t)=>e===r[t]))?t:{modelName:i,toolNames:o}},t5=eU(()=>{let e=eV(()=>new t1,[]),[t,r]=eG(()=>t6(e,t4));return eW(()=>(r(t=>t6(e,t)),e.subscribe(()=>{r(t=>t6(e,t))})),[e]),{getState:()=>t6(e,t),getModelContext:()=>e.getModelContext(),subscribe:t=>e.subscribe(t),register:t=>e.registerModelContextProvider(t)}}),t3=eU(e=>({getState:()=>e})),t9=eU(e=>{let[t]=eG(()=>({suggestions:(e??[]).map(e=>"string"==typeof e?{title:e,label:"",prompt:e}:{title:e.title,label:e.label,prompt:e.prompt})})),r=tZ(()=>t.suggestions.map((e,t)=>e1(t,t3(e))),[t.suggestions]);return{getState:()=>t,suggestion:({index:e})=>r.get({index:e})}}),t8=eU(e=>{let t=tT().clientRef;return eW(()=>e.registerModelContextProvider(t.current.modelContext()),[e,t]),e0(t0({runtime:e.threads,__internal_assistantRuntime:e}))}),t7=eU(()=>{let[e,t]=eG(()=>({renderers:{},fallbacks:[]}));return{getState:()=>e,setDataUI:eJ((e,r)=>(t(t=>({...t,renderers:{...t.renderers,[e]:[...t.renderers[e]??[],r]}})),()=>{t(t=>({...t,renderers:{...t.renderers,[e]:t.renderers[e]?.filter(e=>e!==r)??[]}}))}),[]),setFallbackDataUI:eJ(e=>(t(t=>({...t,fallbacks:[...t.fallbacks,e]})),()=>{t(t=>({...t,fallbacks:t.fallbacks.filter(t=>t!==e)}))}),[])}}),re=eU(({toolkit:e,mcpApp:t})=>{let r=eQ(()=>t?[e1("mcpApp",t)]:[],[t])[0],[n,i]=eG(()=>({tools:{}})),a=eV(()=>({tools:n.tools,mcpApp:r}),[n,r]),o=tT().clientRef,s=eJ((e,t)=>(i(r=>({tools:{...r.tools,[e]:[...r.tools[e]??[],t]}})),()=>{i(r=>({tools:{...r.tools,[e]:r.tools[e]?.filter(e=>e!==t)??[]}}))}),[]);return eW(()=>{if(!e)return;let t=[];for(let[r,n]of Object.entries(e))n.render&&t.push(s(r,n.render));let r=Object.entries(e).reduce((e,[t,r])=>{let{render:n,...i}=r;return e[t]=i,e},{});return t.push(o.current.modelContext().register({getModelContext:()=>({tools:r})})),()=>{t.forEach(e=>e())}},[e,s,o]),{getState:()=>a,setToolUI:s}});tI(re,(e,t)=>{e.modelContext||null!==t.modelContext.source||(e.modelContext=t5())});let rt=eU(e=>e0(t8(e)));tI(rt,(e,t)=>{e.thread??=t_({source:"threads",query:{type:"main"},get:e=>e.threads().thread("main")}),e.threadListItem??=t_({source:"threads",query:{type:"main"},get:e=>e.threads().item("main")}),e.composer??=t_({source:"thread",query:{},get:e=>e.threads().thread("main").composer()}),e.modelContext||null!==t.modelContext.source||(e.modelContext=t5()),e.suggestions||null!==t.suggestions.source||(e.suggestions=t9()),e.tools||null!==t.tools.source||(e.tools=re({})),e.dataRenderers||null!==t.dataRenderers.source||(e.dataRenderers=t7())});let rr=(0,ek.memo)(({runtime:e,aui:t=null,children:r})=>{let n=tU({threads:rt(e)},{parent:t}),i=e._core?.RenderComponent;return(0,ew.jsxs)(tw,{value:n,children:[i&&(0,ew.jsx)(i,{}),r]})}),rn=e=>{let t,r=new Set,n=(e,n)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=n?n:"object"!=typeof i||null===i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,a={setState:n,getState:i,getInitialState:()=>o,subscribe:e=>(r.add(e),()=>r.delete(e))},o=t=e(n,i,a);return a},ri=e=>{let t=e?rn(e):rn,r=e=>(function(e,t=e=>e){let r=ek.default.useSyncExternalStore(e.subscribe,ek.default.useCallback(()=>t(e.getState()),[e,t]),ek.default.useCallback(()=>t(e.getInitialState()),[e,t]));return ek.default.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},ra=e=>e?ri(e):ri,ro=e=>{let t=new Map,r=()=>{let r=0;for(let e of t.values())r+=e;e(r)};return{register:()=>{let e=Symbol();return t.set(e,0),{setHeight:n=>{t.get(e)!==n&&(t.set(e,n),r())},unregister:()=>{t.delete(e),r()}}}}};function rs(e,t){function r(r){let n=e(r);return n?n[t]:null}return{[t]:function(e){let t,n=!1;"function"==typeof e?t=e:e&&"object"==typeof e&&(n=!!e.optional,t=e.selector);let i=r({optional:n});return i?t?i(t):i():null},[`${t}Store`]:r}}let rl=(0,ek.createContext)(null),{useThreadViewport:ru,useThreadViewportStore:rd}=rs(function(e){let t=(0,ek.useContext)(rl);if(!e?.optional&&!t)throw Error("This component must be used within ThreadPrimitive.Viewport.");return t},"useThreadViewport"),rc=({children:e,options:t={}})=>{let r=(e=>{let t=rd({optional:!0}),[r]=(0,ek.useState)(()=>((e={})=>{let t=new Set,r=ro(e=>{a.setState({height:{...a.getState().height,viewport:e}})}),n=ro(e=>{a.setState({height:{...a.getState().height,inset:e}})}),i=(e,t)=>(a.setState({element:{...a.getState().element,[e]:t}}),()=>{a.getState().element[e]===t&&a.setState({element:{...a.getState().element,[e]:null}})}),a=ra(()=>({isAtBottom:!0,scrollToBottom:({behavior:e="auto"}={})=>{for(let r of t)r({behavior:e})},onScrollToBottom:e=>(t.add(e),()=>{t.delete(e)}),turnAnchor:e.turnAnchor??"bottom",topAnchorMessageClamp:{tallerThan:e.topAnchorMessageClamp?.tallerThan??"10em",visibleHeight:e.topAnchorMessageClamp?.visibleHeight??"6em"},height:{viewport:0,inset:0},element:{viewport:null,anchor:null,target:null},targetConfig:null,topAnchorTurn:null,registerViewport:r.register,registerContentInset:n.register,registerViewportElement:e=>i("viewport",e),registerAnchorElement:e=>i("anchor",e),registerAnchorTargetElement:(e,t)=>(a.setState({element:{...a.getState().element,target:e},targetConfig:e&&t?t:null}),()=>{a.getState().element.target===e&&a.setState({element:{...a.getState().element,target:null},targetConfig:null})}),setTopAnchorTurn:e=>{a.setState({topAnchorTurn:e})}}));return a})(e));return(0,ek.useEffect)(()=>t?.getState().onScrollToBottom(()=>{r.getState().scrollToBottom()}),[t,r]),(0,ek.useEffect)(()=>{if(t)return r.subscribe(e=>{t.getState().isAtBottom!==e.isAtBottom&&t.setState({isAtBottom:e.isAtBottom})})},[r,t]),r})(t),[n]=(0,ek.useState)(()=>({useThreadViewport:r}));return(0,ew.jsx)(rl.Provider,{value:n,children:e})},rp=()=>{let e=tU();return(0,ek.useEffect)(()=>{},[e]),null},rm=(0,ek.memo)(({children:e,aui:t,runtime:r})=>(0,ew.jsxs)(rr,{runtime:r,aui:t??null,children:[(0,ew.jsx)(rp,{}),(0,ew.jsx)(rc,{children:e})]}));e.s([],24380),e.i(24380);var rf=e.i(74080),rh=e.i(20783),rg=Symbol.for("react.lazy"),rv=ek[" use ".trim().toString()];function ry(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===rg&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var rb=Symbol("radix.slottable");function rx(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===rb}var rw=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ry(r)&&"function"==typeof rv&&(r=rv(r._payload)),ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e;ry(r)&&"function"==typeof rv&&(r=rv(r._payload));let i=ek.Children.toArray(r),o=i.find(rx);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,ew.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,ew.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ew.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{});function r_(e){let t=(0,ek.forwardRef)(({render:t,asChild:r,children:n,...i},a)=>{if(t&&(0,ek.isValidElement)(t)){let r=void 0!==n?n:t.props.children;return(0,ew.jsx)(e,{...i,asChild:!0,ref:a,children:(0,ek.cloneElement)(t,void 0,r)})}return(0,ew.jsx)(e,{...i,asChild:r,ref:a,children:n})});return t.displayName="string"==typeof e?e:e.displayName??e.name??"Component",t}let rk=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r;return e[t]=((r=r_(rw[t])).displayName=`Primitive.${t}`,r),e},{});var rI=e.i(81140);let rS=e=>{let t=tU(),r=t[tm],n=(0,ek.useSyncExternalStore)(t.subscribe,()=>e(r),()=>e(r));if(n===r)throw Error("You tried to return the entire AssistantState. This is not supported due to technical limitations.");return(0,ek.useDebugValue)(n),n},r$=(0,ek.forwardRef)(({onClick:e,disabled:t,...r},n)=>{let i,a=rS(e=>e.threads.newThreadId===e.threads.mainThreadId),{switchToNewThread:o}=(i=tU(),{switchToNewThread:(0,ek.useCallback)(()=>{i.threads().switchToNewThread()},[i])});return(0,ew.jsx)(rk.button,{type:"button",...a?{"data-active":"true","aria-current":"true"}:null,...r,ref:n,disabled:t,onClick:(0,rI.composeEventHandlers)(e,o)})});r$.displayName="ThreadListPrimitive.New";let rj=Object.freeze({});function rE({getItemState:e,children:t}){let r,n,i;return rT(t((r=tU(),i=(n=(0,ek.useRef)(!1)).current?null:e(r),rS(()=>n.current?e(r):i),()=>(n.current=!0,e(r)))))}let rT=e=>{let t="object"==typeof e&&null!=e&&"type"in e?e:null,r=t?.type,n=t?.key,i="object"==typeof t?.props&&null!=t.props&&0===Object.entries(t.props).length?rj:t?.props;return(0,ek.useMemo)(()=>t,[r,n,i])??e},rC=({index:e,archived:t,children:r})=>{let n=tU({threadListItem:t_({source:"threads",query:{type:"index",index:e,archived:t},get:r=>r.threads().item({index:e,archived:t})})});return(0,ew.jsx)(tw,{value:n,children:r})},rN=(0,ek.memo)(({index:e,archived:t=!1,components:r})=>{let n=r.ThreadListItem;return(0,ew.jsx)(rC,{index:e,archived:t,children:(0,ew.jsx)(n,{})})},(e,t)=>e.index===t.index&&e.archived===t.archived&&e.components.ThreadListItem===t.components.ThreadListItem);rN.displayName="ThreadListPrimitive.ItemByIndex";let rA=({archived:e,children:t})=>{let r=rS(t=>e?t.threads.archivedThreadIds.length:t.threads.threadIds.length);return(0,ek.useMemo)(()=>Array.from({length:r},(r,n)=>(0,ew.jsx)(rC,{index:n,archived:e,children:(0,ew.jsx)(rE,{getItemState:t=>t.threads().item({index:n,archived:e}).getState(),children:e=>t({get threadListItem(){return e()}})})},n)),[r,e,t])},rR=({archived:e=!1,components:t,children:r})=>{if(t){let r=t.ThreadListItem;return(0,ew.jsx)(rA,{archived:e,children:()=>(0,ew.jsx)(r,{})})}return(0,ew.jsx)(rA,{archived:e,children:r})};rR.displayName="ThreadListPrimitive.Items";let rP=(e,t,r=[])=>{let n=(0,ek.forwardRef)((e,n)=>{let i={},a={};Object.keys(e).forEach(t=>{r.includes(t)?i[t]=e[t]:a[t]=e[t]});let o=t(i)??void 0;return(0,ew.jsx)(rk.button,{...a,type:"button",ref:n,disabled:a.disabled||!o,onClick:(0,rI.composeEventHandlers)(a.onClick,o)})});return n.displayName=e,n},rO=rP("ThreadListPrimitive.LoadMore",()=>{let e,t,{loadMore:r,disabled:n}=(e=tU(),t=rS(e=>!e.threads.hasMore||e.threads.isLoading||e.threads.isLoadingMore),{loadMore:(0,ek.useCallback)(()=>{e.threads().loadMore()},[e]),disabled:t});return n?null:r}),rM=(0,ek.forwardRef)((e,t)=>(0,ew.jsx)(rk.div,{...e,ref:t}));rM.displayName="ThreadListPrimitive.Root",e.s(["ItemByIndex",0,rN,"Items",0,rR,"LoadMore",0,rO,"New",0,r$,"Root",0,rM],48376);var rz=e.i(48376),rz=rz;let rD=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),rU=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var rL={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let rZ=(0,ek.createContext)({}),rF=(0,ek.forwardRef)(({color:e,size:t,strokeWidth:r,absoluteStrokeWidth:n,className:i="",children:a,iconNode:o,...s},l)=>{let{size:u=24,strokeWidth:d=2,absoluteStrokeWidth:c=!1,color:p="currentColor",className:m=""}=(0,ek.useContext)(rZ)??{},f=n??c?24*Number(r??d)/Number(t??u):r??d;return(0,ek.createElement)("svg",{ref:l,...rL,width:t??u??rL.width,height:t??u??rL.height,stroke:e??p,strokeWidth:f,className:rD("lucide",m,i),...!a&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(s)&&{"aria-hidden":"true"},...s},[...o.map(([e,t])=>(0,ek.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),rB=(e,t)=>{let r=(0,ek.forwardRef)(({className:r,...n},i)=>(0,ek.createElement)(rF,{ref:i,iconNode:t,className:rD(`lucide-${rU(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,r),...n}));return r.displayName=rU(e),r},rV=rB("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);var rq=e.i(18566);function rW(e){var t;let r,n=(t=e,(r=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${t}.SlotClone`,r),i=ek.forwardRef((e,t)=>{let{children:r,...i}=e,a=ek.Children.toArray(r),o=a.find(rY);if(o){let e=o.props.children,r=a.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,ew.jsx)(n,{...i,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,ew.jsx)(n,{...i,ref:t,children:r})});return i.displayName=`${e}.Slot`,i}var rJ=rW("Slot"),rH=Symbol("radix.slottable");function rK(e){let t=({children:e})=>(0,ew.jsx)(ew.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=rH,t}var rG=rK("Slottable");function rY(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===rH}e.s(["Root",0,rJ,"Slot",0,rJ,"Slottable",0,rG,"createSlot",0,rW,"createSlottable",0,rK],43556);var rX=e.i(43556),rX=rX,rQ=e.i(7670);let r0=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,r1=rQ.clsx,r2=(e,t)=>r=>{var n;if((null==t?void 0:t.variants)==null)return r1(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:i,defaultVariants:a}=t,o=Object.keys(i).map(e=>{let t=null==r?void 0:r[e],n=null==a?void 0:a[e];if(null===t)return null;let o=r0(t)||r0(n);return i[e][o]}),s=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{});return r1(e,o,null==t||null==(n=t.compoundVariants)?void 0:n.reduce((e,t)=>{let{class:r,className:n,...i}=t;return Object.entries(i).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...a,...s}[t]):({...a,...s})[t]===r})?[...e,r,n]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)};var rX=rX,r4=e.i(47163);let r6=r2("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function r5({className:e,variant:t="default",size:r="default",asChild:n=!1,...i}){let a=n?rX.Root:"button";return(0,ew.jsx)(a,{"data-slot":"button","data-variant":t,"data-size":r,className:(0,r4.cn)(r6({variant:t,size:r,className:e})),...i})}var r3=e.i(28231);let r9=(0,ek.forwardRef)(({children:e,tooltip:t,side:r="bottom",className:n,...i},a)=>(0,ew.jsx)(r3.TooltipProvider,{delayDuration:0,children:(0,ew.jsxs)(r3.Tooltip,{children:[(0,ew.jsx)(r3.TooltipTrigger,{asChild:!0,children:(0,ew.jsxs)(r5,{variant:"ghost",size:"icon",...i,className:(0,r4.cn)("aui-button-icon size-6 p-1",n),ref:a,children:[(0,ew.jsx)(rX.Slottable,{children:e}),(0,ew.jsx)("span",{className:"aui-sr-only sr-only",children:t})]})}),(0,ew.jsx)(r3.TooltipContent,{side:r,children:t})]})}));r9.displayName="TooltipIconButton";let r8=rB("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);var r7=e.i(10772),ne=e.i(69340),nt=e.i(26330),nr=Symbol("radix.slottable");function nn(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===nr}var ni=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(nn);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,ew.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,ew.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ew.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),na=e.i(30207),no="focusScope.autoFocusOnMount",ns="focusScope.autoFocusOnUnmount",nl={bubbles:!1,cancelable:!0},nu=ek.forwardRef((e,t)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,l]=ek.useState(null),u=(0,na.useCallbackRef)(i),d=(0,na.useCallbackRef)(a),c=ek.useRef(null),p=(0,rh.useComposedRefs)(t,e=>l(e)),m=ek.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;ek.useEffect(()=>{if(n){let e=function(e){if(m.paused||!s)return;let t=e.target;s.contains(t)?c.current=t:np(c.current,{select:!0})},t=function(e){if(m.paused||!s)return;let t=e.relatedTarget;null!==t&&(s.contains(t)||np(c.current,{select:!0}))};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let r=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&np(s)});return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[n,s,m.paused]),ek.useEffect(()=>{if(s){nm.add(m);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(no,nl);s.addEventListener(no,u),s.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(np(n,{select:t}),document.activeElement!==r)return}(nd(s).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&np(s))}return()=>{s.removeEventListener(no,u),setTimeout(()=>{let t=new CustomEvent(ns,nl);s.addEventListener(ns,d),s.dispatchEvent(t),t.defaultPrevented||np(e??document.body,{select:!0}),s.removeEventListener(ns,d),nm.remove(m)},0)}}},[s,u,d,m]);let f=ek.useCallback(e=>{if(!r&&!n||m.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){var a;let t,n=e.currentTarget,[o,s]=[nc(t=nd(a=n),a),nc(t.reverse(),a)];o&&s?e.shiftKey||i!==s?e.shiftKey&&i===o&&(e.preventDefault(),r&&np(s,{select:!0})):(e.preventDefault(),r&&np(o,{select:!0})):i===n&&e.preventDefault()}},[r,n,m.paused]);return(0,ew.jsx)(ni.div,{tabIndex:-1,...o,ref:p,onKeyDown:f})});function nd(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function nc(e,t){for(let r of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(r,{upTo:t}))return r}function np(e,{select:t=!1}={}){if(e&&e.focus){var r;let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&(r=e)instanceof HTMLInputElement&&"select"in r&&t&&e.select()}}nu.displayName="FocusScope";var nm=(a=[],{add(e){let t=a[0];e!==t&&t?.pause(),(a=nf(a,e)).unshift(e)},remove(e){a=nf(a,e),a[0]?.resume()}});function nf(e,t){let r=[...e],n=r.indexOf(t);return -1!==n&&r.splice(n,1),r}var nh=e.i(74606),ng=e.i(96626);function nv(e){var t;let r,n=(t=e,(r=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${t}.SlotClone`,r),i=ek.forwardRef((e,t)=>{let{children:r,...i}=e,a=ek.Children.toArray(r),o=a.find(nb);if(o){let e=o.props.children,r=a.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,ew.jsx)(n,{...i,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,ew.jsx)(n,{...i,ref:t,children:r})});return i.displayName=`${e}.Slot`,i}var ny=Symbol("radix.slottable");function nb(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===ny}var nx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=nv(`Primitive.${t}`),n=ek.forwardRef((e,n)=>{let{asChild:i,...a}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ew.jsx)(i?r:t,{...a,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),nw=0;function n_(){ek.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??nk()),document.body.insertAdjacentElement("beforeend",e[1]??nk()),nw++,()=>{1===nw&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),nw--}},[])}function nk(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var nI=function(){return(nI=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function nS(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}var n$=("function"==typeof SuppressedError&&SuppressedError,"right-scroll-bar-position"),nj="width-before-scroll-bar";function nE(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var nT="u">typeof window?ek.useLayoutEffect:ek.useEffect,nC=new WeakMap,nN=(void 0===o&&(o={}),(void 0===s&&(s=function(e){return e}),l=[],u=!1,d={read:function(){if(u)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return l.length?l[l.length-1]:null},useMedium:function(e){var t=s(e,u);return l.push(t),function(){l=l.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(u=!0;l.length;){var t=l;l=[],t.forEach(e)}l={push:function(t){return e(t)},filter:function(){return l}}},assignMedium:function(e){u=!0;var t=[];if(l.length){var r=l;l=[],r.forEach(e),t=l}var n=function(){var r=t;t=[],r.forEach(e)},i=function(){return Promise.resolve().then(n)};i(),l={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),l}}}}).options=nI({async:!0,ssr:!1},o),d),nA=function(){},nR=ek.forwardRef(function(e,t){var r,n,i,a,o=ek.useRef(null),s=ek.useState({onScrollCapture:nA,onWheelCapture:nA,onTouchMoveCapture:nA}),l=s[0],u=s[1],d=e.forwardProps,c=e.children,p=e.className,m=e.removeScrollBar,f=e.enabled,h=e.shards,g=e.sideCar,v=e.noRelative,y=e.noIsolation,b=e.inert,x=e.allowPinchZoom,w=e.as,_=e.gapMode,k=nS(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),I=(r=[o,t],n=function(e){return r.forEach(function(t){return nE(t,e)})},(i=(0,ek.useState)(function(){return{value:null,callback:n,facade:{get current(){return i.value},set current(value){var e=i.value;e!==value&&(i.value=value,i.callback(value,e))}}}})[0]).callback=n,a=i.facade,nT(function(){var e=nC.get(a);if(e){var t=new Set(e),n=new Set(r),i=a.current;t.forEach(function(e){n.has(e)||nE(e,null)}),n.forEach(function(e){t.has(e)||nE(e,i)})}nC.set(a,r)},[r]),a),S=nI(nI({},k),l);return ek.createElement(ek.Fragment,null,f&&ek.createElement(g,{sideCar:nN,removeScrollBar:m,shards:h,noRelative:v,noIsolation:y,inert:b,setCallbacks:u,allowPinchZoom:!!x,lockRef:o,gapMode:_}),d?ek.cloneElement(ek.Children.only(c),nI(nI({},S),{ref:I})):ek.createElement(void 0===w?"div":w,nI({},S,{className:p,ref:I}),c))});nR.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},nR.classNames={fullWidth:nj,zeroRight:n$};var nP=function(e){var t=e.sideCar,r=nS(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw Error("Sidecar medium not found");return ek.createElement(n,nI({},r))};nP.isSideCarExport=!0;var nO=function(){var e=0,t=null;return{add:function(r){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=w||("u">typeof __webpack_nonce__?__webpack_nonce__:void 0);return t&&e.setAttribute("nonce",t),e}())){var n,i;(n=t).styleSheet?n.styleSheet.cssText=r:n.appendChild(document.createTextNode(r)),i=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(i)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},nM=function(){var e=nO();return function(t,r){ek.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},nz=function(){var e=nM();return function(t){return e(t.styles,t.dynamic),null}},nD={left:0,top:0,right:0,gap:0},nU=function(e){return parseInt(e||"",10)||0},nL=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],i=t["padding"===e?"paddingRight":"marginRight"];return[nU(r),nU(n),nU(i)]},nZ=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return nD;var t=nL(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},nF=nz(),nB="data-scroll-locked",nV=function(e,t,r,n){var i=e.left,a=e.top,o=e.right,s=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(s,"px ").concat(n,";\n }\n body[").concat(nB,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(i,"px;\n padding-top: ").concat(a,"px;\n padding-right: ").concat(o,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(n$," {\n right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(nj," {\n margin-right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(n$," .").concat(n$," {\n right: 0 ").concat(n,";\n }\n \n .").concat(nj," .").concat(nj," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(nB,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},nq=function(){var e=parseInt(document.body.getAttribute(nB)||"0",10);return isFinite(e)?e:0},nW=function(){ek.useEffect(function(){return document.body.setAttribute(nB,(nq()+1).toString()),function(){var e=nq()-1;e<=0?document.body.removeAttribute(nB):document.body.setAttribute(nB,e.toString())}},[])},nJ=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=void 0===n?"margin":n;nW();var a=ek.useMemo(function(){return nZ(i)},[i]);return ek.createElement(nF,{styles:nV(a,!t,i,r?"":"!important")})},nH=!1;if("u">typeof window)try{var nK=Object.defineProperty({},"passive",{get:function(){return nH=!0,!0}});window.addEventListener("test",nK,nK),window.removeEventListener("test",nK,nK)}catch(e){nH=!1}var nG=!!nH&&{passive:!1},nY=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&(r.overflowY!==r.overflowX||"TEXTAREA"===e.tagName||"visible"!==r[t])},nX=function(e,t){var r=t.ownerDocument,n=t;do{if("u">typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),nQ(e,n)){var i=n0(e,n);if(i[1]>i[2])return!0}n=n.parentNode}while(n&&n!==r.body)return!1},nQ=function(e,t){return"v"===e?nY(t,"overflowY"):nY(t,"overflowX")},n0=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},n1=function(e,t,r,n,i){var a,o=(a=window.getComputedStyle(t).direction,"h"===e&&"rtl"===a?-1:1),s=o*n,l=r.target,u=t.contains(l),d=!1,c=s>0,p=0,m=0;do{if(!l)break;var f=n0(e,l),h=f[0],g=f[1]-f[2]-o*h;(h||g)&&nQ(e,l)&&(p+=g,m+=h);var v=l.parentNode;l=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!u&&l!==document.body||u&&(t.contains(l)||t===l))return c&&(i&&1>Math.abs(p)||!i&&s>p)?d=!0:!c&&(i&&1>Math.abs(m)||!i&&-s>m)&&(d=!0),d},n2=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},n4=function(e){return[e.deltaX,e.deltaY]},n6=function(e){return e&&"current"in e?e.current:e},n5=0,n3=[];let n9=(c=function(e){var t=ek.useRef([]),r=ek.useRef([0,0]),n=ek.useRef(),i=ek.useState(n5++)[0],a=ek.useState(nz)[0],o=ek.useRef(e);ek.useEffect(function(){o.current=e},[e]),ek.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var t=(function(e,t,r){if(r||2==arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))})([e.lockRef.current],(e.shards||[]).map(n6),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var s=ek.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!o.current.allowPinchZoom;var i,a=n2(e),s=r.current,l="deltaX"in e?e.deltaX:s[0]-a[0],u="deltaY"in e?e.deltaY:s[1]-a[1],d=e.target,c=Math.abs(l)>Math.abs(u)?"h":"v";if("touches"in e&&"h"===c&&"range"===d.type)return!1;var p=window.getSelection(),m=p&&p.anchorNode;if(m&&(m===d||m.contains(d)))return!1;var f=nX(c,d);if(!f)return!0;if(f?i=c:(i="v"===c?"h":"v",f=nX(c,d)),!f)return!1;if(!n.current&&"changedTouches"in e&&(l||u)&&(n.current=i),!i)return!0;var h=n.current||i;return n1(h,t,e,"h"===h?l:u,!0)},[]),l=ek.useCallback(function(e){if(n3.length&&n3[n3.length-1]===a){var r="deltaY"in e?n4(e):n2(e),n=t.current.filter(function(t){var n;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(n=t.delta,n[0]===r[0]&&n[1]===r[1])})[0];if(n&&n.should){e.cancelable&&e.preventDefault();return}if(!n){var i=(o.current.shards||[]).map(n6).filter(Boolean).filter(function(t){return t.contains(e.target)});(i.length>0?s(e,i[0]):!o.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),u=ek.useCallback(function(e,r,n,i){var a={name:e,delta:r,target:n,should:i,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(n)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=ek.useCallback(function(e){r.current=n2(e),n.current=void 0},[]),c=ek.useCallback(function(t){u(t.type,n4(t),t.target,s(t,e.lockRef.current))},[]),p=ek.useCallback(function(t){u(t.type,n2(t),t.target,s(t,e.lockRef.current))},[]);ek.useEffect(function(){return n3.push(a),e.setCallbacks({onScrollCapture:c,onWheelCapture:c,onTouchMoveCapture:p}),document.addEventListener("wheel",l,nG),document.addEventListener("touchmove",l,nG),document.addEventListener("touchstart",d,nG),function(){n3=n3.filter(function(e){return e!==a}),document.removeEventListener("wheel",l,nG),document.removeEventListener("touchmove",l,nG),document.removeEventListener("touchstart",d,nG)}},[]);var m=e.removeScrollBar,f=e.inert;return ek.createElement(ek.Fragment,null,f?ek.createElement(a,{styles:"\n .block-interactivity-".concat(i," {pointer-events: none;}\n .allow-interactivity-").concat(i," {pointer-events: all;}\n")}):null,m?ek.createElement(nJ,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},nN.useMedium(c),nP);var n8=ek.forwardRef(function(e,t){return ek.createElement(nR,nI({},e,{ref:t,sideCar:n9}))});n8.classNames=nR.classNames;var n7=new WeakMap,ie=new WeakMap,it={},ir=0,ii=function(e){return e&&(e.host||ii(e.parentNode))},ia=function(e,t,r,n){var i=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var r=ii(e);return r&&t.contains(r)?r:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});it[r]||(it[r]=new WeakMap);var a=it[r],o=[],s=new Set,l=new Set(i),u=function(e){!e||s.has(e)||(s.add(e),u(e.parentNode))};i.forEach(u);var d=function(e){!e||l.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))d(e);else try{var t=e.getAttribute(n),i=null!==t&&"false"!==t,l=(n7.get(e)||0)+1,u=(a.get(e)||0)+1;n7.set(e,l),a.set(e,u),o.push(e),1===l&&i&&ie.set(e,!0),1===u&&e.setAttribute(r,"true"),i||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),s.clear(),ir++,function(){o.forEach(function(e){var t=n7.get(e)-1,i=a.get(e)-1;n7.set(e,t),a.set(e,i),t||(ie.has(e)||e.removeAttribute(n),ie.delete(e)),i||e.removeAttribute(r)}),--ir||(n7=new WeakMap,n7=new WeakMap,ie=new WeakMap,it={})}},io=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||("u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live], script"))),ia(n,i,r,"aria-hidden")):function(){return null}},is="Dialog",[il,iu]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,ew.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(is),[id,ic]=il(is),ip=e=>{let{__scopeDialog:t,children:r,open:n,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=ek.useRef(null),l=ek.useRef(null),[u,d]=(0,ne.useControllableState)({prop:n,defaultProp:i??!1,onChange:a,caller:is});return(0,ew.jsx)(id,{scope:t,triggerRef:s,contentRef:l,contentId:(0,r7.useId)(),titleId:(0,r7.useId)(),descriptionId:(0,r7.useId)(),open:u,onOpenChange:d,onOpenToggle:ek.useCallback(()=>d(e=>!e),[d]),modal:o,children:r})};ip.displayName=is;var im="DialogTrigger",ih=ek.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=ic(im,r),a=(0,rh.useComposedRefs)(t,i.triggerRef);return(0,ew.jsx)(nx.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":iO(i.open),...n,ref:a,onClick:(0,rI.composeEventHandlers)(e.onClick,i.onOpenToggle)})});ih.displayName=im;var ig="DialogPortal",[iv,iy]=il(ig,{forceMount:void 0}),ib=e=>{let{__scopeDialog:t,forceMount:r,children:n,container:i}=e,a=ic(ig,t);return(0,ew.jsx)(iv,{scope:t,forceMount:r,children:ek.Children.map(n,e=>(0,ew.jsx)(ng.Presence,{present:r||a.open,children:(0,ew.jsx)(nh.Portal,{asChild:!0,container:i,children:e})}))})};ib.displayName=ig;var ix="DialogOverlay",iw=ek.forwardRef((e,t)=>{let r=iy(ix,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,a=ic(ix,e.__scopeDialog);return a.modal?(0,ew.jsx)(ng.Presence,{present:n||a.open,children:(0,ew.jsx)(ik,{...i,ref:t})}):null});iw.displayName=ix;var i_=nv("DialogOverlay.RemoveScroll"),ik=ek.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=ic(ix,r);return(0,ew.jsx)(n8,{as:i_,allowPinchZoom:!0,shards:[i.contentRef],children:(0,ew.jsx)(nx.div,{"data-state":iO(i.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),iI="DialogContent",iS=ek.forwardRef((e,t)=>{let r=iy(iI,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,a=ic(iI,e.__scopeDialog);return(0,ew.jsx)(ng.Presence,{present:n||a.open,children:a.modal?(0,ew.jsx)(i$,{...i,ref:t}):(0,ew.jsx)(ij,{...i,ref:t})})});iS.displayName=iI;var i$=ek.forwardRef((e,t)=>{let r=ic(iI,e.__scopeDialog),n=ek.useRef(null),i=(0,rh.useComposedRefs)(t,r.contentRef,n);return ek.useEffect(()=>{let e=n.current;if(e)return io(e)},[]),(0,ew.jsx)(iE,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,rI.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:(0,rI.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:(0,rI.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault())})}),ij=ek.forwardRef((e,t)=>{let r=ic(iI,e.__scopeDialog),n=ek.useRef(!1),i=ek.useRef(!1);return(0,ew.jsx)(iE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(n.current||r.triggerRef.current?.focus(),t.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(n.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));let a=t.target;r.triggerRef.current?.contains(a)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),iE=ek.forwardRef((e,t)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=ic(iI,r),l=ek.useRef(null),u=(0,rh.useComposedRefs)(t,l);return n_(),(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsx)(nu,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,ew.jsx)(nt.DismissableLayer,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":iO(s.open),...o,ref:u,onDismiss:()=>s.onOpenChange(!1)})}),(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsx)(iU,{titleId:s.titleId}),(0,ew.jsx)(iL,{contentRef:l,descriptionId:s.descriptionId})]})]})}),iT="DialogTitle",iC=ek.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=ic(iT,r);return(0,ew.jsx)(nx.h2,{id:i.titleId,...n,ref:t})});iC.displayName=iT;var iN="DialogDescription",iA=ek.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=ic(iN,r);return(0,ew.jsx)(nx.p,{id:i.descriptionId,...n,ref:t})});iA.displayName=iN;var iR="DialogClose",iP=ek.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=ic(iR,r);return(0,ew.jsx)(nx.button,{type:"button",...n,ref:t,onClick:(0,rI.composeEventHandlers)(e.onClick,()=>i.onOpenChange(!1))})});function iO(e){return e?"open":"closed"}iP.displayName=iR;var iM="DialogTitleWarning",[iz,iD]=(p={contentName:iI,titleName:iT,docsSlug:"dialog"},r=ek.createContext(p),(n=e=>{let{children:t,...n}=e,i=ek.useMemo(()=>n,Object.values(n));return(0,ew.jsx)(r.Provider,{value:i,children:t})}).displayName=iM+"Provider",[n,function(e){let t=ek.useContext(r);if(t)return t;if(void 0!==p)return p;throw Error(`\`${e}\` must be used within \`${iM}\``)}]),iU=({titleId:e})=>{let t=iD(iM),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
4
|
+
|
|
5
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
6
|
+
|
|
7
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return ek.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},iL=({contentRef:e,descriptionId:t})=>{let r=iD("DialogDescriptionWarning"),n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return ek.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null};e.s(["Close",0,iP,"Content",0,iS,"Description",0,iA,"Dialog",0,ip,"DialogClose",0,iP,"DialogContent",0,iS,"DialogDescription",0,iA,"DialogOverlay",0,iw,"DialogPortal",0,ib,"DialogTitle",0,iC,"DialogTrigger",0,ih,"Overlay",0,iw,"Portal",0,ib,"Root",0,ip,"Title",0,iC,"Trigger",0,ih,"WarningProvider",0,iz,"createDialogScope",0,iu],26999);var iZ=e.i(26999),iZ=iZ;function iF({...e}){return(0,ew.jsx)(iZ.Root,{"data-slot":"sheet",...e})}function iB({...e}){return(0,ew.jsx)(iZ.Portal,{"data-slot":"sheet-portal",...e})}function iV({className:e,...t}){return(0,ew.jsx)(iZ.Overlay,{"data-slot":"sheet-overlay",className:(0,r4.cn)("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",e),...t})}function iq({className:e,children:t,side:r="right",showCloseButton:n=!0,...i}){return(0,ew.jsxs)(iB,{children:[(0,ew.jsx)(iV,{}),(0,ew.jsxs)(iZ.Content,{"data-slot":"sheet-content",className:(0,r4.cn)("fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500","right"===r&&"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm","left"===r&&"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm","top"===r&&"inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top","bottom"===r&&"inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",e),...i,children:[t,n&&(0,ew.jsxs)(iZ.Close,{className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary",children:[(0,ew.jsx)(r8,{className:"size-4"}),(0,ew.jsx)("span",{className:"sr-only",children:"关闭"})]})]})]})}function iW({className:e,...t}){return(0,ew.jsx)("div",{"data-slot":"sheet-header",className:(0,r4.cn)("flex flex-col gap-1.5 p-4",e),...t})}function iJ({className:e,...t}){return(0,ew.jsx)(iZ.Title,{"data-slot":"sheet-title",className:(0,r4.cn)("font-semibold text-foreground",e),...t})}function iH({className:e,...t}){return(0,ew.jsx)(iZ.Description,{"data-slot":"sheet-description",className:(0,r4.cn)("text-sm text-muted-foreground",e),...t})}let iK=new Set(["high","medium","low"]),iG=new Set(["pending","in_progress","completed"]);function iY(e){return!!(e&&"object"==typeof e&&!Array.isArray(e))}function iX(e){return Array.isArray(e)?e.flatMap(e=>{if(!iY(e))return[];let{content:t,priority:r,status:n}=e;return"string"==typeof t&&"string"==typeof r&&iK.has(r)&&"string"==typeof n&&iG.has(n)?[{content:t,priority:r,status:n}]:[]}):[]}function iQ(){let e=rS(e=>e.thread.messages);return(0,ek.useMemo)(()=>{for(let t=e.length-1;t>=0;t-=1){let r=e[t];if(!r)continue;if("user"===r.role)break;if("assistant"!==r.role)continue;let n=r.metadata?.custom,i=function(e){var t;let r=e?.acpPlans;if(!iY(r))return[];let n=iY(r.byId)?r.byId:{},i=iY(r.removed)?r.removed:{},a="string"==typeof(t=r.latestId)?t.trim():"",o=Object.entries(n).sort(([,e],[,t])=>{let r=iY(e)?Number(e.updatedAt):0;return(iY(t)?Number(t.updatedAt):0)-r});for(let[e,t]of a?[[a,n[a]],...o.filter(([e])=>e!==a)]:o){if(i[e]||!iY(t)||t.removed||"items"!==t.type)continue;let r=iX(t.entries);if(r.length>0)return r}return[]}(n);if(i.length>0)return i;let a=iX(n?.acpPlan);if(a.length>0)return a}return[]},[e])}let i0=rB("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),i1=rB("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),i2=rB("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]),i4=rB("list-x",[["path",{d:"M16 5H3",key:"m91uny"}],["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 19H3",key:"zzsher"}],["path",{d:"m15.5 9.5 5 5",key:"ytk86i"}],["path",{d:"m20.5 9.5-5 5",key:"17o44f"}]]),i6=rB("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),i5=rB("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),i3=rB("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);function i9(e=[],t=new Date().toISOString()){return{version:"2",items:e,updatedAt:t}}function i8(e){return"file"===e||"annotation"===e}function i7(e,t){if(!t)return e;let r=new Set(t);return{...e,items:e.items.filter(e=>r.has(e.kind))}}let ae=["claude","codex","gemini","opencode"],at="bypassPermissions",ar="full-access",an="bypassPermissions",ai="build",aa={openai:"codex"},ao={claude:{provider:"claude",label:"Claude",command:"npx",args:["-y","@agentclientprotocol/claude-agent-acp@^0.39.0"],defaultModel:"sonnet",defaultModeId:at,supportsImages:!0,enabledInP0:!1},codex:{provider:"codex",label:"Codex",command:"./node_modules/.bin/codex-acp",defaultModeId:ar,supportsImages:!0,enabledInP0:!0},gemini:{provider:"gemini",label:"Gemini",command:"npx",args:["-y","@google/gemini-cli@^0.44.1","--acp","--skip-trust"],defaultModel:"gemini-3-pro-preview",defaultModeId:an,supportsImages:!1,enabledInP0:!1},opencode:{provider:"opencode",label:"OpenCode",command:"npx",args:["-y","opencode-ai@^1.15.13","acp"],defaultModel:"opencode/big-pickle",defaultModeId:ai,supportsImages:!1,enabledInP0:!1}};function as(e){let t=String(e||"codex").trim().toLowerCase(),r=aa[t]??t;return ae.includes(r)?r:"codex"}let al="image-generation",au="acp-ui-image-generation",ad="generate_image",ac=`Tool: ${au}/${ad}`,ap="acp.acp_provider_agent_dynamic_tool";function am(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function af(e){return"string"==typeof e&&e.trim()?e.trim():void 0}function ah(e){if(!am(e))return null;let t={},r=af(e.baseUrl)?.replace(/\/+$/u,""),n=af(e.apiKey),i=af(e.model),a=af(e.savePathPattern);return"boolean"==typeof e.enabled&&(t.enabled=e.enabled),r&&(t.baseUrl=r),n&&(t.apiKey=n),i&&(t.model=i),a&&(t.savePathPattern=a),"boolean"==typeof e.preservePrompt&&(t.preservePrompt=e.preservePrompt),Object.keys(t).length>0?t:null}function ag(e){let t=ah(e);return!!(t?.baseUrl&&t.apiKey&&t.model)}function av(e){if(!am(e))return null;let t="string"==typeof e.toolName?e.toolName:null;return t?{toolCallId:"string"==typeof e.toolCallId?e.toolCallId:void 0,toolName:t,args:e.args}:null}function ay(e){return am(e)&&("completed"===e.status||"failed"===e.status)&&"string"==typeof e.requestId&&"string"==typeof e.prompt&&Array.isArray(e.images)}function ab(e){if(ay(e))return e;if(am(e)&&ay(e.structuredContent))return e.structuredContent;if("string"==typeof e)try{return ab(JSON.parse(e))}catch{}return null}let ax={enabled:!1,baseUrl:"",apiKey:"",model:"",preservePrompt:!0};function aw(e){if(!am(e))return ax;let t=t=>"string"==typeof e[t]?e[t].trim():"";return{enabled:!0===e.enabled,baseUrl:t("baseUrl"),apiKey:t("apiKey"),model:t("model"),savePathPattern:t("savePathPattern")||void 0,preservePrompt:"boolean"!=typeof e.preservePrompt||e.preservePrompt}}let a_="user-choice",ak="acp-ui-user-choice",aI="ask_user_choice",aS=`Tool: ${ak}/${aI}`,a$="自定义",aj="USER_CHOICE_RESULT";function aE(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}let aT={enabled:!0,waitTimeoutMs:12e4,allowCustomInput:!0,customInputLabel:a$};function aC(e){var t,r;return{...aT,...!aE(t=e)?{enabled:!0,waitTimeoutMs:12e4,allowCustomInput:!0,customInputLabel:a$}:{enabled:!1!==t.enabled,waitTimeoutMs:function(e){if("number"==typeof e&&Number.isFinite(e))return Math.min(18e4,Math.max(5e3,Math.floor(e)))}(t.waitTimeoutMs)??12e4,allowCustomInput:!1!==t.allowCustomInput,customInputLabel:("string"==typeof(r=t.customInputLabel)&&r.trim()?r.trim():void 0)??a$}}}let aN="acp-ui-builtin-tool-settings",aA=[{id:al,defaultSettings:ax,legacyStorageKey:"acp-ui-image-generation-tool-settings",normalizeSettings:aw,isEnabled(e){let t=aw(e);return t.enabled&&ag(t)}},{id:a_,defaultSettings:aT,normalizeSettings:aC,isEnabled:e=>aC(e).enabled}];function aR(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function aP(e){try{let t=window.localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}}function aO(e,t){window.localStorage.setItem(e,JSON.stringify(t))}function aM(e){let t=aR(e)?e:{},r={};for(let e of aA)r[e.id]=e.normalizeSettings(e.id in t?t[e.id]:e.defaultSettings);return r}function az(e,t,r){let n=e[t],i="function"==typeof r?r(n):r;return aM({...e,[t]:i})}let aD="codex",aU=(0,ek.createContext)(null);function aL(e){return e.map(e=>{let t;return{...e,id:"string"==typeof e.id&&e.id.trim()?e.id.trim():(t={...e},delete t.id,`${e.kind}:${function(e){let t=0x811c9dc5;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,0x1000193);return(t>>>0).toString(36)}(function e(t){return Array.isArray(t)?`[${t.map(t=>e(t)).join(",")}]`:t&&"object"==typeof t?`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${e(t[r])}`).join(",")}}`:JSON.stringify(t)}(t))}`)}})}function aZ(e){return i9(e,new Date().toISOString())}function aF(e){return e.map(e=>e.id).filter(e=>!!e)}function aB(e,t){window.dispatchEvent(new CustomEvent("acp.context.local-change",{detail:{context:e,change:t}}))}function aV({children:e,workspacePath:t,defaultProvider:r}){let[n,i]=(0,ek.useState)(()=>as(r??aD)),[a,o]=(0,ek.useState)(null),[s,l]=(0,ek.useState)(null),[u,d]=(0,ek.useState)(null),[c,p]=(0,ek.useState)(null),[m,f]=(0,ek.useState)(null),[h,g]=(0,ek.useState)(null),[v,y]=(0,ek.useState)({}),[b,x]=(0,ek.useState)(null),[w,_]=(0,ek.useState)(()=>i9()),k=(0,ek.useRef)(w),I=(0,ek.useRef)(v),S=(0,ek.useRef)(b),$=(0,ek.useCallback)(e=>{k.current=e,_(e)},[]);(0,ek.useEffect)(()=>{let e=function(){let e=aP(aN),t=aR(e)?{...e}:{};for(let e of aA){if(e.id in t||!e.legacyStorageKey)continue;let r=aP(e.legacyStorageKey);r&&(t[e.id]=r)}return aM(t)}();I.current=e,y(e)},[]);let j=(0,ek.useCallback)(e=>String(e??"").trim()||null,[]),E=(0,ek.useCallback)(e=>{let t=as(e??aD);i(e=>e===t?e:(o(null),l(null),d(null),p(null),f(null),g(null),t))},[]),T=(0,ek.useCallback)(e=>{let t=j(e);o(t),p(t)},[j]),C=(0,ek.useCallback)(e=>{let t=j(e);l(t),f(t)},[j]),N=(0,ek.useCallback)(e=>{let t=j(e);d(t),g(t)},[j]),A=(0,ek.useCallback)((e,t)=>{let r=az(I.current,e,t);I.current=r;let n=aM(r);for(let e of(aO(aN,n),aA))e.legacyStorageKey&&aO(e.legacyStorageKey,n[e.id]);y(r)},[]),R=(0,ek.useCallback)(e=>{let t=ah("function"==typeof e?e(S.current):e);return S.current=t,x(t),t},[]),P=(0,ek.useCallback)(()=>(S.current=null,x(null),null),[]),O=(0,ek.useCallback)(e=>o(j(e)),[j]),M=(0,ek.useCallback)(e=>l(j(e)),[j]),z=(0,ek.useCallback)(e=>d(j(e)),[j]),D=(0,ek.useCallback)(e=>{let t=aL(e),r=new Map(k.current.items.map(e=>[e.id,e]));for(let e of t)r.set(e.id,e);let n=aZ([...r.values()]),i={operation:"add",ids:aF(t),items:t};return $(n),aB(n,i),{context:n,change:i}},[$]),U=(0,ek.useCallback)(e=>{let t=e.map(e=>e.trim()).filter(Boolean),r=new Set(t),n=aZ(k.current.items.filter(e=>!r.has(e.id??""))),i={operation:"remove",ids:t};return $(n),aB(n,i),{context:n,change:i}},[$]),L=(0,ek.useCallback)(e=>{let t=aL(e),r=aZ(t),n={operation:"replace",ids:aF(t),items:t};return $(r),aB(r,n),{context:r,change:n}},[$]),Z=(0,ek.useCallback)(e=>{let t=e?new Set(e):null,r=aZ(t?k.current.items.filter(e=>!t.has(e.kind)):[]),n={operation:"clear",kinds:e};return $(r),aB(r,n),{context:r,change:n}},[$]),F=(0,ek.useCallback)(e=>i7(k.current,e),[]),B=(0,ek.useCallback)(()=>{let e=k.current;if(0===e.items.length)return null;let t=aZ(e.items.filter(e=>!0===e.pinned));return $(t),aB(t,{operation:"consume",ids:aF(e.items),items:e.items}),e},[$]),V=(0,ek.useMemo)(()=>b?az(v,al,e=>{let t,r;return t=ah(e),r=ah(b),(t?r?{...t,...r}:t:r)??e}):v,[v,b]),q=(0,ek.useMemo)(()=>({provider:n,model:a,modeId:s,thoughtLevel:u,explicitModel:c,explicitModeId:m,explicitThoughtLevel:h,permissionMode:"bypassPermissions",workspacePath:j(t??null),builtinToolSettings:v,runtimeBuiltinToolSettings:V,hostImageGenerationSettings:b,contextBundle:w,setProvider:E,setModel:T,setModeId:C,setThoughtLevel:N,setBuiltinToolSettings:A,setHostImageGenerationSettings:R,clearHostImageGenerationSettings:P,syncModel:O,syncModeId:M,syncThoughtLevel:z,addContextItems:D,removeContextItems:U,replaceContextItems:L,clearContextItems:Z,getContextBundle:F,consumeContextBundle:B}),[D,Z,B,w,v,P,m,c,h,F,b,V,a,s,j,n,U,L,C,T,E,A,R,M,O,z,N,u,t]);return(0,ew.jsx)(aU.Provider,{value:q,children:e})}function aq(){let e=(0,ek.useContext)(aU);if(!e)throw Error("useAcpUiRuntimeContext must be used inside AcpUiProvider");return e}let aW={};function aJ(e){return{apiBasePath:aH(e?.apiBasePath),apiBaseUrl:aH(e?.apiBaseUrl)}}function aH(e){return String(e??"").trim()||null}function aK(e,t){let r,n,i,a,o=e.startsWith("/")?e:`/${e}`,s=(a=String((r=aJ({...aW,...aJ(window.__ACP_UI_RUNTIME_CONFIG__)})).apiBaseUrl??r.apiBasePath??null??(i=aJ({apiBasePath:(n=new URLSearchParams(window.location.search)).get("acpApiBasePath"),apiBaseUrl:n.get("acpApiBaseUrl")})).apiBaseUrl??i.apiBasePath??null??aH(e_.default.env.NEXT_PUBLIC_ACP_UI_API_BASE_URL)??aH(e_.default.env.NEXT_PUBLIC_ACP_UI_API_BASE_PATH)??"").trim())?a.replace(/\/+$/,""):"/api",l=window.location.origin,u=new URL(`${s}${o}`,l);for(let[e,r]of Object.entries(t??{}))null!=r&&""!==r&&u.searchParams.set(e,String(r));return u.origin===l?`${u.pathname}${u.search}`:u.toString()}async function aG(e,t){let r=await fetch(e,{...t,headers:{"content-type":"application/json",...t?.headers}});if(!r.ok){let e=`${r.status} ${r.statusText}`,t=await r.json().catch(()=>null);throw Error(t?.error??e)}return r.json()}function aY(e){return`/conversations/${encodeURIComponent(e)}`}let aX=(e,t)=>aK("/conversations",{workspacePath:e,limit:t?.limit,after:t?.after,refreshProvider:t?.refreshProvider}),aQ=(e,t)=>aK(aY(e),{workspacePath:t}),a0=(e,t,r,n,i)=>aK(`${aY(e)}/messages`,{workspacePath:t,format:r,source:n,hideResumable:i}),a1={chatUrl:()=>aK("/chat"),chatResumeUrl:(e,t)=>((e,t)=>aK(`/chat/resume/${encodeURIComponent(e)}`,t))(e,t),cancelChat:async e=>aG(aK("/chat/cancel"),{method:"POST",body:JSON.stringify(e)}),listConversations:async(e,t)=>aG(aX(e,t)),upsertConversation:async(e,t)=>aG(aX(t),{method:"POST",body:JSON.stringify(e)}),getConversation:async(e,t)=>aG(aQ(e,t)),getConversationRuntime:async(e,t)=>aG(((e,t)=>aK(`${aY(e)}/runtime`,{workspacePath:t}))(e,t)),renameConversation:async(e,t,r)=>aG(aQ(e,r),{method:"PATCH",body:JSON.stringify({title:t})}),archiveConversation:async(e,t,r)=>aG(aQ(e,r),{method:"PATCH",body:JSON.stringify({archived:t})}),async deleteConversation(e,t){let r=await fetch(aQ(e,t),{method:"DELETE"});if(!r.ok)throw Error(`${r.status} ${r.statusText}`)},loadConversationMessages:async(e,t,r,n,i)=>aG(a0(e,t,r,n,i?.hideResumable)),saveConversationMessage:async(e,t,r)=>aG(a0(e,t,r.format),{method:"POST",body:JSON.stringify(r)}),listImageGenerationRecords:async(e,t,r)=>{let n,i;return aG((n=e,i=t,aK("/tools/image-generation/records",{workspacePath:n,threadId:i,limit:r})))},getUserChoiceRequest:async e=>aG(aK("/tools/user-choice",e)),answerUserChoiceRequest:async e=>{let t;return aG(aK("/tools/user-choice",t),{method:"POST",body:JSON.stringify(e)})},listWorkspaceOutputArtifacts:async(e,t,r)=>{let n,i;return aG((n=e,i=t,aK("/output-artifacts/workspace",{workspacePath:n,threadId:i,sinceMs:r})))},collectThreadOutputArtifacts:async e=>aG(aK("/output-artifacts/thread",e)),getCapabilities:async e=>aG((({provider:e,threadId:t,workspacePath:r})=>aK("/acp/capabilities",{provider:e,threadId:t,workspacePath:r}))(e)),listCommands:async e=>aG((({provider:e,threadId:t,workspacePath:r})=>aK("/acp/commands",{provider:e,threadId:t,workspacePath:r}))(e))},a2=rB("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),a4=rB("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),a6=rB("loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);var iZ=iZ;function a5({...e}){return(0,ew.jsx)(iZ.Root,{"data-slot":"dialog",...e})}function a3({...e}){return(0,ew.jsx)(iZ.Trigger,{"data-slot":"dialog-trigger",...e})}function a9({...e}){return(0,ew.jsx)(iZ.Portal,{"data-slot":"dialog-portal",...e})}function a8({...e}){return(0,ew.jsx)(iZ.Close,{"data-slot":"dialog-close",...e})}function a7({className:e,...t}){return(0,ew.jsx)(iZ.Overlay,{"data-slot":"dialog-overlay",className:(0,r4.cn)("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t})}function oe({className:e,children:t,showCloseButton:r=!0,...n}){return(0,ew.jsxs)(a9,{"data-slot":"dialog-portal",children:[(0,ew.jsx)(a7,{}),(0,ew.jsxs)(iZ.Content,{"data-slot":"dialog-content",className:(0,r4.cn)("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg outline-none duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:max-w-lg",e),...n,children:[t,r&&(0,ew.jsxs)(iZ.Close,{"data-slot":"dialog-close",className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",children:[(0,ew.jsx)(r8,{}),(0,ew.jsx)("span",{className:"sr-only",children:"关闭"})]})]})]})}function ot({className:e,...t}){return(0,ew.jsx)("div",{"data-slot":"dialog-header",className:(0,r4.cn)("flex flex-col gap-2 text-center sm:text-left",e),...t})}function or({className:e,showCloseButton:t=!1,children:r,...n}){return(0,ew.jsxs)("div",{"data-slot":"dialog-footer",className:(0,r4.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...n,children:[r,t&&(0,ew.jsx)(iZ.Close,{asChild:!0,children:(0,ew.jsx)(r5,{variant:"outline",children:"关闭"})})]})}function on({className:e,...t}){return(0,ew.jsx)(iZ.Title,{"data-slot":"dialog-title",className:(0,r4.cn)("font-semibold text-lg leading-none",e),...t})}function oi({className:e,...t}){return(0,ew.jsx)(iZ.Description,{"data-slot":"dialog-description",className:(0,r4.cn)("text-muted-foreground text-sm",e),...t})}let oa=rB("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),oo=rB("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),os=rB("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),ol=rB("image-plus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]),ou=rB("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]);var od=e.i(34620),oc=Symbol("radix.slottable");function op(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===oc}var om=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(op);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,ew.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,ew.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ew.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),of="Collapsible",[oh,og]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,ew.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(of),[ov,oy]=oh(of),ob=ek.forwardRef((e,t)=>{let{__scopeCollapsible:r,open:n,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[l,u]=(0,ne.useControllableState)({prop:n,defaultProp:i??!1,onChange:o,caller:of});return(0,ew.jsx)(ov,{scope:r,disabled:a,contentId:(0,r7.useId)(),open:l,onOpenToggle:ek.useCallback(()=>u(e=>!e),[u]),children:(0,ew.jsx)(om.div,{"data-state":oS(l),"data-disabled":a?"":void 0,...s,ref:t})})});ob.displayName=of;var ox="CollapsibleTrigger",ow=ek.forwardRef((e,t)=>{let{__scopeCollapsible:r,...n}=e,i=oy(ox,r);return(0,ew.jsx)(om.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":oS(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...n,ref:t,onClick:(0,rI.composeEventHandlers)(e.onClick,i.onOpenToggle)})});ow.displayName=ox;var o_="CollapsibleContent",ok=ek.forwardRef((e,t)=>{let{forceMount:r,...n}=e,i=oy(o_,e.__scopeCollapsible);return(0,ew.jsx)(ng.Presence,{present:r||i.open,children:({present:e})=>(0,ew.jsx)(oI,{...n,ref:t,present:e})})});ok.displayName=o_;var oI=ek.forwardRef((e,t)=>{let{__scopeCollapsible:r,present:n,children:i,...a}=e,o=oy(o_,r),[s,l]=ek.useState(n),u=ek.useRef(null),d=(0,rh.useComposedRefs)(t,u),c=ek.useRef(0),p=c.current,m=ek.useRef(0),f=m.current,h=o.open||s,g=ek.useRef(h),v=ek.useRef(void 0);return ek.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,od.useLayoutEffect)(()=>{let e=u.current;if(e){v.current=v.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();c.current=t.height,m.current=t.width,g.current||(e.style.transitionDuration=v.current.transitionDuration,e.style.animationName=v.current.animationName),l(n)}},[o.open,n]),(0,ew.jsx)(om.div,{"data-state":oS(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!h,...a,ref:d,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":f?`${f}px`:void 0,...e.style},children:h&&i})});function oS(e){return e?"open":"closed"}e.s(["Collapsible",0,ob,"CollapsibleContent",0,ok,"CollapsibleTrigger",0,ow,"Content",0,ok,"Root",0,ob,"Trigger",0,ow,"createCollapsibleScope",0,og],87607);var o$=e.i(87607),o$=o$;function oj({...e}){return(0,ew.jsx)(o$.Root,{"data-slot":"collapsible",...e})}function oE({...e}){return(0,ew.jsx)(o$.CollapsibleTrigger,{"data-slot":"collapsible-trigger",...e})}function oT({...e}){return(0,ew.jsx)(o$.CollapsibleContent,{"data-slot":"collapsible-content",...e})}var oC=Symbol("radix.slottable");function oN(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===oC}var oA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(oN);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,ew.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,ew.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ew.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),oR="horizontal",oP=["horizontal","vertical"],oO=ek.forwardRef((e,t)=>{var r;let{decorative:n,orientation:i=oR,...a}=e,o=(r=i,oP.includes(r))?i:oR;return(0,ew.jsx)(oA.div,{"data-orientation":o,...n?{role:"none"}:{"aria-orientation":"vertical"===o?o:void 0,role:"separator"},...a,ref:t})});oO.displayName="Separator",e.s(["Root",0,oO,"Separator",0,oO],86392);var oM=e.i(86392),oM=oM;function oz({className:e,orientation:t="horizontal",decorative:r=!0,...n}){return(0,ew.jsx)(oM.Root,{"data-slot":"separator",decorative:r,orientation:t,className:(0,r4.cn)("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...n})}let oD={model:"模型",size:"尺寸",quality:"质量",outputFormat:"格式",background:"背景"};function oU(e){e&&"u">typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(e).catch(()=>{})}async function oL(e){let t=await fetch(e.url);if(!t.ok)throw Error(`Failed to load image source: ${t.status}`);let r=await t.blob(),n=e.mimeType||r.type||"image/png";return new File([r],e.fileName||"generated-image.png",{type:n})}function oZ({image:e,alt:t,compact:r}){let[n,i]=(0,ek.useState)(!1);return e?.url?(0,ew.jsxs)("div",{className:"relative flex size-full items-center justify-center overflow-hidden",children:[!n&&(0,ew.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-muted",children:(0,ew.jsx)(a6,{className:"size-5 animate-spin text-muted-foreground"})}),(0,ew.jsx)("img",{src:e.url,alt:t,className:(0,r4.cn)("block object-contain",r?"size-full object-cover":"max-h-full max-w-full",!n&&"invisible"),onLoad:()=>i(!0)})]}):(0,ew.jsx)("div",{className:(0,r4.cn)("flex size-full items-center justify-center text-muted-foreground",!r&&"min-h-24"),children:(0,ew.jsx)(i5,{className:r?"size-5":"size-8"})})}function oF({result:e,prompt:t,image:r,altText:n,status:i,statusDetail:a,isRunning:o}){let s=tU(),l=i.Icon,u=r?.revisedPrompt||e?.revisedPrompt,[d,c]=(0,ek.useState)("idle"),p="adding"===d||"added"===d,m=async()=>{if(r&&!p){c("adding");try{let e=await oL(r);try{await s.thread().composer().addAttachment(e)}catch(i){if(!(i instanceof Error&&"Attachments are not supported"===i.message))throw i;let t=await new Promise((t,r)=>{let n=new FileReader;n.onload=()=>t(n.result),n.onerror=()=>r(n.error),n.readAsDataURL(e)}),n={name:e.name,type:"image",contentType:e.type||r.mimeType,content:[{type:"image",image:t,filename:e.name}]};await s.thread().composer().addAttachment(n)}c("added"),window.setTimeout(()=>{c(e=>"added"===e?"idle":e)},1600)}catch{c("error"),window.setTimeout(()=>{c(e=>"error"===e?"idle":e)},2400)}}};return(0,ew.jsxs)(oe,{"data-image-generation-detail":!0,className:"grid h-[min(88vh,900px)] max-h-[88vh] grid-rows-[auto_minmax(0,1fr)] gap-0 overflow-hidden p-0 sm:max-w-5xl",showCloseButton:!1,children:[(0,ew.jsx)(ot,{className:"border-b px-5 py-4",children:(0,ew.jsxs)("div",{className:"flex min-h-9 items-center justify-between gap-4",children:[(0,ew.jsx)(on,{className:"min-w-0 truncate",children:"图片生成详情"}),(0,ew.jsxs)("div",{className:"flex shrink-0 items-center gap-3",children:[(0,ew.jsxs)("span",{className:(0,r4.cn)("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border px-2 font-medium text-xs",i.chip),children:[(0,ew.jsx)(l,{className:(0,r4.cn)("size-3.5",o&&"animate-spin")}),i.label]}),(0,ew.jsx)(a8,{asChild:!0,children:(0,ew.jsxs)(r5,{type:"button",variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground",children:[(0,ew.jsx)(r8,{className:"size-4"}),(0,ew.jsx)("span",{className:"sr-only",children:"关闭"})]})})]})]})}),(0,ew.jsxs)("div",{className:"min-h-0 overflow-y-auto lg:grid lg:grid-cols-[minmax(0,1.15fr)_minmax(320px,0.85fr)] lg:overflow-hidden",children:[(0,ew.jsxs)("div",{className:"min-w-0 border-b bg-muted/20 p-4 lg:border-r lg:border-b-0",children:[(0,ew.jsx)("div",{className:"flex h-[min(62vh,720px)] min-h-72 items-center justify-center overflow-hidden rounded-lg border bg-background",children:(0,ew.jsx)(oZ,{image:r,alt:n})}),r&&(0,ew.jsxs)("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2 rounded-md border bg-background px-3 py-2",children:[(0,ew.jsx)("p",{className:"min-w-0 flex-1 truncate text-muted-foreground text-xs",children:r.fileName}),(0,ew.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ew.jsxs)(r5,{type:"button",variant:"default",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:p,onClick:m,children:["added"===d?(0,ew.jsx)(a4,{className:"size-3.5"}):"adding"===d?(0,ew.jsx)(a6,{className:"size-3.5 animate-spin"}):(0,ew.jsx)(ol,{className:"size-3.5"}),"added"===d?"已添加":"error"===d?"添加失败":"添加到对话"]}),(0,ew.jsx)(r5,{asChild:!0,variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",children:(0,ew.jsxs)("a",{href:r.url,download:r.fileName,children:[(0,ew.jsx)(os,{className:"size-3.5"}),"下载"]})})]})]})]}),(0,ew.jsxs)("div",{className:"min-w-0 space-y-4 px-5 pt-5 pb-[calc(2rem+env(safe-area-inset-bottom))] lg:min-h-0 lg:overflow-y-auto lg:p-5",children:[(0,ew.jsx)(oB,{prompt:t,revisedPrompt:u}),(0,ew.jsx)(oq,{requested:e?.requestedParams,actual:r?.actualParams||e?.actualParams}),(0,ew.jsx)(oW,{detail:a}),e?.rawResponseSummary!==void 0&&(0,ew.jsx)(oJ,{value:e.rawResponseSummary})]})]})]})}function oB({prompt:e,revisedPrompt:t}){let r=!!t?.trim()&&t?.trim()!==e.trim();return(0,ew.jsxs)("section",{className:"space-y-3",children:[(0,ew.jsx)(oV,{label:"提示词",value:e,primary:!0}),r&&(0,ew.jsx)(oV,{label:"API 改写提示词",value:t})]})}function oV({label:e,value:t,primary:r}){let[n,i]=(0,ek.useState)(!1);return t?(0,ew.jsxs)("div",{className:"space-y-1.5",children:[(0,ew.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ew.jsx)("h3",{className:(0,r4.cn)("font-medium text-sm",r&&"text-base"),children:e}),(0,ew.jsx)(r9,{tooltip:n?"已复制":"复制",size:"icon-xs",className:"size-6",onClick:()=>{oU(t),i(!0),window.setTimeout(()=>i(!1),1200)},children:n?(0,ew.jsx)(a4,{}):(0,ew.jsx)(oo,{})})]}),(0,ew.jsx)("pre",{className:(0,r4.cn)("max-h-56 overflow-auto whitespace-pre-wrap break-words rounded-md border bg-muted/30 px-3 py-2 font-sans text-xs leading-relaxed",r&&"text-sm"),children:t})]}):null}function oq({requested:e,actual:t}){let r=["model","size","quality","outputFormat","background"].map(r=>{let n=e?.[r],i=t?.[r];return{key:r,label:oD[r],value:i??n,requested:n,actual:i,changed:void 0!==n&&void 0!==i&&n!==i}}).filter(e=>void 0!==e.value);return 0===r.length?null:(0,ew.jsxs)("section",{className:"space-y-2",children:[(0,ew.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ew.jsx)(ou,{className:"size-4 text-muted-foreground"}),(0,ew.jsx)("h3",{className:"font-medium text-sm",children:"参数"})]}),(0,ew.jsx)("div",{className:"flex flex-wrap gap-2",children:r.map(e=>(0,ew.jsxs)("div",{className:"min-w-0 rounded-md border bg-background px-2.5 py-2 text-xs",children:[(0,ew.jsx)("p",{className:"text-muted-foreground",children:e.label}),(0,ew.jsx)("p",{className:(0,r4.cn)("mt-1 max-w-52 truncate font-medium",e.changed&&"text-amber-700 dark:text-amber-400"),children:e.changed?`${String(e.requested)} -> ${String(e.actual)}`:String(e.value)})]},e.key))})]})}function oW({detail:e}){return(0,ew.jsxs)("section",{className:"space-y-1.5",children:[(0,ew.jsx)("h3",{className:"font-medium text-sm",children:"任务状态"}),(0,ew.jsx)("p",{className:"rounded-md border bg-muted/30 px-3 py-2 text-muted-foreground text-sm",children:e})]})}function oJ({value:e}){let t=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}(e);return(0,ew.jsxs)(oj,{className:"rounded-md border",children:[(0,ew.jsx)(oE,{asChild:!0,children:(0,ew.jsxs)(r5,{type:"button",variant:"ghost",className:"h-9 w-full justify-between rounded-md px-3",children:[(0,ew.jsx)("span",{children:"原始响应摘要"}),(0,ew.jsx)(oa,{className:"size-4"})]})}),(0,ew.jsxs)(oT,{children:[(0,ew.jsx)(oz,{}),(0,ew.jsx)("div",{className:"flex items-center justify-end px-2 py-1",children:(0,ew.jsx)(r9,{tooltip:"复制",size:"icon-xs",className:"size-6",onClick:()=>oU(t),children:(0,ew.jsx)(oo,{})})}),(0,ew.jsx)("pre",{className:"max-h-56 overflow-auto whitespace-pre-wrap break-words px-3 pb-3 font-mono text-[11px] text-muted-foreground",children:t})]})]})}function oH({result:e,prompt:t,visualStatus:r,statusDetail:n,compact:i}){var a;let o=e?.images[0],s=function(e){switch(e){case"running":return{label:"生成中",tone:"text-muted-foreground",chip:"border-border bg-muted/60 text-muted-foreground",Icon:a6};case"failed":return{label:"失败",tone:"text-destructive",chip:"border-destructive/30 bg-destructive/10 text-destructive",Icon:a2};case"incomplete":return{label:"未完成",tone:"text-muted-foreground",chip:"border-border bg-muted/60 text-muted-foreground",Icon:a2};default:return{label:"已完成",tone:"text-emerald-700 dark:text-emerald-400",chip:"border-emerald-500/25 bg-emerald-500/10 text-emerald-700 dark:text-emerald-400",Icon:a4}}}(r),l=s.Icon,u=e?.revisedPrompt||t||"Generated image",d="running"===r;return(0,ew.jsxs)(a5,{children:[(0,ew.jsx)(a3,{asChild:!0,children:(0,ew.jsxs)("button",{type:"button","data-image-generation-card":!0,"data-image-generation-card-trigger":!0,className:(0,r4.cn)("aui-tool-fallback-root group/image-generation-card my-2.5 w-full overflow-hidden rounded-lg border bg-background text-left text-sm transition-colors first:mt-0 last:mb-0 hover:bg-muted/30",i&&"my-0"),children:[(0,ew.jsxs)("div",{className:(0,r4.cn)("grid w-full grid-cols-[112px_minmax(0,1fr)] gap-4 p-4 max-sm:grid-cols-[88px_minmax(0,1fr)] max-sm:gap-3",i&&"grid-cols-[72px_minmax(0,1fr)] gap-3 p-3"),children:[(0,ew.jsx)("div",{className:(0,r4.cn)("relative aspect-square size-28 shrink-0 overflow-hidden rounded-md border bg-muted text-muted-foreground max-sm:size-22",i&&"size-18 max-sm:size-18"),children:(0,ew.jsx)(oZ,{image:o,alt:u,compact:!0})}),(0,ew.jsxs)("div",{className:(0,r4.cn)("flex min-h-28 min-w-0 flex-col max-sm:min-h-22",i&&"min-h-18 max-sm:min-h-18"),children:[(0,ew.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ew.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,ew.jsx)(l,{className:(0,r4.cn)("size-4 shrink-0",s.tone,d&&"animate-spin")}),(0,ew.jsx)("span",{className:"truncate font-medium",children:"图片生成"})]}),(0,ew.jsx)("span",{className:(0,r4.cn)("shrink-0 rounded-md border px-1.5 py-0.5 font-medium text-[11px]",s.chip),children:s.label})]}),(0,ew.jsx)("p",{className:(0,r4.cn)("mt-2 line-clamp-2 text-muted-foreground leading-6 max-sm:text-xs",i&&"mt-1 leading-5"),children:t||"等待图片生成参数"}),(0,ew.jsxs)("div",{className:(0,r4.cn)("mt-auto flex min-w-0 flex-wrap gap-1.5 pt-3 text-muted-foreground text-xs",i&&"pt-2"),children:[(0,ew.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5",children:"查看详情"}),!i&&e?.actualParams.model&&(0,ew.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5",children:e.actualParams.model}),e?.actualParams.size&&(0,ew.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5",children:e.actualParams.size}),o?.sizeBytes&&(0,ew.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5",children:(a=o.sizeBytes)?a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:`${(a/1048576).toFixed(1)} MB`:""})]})]})]}),"failed"===r&&(0,ew.jsx)("p",{className:"mx-4 mb-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-destructive text-xs",children:n})]})}),(0,ew.jsx)(oF,{result:e,prompt:t,image:o,altText:u,status:s,statusDetail:n,isRunning:d})]})}function oK(e){let t,r=e.toolName===ac?e.args:(t=av(e.args),t?.args),n=(0,ek.useMemo)(()=>ab(e.result),[e.result]),i=n?.prompt||function e(t){return am(t)?"string"==typeof t.prompt?t.prompt:am(t.arguments)&&"string"==typeof t.arguments.prompt?t.arguments.prompt:am(t.args)?e(t.args):"":""}(r),a=e.status?.type==="running"||e.status?.type==="requires-action"?"running":e.isError||n?.status==="failed"?"failed":e.status?.type==="incomplete"?"incomplete":"completed";return(0,ew.jsx)(oH,{result:n,prompt:i,visualStatus:a,statusDetail:n?.error?n.error:e.status?.type==="incomplete"?`工具调用未完成:${e.status.reason}`:e.isError?"工具调用返回错误。":e.status?.type==="running"||e.status?.type==="requires-action"?"正在等待图片服务返回结果。":"图片已生成并保存到本地工具存储。"})}function oG({record:e,compact:t}){let r={status:e.status,recordId:e.id,requestId:e.requestId||e.id,provider:e.provider,prompt:e.prompt,...e.revisedPrompt?{revisedPrompt:e.revisedPrompt}:{},requestedParams:e.requestedParams,actualParams:e.actualParams,images:e.images,durationMs:e.durationMs,...e.error?{error:e.error}:{}};return(0,ew.jsx)(oH,{result:r,prompt:e.prompt,visualStatus:e.status,statusDetail:e.error||("failed"===e.status?"图片生成失败。":"图片已生成并保存到本地工具存储。"),compact:t})}let oY=({compact:e,records:t,loading:r,error:n,showSection:i,loadRecords:a})=>i?(0,ew.jsxs)("section",{"data-slot":"thread-image-generation-records",className:"flex min-h-0 flex-col gap-2",children:[(0,ew.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ew.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,ew.jsx)(i5,{className:"size-4 shrink-0 text-muted-foreground"}),(0,ew.jsx)("h2",{className:"truncate font-medium text-muted-foreground text-sm",children:"图片记录"})]}),(0,ew.jsx)(r9,{tooltip:"刷新图片记录",size:"icon-xs",className:"size-7",onClick:()=>void a(),children:(0,ew.jsx)(i3,{className:(0,r4.cn)("size-3.5",r&&"animate-spin")})})]}),(0,ew.jsx)("div",{className:(0,r4.cn)("min-h-0 overflow-y-auto pr-1",e?"max-h-72":"max-h-[min(42vh,24rem)]"),children:t.length>0?(0,ew.jsx)("div",{className:"flex flex-col gap-2",children:t.map(e=>(0,ew.jsx)(oG,{record:e,compact:!0},e.id))}):(0,ew.jsx)("div",{className:"rounded-md border border-dashed px-3 py-4 text-muted-foreground text-sm",children:r?"正在加载图片记录":"暂无图片记录"})}),n?(0,ew.jsx)("p",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-destructive text-xs",children:n}):null]}):null,oX=rB("file-code",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]),oQ=rB("package-open",[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]);function o0(e){return!!(e&&"object"==typeof e&&!Array.isArray(e))}function o1(e){return"string"==typeof e?e.trim():""}function o2(){let e=rS(e=>e.thread.messages);return(0,ek.useMemo)(()=>(function(e){let t=new Map;for(let r of e){let e=function(e){if(!o0(e))return;let t=o0(e.metadata)?e.metadata:void 0;return t&&o0(t.custom)?t.custom:void 0}(r),n=e?.acpToolContent;if(!o0(n))continue;let i=n.byToolCallId;if(o0(i)){for(let[e,r]of Object.entries(i))if(o0(r))for(let n of function(e,t){var r;return(Array.isArray(r=e.diffs)?r.filter(e=>o0(e)):!o0(r)?[]:Object.values(r).filter(e=>o0(e))).flatMap(e=>{let r=function(e,t){let r,n=o1(e.type);if(n&&"diff"!==n)return;let i=o1(e.toolCallId)||t;if(!i)return;let a=o1(e.path),o=null===e.oldText||void 0===e.oldText?"新增":"修改",s=a||"未命名文件";return{id:`diff:${i}:${a||s}`,kind:"diff",title:s,detail:o,status:o,path:a||void 0,oldText:"string"==typeof e.oldText||null===e.oldText?e.oldText:void 0,newText:"string"==typeof e.newText?e.newText:void 0,toolCallId:i,updatedAt:Number.isFinite(r=Number(e.updatedAt))?r:0}}(e,t);return r?[r]:[]})}(r,e)){let e=function(e){let t=e.path||e.title;return`${e.kind}:${e.toolCallId}:${t||e.title}`}(n),r=t.get(e);(!r||n.updatedAt>=r.updatedAt)&&t.set(e,n)}}}return[...t.values()].sort((e,t)=>e.updatedAt-t.updatedAt)})([...e]),[e])}function o4({artifact:e}){let t=e.status??"文件";return(0,ew.jsxs)("li",{className:"flex min-w-0 items-start gap-2 rounded-md border border-border/70 bg-muted/15 px-2.5 py-2",children:[(0,ew.jsx)(oX,{className:"mt-0.5 size-3.5 shrink-0 text-muted-foreground"}),(0,ew.jsx)("div",{className:"min-w-0 flex-1",children:(0,ew.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,ew.jsx)("p",{className:"truncate font-medium text-sm leading-5",children:e.title}),(0,ew.jsx)("span",{className:"shrink-0 rounded-sm border bg-background px-1.5 py-0.5 text-[10px] text-muted-foreground leading-none",children:t})]})})]})}let o6=({artifacts:e,compact:t})=>0===e.length?null:(0,ew.jsxs)("section",{"data-slot":"thread-output-artifacts",className:"flex min-h-0 flex-col gap-2",children:[(0,ew.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,ew.jsx)(oQ,{className:"size-4 shrink-0 text-muted-foreground"}),(0,ew.jsx)("h2",{className:"truncate font-medium text-muted-foreground text-sm",children:"产物"})]}),(0,ew.jsx)("ol",{className:(0,r4.cn)("flex min-h-0 flex-col gap-2 overflow-y-auto pr-1",t?"max-h-56":"max-h-[min(28vh,16rem)]"),children:e.map(e=>(0,ew.jsx)(o4,{artifact:e},e.id))})]}),o5={pending:i1,in_progress:i6,completed:i0},o3={pending:"待处理",in_progress:"进行中",completed:"已完成"},o9=[{id:"plan",label:"任务",Icon:i2,Panel:({location:e})=>{let t=iQ(),r=o2(),n=function(){let{workspacePath:e}=aq(),t=rS(e=>e.thread.isRunning),r=rS(e=>e.thread.messages),n=rS(e=>e.threadListItem.remoteId??e.threads.mainThreadId),i=(0,ek.useMemo)(()=>(function(e){let t=new Set,r=0;for(let n of e)if(am(n)&&Array.isArray(n.content))for(let e of n.content){if(!function(e){var t;if(!am(e)||"tool-call"!==e.type)return!1;if(e.toolName===ac)return!0;let r=av(e.args);return e.toolName===ap&&(r?.toolName===ad||r?.toolName===ac||am(t=r?.args)&&t.server===au&&t.tool===ad)}(e))continue;let n=ab(e.result);n?.recordId?t.add(n.recordId):r+=1}return 0===t.size&&0===r?"":JSON.stringify({completed:[...t].sort(),running:r})})([...r]),[r]),[a,o]=(0,ek.useState)([]),[s,l]=(0,ek.useState)("idle"),[u,d]=(0,ek.useState)(null),c=(0,ek.useRef)(0),p=(0,ek.useCallback)(async()=>{let t=c.current+1;if(c.current=t,!n)return void o([]);l(e=>"idle"===e?"loading":e);try{let r=await a1.listImageGenerationRecords(e,n,20);if(t!==c.current)return;o(r.records),d(null),l("idle")}catch(e){if(t!==c.current)return;d(e instanceof Error?e.message:String(e)),l("error")}},[n,e]);(0,ek.useEffect)(()=>{p()},[p]),(0,ek.useEffect)(()=>{i&&p()},[p,i]),(0,ek.useEffect)(()=>{let e=window.setInterval(()=>{p()},t?1500:12e3);return()=>window.clearInterval(e)},[t,p]);let m=a.length>0;return{records:a,loading:"loading"===s,error:"error"===s?u:null,showSection:m,loadRecords:p}}(),i="mobile"===e,a=t.length>0,o=r.length>0,s=!a&&!o&&!n.showSection;return(0,ew.jsxs)("div",{"data-slot":"thread-plan-addon",className:(0,r4.cn)("flex h-full min-h-0 flex-col gap-5",i&&"px-1"),children:[a?(0,ew.jsxs)("section",{className:"flex min-h-0 flex-col gap-3",children:[(0,ew.jsx)("h2",{className:"font-medium text-muted-foreground text-sm",children:"任务进度"}),(0,ew.jsx)("ol",{className:"flex max-h-[min(56vh,32rem)] flex-col gap-3 overflow-x-hidden overflow-y-auto pr-1",children:t.map(e=>{let t=o5[e.status],r="in_progress"===e.status;return(0,ew.jsxs)("li",{className:"flex min-w-0 items-start gap-3",children:[(0,ew.jsx)("span",{"aria-hidden":"true",className:(0,r4.cn)("mt-0.5 flex size-4 shrink-0 items-center justify-center overflow-hidden text-muted-foreground",r&&"text-foreground"),children:(0,ew.jsx)(t,{className:(0,r4.cn)("size-4 shrink-0","completed"===e.status&&"fill-muted-foreground text-background",r&&"animate-spin motion-reduce:animate-none")})}),(0,ew.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ew.jsx)("p",{className:"wrap-break-word font-medium text-sm leading-5",children:e.content}),(0,ew.jsx)("span",{className:"sr-only",children:o3[e.status]})]})]},`${e.status}-${e.priority}-${e.content}`)})})]}):null,(0,ew.jsx)(o6,{artifacts:r,compact:i}),(0,ew.jsx)(oY,{compact:i,...n}),s?(0,ew.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed px-4 py-8 text-center text-muted-foreground text-sm",children:[(0,ew.jsx)(i4,{className:"size-5"}),(0,ew.jsx)("p",{children:"暂无任务、产物和工具记录"})]}):null]})},order:10}],o8=(0,ek.createContext)(null);function o7(){let e=(0,ek.useContext)(o8);if(!e)throw Error("useThreadAddonContext must be used within ThreadAddonProvider.");return e}function se({children:e}){var t;let r=(0,ek.useMemo)(()=>[...o9].sort((e,t)=>e.order-t.order),[]),n=r[0]?.id??null,[i,a]=(0,ek.useState)(n),[o,s]=(0,ek.useState)(!1),l=function(){let[e,t]=(0,ek.useState)(!1);return(0,ek.useEffect)(()=>{let e=window.matchMedia("(min-width: 1280px)"),r=()=>t(e.matches);return r(),e.addEventListener("change",r),()=>e.removeEventListener("change",r)},[]),e}(),u=0===(t=iQ()).length?"":JSON.stringify(t),d=(0,ek.useRef)("");(0,ek.useEffect)(()=>{l&&u&&d.current!==u&&(d.current=u,a("plan"),s(!0))},[l,u]);let c=r.find(e=>e.id===i)??r[0]??null,p=(0,ek.useMemo)(()=>({addons:r,activeAddon:c,activeAddonId:c?.id??null,isDesktop:l,isOpen:o,closeAddon:()=>s(!1),toggleAddon:e=>{a(e),s(t=>!t||c?.id!==e)}}),[c,r,l,o]);return(0,ew.jsx)(o8.Provider,{value:p,children:e})}function st(){let{addons:e,activeAddonId:t,isOpen:r,toggleAddon:n}=o7();return 0===e.length?null:(0,ew.jsx)("div",{"data-slot":"thread-addon-toolbar",className:"ml-auto flex items-center gap-1",children:e.map(e=>{let i=e.Icon,a=r&&t===e.id;return(0,ew.jsx)(r9,{tooltip:e.label,"aria-pressed":a,className:(0,r4.cn)("size-8 rounded-lg bg-background/80 text-muted-foreground backdrop-blur-sm [&_svg]:size-4",a&&"bg-muted text-foreground"),onClick:()=>n(e.id),children:(0,ew.jsx)(i,{className:"size-4"})},e.id)})})}function sr({children:e}){let{activeAddon:t,closeAddon:r,isDesktop:n,isOpen:i}=o7(),a=t?.Panel,o=!!(a&&i&&!n);return(0,ew.jsxs)("div",{"data-slot":"thread-addon-host",className:"flex h-full min-h-0 w-full",children:[(0,ew.jsx)("div",{className:"min-w-0 flex-1 overflow-hidden",children:e}),a&&n&&i?(0,ew.jsx)("aside",{"data-slot":"thread-addon-desktop-panel",className:"hidden w-[22rem] shrink-0 bg-background px-3 pt-20 pb-4 xl:block",children:(0,ew.jsx)(a,{location:"desktop"})}):null,(0,ew.jsx)(iF,{open:o,onOpenChange:e=>!e&&r(),children:(0,ew.jsxs)(iq,{className:"w-[88vw] gap-0 p-0 sm:max-w-md",children:[(0,ew.jsxs)(iW,{className:"sr-only",children:[(0,ew.jsx)(iJ,{children:t?.label??"扩展面板"}),(0,ew.jsx)(iH,{children:"显示当前对话的扩展面板。"})]}),(0,ew.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 pt-20",children:a?(0,ew.jsx)(a,{location:"mobile"}):null})]})})]})}let sn=({children:e,condition:t})=>rS(t)?e:null;sn.displayName="AuiIf",e.s([],20891),e.i(20891);let si=(0,ek.forwardRef)((e,t)=>(0,ew.jsx)(rk.div,{...e,ref:t}));si.displayName="ThreadPrimitive.Root";let sa=({children:e})=>rS(e=>e.thread.isEmpty)?e:null;sa.displayName="ThreadPrimitive.Empty";let so=({children:e,...t})=>rS(e=>(!0!==t.empty||!!e.thread.isEmpty)&&(!1!==t.empty||!e.thread.isEmpty)&&(!0!==t.running||!!e.thread.isRunning)&&(!1!==t.running||!e.thread.isRunning)&&(!0!==t.disabled||!!e.thread.isDisabled)&&(!1!==t.disabled||!e.thread.isDisabled)&&!0)?e:null;so.displayName="ThreadPrimitive.If";let ss=ek.default.createContext(!0);function sl(){throw Error("A function wrapped in useEffectEvent can't be called during rendering.")}let su="use"in ek.default?()=>{try{return ek.default.use(ss)}catch{return!1}}:()=>!1,sd=(e,t)=>{let r,n=tU(),i=(r=ek.default.useRef(sl),ek.default.useInsertionEffect(()=>{r.current=t},[t]),(...e)=>(su()&&sl(),(0,r.current)(...e))),{scope:a,event:o}=t$(e);(0,ek.useEffect)(()=>n.on({scope:a,event:o},i),[n,a,o,i])},sc=e=>{let t=(0,ek.useRef)(void 0);return(0,ek.useCallback)(r=>{t.current&&(t.current(),t.current=void 0),r&&(t.current=e(r))},[e])},sp=e=>{let t=(0,na.useCallbackRef)(e),r=ru(e=>e.onScrollToBottom);(0,ek.useEffect)(()=>r(t),[r,t])},sm=(e,t)=>sc((0,ek.useCallback)(r=>{if(!e)return;let n=e(),i=()=>{let e=t?t(r):r.offsetHeight;n.setHeight(e)},a=new ResizeObserver(i);return a.observe(r),i(),()=>{a.disconnect(),n.unregister()}},[e,t])),sf=e=>{let t=0,r=e;for(;r;)t+=r.offsetTop,r=r.offsetParent;return t},sh=({viewport:e,anchor:t,tallerThan:r,visibleHeight:n})=>{let i=((e,t)=>{let r=0,n=e;for(;n&&n!==t;)r+=n.offsetTop,n=n.offsetParent;return n===t?r:sf(e)-sf(t)})(t,e),a=t.offsetHeight;return i+Math.max(0,a-(a<=r?a:n))},sg=(e,t)=>{let r=e.trim().match(/^(\d+(?:\.\d+)?|\.\d+)(em|px|rem)$/);if(!r)return 1/0;let n=Number(r[1]),i=r[2];return"px"===i?n:"em"===i?n*(parseFloat(getComputedStyle(t).fontSize)||16):"rem"===i?n*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16):1/0},sv=(e,t)=>{let r=`${t}px`;return e.style.height!==r&&(e.style.height=r,!0)},sy=({isRunning:e,messages:t})=>{if(!e)return null;let r=t.at(-1),n=t.at(-2);return n?.role!=="user"||r?.role!=="assistant"?null:{anchorId:n.id,targetId:r.id}},sb=(0,ek.forwardRef)(({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:r,scrollToBottomOnThreadSwitch:n,children:i,...a},o)=>{let s,l,u,d,c,p,m=(({autoScroll:e,scrollToBottomOnRunStart:t=!0,scrollToBottomOnInitialize:r=!0,scrollToBottomOnThreadSwitch:n=!0})=>{var i;let a,o=(0,ek.useRef)(null),s=rS(e=>e.thread.messages.length>0),l=(0,ek.useRef)(!1),u=(0,ek.useRef)(null),d=rd();void 0===e&&(e="top"!==d.getState().turnAnchor);let c=(0,ek.useRef)(0),p=(0,ek.useRef)(null),m=(0,ek.useCallback)(e=>{let t=o.current;t&&(p.current=e,t.scrollTo({top:t.scrollHeight,behavior:e}))},[]),f=(0,ek.useCallback)(e=>{p.current=e,null!==u.current&&cancelAnimationFrame(u.current),u.current=requestAnimationFrame(()=>{u.current=null,m(e)})},[m]);(0,ek.useLayoutEffect)(()=>()=>{null!==u.current&&cancelAnimationFrame(u.current)},[]);let h=(0,ek.useCallback)(()=>{let e=d.getState();return"top"===e.turnAnchor&&e.element.viewport===o.current&&null!==e.element.anchor},[d]),g=()=>{let e=o.current;if(!e)return;let t=d.getState().isAtBottom,r=1>Math.abs(e.scrollHeight-e.scrollTop-e.clientHeight)||e.scrollHeight<=e.clientHeight;!r&&c.current<e.scrollTop||(r&&e.scrollHeight>e.clientHeight+1&&(p.current=null),(r||null===p.current)&&r!==t&&d.setState({isAtBottom:r})),c.current=e.scrollTop},v=(i=()=>{let t=p.current;t&&h()?p.current=null:t?m(t):e&&d.getState().isAtBottom&&m("instant"),g()},a=(0,na.useCallbackRef)(i),sc((0,ek.useCallback)(e=>{let t=new ResizeObserver(()=>{a()}),r=new MutationObserver(e=>{e.some(e=>"attributes"!==e.type||"style"!==e.attributeName)&&a()});return t.observe(e),r.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>{t.disconnect(),r.disconnect()}},[a]))),y=sc(e=>(e.addEventListener("scroll",g),()=>{e.removeEventListener("scroll",g)}));return(0,ek.useLayoutEffect)(()=>{if(r){if(!s){l.current=!1;return}l.current||(l.current=!0,null===p.current&&f("instant"))}},[s,f,r]),sp(({behavior:e})=>{m(e)}),sd("thread.runStart",()=>{t&&"top"!==d.getState().turnAnchor&&f("auto")}),sd("threadListItem.switchedTo",()=>{n&&f("instant")}),(0,rh.useComposedRefs)(v,y,o)})({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:r,scrollToBottomOnThreadSwitch:n}),f=sm(ru(e=>e.registerViewport),(0,ek.useCallback)(e=>e.clientHeight,[])),h=sc(ru(e=>e.registerViewportElement)),g="top"===rd().getState().turnAnchor;s=rd(),l=rS(e=>{if(g){let t;return t=e.thread,sy(t)?.anchorId}}),u=rS(e=>{if(g){let t;return t=e.thread,sy(t)?.targetId}}),d=(0,ek.useMemo)(()=>l&&u?{anchorId:l,targetId:u}:null,[l,u]),(0,ek.useLayoutEffect)(()=>{if(!d)return;let e=s.getState(),t=e.topAnchorTurn;(t?.anchorId!==d.anchorId||t.targetId!==d.targetId)&&e.setTopAnchorTurn(d)},[d,s]),sd("thread.initialize",c=(0,ek.useCallback)(()=>{s.getState().setTopAnchorTurn(null)},[s])),sd("threadListItem.switchedTo",c),p=rd(),(0,ek.useLayoutEffect)(()=>{if(g){var e,t;let r,n,i,a,o,s,l,u,d,c,m,f;return n=null,e=function(){var e;let t,i,o=p.getState(),{viewport:s,anchor:l,target:u}=o.element,d=o.targetConfig;if("top"!==o.turnAnchor||!s||!l||!u||!d){m.disconnect(),n&&(sv(n,0),n.remove());return}if(((n??=((t=document.createElement("div")).dataset.auiTopAnchorReserve="",t.style.height="0px",t.style.flexShrink="0",t.style.pointerEvents="none",t.setAttribute("aria-hidden","true"),t)).parentElement!==u.parentElement||n.previousElementSibling!==u)&&u.after(n),m.target(s,l,u),sv(n,(({viewport:e,reserve:t,...r})=>(({scrollHeight:e,...t})=>{let{viewport:r}=t;return Math.max(0,sh(t)+r.clientHeight-e)})({viewport:e,...r,scrollHeight:e.scrollHeight-t.offsetHeight}))({viewport:s,anchor:l,reserve:n,...d})))return void a.schedule();let c=l.dataset.messageId;if(void 0!==c&&r===c)return;let f=(e=sh({viewport:s,anchor:l,...d}),Math.round(e*(i=window.devicePixelRatio||1))/i);Math.abs(s.scrollTop-f)>1&&s.scrollTo({top:f,behavior:"smooth"}),void 0!==c&&(r=c)},i=null,o=new ResizeObserver(t=(a={schedule:()=>{null===i&&(i=requestAnimationFrame(()=>{i=null,e()}))},cancel:()=>{null!==i&&(cancelAnimationFrame(i),i=null)}}).schedule),s=new MutationObserver(t),l=null,u=null,d=null,m={target:(e,t,r)=>{(l!==e||u!==t||d!==r)&&(c(),o.observe(e),o.observe(t),o.observe(r),s.observe(r,{childList:!0,subtree:!0,characterData:!0}),l=e,u=t,d=r)},disconnect:c=()=>{o.disconnect(),s.disconnect(),l=null,u=null,d=null}},a.schedule(),f=p.subscribe(a.schedule),()=>{a.cancel(),f(),m.disconnect(),n?.remove()}}},[g,p]);let v=(0,rh.useComposedRefs)(o,m,f,h);return(0,ew.jsx)(rk.div,{...a,ref:v,children:i})});sb.displayName="ThreadPrimitive.ViewportScrollable";let sx=(0,ek.forwardRef)(({turnAnchor:e,topAnchorMessageClamp:t,...r},n)=>(0,ew.jsx)(rc,{options:{turnAnchor:e,topAnchorMessageClamp:t},children:(0,ew.jsx)(sb,{...r,ref:n})}));sx.displayName="ThreadPrimitive.Viewport";let sw=(0,ek.forwardRef)((e,t)=>{let r=sm(ru(e=>e.registerContentInset),(0,ek.useCallback)(e=>{let t=parseFloat(getComputedStyle(e).marginTop)||0;return e.offsetHeight+t},[])),n=(0,rh.useComposedRefs)(t,r);return(0,ew.jsx)(rk.div,{...e,ref:n})});sw.displayName="ThreadPrimitive.ViewportFooter";let s_=({index:e,children:t})=>{let r=tU({message:t_({source:"thread",query:{type:"index",index:e},get:t=>t.thread().message({index:e})}),composer:t_({source:"message",query:{},get:t=>t.thread().message({index:e}).composer()})});return(0,ew.jsx)(tw,{value:r,children:t})},sk=(e,t)=>e.Message===t.Message&&e.EditComposer===t.EditComposer&&e.UserEditComposer===t.UserEditComposer&&e.AssistantEditComposer===t.AssistantEditComposer&&e.SystemEditComposer===t.SystemEditComposer&&e.UserMessage===t.UserMessage&&e.AssistantMessage===t.AssistantMessage&&e.SystemMessage===t.SystemMessage,sI=()=>null,sS=({components:e})=>{let t=((e,t,r)=>{switch(t){case"user":if(r)return e.UserEditComposer??e.EditComposer??e.UserMessage??e.Message;return e.UserMessage??e.Message;case"assistant":if(r)return e.AssistantEditComposer??e.EditComposer??e.AssistantMessage??e.Message;return e.AssistantMessage??e.Message;case"system":if(r)return e.SystemEditComposer??e.EditComposer??e.SystemMessage??e.Message;return e.SystemMessage??e.Message??sI;default:throw Error(`Unknown message role: ${t}`)}})(e,rS(e=>e.message.role),rS(e=>e.message.composer.isEditing));return(0,ew.jsx)(t,{})},s$=(0,ek.memo)(({index:e,components:t})=>(0,ew.jsx)(s_,{index:e,children:(0,ew.jsx)(sS,{components:t})}),(e,t)=>e.index===t.index&&sk(e.components,t.components));s$.displayName="ThreadPrimitive.MessageByIndex";let sj=({children:e})=>{let t=rS(e=>e.thread.messages.length);return(0,ek.useMemo)(()=>0===t?null:Array.from({length:t},(t,r)=>(0,ew.jsx)(s_,{index:r,children:(0,ew.jsx)(rE,{getItemState:e=>e.thread().message({index:r}).getState(),children:t=>e({get message(){return t()}})})},r)),[t,e])},sE=({components:e,children:t})=>e?(0,ew.jsx)(sj,{children:()=>(0,ew.jsx)(sS,{components:e})}):(0,ew.jsx)(sj,{children:t});sE.displayName="ThreadPrimitive.Messages";let sT=(0,ek.memo)(sE,(e,t)=>e.children||t.children?e.children===t.children:sk(e.components,t.components)),sC=rP("ThreadPrimitive.ScrollToBottom",({behavior:e}={})=>{let t=ru(e=>e.isAtBottom),r=rd(),n=(0,ek.useCallback)(()=>{r.getState().scrollToBottom({behavior:e})},[r,e]);return t?null:n},["behavior"]),sN=rP("ThreadPrimitive.Suggestion",({prompt:e,send:t,clearComposer:r,autoSend:n,method:i})=>{let{disabled:a,trigger:o}=(({prompt:e,send:t,clearComposer:r=!0})=>{let n=tU(),i=rS(e=>e.thread.isDisabled),a=t??!1;return{trigger:(0,ek.useCallback)(()=>{let t=n.thread().getState().isRunning;if(a&&!t)n.thread().append({content:[{type:"text",text:e}],runConfig:n.composer().getState().runConfig}),r&&n.composer().setText("");else if(r)n.composer().setText(e);else{let t=n.composer().getState().text;n.composer().setText(t.trim()?`${t} ${e}`:e)}},[n,a,r,e]),disabled:i}})({prompt:e,send:t??n??!1,clearComposer:r});return a?null:o},["prompt","send","clearComposer","autoSend","method"]),sA=({index:e,children:t})=>{let r=tU({suggestion:t_({source:"suggestions",query:{index:e},get:t=>t.suggestions().suggestion({index:e})})});return(0,ew.jsx)(tw,{value:r,children:t})},sR=({components:e})=>{let t=e.Suggestion;return(0,ew.jsx)(t,{})},sP=(0,ek.memo)(({index:e,components:t})=>(0,ew.jsx)(sA,{index:e,children:(0,ew.jsx)(sR,{components:t})}),(e,t)=>e.index===t.index&&e.components.Suggestion===t.components.Suggestion);sP.displayName="ThreadPrimitive.SuggestionByIndex";let sO=({children:e})=>{let t=rS(e=>e.suggestions.suggestions.length);return(0,ek.useMemo)(()=>0===t?null:Array.from({length:t},(t,r)=>(0,ew.jsx)(sA,{index:r,children:(0,ew.jsx)(rE,{getItemState:e=>e.suggestions().suggestion({index:r}).getState(),children:t=>e({get suggestion(){return t()}})})},r)),[t,e])},sM=({components:e,children:t})=>e?(0,ew.jsx)(sO,{children:()=>(0,ew.jsx)(sR,{components:e})}):(0,ew.jsx)(sO,{children:t});sM.displayName="ThreadPrimitive.Suggestions";let sz=(0,ek.memo)(sM,(e,t)=>e.children||t.children?e.children===t.children:e.components.Suggestion===t.components.Suggestion);e.s(["Empty",0,sa,"If",0,so,"MessageByIndex",0,s$,"Messages",0,sT,"Root",0,si,"ScrollToBottom",0,sC,"Suggestion",0,sN,"SuggestionByIndex",0,sP,"Suggestions",0,sz,"Viewport",0,sx,"ViewportFooter",0,sw,"ViewportProvider",0,rc],59002);var sD=e.i(59002),sD=sD;e.s([],59182),e.i(59182);let sU=()=>{let e,t,{disabled:r,send:n}=(e=tU(),t=rS(e=>!e.composer.canSend||e.thread.isRunning&&!e.thread.capabilities.queue),{send:(0,ek.useCallback)(t=>{e.composer().send(t)},[e]),disabled:t}),i=(0,ek.useCallback)(()=>n(),[n]);return r?null:i},sL=rP("ComposerPrimitive.Send",sU),sZ=(0,ek.forwardRef)(({onSubmit:e,...t},r)=>{let n=sU();return(0,ew.jsx)(rk.form,{...t,ref:r,onSubmit:(0,rI.composeEventHandlers)(e,e=>{e.preventDefault(),n&&n()})})});sZ.displayName="ComposerPrimitive.Root";var rX=rX;function sF(){return(sF=Object.assign.bind()).apply(null,arguments)}var sB=ek.useLayoutEffect,sV=function(e){var t=ek.default.useRef(e);return sB(function(){t.current=e}),t},sq=function(e,t){"function"==typeof e?e(t):e.current=t},sW=function(e,t){var r=ek.default.useRef();return ek.default.useCallback(function(n){e.current=n,r.current&&sq(r.current,null),r.current=t,t&&sq(t,n)},[t])},sJ={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},sH=function(e){Object.keys(sJ).forEach(function(t){e.style.setProperty(t,sJ[t],"important")})},sK=null,sG=function(e,t){var r=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?r+t.borderSize:r-t.paddingSize},sY=function(){},sX=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],sQ=!!document.documentElement.currentStyle,s0=function(e){var t=window.getComputedStyle(e);if(null===t)return null;var r=sX.reduce(function(e,r){return e[r]=t[r],e},{}),n=r.boxSizing;if(""===n)return null;sQ&&"border-box"===n&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var i=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),a=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:i,borderSize:a}};function s1(e,t,r){var n=sV(r);ek.useLayoutEffect(function(){var r=function(e){return n.current(e)};if(e)return e.addEventListener(t,r),function(){return e.removeEventListener(t,r)}},[])}var s2=function(e,t){s1(document.body,"reset",function(r){e.current.form===r.target&&t(r)})},s4=function(e){s1(window,"resize",e)},s6=function(e){s1(document.fonts,"loadingdone",e)},s5=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],s3=ek.forwardRef(function(e,t){var r=e.cacheMeasurements,n=e.maxRows,i=e.minRows,a=e.onChange,o=void 0===a?sY:a,s=e.onHeightChange,l=void 0===s?sY:s,u=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,s5),d=void 0!==u.value,c=ek.useRef(null),p=sW(c,t),m=ek.useRef(0),f=ek.useRef(),h=function(){var e=c.current,t=r&&f.current?f.current:s0(e);if(t){f.current=t;var a,o,s,u,d,p,h,g,v,y,b,x=(a=e.value||e.placeholder||"x",void 0===(o=i)&&(o=1),void 0===(s=n)&&(s=1/0),sK||((sK=document.createElement("textarea")).setAttribute("tabindex","-1"),sK.setAttribute("aria-hidden","true"),sH(sK)),null===sK.parentNode&&document.body.appendChild(sK),u=t.paddingSize,d=t.borderSize,h=(p=t.sizingStyle).boxSizing,Object.keys(p).forEach(function(e){sK.style[e]=p[e]}),sH(sK),sK.value=a,g=sG(sK,t),sK.value=a,g=sG(sK,t),sK.value="x",y=(v=sK.scrollHeight-u)*o,"border-box"===h&&(y=y+u+d),g=Math.max(y,g),b=v*s,"border-box"===h&&(b=b+u+d),[g=Math.min(b,g),v]),w=x[0],_=x[1];m.current!==w&&(m.current=w,e.style.setProperty("height",w+"px","important"),l(w,{rowHeight:_}))}};return ek.useLayoutEffect(h),s2(c,function(){if(!d){var e=c.current.value;requestAnimationFrame(function(){var t=c.current;t&&e!==t.value&&h()})}}),s4(h),s6(h),ek.createElement("textarea",sF({},u,{onChange:function(e){d||h(),o(e)},ref:p}))}),s9=e.i(26083);let s8=(0,ek.createContext)(null),s7=()=>(0,ek.useContext)(s8),le=({children:e})=>{let t=(0,ek.useRef)(new Map),r=(0,ek.useRef)([]),n=(0,ek.useCallback)(()=>{let e=Array.from(t.current.entries());e.sort((e,t)=>t[1]-e[1]),r.current=e.map(([e])=>e)},[]),i=(0,ek.useCallback)((e,r)=>{let i=r?.priority??0;return t.current.set(e,i),n(),()=>{t.current.delete(e),n()}},[n]),a=(0,ek.useCallback)(()=>r.current,[]),o=(0,ek.useMemo)(()=>({register:i,getPlugins:a}),[i,a]);return(0,ew.jsx)(s8.Provider,{value:o,children:e})},lt=(0,ek.createContext)(null),lr=(0,ek.createContext)(null),ln=()=>{let e=(0,ek.useContext)(lt);if(!e)throw Error("useTriggerPopoverRootContext must be used within ComposerPrimitive.TriggerPopoverRoot");return e},li=()=>(0,ek.useContext)(lt),la=new Map,lo=()=>()=>{},ls=()=>la,ll=()=>null;function lu(){let e=(0,ek.useRef)(new Set);return{notify:(0,ek.useCallback)(()=>{for(let t of e.current)t()},[]),subscribe:(0,ek.useCallback)(t=>(e.current.add(t),()=>{e.current.delete(t)}),[])}}let ld=({children:e})=>{let t=(0,ek.useRef)(new Map),r=(0,ek.useRef)(new Set),{notify:n,subscribe:i}=lu(),a=(0,ek.useCallback)(e=>{let{char:i}=e;if(t.current.has(i))return()=>{};let a=new Map(t.current);for(let o of(a.set(i,e),t.current=a,n(),r.current))o.added(e);return()=>{let e=new Map(t.current);for(let a of(e.delete(i),t.current=e,n(),r.current))a.removed(i)}},[n]),o=(0,ek.useCallback)(()=>t.current,[]),s=(0,ek.useCallback)(e=>(r.current.add(e),()=>{r.current.delete(e)}),[]),l=(0,ek.useRef)(null),u=(0,ek.useRef)(null),{notify:d,subscribe:c}=lu(),p=(0,ek.useCallback)((e,t)=>{if(null===t){if(u.current!==e)return;l.current=null,u.current=null,d();return}let r=l.current;(u.current!==e||null===r||r.popoverId!==t.popoverId||r.highlightedItemId!==t.highlightedItemId)&&(l.current=t,u.current=e,d())},[d]),m=(0,ek.useCallback)(()=>l.current,[]),f=(0,ek.useMemo)(()=>({register:a,getTriggers:o,subscribe:i,subscribeLifecycle:s,getActiveAria:m,subscribeAria:c}),[a,o,i,s,m,c]),h=(0,ek.useMemo)(()=>({setActiveAria:p}),[p]);return(0,ew.jsx)(lt.Provider,{value:f,children:(0,ew.jsx)(lr.Provider,{value:h,children:e})})},lc=({children:e})=>s7()?(0,ew.jsx)(ld,{children:e}):(0,ew.jsx)(le,{children:(0,ew.jsx)(ld,{children:e})});lc.displayName="ComposerPrimitive.TriggerPopoverRoot";let lp=(0,ek.forwardRef)(({autoFocus:e=!1,asChild:t,render:r,disabled:n,onChange:i,onKeyDown:a,onPaste:o,onSelect:s,submitOnEnter:l,submitMode:u,cancelOnEscape:d=!0,unstable_focusOnRunStart:c=!0,unstable_focusOnScrollToBottom:p=!0,unstable_focusOnThreadSwitched:m=!0,addAttachmentOnPaste:f=!0,...h},g)=>{let v,y=tU(),b=s7(),x=(v=li(),(0,ek.useSyncExternalStore)(v?v.subscribeAria:lo,v?v.getActiveAria:ll,v?v.getActiveAria:ll)),w=u??(!1===l?"none":"enter"),_=rS(e=>e.composer.isEditing?e.composer.text:""),k=rS(e=>e.thread.isDisabled||e.composer.dictation?.inputDisabled)||n,I=(0,ek.useRef)(null),S=(0,rh.useComposedRefs)(g,I),$=(0,ek.useRef)(!1);(0,s9.useEscapeKeydown)(e=>{if(!I.current?.contains(e.target))return;if(b){for(let t of b.getPlugins())if(t.handleKeyDown(e))return}if(!d)return;let t=y.composer();t.getState().canCancel&&(t.cancel(),e.preventDefault())});let j=async e=>{if(!f)return;let t=y.thread().getState().capabilities,r=Array.from(e.clipboardData?.files||[]);if(t.attachments&&r.length>0)try{e.preventDefault(),await Promise.all(r.map(e=>y.composer().addAttachment(e)))}catch(e){console.error("Error adding attachment:",e)}},E=e&&!k,T=(0,ek.useCallback)(()=>{let e=I.current;e&&E&&(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))},[E]);(0,ek.useEffect)(()=>T(),[T]),sp(()=>{"thread"===y.composer().getState().type&&p&&T()}),(0,ek.useEffect)(()=>{if("thread"===y.composer().getState().type&&c)return y.on("thread.runStart",T)},[c,T,y]),(0,ek.useEffect)(()=>{if("thread"===y.composer().getState().type&&m)return y.on("threadListItem.switchedTo",T)},[m,T,y]);let C=x?{"aria-controls":x.popoverId,"aria-expanded":!0,"aria-haspopup":"listbox","aria-activedescendant":x.highlightedItemId}:{},N={name:"input",value:_,...h,...C,ref:S,disabled:k,onChange:(0,rI.composeEventHandlers)(i,e=>{if(!y.composer().getState().isEditing)return;let t=!0===e.nativeEvent.isComposing;$.current&&!t&&($.current=!1);let r=t||$.current;if(e9(()=>{y.composer().setText(e.target.value)}),r)return;let n=e.target.selectionStart??e.target.value.length;if(b)for(let e of b.getPlugins())e.setCursorPosition(n)}),onKeyDown:(0,rI.composeEventHandlers)(a,e=>{if(!k&&!e.nativeEvent.isComposing){if(b){for(let t of b.getPlugins())if(t.handleKeyDown(e))return}if("Enter"===e.key){let t=y.thread().getState(),r=t.capabilities.queue;if(e.shiftKey&&(e.ctrlKey||e.metaKey)&&r&&"none"!==w&&y.composer().getState().canSend){e.preventDefault(),y.composer().send({steer:!0});return}if(e.shiftKey||t.isRunning&&!r)return;let n=!1;"ctrlEnter"===w?n=e.ctrlKey||e.metaKey:"enter"===w&&(n=!0),n&&(e.preventDefault(),I.current?.closest("form")?.requestSubmit())}}}),onCompositionStart:(0,rI.composeEventHandlers)(h.onCompositionStart,()=>{$.current=!0}),onCompositionEnd:(0,rI.composeEventHandlers)(h.onCompositionEnd,e=>{if($.current=!1,!y.composer().getState().isEditing)return;let t=e.target;e9(()=>{y.composer().setText(t.value)});let r=t.selectionStart??t.value.length;if(b)for(let e of b.getPlugins())e.setCursorPosition(r)}),onSelect:(0,rI.composeEventHandlers)(s,e=>{if($.current)return;let t=e.target,r=t.selectionStart??t.value.length;if(b)for(let e of b.getPlugins())e.setCursorPosition(r)}),onPaste:(0,rI.composeEventHandlers)(o,j)};if(r&&(0,ek.isValidElement)(r)){let e=void 0!==h.children?h.children:r.props.children;return(0,ew.jsx)(rX.Root,{...N,children:(0,ek.cloneElement)(r,void 0,e)})}let A=t?rX.Root:s3;return(0,ew.jsx)(A,{...N})});lp.displayName="ComposerPrimitive.Input";let lm=rP("ComposerPrimitive.Cancel",()=>{let e,t,{disabled:r,cancel:n}=(e=tU(),t=rS(e=>!e.composer.canCancel),{cancel:(0,ek.useCallback)(()=>{e.composer().cancel()},[e]),disabled:t});return r?null:n}),lf=rP("ComposerPrimitive.AddAttachment",({multiple:e=!0}={})=>{let t,r,{disabled:n,addAttachment:i}=(t=tU(),r=rS(e=>!e.composer.isEditing),{addAttachment:(0,ek.useCallback)(e=>t.composer().addAttachment(e),[t]),disabled:r}),a=tU(),o=(0,ek.useCallback)(()=>{let t=document.createElement("input");t.type="file",t.multiple=e,t.hidden=!0;let r=a.composer().getState().attachmentAccept;"*"!==r&&(t.accept=r),document.body.appendChild(t),t.onchange=e=>{let r=e.target.files;if(r){for(let e of r)i(e);document.body.removeChild(t)}},t.oncancel=()=>{t.files&&0!==t.files.length||document.body.removeChild(t)},t.click()},[a,e,i]);return n?null:o},["multiple"]),lh=({index:e,children:t})=>{let r=tU({attachment:t_({source:"message",query:{type:"index",index:e},get:t=>t.message().attachment({index:e})})});return(0,ew.jsx)(tw,{value:r,children:t})},lg=({index:e,children:t})=>{let r=tU({attachment:t_({source:"composer",query:{type:"index",index:e},get:t=>t.composer().attachment({index:e})})});return(0,ew.jsx)(tw,{value:r,children:t})},lv=(e,t)=>{switch(t.type){case"image":return e?.Image??e?.Attachment;case"document":return e?.Document??e?.Attachment;case"file":return e?.File??e?.Attachment;default:return e?.Attachment}},ly=({components:e})=>{let t=rS(e=>e.attachment);if(!t)return null;let r=lv(e,t);return r?(0,ew.jsx)(r,{}):null},lb=(0,ek.memo)(({index:e,components:t})=>(0,ew.jsx)(lg,{index:e,children:(0,ew.jsx)(ly,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);lb.displayName="ComposerPrimitive.AttachmentByIndex";let lx=({children:e})=>{let t=rS(e=>e.composer.attachments.length);return(0,ek.useMemo)(()=>Array.from({length:t},(t,r)=>(0,ew.jsx)(lg,{index:r,children:(0,ew.jsx)(rE,{getItemState:e=>e.composer().attachment({index:r}).getState(),children:t=>e({get attachment(){return t()}})})},r)),[t,e])},lw=({components:e,children:t})=>e?(0,ew.jsx)(lx,{children:({attachment:t})=>{let r=lv(e,t);return r?(0,ew.jsx)(r,{}):null}}):(0,ew.jsx)(lx,{children:t});lw.displayName="ComposerPrimitive.Attachments";var rX=rX;let l_=(0,ek.forwardRef)(({disabled:e,asChild:t=!1,render:r,children:n,...i},a)=>{let[o,s]=(0,ek.useState)(!1),l=tU(),u=(0,ek.useCallback)(t=>{e||(t.preventDefault(),s(!0))},[e]),d=(0,ek.useCallback)(t=>{!e&&(t.preventDefault(),o||s(!0))},[e,o]),c=(0,ek.useCallback)(t=>{if(e)return;t.preventDefault();let r=t.relatedTarget;r&&t.currentTarget.contains(r)||s(!1)},[e]),p=(0,ek.useCallback)(async t=>{if(e)return;t.preventDefault(),s(!1);let r=Array.from(t.dataTransfer.files);await Promise.all(r.map(async e=>{try{await l.composer().addAttachment(e)}catch(e){console.error("Failed to add attachment:",e)}}))},[e,l]),m={...o?{"data-dragging":"true"}:null,...i,onDragEnterCapture:(0,rI.composeEventHandlers)(i.onDragEnterCapture,u),onDragOverCapture:(0,rI.composeEventHandlers)(i.onDragOverCapture,d),onDragLeaveCapture:(0,rI.composeEventHandlers)(i.onDragLeaveCapture,c),onDropCapture:(0,rI.composeEventHandlers)(i.onDropCapture,p),ref:a};if(r&&(0,ek.isValidElement)(r)){let e=void 0!==n?n:r.props.children;return(0,ew.jsx)(rX.Root,{...m,children:(0,ek.cloneElement)(r,void 0,e)})}let f=t?rX.Root:"div";return(0,ew.jsx)(f,{...m,children:n})});l_.displayName="ComposerPrimitive.AttachmentDropzone";let lk=rP("ComposerPrimitive.Dictate",()=>{let e,t,{disabled:r,startDictation:n}=(e=tU(),t=rS(e=>null!=e.composer.dictation||!e.thread.capabilities.dictation||!e.composer.isEditing),{startDictation:(0,ek.useCallback)(()=>{e.composer().startDictation()},[e]),disabled:t});return r?null:n}),lI=rP("ComposerPrimitive.StopDictation",()=>{let e=tU(),t=rS(e=>null!=e.composer.dictation),r=(0,ek.useCallback)(()=>{e.composer().stopDictation()},[e]);return t?r:null}),lS=(0,ek.forwardRef)(({children:e,...t},r)=>{let n=rS(e=>e.composer.dictation?.transcript);return n?(0,ew.jsx)(rk.span,{...t,ref:r,children:e??n}):null});lS.displayName="ComposerPrimitive.DictationTranscript";let l$=({children:e,...t})=>rS(e=>{if(!0===t.editing&&!e.composer.isEditing||!1===t.editing&&e.composer.isEditing)return!1;let r=null!=e.composer.dictation;return(!0!==t.dictation||!!r)&&(!1!==t.dictation||!r)})?e:null;l$.displayName="ComposerPrimitive.If";let lj=(0,ek.forwardRef)((e,t)=>rS(e=>e.composer.quote)?(0,ew.jsx)(rk.div,{...e,ref:t}):null);lj.displayName="ComposerPrimitive.Quote";let lE=(0,ek.forwardRef)(({children:e,...t},r)=>{let n=rS(e=>e.composer.quote?.text);return n?(0,ew.jsx)(rk.span,{...t,ref:r,children:e??n}):null});lE.displayName="ComposerPrimitive.QuoteText";let lT=(0,ek.forwardRef)(({onClick:e,...t},r)=>{let n=tU(),i=(0,ek.useCallback)(()=>{n.composer().setQuote(void 0)},[n]);return(0,ew.jsx)(rk.button,{type:"button",...t,ref:r,onClick:(0,rI.composeEventHandlers)(e,i)})});lT.displayName="ComposerPrimitive.QuoteDismiss";let lC=({index:e,children:t})=>{let r=tU({queueItem:t_({source:"composer",query:{index:e},get:t=>t.composer().queueItem({index:e})})});return(0,ew.jsx)(tw,{value:r,children:t})},lN=(0,ek.memo)(({children:e})=>{let t=rS(e=>e.composer.queue.length);return(0,ek.useMemo)(()=>Array.from({length:t},(t,r)=>(0,ew.jsx)(lC,{index:r,children:(0,ew.jsx)(rE,{getItemState:e=>e.composer().queueItem({index:r}).getState(),children:t=>e({get queueItem(){return t()}})})},r)),[t,e])});lN.displayName="ComposerPrimitive.Queue";let lA=/\s/u,lR=eU(({text:e,triggerChar:t})=>{let[r,n]=eG(e.length),i=eV(()=>{let n=Math.min(r,e.length),i=e.slice(0,n);for(let e=i.length-1;e>=0;e--){let r=i[e];if(lA.test(r))break;if(i.startsWith(t,e)){if(e>0&&!lA.test(i[e-1]))continue;return{query:i.slice(e+t.length),offset:e}}}return null},[r,e,t]),a=i?.query??"";return{trigger:i,query:a,setCursorPosition:n}}),lP=eU(({navigableList:e,isSearchMode:t,activeCategoryId:r,query:n,popoverId:i,open:a,selectItem:o,selectCategory:s,goBack:l,close:u})=>{let[d,c]=eG(0);eW(()=>{c(0)},[e]),eW(()=>{c(0)},[t,r]);let p=e8(t=>{t<0||t>=e.length||t!==d&&c(t)}),m=e8(t=>{if(!a)return!1;switch(t.key){case"ArrowDown":return t.preventDefault(),c(t=>{let r=e.length;return 0===r?0:t<r-1?t+1:0}),!0;case"ArrowUp":return t.preventDefault(),c(t=>{let r=e.length;return 0===r?0:t>0?t-1:r-1}),!0;case"Enter":case"Tab":{if(t.shiftKey)return!1;t.preventDefault();let r=e[d];if(!r)return!0;return"type"in r?o(r):s(r.id),!0}case"Escape":return t.preventDefault(),u(),!0;case"Backspace":if(r&&""===n)return t.preventDefault(),l(),!0;return!1;default:return!1}}),f=e[d];return{highlightedIndex:d,highlightedItemId:a&&f?`${i}-option-${f.id}`:void 0,highlightIndex:p,handleKeyDown:m}});function lO(e,t){return e.id.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)||(e.description?.toLowerCase().includes(t)??!1)}let lM=eU(({adapter:e,query:t,open:r})=>{let[n,i]=eG(null);eW(()=>{r||i(null)},[r]);let a=eV(()=>r&&e?e.categories():[],[r,e]),o=r?n:null,s=eV(()=>o&&e?e.categoryItems(o):[],[o,e]),l=eV(()=>{if(!r||!e||o||!t&&a.length>0)return null;if(e.search)return e.search(t);let n=[],i=t.toLowerCase();for(let t of a)for(let r of e.categoryItems(t.id))lO(r,i)&&n.push(r);return n},[r,e,t,o,a]),u=null!==l,d=eV(()=>{if(u)return[];if(!t)return a;let e=t.toLowerCase();return a.filter(t=>t.label.toLowerCase().includes(e))},[a,t,u]),c=eV(()=>{if(u)return l??[];if(!t)return s;let e=t.toLowerCase();return s.filter(t=>lO(t,e))},[s,t,u,l]),p=eV(()=>u?l??[]:o?c:d,[u,l,o,c,d]);return{categories:d,items:c,isSearchMode:u,activeCategoryId:o,navigableList:p,selectCategory:e8(e=>{i(e)}),goBack:e8(()=>{i(null)})}}),lz=eU(({behavior:e,trigger:t,aui:r,triggerChar:n,setCursorPosition:i,onSelected:a})=>{let o=eX(null),s=e8(e=>(o.current=e,()=>{o.current===e&&(o.current=null)}));return{selectItem:e8(i=>{if(!t||!e)return;if(o.current?.(i))return void a();let s=r.composer().getState().text,l=s.slice(0,t.offset),u=s.slice(t.offset+n.length+t.query.length),d=()=>{let t=e.formatter.serialize(i);r.composer().setText(l+t+(u.startsWith(" ")?u:` ${u}`))};"directive"===e.kind?(d(),e.onInserted?.(i)):(e.removeOnExecute?r.composer().setText(l+(u.startsWith(" ")?u.slice(1):u)):d(),e.onExecute(i)),a()}),close:e8(()=>{a(),t&&i(t.offset)}),registerSelectItemOverride:s}}),lD=eU(({adapter:e,text:t,triggerChar:r,behavior:n,aui:i,popoverId:a})=>{let o=e0(lR({text:t,triggerChar:r})),s=null!==o.trigger&&void 0!==e&&void 0!==n,l=e0(lM({adapter:e,query:o.query,open:s})),u=e8(()=>{l.goBack()}),d=e0(lz({behavior:n,trigger:o.trigger,aui:i,triggerChar:r,setCursorPosition:o.setCursorPosition,onSelected:u})),c=e0(lP({navigableList:l.navigableList,isSearchMode:l.isSearchMode,activeCategoryId:l.activeCategoryId,query:o.query,popoverId:a,open:s,selectItem:d.selectItem,selectCategory:l.selectCategory,goBack:l.goBack,close:d.close}));return{open:s,query:o.query,activeCategoryId:l.activeCategoryId,categories:l.categories,items:l.items,highlightedIndex:c.highlightedIndex,isSearchMode:l.isSearchMode,popoverId:a,highlightedItemId:c.highlightedItemId,selectCategory:l.selectCategory,goBack:l.goBack,selectItem:d.selectItem,close:d.close,highlightIndex:c.highlightIndex,handleKeyDown:c.handleKeyDown,setCursorPosition:o.setCursorPosition,registerSelectItemOverride:d.registerSelectItemOverride}}),lU=(0,ek.createContext)(null),lL=()=>{let e=(0,ek.useContext)(lU);if(!e)throw Error("useTriggerPopoverScopeContext must be used within ComposerPrimitive.TriggerPopover");return e},lZ=(0,ek.createContext)(null),lF=()=>{let e=(0,ek.useContext)(lZ);if(!e)throw Error("TriggerPopover.Directive / TriggerPopover.Action must be rendered inside ComposerPrimitive.TriggerPopover");return e},lB=(0,ek.forwardRef)(({char:e,adapter:t,"aria-label":r,children:n,...i},a)=>{let o=tU(),s=rS(e=>e.composer.text),l=(0,ek.useId)(),u=(0,ek.useRef)(null),[d,c]=(0,ek.useState)(null),p=(0,ek.useRef)(0),m=(0,ek.useCallback)(e=>(p.current+=1,u.current=e,c(e),()=>{p.current=Math.max(0,p.current-1),u.current===e&&(u.current=null,c(null))}),[e]),f=(0,ek.useMemo)(()=>({register:m}),[m]),h=eD(lD({adapter:t,text:s,triggerChar:e,behavior:d??void 0,aui:o,popoverId:l})),g=(0,ek.useRef)(h);g.current=h;let v=ln();(0,ek.useEffect)(()=>v.register({char:e,...d?{behavior:d}:{},resource:g.current}),[v,e,d]);let y=s7();(0,ek.useEffect)(()=>{if(y)return y.register(g.current)},[y]);let b=null!==d&&h.open,x=(()=>{let e=(0,ek.useContext)(lr);if(!e)throw Error("useTriggerPopoverAriaPublish must be used within ComposerPrimitive.TriggerPopoverRoot");return e})();return(0,ek.useEffect)(()=>{if(b)return()=>{x.setActiveAria(e,null)}},[x,e,b]),(0,ek.useEffect)(()=>{b&&x.setActiveAria(e,{popoverId:l,highlightedItemId:h.highlightedItemId})},[x,e,l,b,h.highlightedItemId]),(0,ew.jsx)(lZ.Provider,{value:f,children:(0,ew.jsx)(lU.Provider,{value:h,children:b?(0,ew.jsx)(rk.div,{role:"listbox",id:l,"aria-label":r??"Suggestions","aria-activedescendant":h.highlightedItemId,"data-state":"open",...i,ref:a,children:n}):n})})});lB.displayName="ComposerPrimitive.TriggerPopover";let lV=/:([\w-]{1,64})\[([^\]\n]{1,1024})\](?:\{name=([^}\n]{1,1024})\})?/gu,lq={serialize(e){let t=e.id!==e.label?`{name=${e.id}}`:"";return`:${e.type}[${e.label}]${t}`},parse(e){let t=[],r=0;for(let n of e.matchAll(lV)){n.index>r&&t.push({kind:"text",text:e.slice(r,n.index)});let i=n[2];t.push({kind:"mention",type:n[1],label:i,id:n[3]??i}),r=n.index+n[0].length}return r<e.length&&t.push({kind:"text",text:e.slice(r)}),t}},lW=({formatter:e,onExecute:t,removeOnExecute:r})=>{let{register:n}=lF(),i=(0,ek.useRef)(t);return i.current=t,(0,ek.useEffect)(()=>n({kind:"action",formatter:e??lq,onExecute:e=>i.current(e),...void 0!==r?{removeOnExecute:r}:{}}),[n,e,r]),null};lW.displayName="ComposerPrimitive.TriggerPopoverAction";let lJ=({formatter:e,onInserted:t})=>{let{register:r}=lF(),n=(0,ek.useRef)(t);return n.current=t,(0,ek.useEffect)(()=>r({kind:"directive",formatter:e??lq,onInserted:e=>n.current?.(e)}),[r,e]),null};lJ.displayName="ComposerPrimitive.TriggerPopoverDirective";let lH=Object.assign(lB,{Directive:lJ,Action:lW}),lK=(0,ek.forwardRef)(({children:e,"aria-label":t,...r},n)=>{let{categories:i,activeCategoryId:a,isSearchMode:o,open:s}=lL();return!s||a||o?null:(0,ew.jsx)(rk.div,{role:"group","aria-label":t??"Categories",...r,ref:n,children:e(i)})});lK.displayName="ComposerPrimitive.TriggerPopoverCategories";let lG=(0,ek.forwardRef)(({categoryId:e,onClick:t,onMouseMove:r,...n},i)=>{let{selectCategory:a,highlightIndex:o,categories:s,highlightedIndex:l,activeCategoryId:u,isSearchMode:d,popoverId:c}=lL(),p=(0,ek.useCallback)(()=>{a(e)},[a,e]),m=s.findIndex(t=>t.id===e),f=!u&&!d&&m===l,h=(0,ek.useCallback)(()=>{o(m)},[o,m]);return(0,ew.jsx)(rk.button,{type:"button",role:"option",id:`${c}-option-${e}`,"aria-selected":f,"data-highlighted":f?"":void 0,...n,ref:i,onClick:(0,rI.composeEventHandlers)(t,p),onMouseMove:(0,rI.composeEventHandlers)(r,h)})});lG.displayName="ComposerPrimitive.TriggerPopoverCategoryItem";let lY=(0,ek.forwardRef)(({children:e,"aria-label":t,...r},n)=>{let{items:i,activeCategoryId:a,isSearchMode:o,open:s}=lL();return s&&(a||o)?(0,ew.jsx)(rk.div,{role:"group","aria-label":t??"Items",...r,ref:n,children:e(i)}):null});lY.displayName="ComposerPrimitive.TriggerPopoverItems";let lX=(0,ek.forwardRef)(({item:e,index:t,onClick:r,onMouseMove:n,...i},a)=>{let{selectItem:o,highlightIndex:s,items:l,highlightedIndex:u,activeCategoryId:d,isSearchMode:c,popoverId:p}=lL(),m=(0,ek.useCallback)(()=>{o(e)},[o,e]),f=t??l.findIndex(t=>t.id===e.id),h=(c||null!==d)&&f===u,g=(0,ek.useCallback)(()=>{s(f)},[s,f]);return(0,ew.jsx)(rk.button,{type:"button",role:"option",id:`${p}-option-${e.id}`,"aria-selected":h,"data-highlighted":h?"":void 0,...i,ref:a,onClick:(0,rI.composeEventHandlers)(r,m),onMouseMove:(0,rI.composeEventHandlers)(n,g)})});lX.displayName="ComposerPrimitive.TriggerPopoverItem";let lQ=(0,ek.forwardRef)(({onClick:e,...t},r)=>{let{activeCategoryId:n,isSearchMode:i,goBack:a,open:o}=lL();return o&&n&&!i?(0,ew.jsx)(rk.button,{type:"button",...t,ref:r,onClick:(0,rI.composeEventHandlers)(e,a)}):null});lQ.displayName="ComposerPrimitive.TriggerPopoverBack",e.s(["AddAttachment",0,lf,"AttachmentByIndex",0,lb,"AttachmentDropzone",0,l_,"Attachments",0,lw,"Cancel",0,lm,"Dictate",0,lk,"DictationTranscript",0,lS,"If",0,l$,"Input",0,lp,"Queue",0,lN,"Quote",0,lj,"QuoteDismiss",0,lT,"QuoteText",0,lE,"Root",0,sZ,"Send",0,sL,"StopDictation",0,lI,"Unstable_TriggerPopover",0,lH,"Unstable_TriggerPopoverBack",0,lQ,"Unstable_TriggerPopoverCategories",0,lK,"Unstable_TriggerPopoverCategoryItem",0,lG,"Unstable_TriggerPopoverItem",0,lX,"Unstable_TriggerPopoverItems",0,lY,"Unstable_TriggerPopoverRoot",0,lc,"unstable_useTriggerPopoverRootContext",0,ln,"unstable_useTriggerPopoverRootContextOptional",0,li,"unstable_useTriggerPopoverScopeContext",0,lL,"unstable_useTriggerPopoverScopeContextOptional",0,()=>(0,ek.useContext)(lU),"unstable_useTriggerPopoverTriggers",0,()=>{let e=ln();return(0,ek.useSyncExternalStore)(e.subscribe,e.getTriggers,e.getTriggers)},"unstable_useTriggerPopoverTriggersOptional",0,()=>{let e=li();return(0,ek.useSyncExternalStore)(e?e.subscribe:lo,e?e.getTriggers:ls,e?e.getTriggers:ls)}],36964);var l0=e.i(36964),l0=l0;let l1=rB("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),l2=rB("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);var l0=l0;let l4=rB("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),l6={claude:{provider:"claude",sessionId:null,source:"generated-default",updatedAt:"2026-05-27T10:18:02.000Z",ttl:18e5,agentVersion:null,capabilities:{model:{key:"model",currentValue:"sonnet",configId:"model",configKey:"model",source:"fallback",options:[{value:"sonnet",label:"Sonnet",description:"Claude Sonnet 默认模型。",order:0},{value:"opus",label:"Opus",description:"Claude Opus 高能力模型。",order:1},{value:"haiku",label:"Haiku",description:"Claude Haiku 快速模型。",order:2},{value:"opusplan",label:"Opus Plan",description:"Claude Opus 规划模式。",order:3},{value:"sonnet[1m]",label:"Sonnet [1M]",description:"Claude Sonnet 长上下文模型。",order:4}]},mode:{key:"mode",currentValue:at,configId:"mode",configKey:"mode",source:"fallback",options:[{value:"default",label:"默认",description:"使用供应商默认权限策略。",order:0},{value:"acceptEdits",label:"接受编辑",description:"允许编辑类操作更顺畅地继续。",order:1},{value:"bypassPermissions",label:"绕过权限",description:"尽量减少权限确认,适合受信任工作区。",order:2},{value:"plan",label:"计划",description:"先规划再执行,适合复杂任务。",order:3}]},thought_level:{key:"thought_level",currentValue:"none",configId:"thought_level",configKey:"thought_level",source:"fallback",options:[{value:"none",label:"无",description:"不额外请求思考深度。",order:0},{value:"think",label:"Think",description:"轻量思考。",order:1},{value:"think-hard",label:"Think Hard",description:"更深入思考。",order:2},{value:"think-harder",label:"Think Harder",description:"高强度思考。",order:3},{value:"ultrathink",label:"Ultrathink",description:"最高强度思考。",order:4}]}},metadata:{availableCommands:[],tokenUsage:null,rawSession:null}},codex:{provider:"codex",sessionId:null,source:"generated-default",updatedAt:"2026-05-26T06:24:12.704Z",ttl:18e5,agentVersion:null,capabilities:{model:{key:"model",currentValue:"gpt-5.5",configId:"model",configKey:"model",source:"fallback",options:[{value:"gpt-5.5",label:"GPT-5.5",description:"适合复杂编码、研究和真实工作场景的前沿模型。",order:0},{value:"gpt-5.4",label:"gpt-5.4",description:"适合日常编码的强力模型。",order:1},{value:"gpt-5.4-mini",label:"GPT-5.4-Mini",description:"适合简单编码任务的小型、快速且高性价比模型。",order:2},{value:"gpt-5.3-codex",label:"gpt-5.3-codex",description:"针对编码优化的模型。",order:3},{value:"gpt-5.2",label:"gpt-5.2",description:"针对专业工作和长时间运行的 agent 优化。",order:4}]},mode:{key:"mode",currentValue:ar,configId:"mode",configKey:"mode",source:"fallback",options:[{value:"read-only",label:"只读",description:"Codex 可以读取当前工作区文件。编辑文件或访问互联网需要审批。",order:0},{value:"auto",label:"默认",description:"Codex 可以读取和编辑当前工作区文件,并运行命令。访问互联网或编辑其他文件需要审批。(等同于 Agent 模式)",order:1},{value:"full-access",label:"完全访问",description:"Codex 可以编辑工作区外的文件并访问互联网,无需请求审批。使用时请谨慎。",order:2}]},thought_level:{key:"thought_level",currentValue:"xhigh",configId:"reasoning_effort",configKey:"reasoning_effort",source:"fallback",options:[{value:"low",label:"低",description:"更轻量推理,响应更快",order:0},{value:"medium",label:"中",description:"在速度和推理深度之间取得平衡,适合日常任务",order:1},{value:"high",label:"高",description:"为复杂问题提供更深的推理",order:2},{value:"xhigh",label:"极高",description:"为复杂问题提供极高推理深度",order:3}]}},metadata:{availableCommands:[],tokenUsage:null,rawSession:null}},gemini:{provider:"gemini",sessionId:null,source:"generated-default",updatedAt:"2026-05-27T10:18:02.000Z",ttl:18e5,agentVersion:null,capabilities:{model:{key:"model",currentValue:"gemini-3-pro-preview",configId:"model",configKey:"model",source:"fallback",options:[{value:"gemini-2.5-pro",label:"Gemini 2.5 Pro",description:"Gemini Pro 稳定模型。",order:0},{value:"gemini-2.5-flash",label:"Gemini 2.5 Flash",description:"Gemini Flash 快速模型。",order:1},{value:"gemini-3-pro-preview",label:"Gemini 3 Pro Preview",description:"Gemini 3 Pro 预览模型。",order:2},{value:"gemini-3-flash-preview",label:"Gemini 3 Flash Preview",description:"Gemini 3 Flash 预览模型。",order:3}]},mode:{key:"mode",currentValue:an,configId:"mode",configKey:"mode",source:"fallback",options:[{value:"default",label:"默认",description:"使用供应商默认权限策略。",order:0},{value:"acceptEdits",label:"接受编辑",description:"允许编辑类操作更顺畅地继续。",order:1},{value:"bypassPermissions",label:"绕过权限",description:"尽量减少权限确认,适合受信任工作区。",order:2}]},thought_level:{key:"thought_level",currentValue:"none",configId:"thought_level",configKey:"thought_level",source:"fallback",options:[{value:"none",label:"无",description:"不额外请求思考深度。",order:0}]}},metadata:{availableCommands:[],tokenUsage:null,rawSession:null}},opencode:{provider:"opencode",sessionId:null,source:"generated-default",updatedAt:"2026-05-27T10:18:02.000Z",ttl:18e5,agentVersion:null,capabilities:{model:{key:"model",currentValue:"opencode/big-pickle",configId:"model",configKey:"model",source:"fallback",options:[{value:"opencode/big-pickle",label:"OpenCode Zen/Big Pickle",description:"OpenCode 默认模型。",order:0},{value:"opencode/nemotron-3-super-free",label:"OpenCode Zen/Nemotron 3 Super Free",description:"OpenCode 可用模型。",order:1},{value:"opencode/deepseek-v4-flash-free",label:"OpenCode Zen/DeepSeek V4 Flash Free",description:"OpenCode 可用模型。",order:2}]},mode:{key:"mode",currentValue:ai,configId:"mode",configKey:"mode",source:"fallback",options:[{value:"build",label:"build",description:"The default agent. Executes tools based on configured permissions.",order:0},{value:"plan",label:"plan",description:"Plan mode. Disallows all edit tools.",order:1}]},thought_level:{key:"thought_level",currentValue:"none",configId:"thought_level",configKey:"thought_level",source:"fallback",options:[{value:"none",label:"无",description:"不额外请求思考深度。",order:0}]}},metadata:{availableCommands:[],tokenUsage:null,rawSession:null}}};l6.codex;let l5=["model","mode","thought_level"],l3="acp.capabilities.updated",l9={getItem(e){try{return window.localStorage.getItem(e)}catch{return null}},removeItem(e){try{window.localStorage.removeItem(e)}catch{}},setItem(e,t){try{window.localStorage.setItem(e,t)}catch{}}};function l8(e){return"string"==typeof e?e.trim():""}function l7(e){return l8(e).toLowerCase()||"unknown"}function ue(e){if(!e||"object"!=typeof e||Array.isArray(e))return null;let t=l8(e.name??e.command??e.id).replace(/^\/+/,"");return t?{name:t,description:l8(e.description),input:e.input,source:"acp"}:null}function ut(e){return(Array.isArray(e)?e:[]).map(ue).filter(e=>!!e)}function ur(e,t=0){if(null==e)return null;if("string"==typeof e||"number"==typeof e||"boolean"==typeof e){let r=String(e).trim();return r?{value:r,label:r,description:"",order:t}:null}if("object"!=typeof e||Array.isArray(e))return null;let r=l8(e.value??e.id??e.modeId??e.const??(Array.isArray(e.enum)?e.enum[0]:void 0)??e.name);return r?{value:r,label:l8(e.label??e.title??e.name??e.description)||r,description:l8(e.description),order:Number.isInteger(e.order)?Number(e.order):t}:null}function un(e){let t=new Set;return e.filter(e=>!(!e.value||t.has(e.value))&&(t.add(e.value),!0))}function ui(e,t){if(!e)return t??null;if(!t)return e;let r={...e.capabilities??{}};for(let e of l5){var n,i;let a=(n=r[e],i=t.capabilities?.[e],n?i?{...n,...i,options:i.options.length?un(i.options):n.options,currentValue:void 0!==i.currentValue?i.currentValue:n.currentValue}:n:i??null);a&&(r[e]=a)}return{...e,...t,capabilities:r,metadata:{...e.metadata??{availableCommands:[]},...t.metadata??{availableCommands:[]},tokenUsage:t.metadata?.tokenUsage??e.metadata?.tokenUsage??null,availableCommands:function(e,t){let r=[],n=new Set;for(let i of[...ut(t),...ut(e)]){let e=i.name.replace(/^\/+/,"").toLowerCase();!e||n.has(e)||(n.add(e),r.push(i))}return r}(e.metadata?.availableCommands,t.metadata?.availableCommands)}}}function ua(e,t){if(!t||"object"!=typeof t||Array.isArray(t))return null;let r={},n=t.capabilities&&"object"==typeof t.capabilities?t.capabilities:{};for(let e of l5){let t=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return null;let t=l8(e.key);if("model"!==t&&"mode"!==t&&"thought_level"!==t)return null;let r=un((Array.isArray(e.options)?e.options:[]).map(ur).filter(e=>!!e));return{key:t,currentValue:l8(e.currentValue)||null,options:r,configId:l8(e.configId)||t,configKey:l8(e.configKey)||l8(e.configId)||t,source:"session"===e.source||"config-option"===e.source||"fallback"===e.source?e.source:"fallback"}}(n[e]);t&&(r[e]=t)}let i=t.metadata&&"object"==typeof t.metadata?t.metadata:{};return{...void 0===t?t:JSON.parse(JSON.stringify(t)),provider:l7(t.provider||e),sessionId:l8(t.sessionId)||null,source:l8(t.source)||null,updatedAt:l8(t.updatedAt)||new Date().toISOString(),ttl:Number.isFinite(Number(t.ttl))&&Number(t.ttl)>0?Number(t.ttl):18e5,agentVersion:l8(t.agentVersion)||null,capabilities:r,metadata:{...i,tokenUsage:i.tokenUsage??null,availableCommands:ut(i.availableCommands)}}}function uo(e,t){let r=encodeURIComponent(l7(e)),n=l8(t);return`acp-capabilities:v1:${r}:${n?encodeURIComponent(n):"global"}`}function us(e,t,r=l9){let n=uo(e,t),i=r.getItem(n);if(!i)return null;try{return ua(e,JSON.parse(i))}catch{return r.removeItem(n),null}}function ul(e,t,r,n=l9){let i=ua(e,r),a=uo(e,t);return i?(n.setItem(a,JSON.stringify(i)),i):(n.removeItem(a),null)}function uu(e){let t=Date.parse(e?.updatedAt||"");return Number.isFinite(t)?t:0}function ud(e,t,r=function(e){return l6[String(e??"").trim().toLowerCase()]??null}(e),n=l9){let i=ua(e,r);if(!i)return us(e,t,n);let a=us(e,t,n);return a?ul(e,t,uu(i)>=uu(a)?ui(i,function(e){let t={...e.capabilities??{}};for(let e of l5)t[e]?.source==="fallback"&&delete t[e];return{...e,capabilities:t}}(a)):ui(i,a),n):ul(e,t,i,n)}function uc(e){return"string"==typeof e?e.trim():""}function up(e){return uc(e).toLowerCase()||"unknown"}function um(e){let t;if(!e||"object"!=typeof e||Array.isArray(e))return null;let r=(t=uc(e.name).replace(/^\/+/,""))?`/${t}`:"";if(!r)return null;let n=uc(e.scope),i="acp"===uc(e.source)?"acp":"skill",a="acp"===uc(e.namespace)||"acp"===i?"acp":"skill";return{name:r,description:uc(e.description)||("acp"===i?"ACP command":"Codex 技能"),namespace:a,source:i,..."skill"===i&&uc(e.path)?{path:uc(e.path)}:{},..."skill"===i&&("project"===n||"system"===n||"user"===n)?{scope:n}:{}}}function uf(e){let t=new Set;return(Array.isArray(e)?e:[]).map(um).filter(e=>{if(!e)return!1;let r=e.name.toLowerCase();return!t.has(r)&&(t.add(r),!0)})}function uh(e,t,r){return Array.isArray(r)?{provider:up(e),workspacePath:uc(t)||null,updatedAt:new Date().toISOString(),ttl:18e5,commands:uf(r)}:!r||"object"!=typeof r||Array.isArray(r)?null:{...void 0===r?r:JSON.parse(JSON.stringify(r)),provider:up(r.provider||e),workspacePath:uc(r.workspacePath)||uc(t)||null,updatedAt:uc(r.updatedAt)||new Date().toISOString(),ttl:Number.isFinite(Number(r.ttl))&&Number(r.ttl)>0?Number(r.ttl):18e5,commands:uf(r.commands)}}function ug(e,t){let r=encodeURIComponent(up(e)),n=uc(t);return`skill-commands:v2:${r}:${n?encodeURIComponent(n):"global"}`}function uv(e,t,r=l9){let n=ug(e,t),i=r.getItem(n);if(!i)return null;try{return uh(e,t,JSON.parse(i))}catch{return r.removeItem(n),null}}function uy(e,t,r,n=l9){let i=uh(e,t,r),a=ug(e,t);return i?(n.setItem(a,JSON.stringify(i)),i):(n.removeItem(a),null)}function ub(e){return{id:e.name,type:"command",label:e.name,description:e.description,metadata:{namespace:e.namespace,source:e.source,...e.scope?{scope:e.scope}:{},...e.path?{path:e.path}:{}}}}function ux(e){return"string"==typeof e?e.trim():""}function uw(e){return e.map(e=>`${e.name}\u0000${e.description}\u0000${e.source}`).join("\n")}function u_(e){return!!(e&&"object"==typeof e&&!Array.isArray(e))}function uk(){let{provider:e,workspacePath:t}=aq(),r=rS(e=>e.threads.mainThreadId),n=rS(e=>e.thread.messages),i=(0,ek.useMemo)(()=>(function(e){if(!Array.isArray(e))return[];for(let t=e.length-1;t>=0;t-=1){let r=e[t];if(!u_(r))continue;if("user"===r.role)break;if("assistant"!==r.role)continue;let n=function(e){if(!u_(e)||!u_(e.acpAvailableCommands))return[];let t=e.acpAvailableCommands.byName;return u_(t)?Object.values(t).flatMap(e=>{let t;if(!u_(e))return[];let r=(t=ux(e.name).replace(/^\/+/,""))?`/${t}`:"";return r?[{name:r,description:ux(e.description)||"ACP command",namespace:"acp",source:"acp"}]:[]}):[]}((u_(r.metadata)?r.metadata:{}).custom);if(n.length>0)return n}return[]})(n),[n]),[a,o]=(0,ek.useState)(()=>uv(e,t)?.commands??[]),s=(0,ek.useRef)(a);(0,ek.useEffect)(()=>{let n=!1,i=uv(e,t);if(i&&(s.current=i.commands,o(i.commands)),function(e,{force:t=!1,now:r=Date.now()}={}){return t||!function(e,t=Date.now()){if(!e)return!1;let r=Date.parse(e.updatedAt||"");if(!Number.isFinite(r))return!1;let n=Number(e.ttl||18e5);return Number.isFinite(n)&&n>0&&t-r<n}(e,r)}(i))return a1.listCommands({provider:e,threadId:r,workspacePath:t}).then(r=>{if(n)return;let i=uy(e,t,Array.isArray(r?.commands)?r.commands:[]),a=i?.commands??[];s.current=a,o(a)}).catch(()=>{!n&&(i||(s.current=[],o([])))}),()=>{n=!0}},[e,r,t]),(0,ek.useEffect)(()=>{if(!i.length)return;let r=function(e,t){let r=new Map;for(let t of e)r.set(t.name.toLowerCase(),t);for(let e of t)r.set(e.name.toLowerCase(),e);return[...r.values()]}(s.current,i);if(uw(r)===uw(s.current))return;let n=uy(e,t,r),a=n?.commands??r;s.current=a,o(a)},[e,i,t]);let l=(0,ek.useMemo)(()=>({categories:()=>[],categoryItems:()=>[],search:e=>a.filter(t=>{let r;return!(r=e.toLowerCase())||t.name.toLowerCase().includes(r)||t.description.toLowerCase().includes(r)||t.namespace.includes(r)||t.source.includes(r)}).map(ub)}),[a]),u=(0,ek.useRef)(null);return(0,ew.jsxs)(l0.Unstable_TriggerPopover,{ref:u,char:"/",adapter:l,className:"absolute bottom-full left-0 z-50 mb-3 w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",children:[(0,ew.jsx)(uI,{popoverRef:u}),(0,ew.jsx)(uS,{commandsRef:s}),(0,ew.jsx)("div",{className:"max-h-80 overflow-y-auto p-1.5",children:(0,ew.jsx)(l0.Unstable_TriggerPopoverItems,{children:e=>e.length?e.map((e,t)=>(0,ew.jsxs)(l0.Unstable_TriggerPopoverItem,{item:e,index:t,className:(0,r4.cn)("flex min-h-10 w-full items-start gap-2 rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent hover:text-accent-foreground data-[highlighted=true]:bg-accent"),children:[(0,ew.jsx)(l4,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),(0,ew.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,ew.jsx)("span",{className:"block truncate font-mono",children:e.label}),e.description?(0,ew.jsx)("span",{className:"block truncate text-muted-foreground text-xs",children:e.description}):null]})]},`${e.type}-${e.id}`)):(0,ew.jsx)(u$,{})})})]})}function uI({popoverRef:e}){let{close:t,open:r}=lL();return(0,ek.useEffect)(()=>{if(r)return document.addEventListener("pointerdown",i),document.addEventListener("focusin",a),()=>{document.removeEventListener("pointerdown",i),document.removeEventListener("focusin",a)};function n(t){return t instanceof Node&&e.current?.contains(t)}function i(e){n(e.target)||t()}function a(e){n(e.target)||t()}},[t,r,e]),null}function uS({commandsRef:e}){let t=tU(),{close:r}=lL(),n=(0,ek.useCallback)(n=>{let i=e.current.find(e=>e.name===n.id),a=i?.name??n.label;t.thread().composer().setText(`${a} `),r()},[t,r,e]);return(0,ew.jsx)(l0.Unstable_TriggerPopover.Action,{removeOnExecute:!0,onExecute:n})}function u$(){return(0,ew.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:"暂无可用命令"})}let uj=rB("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),uE=rB("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]),uT=rB("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),uC=rB("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]),uN=new Set(["low","medium","high","xhigh"]);function uA(e){return String(e??"").trim().toLowerCase()}function uR(e,t){let r=uA(t),n=String(e.value??"").trim();if("codex"!==r||!n.includes("/"))return e;let[i,a,...o]=n.split("/");if(!i||!a||o.length||!uN.has(a))return e;let s=String(e.label??"").trim();return{...e,label:s&&s!==n?s:`${i} / ${function(e){switch(e){case"low":return"低";case"medium":return"中";case"high":return"高";case"xhigh":return"极高";default:return e}}(a)}`}}function uP(e,t){return e.length?e.find(e=>e.value===t)?.label||e[0].label:""}let uO=ae.map((e,t)=>({value:e,label:ao[e].label,description:ao[e].enabledInP0?"已验证":"需本地 CLI/登录",order:t}));function uM(e,t){let r=e?.capabilities[t];return r?.options?.filter(e=>e.value).map(e=>({value:e.value,label:e.label||e.value,description:e.description}))??[]}function uz(e,t){let r=e?.capabilities;r?.model?.currentValue&&t.syncModel(r.model.currentValue),r?.mode?.currentValue&&t.syncModeId(r.mode.currentValue),r?.thought_level?.currentValue&&t.syncThoughtLevel(r.thought_level.currentValue)}function uD(){let e=function(){let{provider:e,workspacePath:t,syncModel:r,syncModeId:n,syncThoughtLevel:i}=aq(),a=rS(e=>e.threadListItem.remoteId??e.threads.mainThreadId),[o,s]=(0,ek.useState)(0),[l,u]=(0,ek.useState)(()=>ud(e,t));return(0,ek.useEffect)(()=>{function r(r){let n=r.detail;n?.provider&&n.provider!==e||n?.threadId&&n.threadId!==a||n&&"workspacePath"in n&&(n.workspacePath??null)!==(t??null)||s(e=>e+1)}return window.addEventListener(l3,r),()=>{window.removeEventListener(l3,r)}},[e,a,t]),(0,ek.useEffect)(()=>{let s=!1,l=ud(e,t);if(u(l),uz(l,{syncModeId:n,syncModel:r,syncThoughtLevel:i}),function(e,{force:t=!1,now:r=Date.now()}={}){return t||!function(e,t=Date.now()){if(!e)return!1;let r=Date.parse(e.updatedAt||"");if(!Number.isFinite(r))return!1;let n=Number(e.ttl||18e5);return Number.isFinite(n)&&n>0&&t-r<n}(e,r)}(l,{force:o>0}))return a1.getCapabilities({provider:e,threadId:a,workspacePath:t}).then(a=>{if(s)return;let o=ul(e,t,a?.capabilitySnapshot??null);u(o),uz(o,{syncModeId:n,syncModel:r,syncThoughtLevel:i})}).catch(()=>{s||u(l)}),()=>{s=!0}},[e,o,n,r,i,a,t]),l}(),t=aq(),r=(0,ek.useMemo)(()=>(function({provider:e="codex",acpModelOptions:t=[],runtimeModelOptions:r=[],fallbackModelOptions:n=[],sessionPinnedModel:i=""}={}){let a=uA(e),o=t.length?t:r.length?r:"codex"===a?[]:n,s=String(i??"").trim();return"codex"===a&&0===o.length?[]:!s||o.some(e=>e.value===s)?o.map(t=>uR(t,e)):[{value:s,label:s},...o].map(t=>uR(t,e))})({provider:t.provider,acpModelOptions:uM(e,"model"),sessionPinnedModel:t.model}),[t.model,t.provider,e]),n=(0,ek.useMemo)(()=>uM(e,"mode"),[e]),i=(0,ek.useMemo)(()=>uM(e,"thought_level"),[e]),a=(0,ek.useMemo)(()=>[{key:"provider",label:"供应商",value:t.provider,options:uO,onChange:t.setProvider,icon:uT},{key:"model",label:"模型",value:t.model,options:r,onChange:t.setModel,icon:ou},{key:"mode",label:"模式",value:t.modeId,options:n,onChange:t.setModeId,icon:ou},{key:"thinking",label:"思考深度",value:t.thoughtLevel,options:i,onChange:t.setThoughtLevel,icon:uE}],[t.modeId,t.model,t.provider,t.setModeId,t.setModel,t.setProvider,t.setThoughtLevel,t.thoughtLevel,r,n,i]);return r.length||n.length||i.length?(0,ew.jsx)(uU,{sections:a}):(0,ew.jsx)(sn,{condition:e=>!e.thread.isEmpty,children:(0,ew.jsx)("div",{className:"flex min-w-0 items-center px-1 text-muted-foreground text-xs",children:"会话开始后会显示供应商能力"})})}function uU({sections:e}){let[t,r]=(0,ek.useState)(!1),n=function(e){let[t,r]=(0,ek.useState)(!1);return(0,ek.useEffect)(()=>{let t=window.matchMedia(e),n=()=>r(t.matches);return n(),t.addEventListener("change",n),()=>{t.removeEventListener("change",n)}},[e]),t}("(min-width: 640px)"),i=(0,ek.useMemo)(()=>e.filter(e=>e.options.length),[e]),[a,o]=(0,ek.useState)(i[0]?.key??null),[s,l]=(0,ek.useState)(null),u=(0,ek.useRef)(null),d=i.find(e=>"provider"===e.key),c=i.find(e=>"model"===e.key),p=i.find(e=>e.key===a)??i[0],m=d?uP(d.options,d.value||d.options[0]?.value||null):"配置",f=c?uP(c.options,c.value||c.options[0]?.value||null):"";return((0,ek.useEffect)(()=>{let e=i.some(e=>e.key===a)?a:i[0]?.key??null;e!==a&&o(e),s&&!i.some(e=>e.key===s)&&l(null)},[a,s,i]),(0,ek.useEffect)(()=>{if(t)return document.addEventListener("pointerdown",i),document.addEventListener("focusin",a),document.addEventListener("keydown",o),()=>{document.removeEventListener("pointerdown",i),document.removeEventListener("focusin",a),document.removeEventListener("keydown",o)};function e(){r(!1),l(null)}function n(e){return e instanceof Node&&u.current?.contains(e)}function i(t){n(t.target)||e()}function a(t){n(t.target)||e()}function o(t){"Escape"===t.key&&e()}},[t]),i.length)?(0,ew.jsxs)("div",{ref:u,className:"relative px-0.5",children:[(0,ew.jsxs)("button",{type:"button",className:"inline-flex h-8 max-w-56 items-center gap-1 rounded-md px-2 text-muted-foreground text-xs hover:bg-accent hover:text-accent-foreground","aria-haspopup":"menu","aria-expanded":t,"data-acp-config-trigger":"",onClick:function(){let e=!t;r(e),o(e=>e??i[0]?.key??null),e||l(null)},children:[(0,ew.jsx)(uC,{className:"size-3.5 shrink-0"}),(0,ew.jsx)("span",{className:"truncate",children:f?`${m} \xb7 ${f}`:m}),(0,ew.jsx)(oa,{className:"size-3 shrink-0"})]}),t?(0,ew.jsxs)("div",{className:"absolute bottom-full left-0 z-50 mb-2 w-[min(20rem,calc(100vw-2rem))] rounded-md border bg-popover p-1 text-popover-foreground shadow-md max-sm:w-[calc(100vw-5rem)]",role:"menu","data-acp-config-root-menu":"",children:[(0,ew.jsx)("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"配置"}),(0,ew.jsxs)("div",{className:"relative",children:[i.map(e=>{let t=e.icon,r=e.value||e.options[0]?.value||null,i=uP(e.options,r),a=e.key===p?.key,u=e.key===s;return(0,ew.jsxs)("div",{children:[(0,ew.jsxs)("button",{type:"button",className:(0,r4.cn)("flex min-h-11 w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:outline-none",a&&"sm:bg-accent/70 sm:text-accent-foreground",u&&"max-sm:bg-accent/70 max-sm:text-accent-foreground"),"aria-haspopup":"menu","aria-expanded":n?a:u,"data-acp-config-section":e.key,onPointerEnter:t=>{"mouse"===t.pointerType&&o(e.key)},onFocus:()=>{n&&o(e.key)},onClick:()=>{var t;return t=e.key,void(n?o(t):l(e=>e===t?null:t))},children:[(0,ew.jsx)(t,{className:"size-4 shrink-0 text-muted-foreground"}),(0,ew.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,ew.jsx)("span",{className:"block truncate",children:e.label}),(0,ew.jsx)("span",{className:"block truncate text-muted-foreground text-xs",children:i||"默认"})]}),(0,ew.jsx)(uj,{className:"hidden size-3.5 shrink-0 text-muted-foreground sm:block"}),(0,ew.jsx)(oa,{className:"size-3.5 shrink-0 text-muted-foreground sm:hidden"})]}),u?(0,ew.jsx)(uL,{section:e,variant:"mobile"}):null]},e.key)}),p?(0,ew.jsx)(uL,{section:p,variant:"desktop"}):null]})]}):null]}):null}function uL({section:e,variant:t}){let r=e.value||e.options[0]?.value||null;return(0,ew.jsxs)("div",{className:(0,r4.cn)("overflow-y-auto rounded-md bg-popover p-1 text-popover-foreground","desktop"===t?"absolute bottom-0 left-[calc(100%+0.5rem)] hidden max-h-80 w-[min(22rem,calc(100vw-2rem))] border shadow-md sm:block":"mt-1 max-h-56 w-full border-x-0 border-b-0 border-t sm:hidden"),role:"menu","data-acp-config-submenu":t,children:[(0,ew.jsx)("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:e.label}),e.options.map(t=>(0,ew.jsxs)("button",{type:"button",className:(0,r4.cn)("flex min-h-10 w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:outline-none",t.value===r&&"bg-accent/60"),role:"menuitemradio","aria-checked":t.value===r,"data-acp-config-option":t.value,onClick:()=>{e.onChange(t.value)},children:[(0,ew.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,ew.jsx)("span",{className:"block truncate",children:t.label}),t.description?(0,ew.jsx)("span",{className:"block truncate text-muted-foreground text-xs",children:t.description}):null]}),t.value===r?(0,ew.jsx)(a4,{className:"size-4 shrink-0"}):null]},t.value))]})}e.s([],12318),e.i(12318);let uZ=(0,ek.forwardRef)((e,t)=>(0,ew.jsx)(rk.div,{...e,ref:t}));uZ.displayName="AttachmentPrimitive.Root";let uF=(0,ek.forwardRef)((e,t)=>{let r=rS(e=>{let t=e.attachment.name.split(".");return t.length>1?t.pop():""});return(0,ew.jsxs)(rk.div,{...e,ref:t,children:[".",r]})});uF.displayName="AttachmentPrimitive.unstable_Thumb";let uB=()=>{let e=rS(e=>e.attachment.name);return(0,ew.jsx)(ew.Fragment,{children:e})};uB.displayName="AttachmentPrimitive.Name";let uV=rP("AttachmentPrimitive.Remove",()=>{let e=tU();return(0,ek.useCallback)(()=>{e.attachment().remove()},[e])});e.s(["Name",0,uB,"Remove",0,uV,"Root",0,uZ,"unstable_Thumb",0,uF],68871);var uq=e.i(68871),uq=uq,l0=l0;e.s([],92058),e.i(92058);let uW=()=>{let e=tU(),t=rS(()=>e.message());return sc((0,ek.useCallback)(e=>{let r=()=>{t.setIsHovering(!0)},n=()=>{t.setIsHovering(!1)};return e.addEventListener("mouseenter",r),e.addEventListener("mouseleave",n),e.matches(":hover")&&queueMicrotask(()=>t.setIsHovering(!0)),()=>{e.removeEventListener("mouseenter",r),e.removeEventListener("mouseleave",n),t.setIsHovering(!1)}},[t]))},uJ=({forwardedRef:e,...t})=>{let r=uW(),n=(0,rh.useComposedRefs)(e,r),i=rS(e=>e.message.id);return(0,ew.jsx)(rk.div,{...t,ref:n,"data-message-id":i})},uH=({forwardedRef:e,threadViewportStore:t,...r})=>{let n,i,a=uW(),o=(n=ru(e=>e.topAnchorTurn?.anchorId),rS(e=>"user"===e.message.role&&e.message.index>0&&e.message.index===e.thread.messages.length-2&&e.thread.messages.at(-1)?.role==="assistant"&&(e.message.id===n||e.thread.isRunning))),s=(i=ru(e=>e.topAnchorTurn?.targetId),rS(e=>e.message.isLast&&"assistant"===e.message.role&&e.message.index>=1&&e.thread.messages.at(e.message.index-1)?.role==="user"&&(e.message.id===i||e.thread.isRunning))),l=sc((0,ek.useCallback)(e=>{if(o)return t.getState().registerAnchorElement(e)},[o,t])),u=(({active:e,threadViewportStore:t})=>sc((0,ek.useCallback)(r=>{if(!e)return;let n=t.getState(),i=n.topAnchorMessageClamp;return n.registerAnchorTargetElement(r,{tallerThan:sg(i.tallerThan,r),visibleHeight:sg(i.visibleHeight,r)})},[e,t])))({active:s,threadViewportStore:t}),d=(0,rh.useComposedRefs)(e,a,l,u),c=rS(e=>e.message.id);return(0,ew.jsx)(rk.div,{...r,ref:d,"data-message-id":c,"data-aui-top-anchor-user":o?"":void 0,"data-aui-top-anchor-target":s?"":void 0})},uK=(0,ek.forwardRef)((e,t)=>{let r=rd();return"top"===r.getState().turnAnchor?(0,ew.jsx)(uH,{...e,forwardedRef:t,threadViewportStore:r}):(0,ew.jsx)(uJ,{...e,forwardedRef:t})});uK.displayName="MessagePrimitive.Root";let uG=({index:e,children:t})=>{let r=tU({part:t_({source:"message",query:{type:"index",index:e},get:t=>t.message().part({index:e})})});return(0,ew.jsx)(tw,{value:r,children:t})},uY=eU(({text:e,isRunning:t})=>{let r=eV(()=>({type:"text",text:e,status:t?{type:"running"}:{type:"complete"}}),[e,t]);return{getState:()=>r,addToolResult:()=>{throw Error("Not supported")},resumeToolCall:()=>{throw Error("Not supported")}}}),uX=({text:e,isRunning:t=!1,children:r})=>{let n=tU({part:uY({text:e,isRunning:t})});return(0,ew.jsx)(tw,{value:n,children:r})},uQ=Object.freeze({type:"complete"}),u0=eU(({parts:e,getMessagePart:t})=>{let[r,n]=eG(!0),i=eV(()=>{let t=e[e.length-1];return t?.status??uQ},[e]),a=eV(()=>({parts:e,collapsed:r,status:i}),[e,r,i]);return{getState:()=>a,setCollapsed:n,part:t}}),u1=({startIndex:e,endIndex:t,children:r})=>{let n=rS(e=>e.message.parts).slice(e,t+1),i=tU(),a=tU({chainOfThought:u0({parts:n,getMessagePart:({index:t})=>{if(t<0||t>=n.length)throw Error(`ChainOfThought part index ${t} is out of bounds (0..${n.length-1})`);return i.message().part({index:e+t})}})});return(0,ew.jsx)(tw,{value:a,children:r})},u2=e=>{let t=e.message.metadata;if(t&&"object"==typeof t)return t.custom?.quote},u4=e=>!!e?.startsWith("ui://"),u6=(e,t)=>{let r=e instanceof Map?e:new Map(e.entries()),n=t instanceof Map?t:new Map(t.entries());if(r.size!==n.size)return!1;for(let[e,t]of r)if(!n.has(e)||!Object.is(t,n.get(e)))return!1;return!0};function u5(e){let t=ek.default.useRef(void 0);return r=>{let n=e(r);return!function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;if(Symbol.iterator in e&&Symbol.iterator in t){if("entries"in e&&"entries"in t)return u6(e,t);let r=e[Symbol.iterator](),n=t[Symbol.iterator](),i=r.next(),a=n.next();for(;!i.done&&!a.done;){if(!Object.is(i.value,a.value))return!1;i=r.next(),a=n.next()}return!!i.done&&!!a.done}return u6({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}(t.current,n)?t.current=n:t.current}}let u3=e=>{let t=-1;return{startGroup:e=>{-1===t&&(t=e)},endGroup:(r,n)=>{-1!==t&&(n.push({type:e,startIndex:t,endIndex:r}),t=-1)},finalize:(r,n)=>{-1!==t&&n.push({type:e,startIndex:t,endIndex:r})}}},u9=({Fallback:e,...t})=>{let r=rS(r=>{let n=r.tools.tools[t.toolName]??e;return Array.isArray(n)?n[0]??e:n});return r?(0,ew.jsx)(r,{...t}):null},u8=(e,t,r)=>{let n=e.renderers[t]?.[0];return n||(e.fallbacks[0]??r)},u7=({Fallback:e,...t})=>{let r=rS(r=>u8(r.dataRenderers,t.name,e));return r?(0,ew.jsx)(r,{...t}):null},de={Text:()=>null,Reasoning:()=>null,Source:()=>null,Image:()=>null,File:()=>null,Unstable_Audio:()=>null,ToolGroup:({children:e})=>e,ReasoningGroup:({children:e})=>e},dt=({components:{Text:e=de.Text,Reasoning:t=de.Reasoning,Image:r=de.Image,Source:n=de.Source,File:i=de.File,Unstable_Audio:a=de.Unstable_Audio,tools:o={},data:s}={}})=>{let l=tU(),u=rS(e=>e.part),d=u.type;if("tool-call"===d){let e=l.part().addToolResult,t=l.part().resumeToolCall;if("Override"in o)return(0,ew.jsx)(o.Override,{...u,addResult:e,resume:t});let r=o.by_name?.[u.toolName]??o.Fallback;return(0,ew.jsx)(u9,{...u,Fallback:r,addResult:e,resume:t})}if(u.status?.type==="requires-action")throw Error("Encountered unexpected requires-action status");switch(d){case"text":return(0,ew.jsx)(e,{...u});case"reasoning":return(0,ew.jsx)(t,{...u});case"source":return(0,ew.jsx)(n,{...u});case"image":return(0,ew.jsx)(r,{...u});case"file":return(0,ew.jsx)(i,{...u});case"audio":return(0,ew.jsx)(a,{...u});case"data":{let e=s?.by_name?.[u.name]??s?.Fallback;return(0,ew.jsx)(u7,{...u,Fallback:e})}default:return console.warn(`Unknown message part type: ${d}`),null}},dr=(0,ek.memo)(({index:e,components:t})=>(0,ew.jsx)(uG,{index:e,children:(0,ew.jsx)(dt,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.ToolGroup===t.components?.ToolGroup&&e.components?.ReasoningGroup===t.components?.ReasoningGroup);dr.displayName="MessagePrimitive.PartByIndex";let dn=({status:e,component:t})=>(0,ew.jsx)(uX,{text:"",isRunning:"running"===e.type,children:(0,ew.jsx)(t,{type:"text",text:"",status:e})}),di=Object.freeze({type:"complete"}),da=Object.freeze({type:"running"}),ds=(0,ek.memo)(({components:e})=>{let t=rS(e=>e.message.status??di);return e?.Empty?(0,ew.jsx)(e.Empty,{status:t}):"running"!==t.type?null:(0,ew.jsx)(dn,{status:t,component:e?.Text??de.Text})},(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),dl=(0,ek.memo)(({components:e,enabled:t})=>rS(e=>{if(!t||0===e.message.parts.length)return!1;let r=e.message.parts[e.message.parts.length-1];return r?.type!=="text"&&r?.type!=="reasoning"})?(0,ew.jsx)(ds,{components:e}):null,(e,t)=>e.enabled===t.enabled&&e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),du=(0,ek.memo)(({Quote:e})=>{let t=rS(u2);return t?(0,ew.jsx)(e,{text:t.text,messageId:t.messageId}):null});function dd(e,t){let r=e.tools[t.toolName],n=Array.isArray(r)?r[0]??null:r??null;return n||(u4(t.mcp?.app?.resourceUri)&&e.mcpApp?e.mcpApp.render:null)}let dc=()=>{let e=tU(),t=rS(e=>e.part),r=rS(e=>"tool-call"===e.part.type?dd(e.tools,e.part):null);return r&&"tool-call"===t.type?(0,ew.jsx)(r,{...t,addResult:e.part().addToolResult,resume:e.part().resumeToolCall}):null},dp=()=>{let e=rS(e=>e.part),t=rS(e=>"data"===e.part.type?u8(e.dataRenderers,e.part.name,void 0)??null:null);return t&&"data"===e.type?(0,ew.jsx)(t,{...e}):null},dm=()=>{let e=rS(e=>e.part.type);return"tool-call"===e?(0,ew.jsx)(dc,{}):"data"===e?(0,ew.jsx)(dp,{}):null},df=Object.freeze({type:"text",text:"",status:da}),dh=({index:e,children:t})=>{let r=tU(),n=rS(e=>e.dataRenderers);return(0,ew.jsx)(uG,{index:e,children:(0,ew.jsx)(rE,{getItemState:t=>t.message().part({index:e}).getState(),children:i=>t({get part(){let t=i();if("tool-call"===t.type){let n=null!==dd(r.tools().getState(),t),i=r.message().part({index:e});return{...t,toolUI:n?(0,ew.jsx)(dc,{}):null,addResult:i.addToolResult,resume:i.resumeToolCall}}if("data"===t.type){let e=void 0!==u8(n,t.name,void 0);return{...t,dataRendererUI:e?(0,ew.jsx)(dp,{}):null}}return t}})})})},dg=({children:e})=>{let t=rS(e=>e.message.parts.length),r=rS(e=>(e.message.status?.type??"complete")==="running"),n=0===t&&r;return 0===t?n?(0,ew.jsx)(uX,{text:"",isRunning:!0,children:e({part:df})}):null:(0,ew.jsx)(ew.Fragment,{children:Array.from({length:t},(t,r)=>(0,ew.jsx)(dh,{index:r,children:t=>e(t)??(0,ew.jsx)(dm,{})},r))})},dv=({components:e,unstable_showEmptyOnNonTextEnd:t=!0,children:r})=>r?(0,ew.jsx)(dg,{children:r}):(0,ew.jsx)(dy,{components:e,unstable_showEmptyOnNonTextEnd:t});dv.displayName="MessagePrimitive.Parts";let dy=({components:e,unstable_showEmptyOnNonTextEnd:t})=>{var r;let n,i=rS(e=>e.message.parts.length),a=(r=!!e?.ChainOfThought,n=rS(u5(e=>e.message.parts.map(e=>e.type))),(0,ek.useMemo)(()=>0===n.length?[]:((e,t)=>{let r=[];if(t){let t=u3("chainOfThoughtGroup");for(let n=0;n<e.length;n++){let i=e[n];"tool-call"===i||"reasoning"===i?t.startGroup(n):(t.endGroup(n-1,r),r.push({type:"single",index:n}))}t.finalize(e.length-1,r)}else{let t=u3("toolGroup"),n=u3("reasoningGroup");for(let i=0;i<e.length;i++){let a=e[i];"tool-call"===a?(n.endGroup(i-1,r),t.startGroup(i)):"reasoning"===a?(t.endGroup(i-1,r),n.startGroup(i)):(t.endGroup(i-1,r),n.endGroup(i-1,r),r.push({type:"single",index:i}))}t.finalize(e.length-1,r),n.finalize(e.length-1,r)}return r})(n,r),[n,r])),o=(0,ek.useMemo)(()=>0===i?(0,ew.jsx)(ds,{components:e}):a.map(t=>{if("single"===t.type)return(0,ew.jsx)(dr,{index:t.index,components:e},t.index);if("chainOfThoughtGroup"===t.type){let r=e?.ChainOfThought;return r?(0,ew.jsx)(u1,{startIndex:t.startIndex,endIndex:t.endIndex,children:(0,ew.jsx)(r,{})},`chainOfThought-${t.startIndex}`):null}if("toolGroup"===t.type){let r=e?.ToolGroup??de.ToolGroup;return(0,ew.jsx)(r,{startIndex:t.startIndex,endIndex:t.endIndex,children:Array.from({length:t.endIndex-t.startIndex+1},(r,n)=>{let i=t.startIndex+n;return(0,ew.jsx)(dr,{index:i,components:e},`part-${i}`)})},`tool-${t.startIndex}`)}{let r=e?.ReasoningGroup??de.ReasoningGroup;return(0,ew.jsx)(r,{startIndex:t.startIndex,endIndex:t.endIndex,children:Array.from({length:t.endIndex-t.startIndex+1},(r,n)=>{let i=t.startIndex+n;return(0,ew.jsx)(dr,{index:i,components:e},`part-${i}`)})},`reasoning-${t.startIndex}`)}}),[a,e,i]);return(0,ew.jsxs)(ew.Fragment,{children:[e?.Quote&&(0,ew.jsx)(du,{Quote:e.Quote}),o,(0,ew.jsx)(dl,{components:e,enabled:t})]})},db=()=>rS(e=>{if("text"!==e.part.type&&"reasoning"!==e.part.type)throw Error("MessagePartText can only be used inside text or reasoning message parts.");return e.part}),dx=(0,ek.createContext)(null),dw=({children:e})=>{let t=d_({optional:!0}),r=tU(),[n]=(0,ek.useState)(()=>{var e;return e=r.part().getState().status,{useSmoothStatus:ra(()=>e)}});return t?e:(0,ew.jsx)(dx.Provider,{value:n,children:e})};function d_(e){let t=(0,ek.useContext)(dx);if(!e?.optional&&!t)throw Error("This component must be used within a SmoothContextProvider.");return t}let{useSmoothStatus:dk,useSmoothStatusStore:dI}=rs(d_,"useSmoothStatus");class dS{currentText;setText;animationFrameId=null;lastUpdateTime=Date.now();targetText="";constructor(e,t){this.currentText=e,this.setText=t}start(){null===this.animationFrameId&&(this.lastUpdateTime=Date.now(),this.animate())}stop(){null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}animate=()=>{let e=Date.now(),t=e-this.lastUpdateTime,r=this.targetText.length-this.currentText.length,n=Math.min(5,250/r),i=0;for(;t>=n&&i<r;)i++,t-=n;i!==r?this.animationFrameId=requestAnimationFrame(this.animate):this.animationFrameId=null,0!==i&&(this.currentText=this.targetText.slice(0,this.currentText.length+i),this.lastUpdateTime=e-t,this.setText(this.currentText))}}let d$=Object.freeze({type:"running"}),dj=(e,t=!1)=>{let{text:r}=e,[n,i]=(0,ek.useState)("running"===e.status.type?"":r),a=tU(),o=rS(()=>a.part()),[s,l]=(0,ek.useState)(o);o===s&&r.startsWith(n)||(l(o),i("running"===e.status.type?"":r));let u=dI({optional:!0}),d=(0,na.useCallbackRef)(t=>{if(i(t),u){let r=n!==t||"running"===e.status.type?d$:e.status;u.setState(r,!0)}});(0,ek.useEffect)(()=>{if(u){let i=t&&(n!==r||"running"===e.status.type)?d$:e.status;u.setState(i,!0)}},[u,t,r,n,e.status]);let[c]=(0,ek.useState)(new dS(n,d)),p=(0,ek.useRef)(o);return(0,ek.useEffect)(()=>{if(!t)return void c.stop();let n=p.current!==o;(p.current=o,n||!r.startsWith(c.targetText))?"running"===e.status.type?(c.currentText="",c.targetText=r,c.start()):(c.currentText=r,c.targetText=r,c.stop()):(c.targetText=r,c.start())},[c,t,r,e.status.type,o]),(0,ek.useEffect)(()=>()=>{c.stop()},[c]),(0,ek.useMemo)(()=>t?{type:"text",text:n,status:r===n?e.status:d$}:e,[t,n,e,r])},dE=(0,ek.forwardRef)(({smooth:e=!0,component:t="span",...r},n)=>{let{text:i,status:a}=dj(db(),e);return(0,ew.jsx)(t,{"data-status":a.type,...r,ref:n,children:i})});dE.displayName="MessagePartPrimitive.Text";let dT=(0,ek.forwardRef)((e,t)=>{let{image:r}=rS(e=>{if("image"!==e.part.type)throw Error("MessagePartImage can only be used inside image message parts.");return e.part});return(0,ew.jsx)(rk.img,{src:r,...e,ref:t})});dT.displayName="MessagePartPrimitive.Image";let dC=({children:e})=>rS(e=>"running"===e.part.status.type)?e:null;dC.displayName="MessagePartPrimitive.InProgress";let dN={...de,Text:()=>(0,ew.jsxs)("p",{style:{whiteSpace:"pre-line"},children:[(0,ew.jsx)(dE,{}),(0,ew.jsx)(dC,{children:(0,ew.jsx)("span",{style:{fontFamily:"revert"},children:" ●"})})]}),Image:()=>(0,ew.jsx)(dT,{})},dA=e=>{if("children"in e)return(0,ew.jsx)(dv,{children:e.children});let{components:t,...r}=e,n=t?{Text:t.Text??dN.Text,Image:t.Image??dN.Image,Reasoning:t.Reasoning??de.Reasoning,Source:t.Source??de.Source,File:t.File??de.File,Unstable_Audio:t.Unstable_Audio??de.Unstable_Audio,..."ChainOfThought"in t?{ChainOfThought:t.ChainOfThought}:{tools:t.tools,data:t.data,ToolGroup:t.ToolGroup??de.ToolGroup,ReasoningGroup:t.ReasoningGroup??de.ReasoningGroup},Empty:t.Empty,Quote:t.Quote}:dN;return(0,ew.jsx)(dv,{components:n,...r})};dA.displayName="MessagePrimitive.Parts";let dR=({children:e,...t})=>rS(e=>{let{role:r,attachments:n,parts:i,branchCount:a,isLast:o,speech:s,isCopied:l,isHovering:u}=e.message;return!(!0===t.hasBranches&&a<2||t.user&&"user"!==r||t.assistant&&"assistant"!==r||t.system&&"system"!==r||!0===t.lastOrHover&&!u&&!o||void 0!==t.last&&t.last!==o||!0===t.copied&&!l||!1===t.copied&&l||!0===t.speaking&&null==s||!1===t.speaking&&null!=s||!0===t.hasAttachments&&("user"!==r||!n?.length)||!1===t.hasAttachments&&"user"===r&&n?.length)&&(!0!==t.hasContent||0!==i.length)&&(!1!==t.hasContent||!(i.length>0))&&(void 0===t.submittedFeedback||(e.message.metadata.submittedFeedback?.type??null)===t.submittedFeedback)})?e:null;dR.displayName="MessagePrimitive.If";let dP=(e,t)=>{switch(t.type){case"image":return e?.Image??e?.Attachment;case"document":return e?.Document??e?.Attachment;case"file":return e?.File??e?.Attachment;default:return e?.Attachment}},dO=({components:e})=>{let t=rS(e=>e.attachment);if(!t)return null;let r=dP(e,t);return r?(0,ew.jsx)(r,{}):null},dM=(0,ek.memo)(({index:e,components:t})=>(0,ew.jsx)(lh,{index:e,children:(0,ew.jsx)(dO,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);dM.displayName="MessagePrimitive.AttachmentByIndex";let dz=({children:e})=>{let t=rS(e=>"user"!==e.message.role?0:(e.message.attachments??[]).length);return(0,ek.useMemo)(()=>Array.from({length:t},(t,r)=>(0,ew.jsx)(lh,{index:r,children:(0,ew.jsx)(rE,{getItemState:e=>e.message().attachment({index:r}).getState(),children:t=>e({get attachment(){return t()}})})},r)),[t,e])},dD=({components:e,children:t})=>e?(0,ew.jsx)(dz,{children:({attachment:t})=>{let r=dP(e,t);return r?(0,ew.jsx)(r,{}):null}}):(0,ew.jsx)(dz,{children:t});dD.displayName="MessagePrimitive.Attachments";let dU=(0,ek.memo)(({children:e})=>{let t=rS(u2);return t?(0,ew.jsx)(ew.Fragment,{children:e(t)}):null});dU.displayName="MessagePrimitive.Quote";let dL=()=>rS(e=>e.message.status?.type==="incomplete"&&"error"===e.message.status.reason?e.message.status.error??"An error occurred":void 0),dZ=({children:e})=>void 0!==dL()?e:null;dZ.displayName="MessagePrimitive.Error";let dF=Object.freeze([]),dB=e=>{let t=e.nextChildIdx++;return""===e.nodeKey?String(t):`${e.nodeKey}.${t}`},dV=Object.freeze({type:"complete"}),dq=()=>{throw Error("MessagePrimitive.GroupedParts: rendered `children` under a leaf part. `children` is only meaningful for `group-…` cases — add a matching case for the part type or return `null` to skip it.")},dW=(e,t,r)=>{if("part"===e.type)return(0,ew.jsx)(dh,{index:e.index,children:({part:e})=>r({part:e,children:(0,ew.jsx)(dq,{})})},`part-${e.index}`);let n=t[e.indices.at(-1)]?.status??dV,i={type:e.key,status:n,indices:e.indices};return(0,ew.jsx)(ek.Fragment,{children:r({part:i,children:(0,ew.jsx)(ew.Fragment,{children:e.children.map(e=>dW(e,t,r))})})},e.nodeKey)},dJ=({groupBy:e,children:t})=>{let r=rS(u5(e=>e.message.parts)),n=(0,ek.useMemo)(()=>(e=>{let t={key:"",nodeKey:"",indices:[],children:[],nextChildIdx:0},r=[t],n=()=>{let e=r.pop();r[r.length-1].children.push({type:"group",key:e.key,nodeKey:e.nodeKey,indices:e.indices,children:e.children})};for(let t=0;t<e.length;t++){let i=e[t],a=0;for(;a<r.length-1&&a<i.length&&r[a+1].key===i[a];)a++;for(;r.length-1>a;)n();for(;r.length-1<i.length;){let e=r[r.length-1];r.push({key:i[r.length-1],nodeKey:dB(e),indices:[],children:[],nextChildIdx:0})}let o=r[r.length-1];o.children.push({type:"part",index:t,nodeKey:dB(o)});for(let e=1;e<r.length;e++)r[e].indices.push(t)}for(;r.length>1;)n();return t.children})(r.map((t,n)=>{var i;return null==(i=e(t,n,r))?dF:"string"==typeof i?[i]:i})),[r,e]);return(0,ew.jsx)(ew.Fragment,{children:n.map(e=>dW(e,r,t))})};dJ.displayName="MessagePrimitive.GroupedParts";let dH=e=>{let t=new Map;for(let r=0;r<e.length;r++){let n=e[r],i=n?.parentId??`__ungrouped_${r}`,a=t.get(i)??[];a.push(r),t.set(i,a)}let r=[];for(let[e,n]of t){let t=e.startsWith("__ungrouped_")?void 0:e;r.push({groupKey:t,indices:n})}return r},dK=({Fallback:e,...t})=>{let r=rS(r=>{let n=r.tools.tools[t.toolName]??e;return Array.isArray(n)?n[0]??e:n});return r?(0,ew.jsx)(r,{...t}):null},dG=({Fallback:e,...t})=>{let r=rS(r=>{let n=r.dataRenderers.renderers[t.name]??e;return Array.isArray(n)?n[0]??e:n});return r?(0,ew.jsx)(r,{...t}):null},dY=()=>(0,ew.jsxs)("p",{style:{whiteSpace:"pre-line"},children:[(0,ew.jsx)(dE,{}),(0,ew.jsx)(dC,{children:(0,ew.jsx)("span",{style:{fontFamily:"revert"},children:" ●"})})]}),dX=()=>null,dQ=()=>null,d0=()=>(0,ew.jsx)(dT,{}),d1=()=>null,d2=()=>null,d4=({children:e})=>e,d6=({components:{Text:e=dY,Reasoning:t=dX,Image:r=d0,Source:n=dQ,File:i=d1,Unstable_Audio:a=d2,tools:o={},data:s}={}})=>{let l=tU(),u=rS(e=>e.part),d=u.type;if("tool-call"===d){let e=l.part().addToolResult,t=l.part().resumeToolCall;if("Override"in o)return(0,ew.jsx)(o.Override,{...u,addResult:e,resume:t});let r=o.by_name?.[u.toolName]??o.Fallback;return(0,ew.jsx)(dK,{...u,Fallback:r,addResult:e,resume:t})}if(u.status?.type==="requires-action")throw Error("Encountered unexpected requires-action status");switch(d){case"text":return(0,ew.jsx)(e,{...u});case"reasoning":return(0,ew.jsx)(t,{...u});case"source":return(0,ew.jsx)(n,{...u});case"image":return(0,ew.jsx)(r,{...u});case"file":return(0,ew.jsx)(i,{...u});case"audio":return(0,ew.jsx)(a,{...u});case"data":{let e=s?.by_name?.[u.name]??s?.Fallback;return(0,ew.jsx)(dG,{...u,Fallback:e})}default:return console.warn(`Unknown message part type: ${d}`),null}},d5=(0,ek.memo)(({partIndex:e,components:t})=>(0,ew.jsx)(uG,{index:e,children:(0,ew.jsx)(d6,{components:t})}),(e,t)=>e.partIndex===t.partIndex&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.Group===t.components?.Group),d3=({status:e,component:t})=>(0,ew.jsx)(uX,{text:"",isRunning:"running"===e.type,children:(0,ew.jsx)(t,{type:"text",text:"",status:e})}),d9=Object.freeze({type:"complete"}),d8=(0,ek.memo)(({components:e})=>{let t=rS(e=>e.message.status??d9);return e?.Empty?(0,ew.jsx)(e.Empty,{status:t}):(0,ew.jsx)(d3,{status:t,component:e?.Text??dY})},(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),d7=({groupingFunction:e,components:t})=>{let r,n=rS(e=>e.message.parts.length),i=(r=rS(e=>e.message.parts),(0,ek.useMemo)(()=>0===r.length?[]:e(r),[r,e])),a=(0,ek.useMemo)(()=>0===n?(0,ew.jsx)(d8,{components:t}):i.map((e,r)=>{let n=t?.Group??d4;return(0,ew.jsx)(n,{groupKey:e.groupKey,indices:e.indices,children:e.indices.map(e=>(0,ew.jsx)(d5,{partIndex:e,components:t},e))},`group-${r}-${e.groupKey??"ungrouped"}`)}),[i,t,n]);return(0,ew.jsx)(ew.Fragment,{children:a})};d7.displayName="MessagePrimitive.Unstable_PartsGrouped";let ce=({components:e,...t})=>(0,ew.jsx)(d7,{...t,components:e,groupingFunction:dH});ce.displayName="MessagePrimitive.Unstable_PartsGroupedByParentId",e.s(["AttachmentByIndex",0,dM,"Attachments",0,dD,"Content",0,dA,"Error",0,dZ,"GroupedParts",0,dJ,"If",0,dR,"PartByIndex",0,dr,"Parts",0,dA,"Quote",0,dU,"Root",0,uK,"Unstable_PartsGrouped",0,d7,"Unstable_PartsGroupedByParentId",0,ce],7860);var ct=e.i(7860),ct=ct;let cr=rB("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);var cn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=rW(`Primitive.${t}`),n=ek.forwardRef((e,n)=>{let{asChild:i,...a}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ew.jsx)(i?r:t,{...a,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),ci=e.i(2239);function ca(){return()=>{}}var co="Avatar",[cs,cl]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,ew.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(co),[cu,cd]=cs(co),cc=ek.forwardRef((e,t)=>{let{__scopeAvatar:r,...n}=e,[i,a]=ek.useState("idle");return(0,ew.jsx)(cu,{scope:r,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,ew.jsx)(cn.span,{...n,ref:t})})});cc.displayName=co;var cp="AvatarImage",cm=ek.forwardRef((e,t)=>{let{__scopeAvatar:r,src:n,onLoadingStatusChange:i=()=>{},...a}=e,o=cd(cp,r),s=function(e,{referrerPolicy:t,crossOrigin:r}){let n=(0,ci.useSyncExternalStore)(ca,()=>!0,()=>!1),i=ek.useRef(null),a=n?(i.current||(i.current=new window.Image),i.current):null,[o,s]=ek.useState(()=>cg(a,e));return(0,od.useLayoutEffect)(()=>{s(cg(a,e))},[a,e]),(0,od.useLayoutEffect)(()=>{let e=e=>()=>{s(e)};if(!a)return;let n=e("loaded"),i=e("error");return a.addEventListener("load",n),a.addEventListener("error",i),t&&(a.referrerPolicy=t),"string"==typeof r&&(a.crossOrigin=r),()=>{a.removeEventListener("load",n),a.removeEventListener("error",i)}},[a,r,t]),o}(n,a),l=(0,na.useCallbackRef)(e=>{i(e),o.onImageLoadingStatusChange(e)});return(0,od.useLayoutEffect)(()=>{"idle"!==s&&l(s)},[s,l]),"loaded"===s?(0,ew.jsx)(cn.img,{...a,ref:t,src:n}):null});cm.displayName=cp;var cf="AvatarFallback",ch=ek.forwardRef((e,t)=>{let{__scopeAvatar:r,delayMs:n,...i}=e,a=cd(cf,r),[o,s]=ek.useState(void 0===n);return ek.useEffect(()=>{if(void 0!==n){let e=window.setTimeout(()=>s(!0),n);return()=>window.clearTimeout(e)}},[n]),o&&"loaded"!==a.imageLoadingStatus?(0,ew.jsx)(cn.span,{...i,ref:t}):null});function cg(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}ch.displayName=cf,e.s(["Avatar",0,cc,"AvatarFallback",0,ch,"AvatarImage",0,cm,"Fallback",0,ch,"Image",0,cm,"Root",0,cc,"createAvatarScope",0,cl],60860);var cv=e.i(60860),cv=cv;function cy({className:e,size:t="default",...r}){return(0,ew.jsx)(cv.Root,{"data-slot":"avatar","data-size":t,className:(0,r4.cn)("group/avatar relative flex size-8 shrink-0 select-none overflow-hidden rounded-full data-[size=lg]:size-10 data-[size=sm]:size-6",e),...r})}function cb({className:e,...t}){return(0,ew.jsx)(cv.Image,{"data-slot":"avatar-image",className:(0,r4.cn)("aspect-square size-full",e),...t})}function cx({className:e,...t}){return(0,ew.jsx)(cv.Fallback,{"data-slot":"avatar-fallback",className:(0,r4.cn)("flex size-full items-center justify-center rounded-full bg-muted text-muted-foreground text-sm group-data-[size=sm]/avatar:text-xs",e),...t})}let cw=()=>{let{file:e,src:t}=rS(u5(e=>{if("image"!==e.attachment.type)return{};if(e.attachment.file)return{file:e.attachment.file};let t=e.attachment.content?.filter(e=>"image"===e.type)[0]?.image;return t?{src:t}:{}}));return(e=>{let[t,r]=(0,ek.useState)(void 0);return(0,ek.useEffect)(()=>{if(!e)return void r(void 0);let t=URL.createObjectURL(e);return r(t),()=>{URL.revokeObjectURL(t)}},[e]),t})(e)??t},c_=({src:e})=>{let[t,r]=(0,ek.useState)(!1);return(0,ew.jsx)("img",{src:e,alt:"附件预览",className:(0,r4.cn)("block h-auto max-h-[80vh] w-auto max-w-full object-contain",t?"aui-attachment-preview-image-loaded":"aui-attachment-preview-image-loading invisible"),onLoad:()=>r(!0)})},ck=({children:e})=>{let t=cw();return t?(0,ew.jsxs)(a5,{children:[(0,ew.jsx)(a3,{className:"aui-attachment-preview-trigger cursor-pointer transition-colors hover:bg-accent/50",asChild:!0,children:e}),(0,ew.jsxs)(oe,{className:"aui-attachment-preview-dialog-content p-2 sm:max-w-3xl [&>button]:rounded-full [&>button]:bg-foreground/60 [&>button]:p-1 [&>button]:opacity-100 [&>button]:ring-0! [&_svg]:text-background [&>button]:hover:[&_svg]:text-destructive",children:[(0,ew.jsx)(on,{className:"aui-sr-only sr-only",children:"图片附件预览"}),(0,ew.jsx)("div",{className:"aui-attachment-preview relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden bg-background",children:(0,ew.jsx)(c_,{src:t})})]})]}):e},cI=()=>{let e=cw();return(0,ew.jsxs)(cy,{className:"aui-attachment-tile-avatar h-full w-full rounded-none",children:[(0,ew.jsx)(cb,{src:e,alt:"附件预览",className:"aui-attachment-tile-image object-cover"}),(0,ew.jsx)(cx,{children:(0,ew.jsx)(cr,{className:"aui-attachment-tile-fallback-icon size-8 text-muted-foreground"})})]})},cS=()=>{let e="message"!==tU().attachment.source,t=rS(e=>"image"===e.attachment.type),r=rS(e=>{let t=e.attachment.type;switch(t){case"image":return"图片";case"document":return"文档";case"file":return"文件";default:return t}});return(0,ew.jsxs)(r3.Tooltip,{children:[(0,ew.jsxs)(uq.Root,{className:(0,r4.cn)("aui-attachment-root relative",t&&"aui-attachment-root-composer only:*:first:size-24"),children:[(0,ew.jsx)(ck,{children:(0,ew.jsx)(r3.TooltipTrigger,{asChild:!0,children:(0,ew.jsx)("button",{type:"button",className:"aui-attachment-tile size-14 cursor-pointer overflow-hidden rounded-[calc(var(--composer-radius)-var(--composer-padding))] border bg-muted p-0 transition-opacity hover:opacity-75","aria-label":`${r}附件`,children:(0,ew.jsx)(cI,{})})})}),e&&(0,ew.jsx)(c$,{})]}),(0,ew.jsx)(r3.TooltipContent,{side:"top",children:(0,ew.jsx)(uq.Name,{})})]})},c$=()=>(0,ew.jsx)(uq.Remove,{asChild:!0,children:(0,ew.jsx)(r9,{tooltip:"移除文件",className:"aui-attachment-tile-remove absolute end-1.5 top-1.5 size-3.5 rounded-full bg-white text-muted-foreground opacity-100 shadow-sm hover:bg-white! [&_svg]:text-black hover:[&_svg]:text-destructive",side:"top",children:(0,ew.jsx)(r8,{className:"aui-attachment-remove-icon size-3 dark:stroke-[2.5px]"})})}),cj=()=>(0,ew.jsx)("div",{className:"aui-user-message-attachments-end col-span-full col-start-1 row-start-1 flex w-full flex-row justify-end gap-2",children:(0,ew.jsx)(ct.Attachments,{children:()=>(0,ew.jsx)(cS,{})})}),cE=()=>(0,ew.jsx)("div",{className:"aui-composer-attachments flex w-full flex-row items-center gap-2 overflow-x-auto empty:hidden",children:(0,ew.jsx)(l0.Attachments,{children:()=>(0,ew.jsx)(cS,{})})}),cT=({label:e="添加附件"})=>(0,ew.jsx)(l0.AddAttachment,{asChild:!0,children:(0,ew.jsx)(r9,{tooltip:e,side:"bottom",variant:"ghost",size:"icon",className:"aui-composer-add-attachment size-8 rounded-full p-1 font-semibold text-xs hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30","aria-label":e,children:(0,ew.jsx)(rV,{className:"aui-attachment-add-icon size-5 stroke-[1.5px]"})})}),cC=({addAttachmentLabel:e,ariaLabel:t="消息输入框",leadingActions:r,onPaste:n,placeholder:i="输入 / 使用技能,或直接发送消息...",sendLabel:a,showAttachments:o=!0,showCommandMenu:s=!0,showSelectors:l=!0,trailingActions:u,triggerPopovers:d})=>{let c=tU(),p=cA(),m=(0,ek.useCallback)(e=>{if("Escape"!==e.key)return;let t=c.composer();queueMicrotask(()=>{e.defaultPrevented||t.getState().canCancel&&(p(),t.cancel())})},[c,p]);return(0,ew.jsx)(l0.Root,{className:"aui-composer-root relative flex w-full flex-col",children:(0,ew.jsx)(l0.AttachmentDropzone,{asChild:!0,children:(0,ew.jsxs)("div",{"data-slot":"aui_composer-shell",className:"flex w-full flex-col gap-2 rounded-(--composer-radius) border bg-background p-(--composer-padding) transition-shadow focus-within:border-ring/75 focus-within:ring-2 focus-within:ring-ring/20 data-[dragging=true]:border-ring data-[dragging=true]:border-dashed data-[dragging=true]:bg-accent/50",children:[(0,ew.jsxs)(l0.Unstable_TriggerPopoverRoot,{children:[o?(0,ew.jsx)(cE,{}):null,(0,ew.jsx)(l0.Input,{placeholder:i,className:"aui-composer-input max-h-32 min-h-10 w-full resize-none bg-transparent px-1.75 py-1 text-[13px] outline-none placeholder:text-muted-foreground/80 md:text-sm",rows:1,autoFocus:!0,"aria-label":t,cancelOnEscape:!1,onKeyDown:m,onPaste:n}),s?(0,ew.jsx)(uk,{}):null,d]}),(0,ew.jsx)(cN,{addAttachmentLabel:e,leadingActions:r,sendLabel:a,showAddAttachment:o,showSelectors:l,trailingActions:u})]})})})},cN=({addAttachmentLabel:e,leadingActions:t,sendLabel:r="发送消息",showAddAttachment:n=!0,showSelectors:i=!0,trailingActions:a})=>{let o=cA();return(0,ew.jsxs)("div",{className:"aui-composer-action-wrapper relative flex items-center justify-between text-[13px] md:text-sm",children:[(0,ew.jsxs)("div",{className:"flex min-w-0 items-center gap-1",children:[n?(0,ew.jsx)(cT,{label:e}):null,i?(0,ew.jsx)(uD,{}):null,t]}),(0,ew.jsxs)("div",{className:"flex items-center gap-1",children:[a,(0,ew.jsx)(sn,{condition:e=>!e.thread.isRunning,children:(0,ew.jsx)(l0.Send,{asChild:!0,children:(0,ew.jsx)(r9,{tooltip:r,side:"bottom",type:"button",variant:"default",size:"icon",className:"aui-composer-send size-8 rounded-full","aria-label":r,children:(0,ew.jsx)(l1,{className:"aui-composer-send-icon size-4"})})})}),(0,ew.jsx)(sn,{condition:e=>e.thread.isRunning,children:(0,ew.jsx)(l0.Cancel,{asChild:!0,children:(0,ew.jsx)(r5,{type:"button",variant:"default",size:"icon",className:"aui-composer-cancel size-8 rounded-full","aria-label":"停止生成",onClick:()=>{o()},children:(0,ew.jsx)(l2,{className:"aui-composer-cancel-icon size-3 fill-current"})})})})]})]})};function cA(){let{provider:e,workspacePath:t}=aq(),r=rS(e=>e.threadListItem.remoteId),n=rS(e=>e.threads.mainThreadId),i=r??n;return(0,ek.useCallback)(()=>{a1.cancelChat({threadId:i,provider:e,workspacePath:t})},[e,i,t])}let cR=rB("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]]);function cP(e){return e.title||(e.target.label?e.target.label:"web-element"===e.target.type?e.target.elementId||e.target.selector||e.target.url||"网页":"canvas-element"===e.target.type?e.target.elementId||e.target.elementType||e.target.canvasId||e.target.filePath||"画布":e.target.filePath||e.target.quote||"文本")||e.body}let cO=()=>{let{contextBundle:e,removeContextItems:t,workspacePath:r}=aq(),n=e.items.filter(e=>!0!==e.hidden);return 0===n.length?null:(0,ew.jsx)("div",{className:"flex min-h-11 w-full items-center",children:(0,ew.jsx)("div",{className:"flex w-full flex-wrap items-center gap-1.5 px-1",children:n.map(e=>{let n=e.id;if(!n)return null;let i=function(e){if("file"===e.kind)return e.name||e.path.split(/[\\/]/).filter(Boolean).at(-1)||e.path;return cP(e)}(e),a="file"===e.kind?function(e,t){var r;let n=e.path.trim();if(!n||(r=n).startsWith("/")||r.startsWith("\\\\")||/^[A-Za-z]:[\\/]/.test(r)||!t)return n||e.path;let i=t.replace(/[\\/]+$/g,""),a=n.replace(/^[\\/]+/g,""),o=i.includes("\\")&&!i.includes("/")?"\\":"/";return`${i}${o}${a}`}(e,r):cP(e),o="file"===e.kind?cr:cR;return(0,ew.jsxs)(r3.Tooltip,{children:[(0,ew.jsx)(r3.TooltipTrigger,{asChild:!0,children:(0,ew.jsxs)("div",{className:"inline-flex max-w-full items-center gap-1.5 rounded-md border bg-muted/50 px-2 py-1 text-muted-foreground text-xs",children:[(0,ew.jsx)(o,{className:"size-3.5 shrink-0"}),(0,ew.jsx)("span",{className:"min-w-0 max-w-48 truncate",children:i}),(0,ew.jsx)(r5,{type:"button",variant:"ghost",size:"icon-xs",className:"-me-1 size-5 rounded-sm text-muted-foreground hover:text-foreground","aria-label":"移除上下文",onClick:()=>t([n]),children:(0,ew.jsx)(r8,{className:"size-3"})})]})}),(0,ew.jsx)(r3.TooltipContent,{side:"top",className:"whitespace-pre-wrap break-normal text-left [overflow-wrap:anywhere]",style:{width:"max-content",maxWidth:"min(28rem, calc(100vw - 2rem))",textWrap:"wrap"},children:"file"===e.kind?(function(e){let t=[],r=0;for(let n=0;n<e.length;n+=1){let i=e[n];("/"===i||"\\"===i)&&(t.push(e.slice(r,n+1)),r=n+1)}if(r<e.length&&t.push(e.slice(r)),0===t.length)return[e];let n=[],i="";for(let e of t){if(i&&i.length+e.length>42&&(n.push(i),i=""),e.length<=42){i+=e;continue}for(let t=0;t<e.length;t+=42){let r=e.slice(t,t+42);i&&(n.push(i),i=""),42===r.length?n.push(r):i=r}}return i&&n.push(i),n})(a).join("\n"):a})]},n)})})})};e.s([],78481),e.i(78481);let cM=(0,ek.forwardRef)((e,t)=>{let r=rS(e=>e.suggestion.title);return(0,ew.jsx)(rk.span,{...e,ref:t,children:e.children??r})});cM.displayName="SuggestionPrimitive.Title";let cz=(0,ek.forwardRef)((e,t)=>{let r=rS(e=>e.suggestion.label);return(0,ew.jsx)(rk.span,{...e,ref:t,children:e.children??r})});cz.displayName="SuggestionPrimitive.Description";let cD=rP("SuggestionPrimitive.Trigger",({send:e,clearComposer:t=!0})=>{let r=tU(),n=rS(e=>e.thread.isDisabled),i=rS(e=>e.suggestion.prompt),a=e??!1,o=(0,ek.useCallback)(()=>{let e=r.thread().getState().isRunning;if(a&&!e)r.thread().append({content:[{type:"text",text:i}],runConfig:r.composer().getState().runConfig}),t&&r.composer().setText("");else if(t)r.composer().setText(i);else{let e=r.composer().getState().text;r.composer().setText(e.trim()?`${e} ${i}`:i)}},[r,a,t,i]);return n?null:o},["send","clearComposer"]);e.s(["Description",0,cz,"Title",0,cM,"Trigger",0,cD],87448);var cU=e.i(87448),cU=cU,sD=sD;let cL=({isHistoryRoute:e})=>e?(0,ew.jsx)(cF,{}):(0,ew.jsx)(cZ,{}),cZ=()=>(0,ew.jsxs)("div",{className:"aui-thread-welcome-root my-auto flex grow flex-col",children:[(0,ew.jsx)("div",{className:"aui-thread-welcome-center flex w-full grow flex-col items-center justify-center",children:(0,ew.jsxs)("div",{className:"aui-thread-welcome-message flex size-full flex-col justify-center px-4",children:[(0,ew.jsx)("h1",{className:"aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both font-semibold text-2xl duration-200",children:"准备好了"}),(0,ew.jsx)("p",{className:"aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-muted-foreground text-xl delay-75 duration-200",children:"发来你的想法,我们一起开始。"})]})}),(0,ew.jsx)(cV,{})]}),cF=()=>(0,ew.jsx)("div",{className:"aui-thread-welcome-root my-auto flex grow flex-col",children:(0,ew.jsx)("div",{className:"aui-thread-welcome-center flex w-full grow flex-col items-center justify-center",children:(0,ew.jsxs)("div",{className:"aui-thread-welcome-message flex size-full flex-col justify-center px-4",children:[(0,ew.jsx)("h1",{className:"aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both font-semibold text-2xl duration-200",children:"还没有可显示的回复"}),(0,ew.jsx)("p",{className:"aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-muted-foreground text-xl delay-75 duration-200",children:"你可以继续发送消息,我会接着帮你处理。"})]})})}),cB=()=>(0,ew.jsx)("div",{className:"aui-thread-welcome-root my-auto flex grow flex-col",children:(0,ew.jsx)("div",{className:"aui-thread-welcome-center flex w-full grow flex-col items-center justify-center",children:(0,ew.jsxs)("div",{className:"aui-thread-welcome-message flex size-full flex-col justify-center px-4",children:[(0,ew.jsx)("h1",{className:"aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both font-semibold text-2xl duration-200",children:"正在打开对话"}),(0,ew.jsx)("p",{className:"aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-muted-foreground text-xl delay-75 duration-200",children:"稍等一下,正在整理记录。"})]})})}),cV=()=>(0,ew.jsx)("div",{className:"aui-thread-welcome-suggestions grid w-full @md:grid-cols-2 gap-2 pb-4",children:(0,ew.jsx)(sD.Suggestions,{children:()=>(0,ew.jsx)(cq,{})})}),cq=()=>(0,ew.jsx)("div",{className:"aui-thread-welcome-suggestion-display fade-in slide-in-from-bottom-2 @md:nth-[n+3]:block nth-[n+3]:hidden animate-in fill-mode-both duration-200",children:(0,ew.jsx)(cU.Trigger,{send:!0,asChild:!0,children:(0,ew.jsxs)(r5,{variant:"ghost",className:"aui-thread-welcome-suggestion h-auto w-full @md:flex-col flex-wrap items-start justify-start gap-1 rounded-3xl border bg-background px-4 py-3 text-start text-sm transition-colors hover:bg-muted",children:[(0,ew.jsx)(cU.Title,{className:"aui-thread-welcome-suggestion-text-1 font-medium"}),(0,ew.jsx)(cU.Description,{className:"aui-thread-welcome-suggestion-text-2 text-muted-foreground empty:hidden"})]})})});var sD=sD;e.s([],73503),e.i(73503);var cW=Symbol("radix.slottable");function cJ(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===cW}var cH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(cJ);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,ew.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,ew.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ew.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{});function cK(e){var t;let r,n=(t=e,(r=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${t}.SlotClone`,r),i=ek.forwardRef((e,t)=>{let{children:r,...i}=e,a=ek.Children.toArray(r),o=a.find(cY);if(o){let e=o.props.children,r=a.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,ew.jsx)(n,{...i,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,ew.jsx)(n,{...i,ref:t,children:r})});return i.displayName=`${e}.Slot`,i}var cG=Symbol("radix.slottable");function cY(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===cG}function cX(e){let t=e+"CollectionProvider",[r,n]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,ew.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(t),[i,a]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:r}=e,n=ek.default.useRef(null),a=ek.default.useRef(new Map).current;return(0,ew.jsx)(i,{scope:t,itemMap:a,collectionRef:n,children:r})};o.displayName=t;let s=e+"CollectionSlot",l=cK(s),u=ek.default.forwardRef((e,t)=>{let{scope:r,children:n}=e,i=a(s,r),o=(0,rh.useComposedRefs)(t,i.collectionRef);return(0,ew.jsx)(l,{ref:o,children:n})});u.displayName=s;let d=e+"CollectionItemSlot",c="data-radix-collection-item",p=cK(d),m=ek.default.forwardRef((e,t)=>{let{scope:r,children:n,...i}=e,o=ek.default.useRef(null),s=(0,rh.useComposedRefs)(t,o),l=a(d,r);return ek.default.useEffect(()=>(l.itemMap.set(o,{ref:o,...i}),()=>void l.itemMap.delete(o))),(0,ew.jsx)(p,{...{[c]:""},ref:s,children:n})});return m.displayName=d,[{Provider:o,Slot:u,ItemSlot:m},function(t){let r=a(e+"CollectionConsumer",t);return ek.default.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${c}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])},n]}var cQ=new WeakMap;function c0(e,t){var r,n;let i,a,o;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let s=(r=e,n=t,i=r.length,(o=(a=c1(n))>=0?a:i+a)<0||o>=i?-1:o);return -1===s?void 0:e[s]}function c1(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],cQ.set(this,!0)}set(e,t){return cQ.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let n,i=this.has(t),a=this.#e.length,o=c1(e),s=o>=0?o:a+o,l=s<0||s>=a?-1:s;if(l===this.size||i&&l===this.size-1||-1===l)return this.set(t,r),this;let u=this.size+ +!i;o<0&&s++;let d=[...this.#e],c=!1;for(let e=s;e<u;e++)if(s===e){let a=d[e];d[e]===t&&(a=d[e+1]),i&&this.delete(t),n=this.get(a),this.set(t,r)}else{c||d[e-1]!==t||(c=!0);let r=d[c?e:e-1],i=n;n=this.get(r),this.delete(r),this.set(r,i)}return this}with(t,r,n){let i=new e(this);return i.insert(t,r,n),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n,t,r)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=c0(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=c0(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return c0(this.#e,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.at(n)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.keyAt(n)}find(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return n;r++}}findIndex(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return r;r++}return -1}filter(t,r){let n=[],i=0;for(let e of this)Reflect.apply(t,r,[e,i,this])&&n.push(e),i++;return new e(n)}map(t,r){let n=[],i=0;for(let e of this)n.push([e[0],Reflect.apply(t,r,[e,i,this])]),i++;return new e(n)}reduce(...e){let[t,r]=e,n=0,i=r??this.at(0);for(let r of this)i=0===n&&1===e.length?r:Reflect.apply(t,this,[i,r,n,this]),n++;return i}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let i=this.at(r);n=r===this.size-1&&1===e.length?i:Reflect.apply(t,this,[n,i,r,this])}return n}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),n=this.get(r);t.set(r,n)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let n=new e,i=this.size-1;if(void 0===t)return n;t<0&&(t+=this.size),void 0!==r&&r>0&&(i=r-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),r=this.get(t);n.set(t,r)}return n}every(e,t){let r=0;for(let n of this){if(!Reflect.apply(e,t,[n,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return!0;r++}return!1}});var c2=ek.createContext(void 0);function c4(e){let t=ek.useContext(c2);return e||t||"ltr"}var c6=e.i(53660);function c5(e){var t;let r,n=(t=e,(r=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${t}.SlotClone`,r),i=ek.forwardRef((e,t)=>{let{children:r,...i}=e,a=ek.Children.toArray(r),o=a.find(c9);if(o){let e=o.props.children,r=a.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,ew.jsx)(n,{...i,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,ew.jsx)(n,{...i,ref:t,children:r})});return i.displayName=`${e}.Slot`,i}var c3=Symbol("radix.slottable");function c9(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===c3}var c8=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=c5(`Primitive.${t}`),n=ek.forwardRef((e,n)=>{let{asChild:i,...a}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ew.jsx)(i?r:t,{...a,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),c7=Symbol("radix.slottable");function pe(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===c7}var pt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(pe);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,ew.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,ew.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ew.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),pr="rovingFocusGroup.onEntryFocus",pn={bubbles:!1,cancelable:!0},pi="RovingFocusGroup",[pa,po,ps]=cX(pi),[pl,pu]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,ew.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(pi,[ps]),[pd,pc]=pl(pi),pp=ek.forwardRef((e,t)=>(0,ew.jsx)(pa.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,ew.jsx)(pa.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,ew.jsx)(pm,{...e,ref:t})})}));pp.displayName=pi;var pm=ek.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...c}=e,p=ek.useRef(null),m=(0,rh.useComposedRefs)(t,p),f=c4(a),[h,g]=(0,ne.useControllableState)({prop:o,defaultProp:s??null,onChange:l,caller:pi}),[v,y]=ek.useState(!1),b=(0,na.useCallbackRef)(u),x=po(r),w=ek.useRef(!1),[_,k]=ek.useState(0);return ek.useEffect(()=>{let e=p.current;if(e)return e.addEventListener(pr,b),()=>e.removeEventListener(pr,b)},[b]),(0,ew.jsx)(pd,{scope:r,orientation:n,dir:f,loop:i,currentTabStopId:h,onItemFocus:ek.useCallback(e=>g(e),[g]),onItemShiftTab:ek.useCallback(()=>y(!0),[]),onFocusableItemAdd:ek.useCallback(()=>k(e=>e+1),[]),onFocusableItemRemove:ek.useCallback(()=>k(e=>e-1),[]),children:(0,ew.jsx)(pt.div,{tabIndex:v||0===_?-1:0,"data-orientation":n,...c,ref:m,style:{outline:"none",...e.style},onMouseDown:(0,rI.composeEventHandlers)(e.onMouseDown,()=>{w.current=!0}),onFocus:(0,rI.composeEventHandlers)(e.onFocus,e=>{let t=!w.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(pr,pn);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);pv([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),d)}}w.current=!1}),onBlur:(0,rI.composeEventHandlers)(e.onBlur,()=>y(!1))})})}),pf="RovingFocusGroupItem",ph=ek.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:a,children:o,...s}=e,l=(0,r7.useId)(),u=a||l,d=pc(pf,r),c=d.currentTabStopId===u,p=po(r),{onFocusableItemAdd:m,onFocusableItemRemove:f,currentTabStopId:h}=d;return ek.useEffect(()=>{if(n)return m(),()=>f()},[n,m,f]),(0,ew.jsx)(pa.ItemSlot,{scope:r,id:u,focusable:n,active:i,children:(0,ew.jsx)(pt.span,{tabIndex:c?0:-1,"data-orientation":d.orientation,...s,ref:t,onMouseDown:(0,rI.composeEventHandlers)(e.onMouseDown,e=>{n?d.onItemFocus(u):e.preventDefault()}),onFocus:(0,rI.composeEventHandlers)(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:(0,rI.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void d.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,r){var n;let i=(n=e.key,"rtl"!==r?n:"ArrowLeft"===n?"ArrowRight":"ArrowRight"===n?"ArrowLeft":n);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(i))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(i)))return pg[i]}(e,d.orientation,d.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=p().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)i.reverse();else if("prev"===t||"next"===t){var r,n;"prev"===t&&i.reverse();let a=i.indexOf(e.currentTarget);i=d.loop?(r=i,n=a+1,r.map((e,t)=>r[(n+t)%r.length])):i.slice(a+1)}setTimeout(()=>pv(i))}}),children:"function"==typeof o?o({isCurrentTabStop:c,hasTabStop:null!=h}):o})})});ph.displayName=pf;var pg={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function pv(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}var py=["Enter"," "],pb=["ArrowUp","PageDown","End"],px=["ArrowDown","PageUp","Home",...pb],pw={ltr:[...py,"ArrowRight"],rtl:[...py,"ArrowLeft"]},p_={ltr:["ArrowLeft"],rtl:["ArrowRight"]},pk="Menu",[pI,pS,p$]=cX(pk),[pj,pE]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,ew.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(pk,[p$,c6.createPopperScope,pu]),pT=(0,c6.createPopperScope)(),pC=pu(),[pN,pA]=pj(pk),[pR,pP]=pj(pk),pO=e=>{let{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:a,modal:o=!0}=e,s=pT(t),[l,u]=ek.useState(null),d=ek.useRef(!1),c=(0,na.useCallbackRef)(a),p=c4(i);return ek.useEffect(()=>{let e=()=>{d.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>d.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,ew.jsx)(c6.Root,{...s,children:(0,ew.jsx)(pN,{scope:t,open:r,onOpenChange:c,content:l,onContentChange:u,children:(0,ew.jsx)(pR,{scope:t,onClose:ek.useCallback(()=>c(!1),[c]),isUsingKeyboardRef:d,dir:p,modal:o,children:n})})})};pO.displayName=pk;var pM=ek.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,i=pT(r);return(0,ew.jsx)(c6.Anchor,{...i,...n,ref:t})});pM.displayName="MenuAnchor";var pz="MenuPortal",[pD,pU]=pj(pz,{forceMount:void 0}),pL=e=>{let{__scopeMenu:t,forceMount:r,children:n,container:i}=e,a=pA(pz,t);return(0,ew.jsx)(pD,{scope:t,forceMount:r,children:(0,ew.jsx)(ng.Presence,{present:r||a.open,children:(0,ew.jsx)(nh.Portal,{asChild:!0,container:i,children:n})})})};pL.displayName=pz;var pZ="MenuContent",[pF,pB]=pj(pZ),pV=ek.forwardRef((e,t)=>{let r=pU(pZ,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,a=pA(pZ,e.__scopeMenu),o=pP(pZ,e.__scopeMenu);return(0,ew.jsx)(pI.Provider,{scope:e.__scopeMenu,children:(0,ew.jsx)(ng.Presence,{present:n||a.open,children:(0,ew.jsx)(pI.Slot,{scope:e.__scopeMenu,children:o.modal?(0,ew.jsx)(pq,{...i,ref:t}):(0,ew.jsx)(pW,{...i,ref:t})})})})}),pq=ek.forwardRef((e,t)=>{let r=pA(pZ,e.__scopeMenu),n=ek.useRef(null),i=(0,rh.useComposedRefs)(t,n);return ek.useEffect(()=>{let e=n.current;if(e)return io(e)},[]),(0,ew.jsx)(pH,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:(0,rI.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),pW=ek.forwardRef((e,t)=>{let r=pA(pZ,e.__scopeMenu);return(0,ew.jsx)(pH,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),pJ=c5("MenuContent.ScrollLock"),pH=ek.forwardRef((e,t)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:c,onInteractOutside:p,onDismiss:m,disableOutsideScroll:f,...h}=e,g=pA(pZ,r),v=pP(pZ,r),y=pT(r),b=pC(r),x=pS(r),[w,_]=ek.useState(null),k=ek.useRef(null),I=(0,rh.useComposedRefs)(t,k,g.onContentChange),S=ek.useRef(0),$=ek.useRef(""),j=ek.useRef(0),E=ek.useRef(null),T=ek.useRef("right"),C=ek.useRef(0),N=f?n8:ek.Fragment;ek.useEffect(()=>()=>window.clearTimeout(S.current),[]),n_();let A=ek.useCallback(e=>{var t,r;return T.current===E.current?.side&&(t=e,!!(r=E.current?.area)&&function(e,t){let{x:r,y:n}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],l=o.x,u=o.y,d=s.x,c=s.y;u>n!=c>n&&r<(d-l)*(n-u)/(c-u)+l&&(i=!i)}return i}({x:t.clientX,y:t.clientY},r))},[]);return(0,ew.jsx)(pF,{scope:r,searchRef:$,onItemEnter:ek.useCallback(e=>{A(e)&&e.preventDefault()},[A]),onItemLeave:ek.useCallback(e=>{A(e)||(k.current?.focus(),_(null))},[A]),onTriggerLeave:ek.useCallback(e=>{A(e)&&e.preventDefault()},[A]),pointerGraceTimerRef:j,onPointerGraceIntentChange:ek.useCallback(e=>{E.current=e},[]),children:(0,ew.jsx)(N,{...f?{as:pJ,allowPinchZoom:!0}:void 0,children:(0,ew.jsx)(nu,{asChild:!0,trapped:i,onMountAutoFocus:(0,rI.composeEventHandlers)(a,e=>{e.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,ew.jsx)(nt.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:c,onInteractOutside:p,onDismiss:m,children:(0,ew.jsx)(pp,{asChild:!0,...b,dir:v.dir,orientation:"vertical",loop:n,currentTabStopId:w,onCurrentTabStopIdChange:_,onEntryFocus:(0,rI.composeEventHandlers)(l,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,ew.jsx)(c6.Content,{role:"menu","aria-orientation":"vertical","data-state":mp(g.open),"data-radix-menu-content":"",dir:v.dir,...y,...h,ref:I,style:{outline:"none",...h.style},onKeyDown:(0,rI.composeEventHandlers)(h.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,r=e.ctrlKey||e.altKey||e.metaKey,n=1===e.key.length;if(t){var i;let t,a,o,s,l,u;"Tab"===e.key&&e.preventDefault(),!r&&n&&(i=e.key,t=$.current+i,a=x().filter(e=>!e.disabled),o=document.activeElement,s=a.find(e=>e.ref.current===o)?.textValue,l=function(e,t,r){var n;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=r?e.indexOf(r):-1,o=(n=Math.max(a,0),e.map((t,r)=>e[(n+r)%e.length]));1===i.length&&(o=o.filter(e=>e!==r));let s=o.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return s!==r?s:void 0}(a.map(e=>e.textValue),t,s),u=a.find(e=>e.textValue===l)?.ref.current,function e(t){$.current=t,window.clearTimeout(S.current),""!==t&&(S.current=window.setTimeout(()=>e(""),1e3))}(t),u&&setTimeout(()=>u.focus()))}let a=k.current;if(e.target!==a||!px.includes(e.key))return;e.preventDefault();let o=x().filter(e=>!e.disabled).map(e=>e.ref.current);pb.includes(e.key)&&o.reverse(),function(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}(o)}),onBlur:(0,rI.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(S.current),$.current="")}),onPointerMove:(0,rI.composeEventHandlers)(e.onPointerMove,mh(e=>{let t=e.target,r=C.current!==e.clientX;e.currentTarget.contains(t)&&r&&(T.current=e.clientX>C.current?"right":"left",C.current=e.clientX)}))})})})})})})});pV.displayName=pZ;var pK=ek.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,ew.jsx)(c8.div,{role:"group",...n,ref:t})});pK.displayName="MenuGroup";var pG=ek.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,ew.jsx)(c8.div,{...n,ref:t})});pG.displayName="MenuLabel";var pY="MenuItem",pX="menu.itemSelect",pQ=ek.forwardRef((e,t)=>{let{disabled:r=!1,onSelect:n,...i}=e,a=ek.useRef(null),o=pP(pY,e.__scopeMenu),s=pB(pY,e.__scopeMenu),l=(0,rh.useComposedRefs)(t,a),u=ek.useRef(!1);return(0,ew.jsx)(p0,{...i,ref:l,disabled:r,onClick:(0,rI.composeEventHandlers)(e.onClick,()=>{let e=a.current;if(!r&&e){let t=new CustomEvent(pX,{bubbles:!0,cancelable:!0});e.addEventListener(pX,e=>n?.(e),{once:!0}),e&&rf.flushSync(()=>e.dispatchEvent(t)),t.defaultPrevented?u.current=!1:o.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:(0,rI.composeEventHandlers)(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:(0,rI.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==s.searchRef.current;r||t&&" "===e.key||py.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});pQ.displayName=pY;var p0=ek.forwardRef((e,t)=>{let{__scopeMenu:r,disabled:n=!1,textValue:i,...a}=e,o=pB(pY,r),s=pC(r),l=ek.useRef(null),u=(0,rh.useComposedRefs)(t,l),[d,c]=ek.useState(!1),[p,m]=ek.useState("");return ek.useEffect(()=>{let e=l.current;e&&m((e.textContent??"").trim())},[a.children]),(0,ew.jsx)(pI.ItemSlot,{scope:r,disabled:n,textValue:i??p,children:(0,ew.jsx)(ph,{asChild:!0,...s,focusable:!n,children:(0,ew.jsx)(c8.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...a,ref:u,onPointerMove:(0,rI.composeEventHandlers)(e.onPointerMove,mh(e=>{n?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,rI.composeEventHandlers)(e.onPointerLeave,mh(e=>o.onItemLeave(e))),onFocus:(0,rI.composeEventHandlers)(e.onFocus,()=>c(!0)),onBlur:(0,rI.composeEventHandlers)(e.onBlur,()=>c(!1))})})})}),p1=ek.forwardRef((e,t)=>{let{checked:r=!1,onCheckedChange:n,...i}=e;return(0,ew.jsx)(p7,{scope:e.__scopeMenu,checked:r,children:(0,ew.jsx)(pQ,{role:"menuitemcheckbox","aria-checked":mm(r)?"mixed":r,...i,ref:t,"data-state":mf(r),onSelect:(0,rI.composeEventHandlers)(i.onSelect,()=>n?.(!!mm(r)||!r),{checkForDefaultPrevented:!1})})})});p1.displayName="MenuCheckboxItem";var p2="MenuRadioGroup",[p4,p6]=pj(p2,{value:void 0,onValueChange:()=>{}}),p5=ek.forwardRef((e,t)=>{let{value:r,onValueChange:n,...i}=e,a=(0,na.useCallbackRef)(n);return(0,ew.jsx)(p4,{scope:e.__scopeMenu,value:r,onValueChange:a,children:(0,ew.jsx)(pK,{...i,ref:t})})});p5.displayName=p2;var p3="MenuRadioItem",p9=ek.forwardRef((e,t)=>{let{value:r,...n}=e,i=p6(p3,e.__scopeMenu),a=r===i.value;return(0,ew.jsx)(p7,{scope:e.__scopeMenu,checked:a,children:(0,ew.jsx)(pQ,{role:"menuitemradio","aria-checked":a,...n,ref:t,"data-state":mf(a),onSelect:(0,rI.composeEventHandlers)(n.onSelect,()=>i.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});p9.displayName=p3;var p8="MenuItemIndicator",[p7,me]=pj(p8,{checked:!1}),mt=ek.forwardRef((e,t)=>{let{__scopeMenu:r,forceMount:n,...i}=e,a=me(p8,r);return(0,ew.jsx)(ng.Presence,{present:n||mm(a.checked)||!0===a.checked,children:(0,ew.jsx)(c8.span,{...i,ref:t,"data-state":mf(a.checked)})})});mt.displayName=p8;var mr=ek.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,ew.jsx)(c8.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});mr.displayName="MenuSeparator";var mn=ek.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,i=pT(r);return(0,ew.jsx)(c6.Arrow,{...i,...n,ref:t})});mn.displayName="MenuArrow";var mi="MenuSub",[ma,mo]=pj(mi),ms=e=>{let{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,a=pA(mi,t),o=pT(t),[s,l]=ek.useState(null),[u,d]=ek.useState(null),c=(0,na.useCallbackRef)(i);return ek.useEffect(()=>(!1===a.open&&c(!1),()=>c(!1)),[a.open,c]),(0,ew.jsx)(c6.Root,{...o,children:(0,ew.jsx)(pN,{scope:t,open:n,onOpenChange:c,content:u,onContentChange:d,children:(0,ew.jsx)(ma,{scope:t,contentId:(0,r7.useId)(),triggerId:(0,r7.useId)(),trigger:s,onTriggerChange:l,children:r})})})};ms.displayName=mi;var ml="MenuSubTrigger",mu=ek.forwardRef((e,t)=>{let r=pA(ml,e.__scopeMenu),n=pP(ml,e.__scopeMenu),i=mo(ml,e.__scopeMenu),a=pB(ml,e.__scopeMenu),o=ek.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=a,u={__scopeMenu:e.__scopeMenu},d=ek.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return ek.useEffect(()=>d,[d]),ek.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),l(null)}},[s,l]),(0,ew.jsx)(pM,{asChild:!0,...u,children:(0,ew.jsx)(p0,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":mp(r.open),...e,ref:(0,rh.composeRefs)(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:(0,rI.composeEventHandlers)(e.onPointerMove,mh(t=>{a.onItemEnter(t),!t.defaultPrevented&&(e.disabled||r.open||o.current||(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100)))})),onPointerLeave:(0,rI.composeEventHandlers)(e.onPointerLeave,mh(e=>{d();let t=r.content?.getBoundingClientRect();if(t){let n=r.content?.dataset.side,i="right"===n,o=t[i?"left":"right"],l=t[i?"right":"left"];a.onPointerGraceIntentChange({area:[{x:e.clientX+(i?-5:5),y:e.clientY},{x:o,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:o,y:t.bottom}],side:n}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:(0,rI.composeEventHandlers)(e.onKeyDown,t=>{let i=""!==a.searchRef.current;e.disabled||i&&" "===t.key||pw[n.dir].includes(t.key)&&(r.onOpenChange(!0),r.content?.focus(),t.preventDefault())})})})});mu.displayName=ml;var md="MenuSubContent",mc=ek.forwardRef((e,t)=>{let r=pU(pZ,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,a=pA(pZ,e.__scopeMenu),o=pP(pZ,e.__scopeMenu),s=mo(md,e.__scopeMenu),l=ek.useRef(null),u=(0,rh.useComposedRefs)(t,l);return(0,ew.jsx)(pI.Provider,{scope:e.__scopeMenu,children:(0,ew.jsx)(ng.Presence,{present:n||a.open,children:(0,ew.jsx)(pI.Slot,{scope:e.__scopeMenu,children:(0,ew.jsx)(pH,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:u,align:"start",side:"rtl"===o.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,rI.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:(0,rI.composeEventHandlers)(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:(0,rI.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),r=p_[o.dir].includes(e.key);t&&r&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});function mp(e){return e?"open":"closed"}function mm(e){return"indeterminate"===e}function mf(e){return mm(e)?"indeterminate":e?"checked":"unchecked"}function mh(e){return t=>"mouse"===t.pointerType?e(t):void 0}mc.displayName=md;var mg="DropdownMenu",[mv,my]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,ew.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(mg,[pE]),mb=pE(),[mx,mw]=mv(mg),m_=e=>{let{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,l=mb(t),u=ek.useRef(null),[d,c]=(0,ne.useControllableState)({prop:i,defaultProp:a??!1,onChange:o,caller:mg});return(0,ew.jsx)(mx,{scope:t,triggerId:(0,r7.useId)(),triggerRef:u,contentId:(0,r7.useId)(),open:d,onOpenChange:c,onOpenToggle:ek.useCallback(()=>c(e=>!e),[c]),modal:s,children:(0,ew.jsx)(pO,{...l,open:d,onOpenChange:c,dir:n,modal:s,children:r})})};m_.displayName=mg;var mk="DropdownMenuTrigger",mI=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,a=mw(mk,r),o=mb(r);return(0,ew.jsx)(pM,{asChild:!0,...o,children:(0,ew.jsx)(cH.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...i,ref:(0,rh.composeRefs)(t,a.triggerRef),onPointerDown:(0,rI.composeEventHandlers)(e.onPointerDown,e=>{!n&&0===e.button&&!1===e.ctrlKey&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:(0,rI.composeEventHandlers)(e.onKeyDown,e=>{!n&&(["Enter"," "].includes(e.key)&&a.onOpenToggle(),"ArrowDown"===e.key&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});mI.displayName=mk;var mS=e=>{let{__scopeDropdownMenu:t,...r}=e,n=mb(t);return(0,ew.jsx)(pL,{...n,...r})};mS.displayName="DropdownMenuPortal";var m$="DropdownMenuContent",mj=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mw(m$,r),a=mb(r),o=ek.useRef(!1);return(0,ew.jsx)(pV,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...n,ref:t,onCloseAutoFocus:(0,rI.composeEventHandlers)(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:(0,rI.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;(!i.modal||n)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});mj.displayName=m$;var mE=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mb(r);return(0,ew.jsx)(pK,{...i,...n,ref:t})});mE.displayName="DropdownMenuGroup";var mT=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mb(r);return(0,ew.jsx)(pG,{...i,...n,ref:t})});mT.displayName="DropdownMenuLabel";var mC=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mb(r);return(0,ew.jsx)(pQ,{...i,...n,ref:t})});mC.displayName="DropdownMenuItem";var mN=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mb(r);return(0,ew.jsx)(p1,{...i,...n,ref:t})});mN.displayName="DropdownMenuCheckboxItem";var mA=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mb(r);return(0,ew.jsx)(p5,{...i,...n,ref:t})});mA.displayName="DropdownMenuRadioGroup";var mR=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mb(r);return(0,ew.jsx)(p9,{...i,...n,ref:t})});mR.displayName="DropdownMenuRadioItem";var mP=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mb(r);return(0,ew.jsx)(mt,{...i,...n,ref:t})});mP.displayName="DropdownMenuItemIndicator";var mO=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mb(r);return(0,ew.jsx)(mr,{...i,...n,ref:t})});mO.displayName="DropdownMenuSeparator";var mM=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mb(r);return(0,ew.jsx)(mn,{...i,...n,ref:t})});mM.displayName="DropdownMenuArrow";var mz=e=>{let{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:a}=e,o=mb(t),[s,l]=(0,ne.useControllableState)({prop:n,defaultProp:a??!1,onChange:i,caller:"DropdownMenuSub"});return(0,ew.jsx)(ms,{...o,open:s,onOpenChange:l,children:r})},mD=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mb(r);return(0,ew.jsx)(mu,{...i,...n,ref:t})});mD.displayName="DropdownMenuSubTrigger";var mU=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mb(r);return(0,ew.jsx)(mc,{...i,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});mU.displayName="DropdownMenuSubContent",e.s(["Arrow",0,mM,"CheckboxItem",0,mN,"Content",0,mj,"DropdownMenu",0,m_,"DropdownMenuArrow",0,mM,"DropdownMenuCheckboxItem",0,mN,"DropdownMenuContent",0,mj,"DropdownMenuGroup",0,mE,"DropdownMenuItem",0,mC,"DropdownMenuItemIndicator",0,mP,"DropdownMenuLabel",0,mT,"DropdownMenuPortal",0,mS,"DropdownMenuRadioGroup",0,mA,"DropdownMenuRadioItem",0,mR,"DropdownMenuSeparator",0,mO,"DropdownMenuSub",0,mz,"DropdownMenuSubContent",0,mU,"DropdownMenuSubTrigger",0,mD,"DropdownMenuTrigger",0,mI,"Group",0,mE,"Item",0,mC,"ItemIndicator",0,mP,"Label",0,mT,"Portal",0,mS,"RadioGroup",0,mA,"RadioItem",0,mR,"Root",0,m_,"Separator",0,mO,"Sub",0,mz,"SubContent",0,mU,"SubTrigger",0,mD,"Trigger",0,mI,"createDropdownMenuScope",0,my],40666);var mL=e.i(40666),mL=mL,mL=mL;let mZ=mL.createDropdownMenuScope(),mF=(0,ek.createContext)(null),mB=({__scopeActionBarMore:e,open:t,onOpenChange:r,...n})=>{let i=mZ(e),a=(0,ek.useContext)(mF),o=(0,ek.useRef)(null),s=void 0!==t,l=(0,ek.useCallback)(e=>{if(e){if(o.current)return;o.current=a?.acquireInteractionLock()??null;return}o.current?.(),o.current=null},[a]),u=(0,ek.useCallback)(e=>{s||l(e),r?.(e)},[s,l,r]);return(0,ek.useEffect)(()=>{s&&l(!!t)},[s,t,l]),(0,ek.useEffect)(()=>()=>{o.current?.(),o.current=null},[]),(0,ew.jsx)(mL.Root,{...i,...n,...void 0!==t?{open:t}:null,onOpenChange:u})};mB.displayName="ActionBarMorePrimitive.Root";var mL=mL;let mV=r_(mL.Trigger),mq=r_(mL.Content),mW=r_(mL.Item),mJ=r_(mL.Separator),mH=(0,ek.forwardRef)(({__scopeActionBarMore:e,...t},r)=>{let n=mZ(e);return(0,ew.jsx)(mV,{...n,...t,ref:r})});mH.displayName="ActionBarMorePrimitive.Trigger";var mL=mL;let mK=(0,ek.forwardRef)(({__scopeActionBarMore:e,portalProps:t,sideOffset:r=4,...n},i)=>{let a=mZ(e);return(0,ew.jsx)(mL.Portal,{...a,...t,children:(0,ew.jsx)(mq,{...a,...n,ref:i,sideOffset:r})})});mK.displayName="ActionBarMorePrimitive.Content";let mG=(0,ek.forwardRef)(({__scopeActionBarMore:e,...t},r)=>{let n=mZ(e);return(0,ew.jsx)(mW,{...n,...t,ref:r})});mG.displayName="ActionBarMorePrimitive.Item";let mY=(0,ek.forwardRef)(({__scopeActionBarMore:e,...t},r)=>{let n=mZ(e);return(0,ew.jsx)(mJ,{...n,...t,ref:r})});mY.displayName="ActionBarMorePrimitive.Separator",e.s(["Content",0,mK,"Item",0,mG,"Root",0,mB,"Separator",0,mY,"Trigger",0,mH],42941);var mX=e.i(42941),mX=mX;e.s([],14331),e.i(14331),(m=_||(_={})).Hidden="hidden",m.Floating="floating",m.Normal="normal";let mQ=(0,ek.forwardRef)(({hideWhenRunning:e,autohide:t,autohideFloat:r,...n},i)=>{let[a,o]=(0,ek.useState)(0),s=(0,ek.useCallback)(()=>{let e=!1;return o(e=>e+1),()=>{e||(e=!0,o(e=>Math.max(0,e-1)))}},[]),l=(0,ek.useMemo)(()=>({acquireInteractionLock:s}),[s]),u=(({hideWhenRunning:e,autohide:t,autohideFloat:r,forceVisible:n})=>rS(i=>{if(e&&i.thread.isRunning)return _.Hidden;let a="always"===t||"not-last"===t&&!i.message.isLast,o=n||i.message.isHovering;return a?o?"always"===r||"single-branch"===r&&i.message.branchCount<=1?_.Floating:_.Normal:_.Hidden:_.Normal}))({hideWhenRunning:e,autohide:t,autohideFloat:r,forceVisible:a>0});return u===_.Hidden?null:(0,ew.jsx)(mF.Provider,{value:l,children:(0,ew.jsx)(rk.div,{...u===_.Floating?{"data-floating":"true"}:null,...n,ref:i})})});mQ.displayName="ActionBarPrimitive.Root";let m0=(0,ek.forwardRef)(({copiedDuration:e,onClick:t,disabled:r,...n},i)=>{let a=rS(e=>e.message.isCopied),o=(({copiedDuration:e=3e3}={})=>{let{copy:t,disabled:r}=(({copiedDuration:e=3e3,copyToClipboard:t}={})=>{let r=tU(),n=rS(e=>!(("assistant"!==e.message.role||e.message.status?.type!=="running")&&e.message.parts.some(e=>"text"===e.type&&e.text.length>0))),i=rS(e=>e.message.isCopied),a=rS(e=>e.composer.isEditing),o=rS(e=>e.composer.text);return{copy:(0,ek.useCallback)(()=>{let n=a?o:r.message().getCopyText();n&&Promise.resolve((t??(()=>{}))(n)).then(()=>{r.message().setIsCopied(!0),setTimeout(()=>r.message().setIsCopied(!1),e)},()=>{})},[r,a,o,e,t]),disabled:n,isCopied:i}})({copiedDuration:e,copyToClipboard:e=>"u"<typeof navigator||!navigator.clipboard?Promise.reject(Error("Clipboard API is unavailable")):navigator.clipboard.writeText(e)});return r?null:t})({copiedDuration:e});return(0,ew.jsx)(rk.button,{type:"button",...a?{"data-copied":"true"}:{},...n,ref:i,disabled:r||!o,onClick:(0,rI.composeEventHandlers)(t,()=>{o?.()})})});m0.displayName="ActionBarPrimitive.Copy";let m1=rP("ActionBarPrimitive.Reload",()=>{let e,t,{disabled:r,reload:n}=(e=tU(),t=rS(e=>e.thread.isRunning||e.thread.isDisabled||"assistant"!==e.message.role),{reload:(0,ek.useCallback)(()=>{e.message().reload()},[e]),disabled:t});return r?null:n}),m2=rP("ActionBarPrimitive.Edit",()=>{let e,t,{disabled:r,edit:n}=(e=tU(),t=rS(e=>e.composer.isEditing),{edit:(0,ek.useCallback)(()=>{e.composer().beginEdit()},[e]),disabled:t});return r?null:n}),m4=rP("ActionBarPrimitive.Speak",()=>{let e,t,{disabled:r,speak:n}=(e=tU(),t=rS(e=>!(("assistant"!==e.message.role||e.message.status?.type!=="running")&&e.message.parts.some(e=>"text"===e.type&&e.text.length>0))),{speak:(0,ek.useCallback)(async()=>{e.message().speak()},[e]),disabled:t});return r?null:n}),m6=(0,ek.forwardRef)((e,t)=>{let r=(()=>{let e,t,{disabled:r,stopSpeaking:n}=(e=tU(),t=rS(e=>null==e.message.speech),{stopSpeaking:(0,ek.useCallback)(()=>{e.message().stopSpeaking()},[e]),disabled:t});return r?null:n})();return(0,s9.useEscapeKeydown)(e=>{r&&(e.preventDefault(),r())}),(0,ew.jsx)(rk.button,{type:"button",disabled:!r,...e,ref:t,onClick:(0,rI.composeEventHandlers)(e.onClick,()=>{r?.()})})});m6.displayName="ActionBarPrimitive.StopSpeaking";let m5=(0,ek.forwardRef)(({onClick:e,disabled:t,...r},n)=>{let i=rS(e=>e.message.metadata.submittedFeedback?.type==="positive"),a=(()=>{let e,t,{submit:r}=(e=tU(),t=rS(e=>e.message.metadata.submittedFeedback?.type==="positive"),{submit:(0,ek.useCallback)(()=>{e.message().submitFeedback({type:"positive"})},[e]),isSubmitted:t});return r})();return(0,ew.jsx)(rk.button,{type:"button",...i?{"data-submitted":"true"}:{},...r,ref:n,disabled:t||!a,onClick:(0,rI.composeEventHandlers)(e,()=>{a?.()})})});m5.displayName="ActionBarPrimitive.FeedbackPositive";let m3=(0,ek.forwardRef)(({onClick:e,disabled:t,...r},n)=>{let i=rS(e=>e.message.metadata.submittedFeedback?.type==="negative"),a=(()=>{let e,t,{submit:r}=(e=tU(),t=rS(e=>e.message.metadata.submittedFeedback?.type==="negative"),{submit:(0,ek.useCallback)(()=>{e.message().submitFeedback({type:"negative"})},[e]),isSubmitted:t});return r})();return(0,ew.jsx)(rk.button,{type:"button",...i?{"data-submitted":"true"}:{},...r,ref:n,disabled:t||!a,onClick:(0,rI.composeEventHandlers)(e,()=>{a?.()})})});m3.displayName="ActionBarPrimitive.FeedbackNegative";let m9=(0,ek.forwardRef)(({filename:e,onExport:t,onClick:r,disabled:n,...i},a)=>{let o=(({filename:e,onExport:t}={})=>{let r=tU(),n=rS(e=>("assistant"!==e.message.role||e.message.status?.type!=="running")&&e.message.parts.some(e=>"text"===e.type&&e.text.length>0)),i=(0,ek.useCallback)(async()=>{let n=r.message().getCopyText();if(!n)return;if(t)return void await t(n);let i=new Blob([n],{type:"text/markdown"}),a=URL.createObjectURL(i),o=document.createElement("a");o.href=a,o.download=e??`message-${Date.now()}.md`,o.click(),URL.revokeObjectURL(a)},[r,e,t]);return n?i:null})({filename:e,onExport:t});return(0,ew.jsx)(rk.button,{type:"button",...i,ref:a,disabled:n||!o,onClick:(0,rI.composeEventHandlers)(r,()=>{o?.()})})});m9.displayName="ActionBarPrimitive.ExportMarkdown",e.s(["Copy",0,m0,"Edit",0,m2,"ExportMarkdown",0,m9,"FeedbackNegative",0,m3,"FeedbackPositive",0,m5,"Reload",0,m1,"Root",0,mQ,"Speak",0,m4,"StopSpeaking",0,m6],24895);var m8=e.i(24895),m8=m8;e.s([],29764),e.i(29764);let m7=rP("BranchPickerPrimitive.Next",()=>{let e,t,{disabled:r,next:n}=(e=tU(),t=rS(e=>!!(e.message.branchNumber>=e.message.branchCount)||!!e.thread.isRunning&&!e.thread.capabilities.switchBranchDuringRun),{next:(0,ek.useCallback)(()=>{e.message().switchToBranch({position:"next"})},[e]),disabled:t});return r?null:n}),fe=rP("BranchPickerPrimitive.Previous",()=>{let e,t,{disabled:r,previous:n}=(e=tU(),t=rS(e=>!!(e.message.branchNumber<=1)||!!e.thread.isRunning&&!e.thread.capabilities.switchBranchDuringRun),{previous:(0,ek.useCallback)(()=>{e.message().switchToBranch({position:"previous"})},[e]),disabled:t});return r?null:n}),ft=()=>{let e=rS(e=>e.message.branchCount);return(0,ew.jsx)(ew.Fragment,{children:e})};ft.displayName="BranchPickerPrimitive.Count";let fr=()=>{let e=rS(e=>e.message.branchNumber);return(0,ew.jsx)(ew.Fragment,{children:e})};fr.displayName="BranchPickerPrimitive.Number";let fn=(0,ek.forwardRef)(({hideWhenSingleBranch:e,...t},r)=>(0,ew.jsx)(dR,{hasBranches:!!e||void 0,children:(0,ew.jsx)(rk.div,{...t,ref:r})}));fn.displayName="BranchPickerPrimitive.Root",e.s(["Count",0,ft,"Next",0,m7,"Number",0,fr,"Previous",0,fe,"Root",0,fn],18443);var fi=e.i(18443),fi=fi,l0=l0;e.s([],87572),e.i(87572);let fa=(0,ek.forwardRef)((e,t)=>(0,ew.jsx)(rk.div,{role:"alert",...e,ref:t}));fa.displayName="ErrorPrimitive.Root";let fo=(0,ek.forwardRef)(({children:e,...t},r)=>{let n=dL();return void 0===n?null:(0,ew.jsx)(rk.span,{...t,ref:r,children:e??String(n)})});fo.displayName="ErrorPrimitive.Message",e.s(["Message",0,fo,"Root",0,fa],73703);var fs=e.i(73703),fs=fs,ct=ct;let fl=rB("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),fu=rB("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]),fd=rB("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),fc=rB("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),fp=rB("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),fm=rB("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);function ff({className:e,type:t,...r}){return(0,ew.jsx)("input",{type:t,"data-slot":"input",className:(0,r4.cn)("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",e),...r})}let fh="__acp_ui_custom_input__";function fg(e){return Array.isArray(e)?e:e?[e]:[]}function fv(e,t){return"multi"===t?e:e[0]??null}function fy({id:e,options:t,selectionMode:r="multi",value:n,defaultValue:i,choice:a,minSelections:o=1,maxSelections:s,actions:l=[{id:"cancel",label:"取消",variant:"outline"},{id:"confirm",label:"确认"}],onChange:u,onAction:d,onBeforeAction:c,isActionDisabled:p,allowCustomInput:m=!1,customInputLabel:f="自定义",showRecommendedBadge:h=!0,className:g}){let v=void 0!==n,y=void 0!==a,[b,x]=(0,ek.useState)(fg(i)),[w,_]=(0,ek.useState)(""),k=(0,ek.useRef)([]),I=(0,ek.useMemo)(()=>!m||y?t:[...t,{id:fh,label:f}],[m,f,y,t]),S=(0,ek.useMemo)(()=>y?fg(a):v?fg(n):b,[a,b,v,y,n]),$=(0,ek.useMemo)(()=>new Set(S),[S]),j=y?I.filter(e=>$.has(e.id)):I,E=(0,ek.useMemo)(()=>{let e=w.trim(),t=S.filter(e=>e!==fh);return $.has(fh)&&e?"single"===r?e:[...t,e]:fv(t,r)},[w,S,$,r]),T=null===E?0:Array.isArray(E)?E.length:1,C=T>=o&&(void 0===s||T<=s),N=(0,ek.useCallback)(e=>{let t=fv(e,r);v||x(e),u?.(t)},[v,u,r]),A=(0,ek.useCallback)(e=>{if(y||e.disabled)return;if("single"===r)return void N($.has(e.id)?[]:[e.id]);let t=$.has(e.id)?S.filter(t=>t!==e.id):[...S,e.id];void 0!==s&&t.length>s||N(t)},[N,y,s,S,$,r]),R=(0,ek.useCallback)((e,t)=>{if(0===k.current.length)return;let r=e;for(let e=0;e<k.current.length;e++){r=(r+t+k.current.length)%k.current.length;let e=k.current[r];if(e&&!e.disabled)return void e.focus()}},[]),P=(0,ek.useCallback)((e,t)=>{let r=Number(e.currentTarget.dataset.index??0);"ArrowDown"===e.key||"ArrowRight"===e.key?(e.preventDefault(),R(r,1)):"ArrowUp"===e.key||"ArrowLeft"===e.key?(e.preventDefault(),R(r,-1)):"Home"===e.key?(e.preventDefault(),k.current.find(e=>!e?.disabled)?.focus()):"End"===e.key?(e.preventDefault(),k.current.findLast(e=>!e?.disabled)?.focus()):"Enter"===e.key||" "===e.key?(e.preventDefault(),A(t)):"Escape"===e.key&&e.currentTarget.blur()},[R,A]),O=(0,ek.useCallback)(async e=>{!1!==await c?.(e.id,E)&&await d?.(e.id,E)},[E,d,c]),M=(0,ek.useCallback)(e=>{_(e.currentTarget.value)},[]);return(0,ew.jsxs)("div",{"data-slot":"tool-ui-option-list",className:(0,r4.cn)("my-2.5 w-full rounded-lg border bg-background p-3 shadow-xs",g),children:[(0,ew.jsx)("div",{id:e,role:"listbox","aria-multiselectable":"multi"===r||void 0,className:"flex flex-col gap-1.5",children:j.map((e,t)=>{let r=$.has(e.id),n=!!e.description;return(0,ew.jsxs)("button",{ref:e=>{k.current[t]=e},type:"button",role:"option","aria-selected":r,"data-index":t,disabled:e.disabled||y,onClick:()=>A(e),onKeyDown:t=>P(t,e),className:(0,r4.cn)("flex min-h-11 w-full gap-2.5 rounded-md border px-3 py-2 text-left text-sm transition-colors","focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:outline-none",r?"border-primary/40 bg-primary/8":"border-border bg-card hover:bg-muted/60",(e.disabled||y)&&"cursor-default opacity-80 hover:bg-card",n?"items-start":"items-center"),children:[(0,ew.jsx)("span",{className:(0,r4.cn)("flex size-4 shrink-0 items-center justify-center rounded-full border",r?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/30 text-transparent",n&&"mt-0.5"),children:(0,ew.jsx)(a4,{className:"size-3"})}),e.icon&&(0,ew.jsx)("span",{className:(0,r4.cn)("shrink-0 text-muted-foreground",n&&"mt-0.5"),children:e.icon}),(0,ew.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,ew.jsx)("span",{className:"block break-words font-medium leading-5",children:e.label}),e.description&&(0,ew.jsx)("span",{className:"mt-0.5 block break-words text-muted-foreground text-xs leading-5",children:e.description}),h&&e.recommended&&(0,ew.jsx)("span",{className:"mt-1 inline-flex rounded-sm bg-primary/10 px-1.5 py-0.5 font-medium text-primary text-xs",children:"推荐"})]})]},e.id)})}),m&&$.has(fh)&&!y&&(0,ew.jsx)(ff,{className:"mt-2",placeholder:f,value:w,onChange:M}),!y&&l.length>0&&(0,ew.jsx)("div",{className:"mt-3 flex flex-wrap justify-end gap-2",children:l.map(e=>(0,ew.jsx)(r5,{type:"button",size:"sm",variant:e.variant??"default",disabled:e.disabled||"confirm"===e.id&&!C||p?.(e.id,E),onClick:()=>void O(e),children:e.label},e.id))})]})}function fb(e){return!!(e&&"object"==typeof e&&!Array.isArray(e))}function fx(e){return"string"==typeof e?e.trim():""}function fw(e){return Array.isArray(e)?e.map(fx).filter(Boolean):[]}function f_(e){let t=(0,ek.useMemo)(()=>(function(e){if(!fb(e)||"single"!==e.selectionMode&&"multi"!==e.selectionMode)return null;let t=Array.isArray(e.options)?e.options.flatMap(e=>{if(!fb(e))return[];let t=fx(e.id),r=fx(e.label);return t&&r?[{id:t,label:r,...fx(e.description)?{description:fx(e.description)}:{},..."boolean"==typeof e.disabled?{disabled:e.disabled}:{}}]:[]}):[],r=fx(e.fieldName);return r&&0!==t.length?{toolCallId:fx(e.toolCallId),message:fx(e.message)||"Choose an option",fieldName:r,fieldTitle:fx(e.fieldTitle)||r,...fx(e.fieldDescription)?{fieldDescription:fx(e.fieldDescription)}:{},selectionMode:e.selectionMode,options:t,defaultValue:"multi"===e.selectionMode?fw(e.defaultValue):fx(e.defaultValue)||null,minSelections:"number"==typeof e.minSelections?e.minSelections:1,..."number"==typeof e.maxSelections?{maxSelections:e.maxSelections}:{},required:!0===e.required}:null})(e.args),[e.args]),r=(0,ek.useMemo)(()=>{var t;return fb(t=e.result)?"decline"===t.action||"cancel"===t.action?{action:t.action}:"accept"===t.action&&fb(t.content)?{action:"accept",content:t.content}:null:null},[e.result]),[n,i]=(0,ek.useState)(!1),[a,o]=(0,ek.useState)(null),[s,l]=(0,ek.useState)();if(!t)return null;let u=n||!!r||e.status?.type==="complete"||e.status?.type==="incomplete",d=function(e,t){if(!t)return;if("accept"!==t.action)return null;let r=t.content[e.fieldName];return"multi"===e.selectionMode?fw(r):fx(r)||null}(t,r),c=n?s??null:d,p=r?.action??a,m=void 0!==c,f=r?.action==="accept"?"已选择":r?.action==="decline"?"已拒绝":r?.action==="cancel"?"已取消":"等待选择",h=r?.action==="accept"?fc:r?fm:fp,g="accept"===p;return(0,ew.jsxs)("div",{className:"my-2.5 w-full rounded-lg border bg-card p-4 shadow-xs",children:[(0,ew.jsxs)("div",{className:"mb-3 flex items-start gap-3",children:[(0,ew.jsx)(h,{className:(0,r4.cn)("mt-0.5 size-4 shrink-0",r?.action==="accept"?"text-emerald-600 dark:text-emerald-400":r?"text-muted-foreground":"text-primary")}),(0,ew.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ew.jsx)("div",{className:"break-words font-medium text-base leading-snug",children:t.message}),(0,ew.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-muted-foreground text-xs",children:[(0,ew.jsx)("span",{children:t.fieldTitle}),(0,ew.jsx)("span",{"aria-hidden":!0,children:"·"}),(0,ew.jsx)("span",{children:f})]}),t.fieldDescription&&(0,ew.jsx)("div",{className:"mt-2 break-words text-muted-foreground text-sm leading-snug",children:t.fieldDescription})]})]}),m?(0,ew.jsxs)("div",{className:(0,r4.cn)("flex items-center gap-2 rounded-md border px-3 py-2 text-sm",g?"border-emerald-200 bg-emerald-50 text-emerald-900 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-200":"border-muted-foreground/20 bg-muted/40 text-muted-foreground"),children:[g?(0,ew.jsx)(a4,{className:"size-4 shrink-0"}):(0,ew.jsx)(fm,{className:"size-4 shrink-0"}),(0,ew.jsx)("span",{className:"min-w-0 break-words",children:function(e,t,r){let n,i;return"decline"===t?"已拒绝":"cancel"===t?"已取消":`已选择 ${n=new Set(Array.isArray(r)?r:r?[r]:[]),(i=e.options.filter(e=>n.has(e.id)).map(e=>e.label)).length>0?i.join("、"):"未选择"}`}(t,p,c)})]}):(0,ew.jsx)(fy,{id:t.toolCallId||e.toolCallId,options:t.options,selectionMode:t.selectionMode,defaultValue:t.defaultValue,minSelections:t.minSelections,maxSelections:t.maxSelections,className:"my-0 border-0 bg-transparent p-0 shadow-none",actions:[{id:"cancel",label:"取消",variant:"outline"},{id:"confirm",label:"确认"}],onAction:(r,n)=>{if(!u){if(i(!0),"cancel"===r){o("cancel"),l(null),e.addResult({action:"cancel"});return}o("accept"),l(n),e.addResult({action:"accept",content:{[t.fieldName]:"multi"===t.selectionMode?fw(n):fx(n)}})}}})]})}let fk=rB("braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]),fI=rB("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]),fS=rB("music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]),f$=rB("video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]),fj=r2("aui-file-root inline-flex max-w-full items-center gap-3 rounded-lg transition-colors",{variants:{variant:{outline:"border-border border hover:bg-muted/50",ghost:"hover:bg-muted/50",muted:"bg-muted/50 hover:bg-muted/70"},size:{sm:"px-2.5 py-1.5 text-xs",default:"px-3 py-2 text-sm",lg:"px-4 py-3 text-base"}},defaultVariants:{variant:"outline",size:"default"}});function fE({className:e,variant:t,size:r,children:n,...i}){return(0,ew.jsx)("div",{"data-slot":"file-root","data-variant":t,"data-size":r,className:(0,r4.cn)(fj({variant:t,size:r,className:e})),...i,children:n})}function fT({mimeType:e,className:t,children:r,...n}){let i=e?e.startsWith("image/")?i5:"application/pdf"===e?cr:"application/json"===e?fk:e.startsWith("text/")?cr:e.startsWith("audio/")?fS:e.startsWith("video/")?f$:fI:fI;return(0,ew.jsx)("span",{"data-slot":"file-icon",className:(0,r4.cn)("shrink-0 text-muted-foreground",t),...n,children:r??(0,ew.jsx)(i,{className:"size-5"})})}function fC({className:e,children:t,...r}){return(0,ew.jsx)("span",{"data-slot":"file-name",className:(0,r4.cn)("min-w-0 flex-1 truncate font-medium",e),...r,children:t||"Unnamed file"})}function fN({bytes:e,className:t,...r}){return(0,ew.jsx)("span",{"data-slot":"file-size",className:(0,r4.cn)("shrink-0 text-muted-foreground",t),...r,children:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`})}function fA({data:e,mimeType:t,filename:r,className:n,children:i,...a}){let o=e.startsWith("data:")?e:`data:${t};base64,${e}`;return(0,ew.jsx)("a",{"data-slot":"file-download",href:o,download:r||"download",className:(0,r4.cn)("shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",n),...a,children:i||(0,ew.jsx)(os,{className:"size-4"})})}let fR=(0,ek.memo)(({filename:e,data:t,mimeType:r})=>{let n,i,a,o=(a=((i=(n=t.indexOf(","))>=0?t.slice(n+1):t).match(/=/g)||[]).length,Math.floor(3*i.length/4)-a);return(0,ew.jsxs)(fE,{className:"flex w-fit",children:[(0,ew.jsx)(fT,{mimeType:r}),(0,ew.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,ew.jsx)(fC,{children:e}),(0,ew.jsx)(fN,{bytes:o,className:"text-xs"})]}),(0,ew.jsx)(fA,{data:t,mimeType:r,...void 0!==e&&{filename:e}})]})});fR.displayName="File",fR.Root=fE,fR.Icon=fT,fR.Name=fC,fR.Size=fN,fR.Download=fA;let fP=rB("image-off",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]),fO=rB("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),fM=e=>{let[t,r]=e.split(","),n=t?.match(/data:([^;]+)/)?.[1]??"application/octet-stream";if(!/;base64/i.test(t??""))return new Blob([decodeURIComponent(r??"")],{type:n});let i=atob(r??""),a=new Uint8Array(i.length);for(let e=0;e<i.length;e++)a[e]=i.charCodeAt(e);return new Blob([a],{type:n})},fz=e=>e.match(/^data:([^;,]+)/)?.[1],fD=async e=>{if("u"<typeof navigator||!navigator.clipboard||"u"<typeof ClipboardItem)throw Error("Clipboard API is not available in this environment.");let t=e.image.startsWith("data:")?fM(e.image):await fetch(e.image).then(e=>e.blob()),r=fz(e.image)??t.type??"image/png";await navigator.clipboard.write([new ClipboardItem({[r]:t})])},fU=r2("aui-image-root relative w-fit max-w-full overflow-hidden rounded-lg",{variants:{variant:{outline:"border-border border",ghost:"",muted:"bg-muted/50"},size:{sm:"max-w-64",default:"max-w-[30vw] max-md:max-w-full",lg:"max-w-[512px]",full:"w-full"}},defaultVariants:{variant:"outline",size:"default"}});function fL({className:e,variant:t,size:r,children:n,...i}){return(0,ew.jsx)("div",{"data-slot":"image-root","data-variant":t,"data-size":r,className:(0,r4.cn)(fU({variant:t,size:r,className:e})),...i,children:n})}function fZ({className:e,containerClassName:t,onLoad:r,onError:n,alt:i="Image content",src:a,...o}){let s=(0,ek.useRef)(null),[l,u]=(0,ek.useState)(void 0),[d,c]=(0,ek.useState)(void 0),p=l===a,m=d===a;return(0,ek.useEffect)(()=>{"string"==typeof a&&s.current?.complete&&s.current.naturalWidth>0&&u(a)},[a]),(0,ew.jsxs)("div",{"data-slot":"image-preview",className:(0,r4.cn)("relative min-h-32",t),children:[!p&&!m&&(0,ew.jsx)("div",{"data-slot":"image-preview-loading",className:"absolute inset-0 flex items-center justify-center bg-muted/50",children:(0,ew.jsx)(i5,{className:"size-8 animate-pulse text-muted-foreground"})}),m?(0,ew.jsx)("div",{"data-slot":"image-preview-error",className:"flex min-h-32 items-center justify-center bg-muted/50 p-4",children:(0,ew.jsx)(fP,{className:"size-8 text-muted-foreground"})}):(0,ew.jsx)("img",{ref:s,src:a,alt:i,className:(0,r4.cn)("block h-auto w-auto max-h-[30vh] max-w-[30vw] object-contain max-md:max-w-full",!p&&"invisible",e),onLoad:e=>{"string"==typeof a&&u(a),r?.(e)},onError:e=>{"string"==typeof a&&c(a),n?.(e)},...o})]})}function fF({className:e,children:t,...r}){return t?(0,ew.jsx)("span",{"data-slot":"image-filename",className:(0,r4.cn)("block w-full min-w-0 truncate px-2 py-1.5 text-muted-foreground text-xs [contain:inline-size]",e),...r,children:t}):null}function fB({src:e,alt:t="Image preview",children:r}){let[n,i]=(0,ek.useState)(!1),[a,o]=(0,ek.useState)(!1);(0,ek.useEffect)(()=>{i(!0)},[]);let s=()=>o(!0),l=()=>o(!1);return(0,ek.useEffect)(()=>{if(!a)return;let e=e=>{"Escape"===e.key&&o(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a]),(0,ek.useEffect)(()=>{if(!a)return;let e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[a]),(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsx)("button",{type:"button",onClick:s,onKeyDown:e=>"Enter"===e.key&&s(),className:"aui-image-zoom-trigger cursor-zoom-in border-0 bg-transparent p-0 text-left","aria-label":"Click to zoom image",children:r}),n&&a&&(0,rf.createPortal)((0,ew.jsx)("button",{type:"button","data-slot":"image-zoom-overlay",className:"aui-image-zoom-overlay fade-in fixed inset-0 z-50 flex animate-in items-center justify-center bg-black/80 duration-200",onClick:l,onKeyDown:e=>"Enter"===e.key&&l(),"aria-label":"Close zoomed image",children:(0,ew.jsx)("img",{"data-slot":"image-zoom-content",src:e,alt:t,className:"aui-image-zoom-content fade-in zoom-in-95 max-h-[90vh] max-w-[90vw] animate-in cursor-zoom-out object-contain duration-200",onClick:e=>{e.stopPropagation(),l()}})}),document.body)]})}function fV({className:e}){return(0,ew.jsxs)("div",{"data-slot":"image-generating",className:(0,r4.cn)("flex min-h-32 items-center justify-center bg-muted/50 p-4",e),children:[(0,ew.jsx)(i6,{className:"size-8 animate-spin text-muted-foreground"}),(0,ew.jsx)("span",{className:"sr-only",children:"Generating image..."})]})}function fq({className:e,reason:t}){return(0,ew.jsxs)("div",{"data-slot":"image-content-filter-error",className:(0,r4.cn)("flex min-h-32 flex-col items-center justify-center gap-2 bg-muted/50 p-4 text-center",e),children:[(0,ew.jsx)(fO,{className:"size-8 text-muted-foreground"}),(0,ew.jsx)("p",{className:"font-medium text-sm",children:"Image could not be generated"}),t&&(0,ew.jsx)("p",{className:"text-muted-foreground text-xs",children:t})]})}function fW({onRegenerate:e}){let[t,r]=(0,ek.useState)(!1);return(0,ew.jsx)("button",{type:"button",onClick:async()=>{r(!0);try{await e()}finally{r(!1)}},disabled:t,"data-slot":"image-regenerate","aria-label":"Regenerate image",className:"inline-flex size-7 items-center justify-center rounded hover:bg-muted disabled:opacity-50",children:(0,ew.jsx)(i3,{className:(0,r4.cn)("size-4",t&&"animate-spin")})})}let fJ=(0,ek.memo)(e=>{let{image:t,filename:r,status:n}=e;return n?.type==="running"?(0,ew.jsxs)(fL,{children:[(0,ew.jsx)(fV,{}),(0,ew.jsx)(fF,{children:r})]}):n?.type==="incomplete"&&"content-filter"===n.reason?(0,ew.jsx)(fL,{children:(0,ew.jsx)(fq,{reason:"The provider blocked this image."})}):(0,ew.jsxs)(fL,{children:[(0,ew.jsx)(fB,{src:t,alt:r||"Image content",children:(0,ew.jsx)(fZ,{src:t,alt:r||"Image content"})}),(0,ew.jsx)(fF,{children:r})]})});fJ.displayName="Image",fJ.Root=fL,fJ.Preview=fZ,fJ.Filename=fF,fJ.Zoom=fB,fJ.Actions=function({part:e,onRegenerate:t,className:r}){return(0,ew.jsxs)("div",{"data-slot":"image-actions",className:(0,r4.cn)("flex items-center gap-1 p-1",r),children:[(0,ew.jsx)("button",{type:"button",onClick:()=>(e=>{if("u"<typeof document)return;let t=(e=>{switch(e){case"image/png":default:return"png";case"image/jpeg":case"image/jpg":return"jpg";case"image/webp":return"webp";case"image/gif":return"gif";case"image/svg+xml":return"svg"}})(fz(e.image)),r=e.filename??`image.${t}`,n=e.image.startsWith("data:")?URL.createObjectURL(fM(e.image)):null,i=n??e.image,a=document.createElement("a");a.href=i,a.download=r,a.rel="noopener",document.body.appendChild(a),a.click(),document.body.removeChild(a),n&&URL.revokeObjectURL(n)})(e),"data-slot":"image-download","aria-label":"Download image",className:"inline-flex size-7 items-center justify-center rounded hover:bg-muted",children:(0,ew.jsx)(os,{className:"size-4"})}),(0,ew.jsx)("button",{type:"button",onClick:()=>{fD(e).catch(()=>{})},"data-slot":"image-copy","aria-label":"Copy image",className:"inline-flex size-7 items-center justify-center rounded hover:bg-muted",children:(0,ew.jsx)(oo,{className:"size-4"})}),t&&(0,ew.jsx)(fW,{onRegenerate:t})]})},fJ.Generating=fV,fJ.ContentFilterError=fq,e.s([],6030),e.i(6030);let fH=Symbol("skip-update");class fK{_subscribers=new Set;subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}waitForUpdate(){return new Promise(e=>{let t=this.subscribe(()=>{t(),e()})})}_notifySubscribers(){let e=[];for(let t of this._subscribers)try{t()}catch(t){e.push(t)}if(e.length>0)if(1===e.length)throw e[0];else{for(let t of e)console.error(t);throw AggregateError(e)}}}class fG{_subscriptions=new Set;_connection;get isConnected(){return!!this._connection}notifySubscribers(e){for(let t of this._subscriptions)t(e)}_updateConnection(){this._subscriptions.size>0?this._connection||(this._connection=this._connect()):(this._connection?.(),this._connection=void 0)}subscribe(e){return this._subscriptions.add(e),this._updateConnection(),()=>{this._subscriptions.delete(e),this._updateConnection()}}}class fY extends fG{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e;const t=e.getState();if(t===fH)throw Error("Entry not available in the store");this._previousState=t}_previousState;getState=()=>(this.isConnected||this._syncState(),this._previousState);_syncState(){let e=this.binding.getState();return!(e===fH||function(e,t){if(void 0===e&&void 0===t)return!0;if(void 0===e||void 0===t)return!1;for(let r of Object.keys(e))if(!Object.is(e[r],t[r]))return!1;return!0}(e,this._previousState))&&(this._previousState=e,!0)}_connect(){let e=()=>{this._syncState()&&this.notifySubscribers()};return this.binding.subscribe(e)}}class fX extends fG{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e}_previousStateDirty=!0;_previousState;getState=()=>{if(!this.isConnected||this._previousStateDirty){let e=this.binding.getState();e!==fH&&(this._previousState=e),this._previousStateDirty=!1}if(void 0===this._previousState)throw Error("Entry not available in the store");return this._previousState};_connect(){let e=()=>{this._previousStateDirty=!0,this.notifySubscribers()};return this.binding.subscribe(e)}}class fQ extends fG{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e}getState(){return this.binding.getState()}outerSubscribe(e){return this.binding.subscribe(e)}_connect(){let e=()=>{this.notifySubscribers()},t=this.binding.getState(),r=t?.subscribe(e),n=()=>{let n=this.binding.getState();n!==t&&(t=n,r?.(),r=n?.subscribe(e),e())},i=this.outerSubscribe(n);return()=>{i?.(),r?.()}}}class f0 extends fG{config;constructor(e){super(),this.config=e}getState(){return this.config.binding.getState()}outerSubscribe(e){return this.config.binding.subscribe(e)}_connect(){let e=e=>{this.notifySubscribers(e)},t=this.config.binding.getState(),r=t?.unstable_on(this.config.event,e),n=()=>{let n=this.config.binding.getState();n!==t&&(t=n,r?.(),r=n?.unstable_on(this.config.event,e))},i=this.outerSubscribe(n);return()=>{i?.(),r?.()}}}let f1=(e,t=21)=>(r=t)=>{let n="",i=0|r;for(;i--;)n+=e[Math.random()*e.length|0];return n},f2=f1("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7),f4=()=>`__optimistic__${f2()}`;function f6(e,t){if("*"===t)return!0;let r=t.split(",").map(e=>e.trim().toLowerCase()),n=`.${e.name.split(".").pop().toLowerCase()}`,i=e.type.toLowerCase();for(let e of r){if(e.startsWith(".")&&e===n||e.includes("/")&&e===i)return!0;if(e.endsWith("/*")){let t=e.split("/")[0];if(i.startsWith(`${t}/`))return!0}}return!1}class f5 extends fK{isEditing=!0;get attachmentAccept(){return this.getAttachmentAdapter()?.accept??"*"}_attachments=[];get attachments(){return this._attachments}setAttachments(e){this._attachments=e,this._notifySubscribers()}get isEmpty(){return!this.text.trim()&&!this.attachments.length}_text="";get text(){return this._text}_role="user";get role(){return this._role}_runConfig={};get runConfig(){return this._runConfig}_quote=void 0;get quote(){return this._quote}setQuote(e){this._quote!==e&&(this._quote=e,this._notifySubscribers())}setText(e){if(this._text!==e){if(this._text=e,this._dictation){this._dictationBaseText=e,this._currentInterimText="";let{status:t,inputDisabled:r}=this._dictation;this._dictation=r?{status:t,inputDisabled:r}:{status:t}}this._notifySubscribers()}}setRole(e){this._role!==e&&(this._role=e,this._notifySubscribers())}setRunConfig(e){this._runConfig!==e&&(this._runConfig=e,this._notifySubscribers())}_emptyTextAndAttachments(){this._attachments=[],this._text="",this._notifySubscribers()}async _onClearAttachments(){let e=this.getAttachmentAdapter();if(e){let t=this._attachments.filter(e=>"complete"!==e.status.type);await Promise.all(t.map(t=>e.remove(t)))}}async reset(){if(0===this._attachments.length&&""===this._text&&"user"===this._role&&0===Object.keys(this._runConfig).length&&void 0===this._quote)return;this._role="user",this._runConfig={},this._quote=void 0;let e=this._onClearAttachments();this._emptyTextAndAttachments(),await e}async clearAttachments(){let e=this._onClearAttachments();this.setAttachments([]),await e}async send(e){if(!this.canSend)return;this._dictationSession&&(this._dictationSession.cancel(),this._cleanupDictation());let t=this.getAttachmentAdapter(),r=this.attachments.length>0?Promise.all(this.attachments.map(async e=>{if("complete"===e.status.type)return e;if(!t)throw Error("Attachments are not supported");return await t.send(e)})):[],n=this.text,i=this._quote;this._quote=void 0,this._emptyTextAndAttachments();let a={createdAt:new Date,role:this.role,content:n?[{type:"text",text:n}]:[],attachments:await r,runConfig:this.runConfig,metadata:{custom:{...i?{quote:i}:{}}}};this.handleSend(a,e),this._notifyEventSubscribers("send",{})}cancel(){this.handleCancel()}async addAttachment(e){let t;if(!(e instanceof File)){let t=this.getAttachmentAdapter();if(t&&!f6({name:e.name,type:e.contentType??""},t.accept)){let r=`File type ${e.contentType||"unknown"} is not accepted. Accepted types: ${t.accept}`,n=Error(r);throw this._safeEmitAttachmentAddError("not-accepted",r,void 0,n),n}let r={id:e.id??f2(),type:e.type??"document",name:e.name,contentType:e.contentType,content:e.content,status:{type:"complete"}};this._attachments=[...this._attachments,r],this._notifySubscribers(),this._notifyEventSubscribers("attachmentAdd",{});return}let r=e=>{let t=this._attachments.findIndex(t=>t.id===e.id);-1!==t?this._attachments=[...this._attachments.slice(0,t),e,...this._attachments.slice(t+1)]:this._attachments=[...this._attachments,e],this._notifySubscribers()},n=this.getAttachmentAdapter();if(!n){let e="Attachments are not supported",t=Error(e);throw this._safeEmitAttachmentAddError("no-adapter",e,void 0,t),t}if(!f6({name:e.name,type:e.type},n.accept)){let t=`File type ${e.type||"unknown"} is not accepted. Accepted types: ${n.accept}`,r=Error(t);throw this._safeEmitAttachmentAddError("not-accepted",t,void 0,r),r}try{let i=n.add({file:e});if(Symbol.asyncIterator in i)for await(let e of i)t=e,r(e);else t=await i,r(t)}catch(e){throw t&&r({...t,status:{type:"incomplete",reason:"error"}}),this._safeEmitAttachmentAddError("adapter-error",e instanceof Error?e.message:String(e),t?.id,e instanceof Error?e:void 0),e}t?.status.type==="incomplete"&&"error"===t.status.reason?this._safeEmitAttachmentAddError("adapter-error","Attachment upload did not complete successfully.",t?.id):this._notifyEventSubscribers("attachmentAdd",{})}_safeEmitAttachmentAddError(e,t,r,n){try{this._notifyEventSubscribers("attachmentAddError",{reason:e,message:t,...void 0!==r&&{attachmentId:r},...void 0!==n&&{error:n}})}catch(e){console.error("[assistant-ui] attachmentAddError subscriber threw:",e)}}async removeAttachment(e){let t=this._attachments.findIndex(t=>t.id===e);if(-1===t)throw Error("Attachment not found");let r=this._attachments[t];if("complete"!==r.status.type){let e=this.getAttachmentAdapter();if(!e)throw Error("Attachments are not supported");await e.remove(r)}this._attachments=this._attachments.filter(t=>t.id!==e),this._notifySubscribers()}_dictation;_dictationSession;_dictationUnsubscribes=[];_dictationBaseText="";_currentInterimText="";_dictationSessionIdCounter=0;_activeDictationSessionId;_isCleaningDictation=!1;get dictation(){return this._dictation}_isActiveSession(e,t){return this._activeDictationSessionId===e&&this._dictationSession===t}startDictation(){let e=this.getDictationAdapter();if(!e)throw Error("Dictation adapter not configured");if(this._dictationSession){for(let e of this._dictationUnsubscribes)e();this._dictationUnsubscribes=[],this._dictationSession.stop().catch(()=>{}),this._dictationSession=void 0}let t=e.disableInputDuringDictation??!1;this._dictationBaseText=this._text,this._currentInterimText="";let r=e.listen();this._dictationSession=r;let n=++this._dictationSessionIdCounter;this._activeDictationSessionId=n,this._dictation={status:r.status,inputDisabled:t},this._notifySubscribers();let i=r.onSpeech(e=>{if(!this._isActiveSession(n,r))return;let t=!1!==e.isFinal,i=this._dictationBaseText&&!this._dictationBaseText.endsWith(" ")&&e.transcript?" ":"";if(t){if(this._dictationBaseText=this._dictationBaseText+i+e.transcript,this._currentInterimText="",this._text=this._dictationBaseText,this._dictation){let{transcript:e,...t}=this._dictation;this._dictation=t}this._notifySubscribers()}else this._currentInterimText=i+e.transcript,this._text=this._dictationBaseText+this._currentInterimText,this._dictation&&(this._dictation={...this._dictation,transcript:e.transcript}),this._notifySubscribers()});this._dictationUnsubscribes.push(i);let a=r.onSpeechStart(()=>{this._isActiveSession(n,r)&&(this._dictation={status:{type:"running"},inputDisabled:t,...this._dictation?.transcript&&{transcript:this._dictation.transcript}},this._notifySubscribers())});this._dictationUnsubscribes.push(a);let o=r.onSpeechEnd(()=>{this._cleanupDictation({sessionId:n})});this._dictationUnsubscribes.push(o);let s=setInterval(()=>{this._isActiveSession(n,r)&&"ended"===r.status.type&&this._cleanupDictation({sessionId:n})},100);this._dictationUnsubscribes.push(()=>clearInterval(s))}stopDictation(){if(!this._dictationSession)return;let e=this._dictationSession,t=this._activeDictationSessionId;e.stop().finally(()=>{this._cleanupDictation({sessionId:t})})}_cleanupDictation(e){if((e?.sessionId===void 0||e.sessionId===this._activeDictationSessionId)&&!this._isCleaningDictation){this._isCleaningDictation=!0;try{for(let e of this._dictationUnsubscribes)e();this._dictationUnsubscribes=[],this._dictationSession=void 0,this._activeDictationSessionId=void 0,this._dictation=void 0,this._dictationBaseText="",this._currentInterimText="",this._notifySubscribers()}finally{this._isCleaningDictation=!1}}}_eventSubscribers=new Map;_notifyEventSubscribers(e,t){let r=this._eventSubscribers.get(e);if(r)for(let e of r)e(t)}unstable_on(e,t){let r=this._eventSubscribers.get(e);return r||(r=new Set,this._eventSubscribers.set(e,r)),r.add(t),()=>{this._eventSubscribers.get(e)?.delete(t)}}}class f3 extends f5{runtime;_canCancel=!1;get canCancel(){return this._canCancel}get canSend(){return!this.isEmpty&&!this.runtime.isSendDisabled}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}constructor(e){super(),this.runtime=e,this.connect()}connect(){let e=this.runtime.isSendDisabled;return this.runtime.subscribe(()=>{let t=!1;this.canCancel!==this.runtime.capabilities.cancel&&(this._canCancel=this.runtime.capabilities.cancel,t=!0),e!==this.runtime.isSendDisabled&&(e=this.runtime.isSendDisabled,t=!0),t&&this._notifySubscribers()})}async handleSend(e,t){this.runtime.append({...e,parentId:this.runtime.messages.at(-1)?.id??null,sourceId:null,startRun:t?.startRun})}async handleCancel(){this.runtime.cancelRun()}}let f9=Symbol("autoStatus"),f8=Object.freeze(Object.assign({type:"running"},{[f9]:!0})),f7=Object.freeze(Object.assign({type:"complete",reason:"unknown"},{[f9]:!0})),he=Object.freeze(Object.assign({type:"requires-action",reason:"tool-calls"},{[f9]:!0})),ht=Object.freeze(Object.assign({type:"requires-action",reason:"interrupt"},{[f9]:!0})),hr=e=>!0===e[f9],hn=(e,t,r,n,i)=>e&&i?Object.assign({type:"incomplete",reason:"error",error:i},{[f9]:!0}):e&&t?f8:r?ht:n?he:f7;var hi=e.i(82579);let ha=Symbol("aui.parse-partial-json-object.meta"),ho=e=>{if(0===e.length)return{[ha]:{state:"partial",partialPath:[]}};try{let t=hi.default.parse(e);if("object"!=typeof t||null===t)throw Error("argsText is expected to be an object");return t[ha]={state:"complete",partialPath:[]},t}catch{try{let[t,r]=function(e){let t,r=["ROOT"],n=-1,i=null,a=[];function o(){void 0!==t&&(a.push(JSON.parse(`"${t}"`)),t=void 0)}function s(e,t,a){switch(e){case'"':n=t,r.pop(),r.push(a),r.push("INSIDE_STRING"),o();break;case"f":case"t":case"n":n=t,i=t,r.pop(),r.push(a),r.push("INSIDE_LITERAL");break;case"-":r.pop(),r.push(a),r.push("INSIDE_NUMBER"),o();break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=t,r.pop(),r.push(a),r.push("INSIDE_NUMBER"),o();break;case"{":n=t,r.pop(),r.push(a),r.push("INSIDE_OBJECT_START"),o();break;case"[":n=t,r.pop(),r.push(a),r.push("INSIDE_ARRAY_START"),o()}}function l(e,i){switch(e){case",":r.pop(),r.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":n=i,r.pop(),t=a.pop()}}function u(e,i){switch(e){case",":r.pop(),r.push("INSIDE_ARRAY_AFTER_COMMA"),t=(Number(t)+1).toString();break;case"]":n=i,r.pop(),t=a.pop()}}for(let o=0;o<e.length;o++){let d=e[o];switch(r[r.length-1]){case"ROOT":s(d,o,"FINISH");break;case"INSIDE_OBJECT_START":switch(d){case'"':r.pop(),r.push("INSIDE_OBJECT_KEY"),t="";break;case"}":n=o,r.pop(),t=a.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":'"'===d&&(r.pop(),r.push("INSIDE_OBJECT_KEY"),t="");break;case"INSIDE_OBJECT_KEY":switch(d){case'"':r.pop(),r.push("INSIDE_OBJECT_AFTER_KEY");break;case"\\":r.push("INSIDE_STRING_ESCAPE"),t+=d;break;default:t+=d}break;case"INSIDE_OBJECT_AFTER_KEY":":"===d&&(r.pop(),r.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":s(d,o,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":l(d,o);break;case"INSIDE_STRING":switch(d){case'"':r.pop(),n=o,t=a.pop();break;case"\\":r.push("INSIDE_STRING_ESCAPE");break;default:n=o}break;case"INSIDE_ARRAY_START":"]"===d?(n=o,r.pop(),t=a.pop()):(n=o,t="0",s(d,o,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(d){case",":r.pop(),r.push("INSIDE_ARRAY_AFTER_COMMA"),t=(Number(t)+1).toString();break;case"]":n=o,r.pop(),t=a.pop();break;default:n=o}break;case"INSIDE_ARRAY_AFTER_COMMA":s(d,o,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":r.pop(),"INSIDE_STRING"===r[r.length-1]?n=o:"INSIDE_OBJECT_KEY"===r[r.length-1]&&(t+=d);break;case"INSIDE_NUMBER":switch(d){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=o;break;case"e":case"E":case"-":case".":break;case",":r.pop(),t=a.pop(),"INSIDE_ARRAY_AFTER_VALUE"===r[r.length-1]&&u(d,o),"INSIDE_OBJECT_AFTER_VALUE"===r[r.length-1]&&l(d,o);break;case"}":r.pop(),t=a.pop(),"INSIDE_OBJECT_AFTER_VALUE"===r[r.length-1]&&l(d,o);break;case"]":r.pop(),t=a.pop(),"INSIDE_ARRAY_AFTER_VALUE"===r[r.length-1]&&u(d,o);break;default:r.pop(),t=a.pop()}break;case"INSIDE_LITERAL":{let t=e.substring(i,o+1);"false".startsWith(t)||"true".startsWith(t)||"null".startsWith(t)?n=o:(r.pop(),"INSIDE_OBJECT_AFTER_VALUE"===r[r.length-1]?l(d,o):"INSIDE_ARRAY_AFTER_VALUE"===r[r.length-1]&&u(d,o))}}}let d=e.slice(0,n+1);for(let t=r.length-1;t>=0;t--)switch(r[t]){case"INSIDE_STRING":d+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":d+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":d+="]";break;case"INSIDE_LITERAL":{let t=e.substring(i,e.length);"true".startsWith(t)?d+="true".slice(t.length):"false".startsWith(t)?d+="false".slice(t.length):"null".startsWith(t)&&(d+="null".slice(t.length))}}return[d,a]}(e),n=hi.default.parse(t);if("object"!=typeof n||null===n)throw Error("argsText is expected to be an object");return n[ha]={state:"partial",partialPath:r},n}catch{return}}},hs=(e,t,r)=>{if("object"!=typeof e||null===e)return t.state;if("complete"===t.state)return"complete";if(0===r.length)return t.state;let[n,...i]=r;if(!Object.hasOwn(e,n))return"partial";let[a,...o]=t.partialPath;return n!==a?"complete":hs(e[n],{state:"partial",partialPath:o},i)},hl=(e,t)=>{let r=e?.[ha];if(!r)throw Error("unable to determine object state");return hs(e,r,t.map(String))},hu=(e,t)=>{if(e.startsWith("data-"))return{type:"data",name:e.substring(5),data:t}},hd=(e,t,r)=>{let{role:n,id:i,createdAt:a,attachments:o,status:s,metadata:l}=e,u={id:i??t,createdAt:a??new Date},d="string"==typeof e.content?[{type:"text",text:e.content}]:e.content;if("user"!==n&&o?.length)throw Error("attachments are only supported for user messages");if("assistant"!==n&&s)throw Error("status is only supported for assistant messages");if("assistant"!==n&&l?.steps)throw Error("metadata.steps is only supported for assistant messages");switch(n){case"assistant":return{...u,role:n,content:d.map(e=>{let t=e.type;switch(t){case"text":case"reasoning":if(0===e.text.trim().length)return null;return e;case"file":case"source":case"data":return e;case"image":return(({image:e,...t})=>e.match(/^data:image\/(png|jpeg|jpg|gif|webp);base64,(.*)$/)?{...t,image:e}:(console.warn("Invalid image data format detected"),null))(e);case"tool-call":{let{parentId:t,messages:r,...n}=e,i={...n,toolCallId:e.toolCallId??`tool-${f2()}`,...void 0!==t&&{parentId:t},...void 0!==r&&{messages:r}};if(e.args)return{...i,args:e.args,argsText:e.argsText??JSON.stringify(e.args)};return{...i,args:ho(e.argsText??"")??{},argsText:e.argsText??""}}default:{let r=hu(t,e.data);if(r)return r;throw Error(`Unsupported assistant message part type: ${t}`)}}}).filter(e=>!!e),status:s??r,metadata:{unstable_state:l?.unstable_state??null,unstable_annotations:l?.unstable_annotations??[],unstable_data:l?.unstable_data??[],custom:l?.custom??{},steps:l?.steps??[],...l?.timing&&{timing:l.timing},...l?.submittedFeedback&&{submittedFeedback:l.submittedFeedback}}};case"user":return{...u,role:n,content:d.map(e=>{let t=e.type;switch(t){case"text":case"image":case"audio":case"file":case"data":return e;default:{let r=hu(t,e.data);if(r)return r;throw Error(`Unsupported user message part type: ${t}`)}}}),attachments:(o??[]).map(e=>({...e,content:e.content.map(e=>hu(e.type,e.data)??e)})),metadata:{custom:l?.custom??{}}};case"system":if(1!==d.length||"text"!==d[0].type)throw Error("System messages must have exactly one text message part.");return{...u,role:n,content:d,metadata:{custom:l?.custom??{}}};default:throw Error(`Unknown message role: ${n}`)}},hc=e=>{let t=e.map(e=>hd(e,f2(),hn(!1,!1,!1,!1,void 0)));return{messages:t.map((e,r)=>({parentId:r>0?t[r-1].id:null,message:e}))}},hp=e=>e.next?hp(e.next):"current"in e?e:null;class hm{func;_value=null;constructor(e){this.func=e}get value(){return null===this._value&&(this._value=this.func()),this._value}dirty(){this._value=null}}class hf{messages=new Map;head=null;root={children:[],next:null};updateLevels(e,t){for(let r of(e.level=t,e.children)){let e=this.messages.get(r);e&&this.updateLevels(e,t+1)}}performOp(e,t,r){let n=t.prev??this.root,i=e??this.root;if("relink"!==r||n!==i){if("link"!==r&&(n.children=n.children.filter(e=>e!==t.current.id),n.next===t)){let e=n.children.at(-1),t=e?this.messages.get(e):null;if(void 0===t)throw Error("MessageRepository(performOp/cut): Fallback sibling message not found. This is likely an internal bug in assistant-ui.");n.next=t}if("cut"!==r){for(let r=e;r;r=r.prev)if(r.current.id===t.current.id)throw Error("MessageRepository(performOp/link): A message with the same id already exists in the parent tree. This error occurs if the same message id is found multiple times. This is likely an internal bug in assistant-ui.");i.children=[...i.children,t.current.id],(hp(t)===this.head||null===i.next)&&(i.next=t),t.prev=e;let r=e?e.level+1:0;this.updateLevels(t,r)}}}_messages=new hm(()=>{let e=Array((this.head?.level??-1)+1);for(let t=this.head;t;t=t.prev)e[t.level]=t.current;return e});get headId(){return this.head?.current.id??null}getMessages(e){if(void 0===e||e===this.head?.current.id)return this._messages.value;let t=this.messages.get(e);if(!t)throw Error("MessageRepository(getMessages): Head message not found. This is likely an internal bug in assistant-ui.");let r=Array(t.level+1);for(let e=t;e;e=e.prev)r[e.level]=e.current;return r}addOrUpdateMessage(e,t){let r=this.messages.get(t.id),n=e?this.messages.get(e):null;if(void 0===n)throw Error("MessageRepository(addOrUpdateMessage): Parent message not found. This is likely an internal bug in assistant-ui.");if(r){r.current=t,this.performOp(n,r,"relink"),this._messages.dirty();return}let i={prev:n,current:t,next:null,children:[],level:n?n.level+1:0};this.messages.set(t.id,i),this.performOp(n,i,"link"),this.head===n&&(this.head=i),this._messages.dirty()}getMessage(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui.");return{parentId:t.prev?.current.id??null,message:t.current,index:t.level}}appendOptimisticMessage(e,t){let r;do r=f4();while(this.messages.has(r))return this.addOrUpdateMessage(e,hd(t,r,{type:"running"})),r}deleteMessage(e,t){let r=this.messages.get(e);if(!r)throw Error("MessageRepository(deleteMessage): Message not found. This is likely an internal bug in assistant-ui.");let n=void 0===t?r.prev:null===t?null:this.messages.get(t);if(void 0===n)throw Error("MessageRepository(deleteMessage): Replacement not found. This is likely an internal bug in assistant-ui.");for(let e of r.children){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui.");this.performOp(n,t,"relink")}this.performOp(null,r,"cut"),this.messages.delete(e),this.head===r&&(this.head=hp(n??this.root)),this._messages.dirty()}getBranches(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(getBranches): Message not found. This is likely an internal bug in assistant-ui.");let{children:r}=t.prev??this.root;return r}switchToBranch(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(switchToBranch): Branch not found. This is likely an internal bug in assistant-ui.");(t.prev??this.root).next=t,this.head=hp(t),this._messages.dirty()}resetHead(e){if(null===e)return void this.clear();let t=this.messages.get(e);if(!t)throw Error("MessageRepository(resetHead): Branch not found. This is likely an internal bug in assistant-ui.");if(t.children.length>0){let e=t=>{for(let r of t.children){let t=this.messages.get(r);t&&(e(t),this.messages.delete(r))}};e(t),t.children=[],t.next=null}this.head=t;for(let e=t;e;e=e.prev)e.prev?e.prev.next=e:this.root.next=e;this._messages.dirty()}clear(){this.messages.clear(),this.head=null,this.root={children:[],next:null},this._messages.dirty()}export(){let e=[];for(let[,t]of this.messages)e.push({message:t.current,parentId:t.prev?.current.id??null});return{headId:this.head?.current.id??null,messages:e}}import({headId:e,messages:t}){for(let{message:e,parentId:r}of t)this.addOrUpdateMessage(r,e);this.resetHead(e??t.at(-1)?.message.id??null)}}class hh{_contextProvider=new t1;registerModelContextProvider(e){return this._contextProvider.registerModelContextProvider(e)}getModelContextProvider(){return this._contextProvider}}class hg{_core;_threadListBinding;get path(){return this._core.path}constructor(e,t){this._core=e,this._threadListBinding=t,this.__internal_bindMethods()}__internal_bindMethods(){this.switchTo=this.switchTo.bind(this),this.rename=this.rename.bind(this),this.archive=this.archive.bind(this),this.unarchive=this.unarchive.bind(this),this.delete=this.delete.bind(this),this.initialize=this.initialize.bind(this),this.generateTitle=this.generateTitle.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getState=this.getState.bind(this),this.detach=this.detach.bind(this)}getState(){return this._core.getState()}switchTo(){let e=this._core.getState();return this._threadListBinding.switchToThread(e.id)}rename(e){let t=this._core.getState();return this._threadListBinding.rename(t.id,e)}archive(){let e=this._core.getState();return this._threadListBinding.archive(e.id)}unarchive(){let e=this._core.getState();return this._threadListBinding.unarchive(e.id)}delete(){let e=this._core.getState();return this._threadListBinding.delete(e.id)}initialize(){let e=this._core.getState();return this._threadListBinding.initialize(e.id)}generateTitle(){let e=this._core.getState();return this._threadListBinding.generateTitle(e.id)}unstable_on(e,t){let r=this._core.getState().isMain,n=this._core.getState().id;return this.subscribe(()=>{let i=this._core.getState(),a=i.isMain,o=i.id;r===a&&n===o||(r=a,n=o,"switchedTo"===e&&!a||"switchedAway"===e&&a||t({}))})}subscribe(e){return this._core.subscribe(e)}detach(){let e=this._core.getState();this._threadListBinding.detach(e.id)}__internal_getRuntime(){return this}}let hv=Symbol("innerMessage"),hy=Symbol("innerMessages"),hb=[],hx=(e,t)=>{hv in e||(e[hv]=t)},hw=e=>{let t="messages"in e?e.messages:e,r=t[hy]||t[hv];return r?Array.isArray(r)?r:(t[hy]=[r],t[hy]):hb},h_=e=>e.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n\n");class hk{_core;get path(){return this._core.path}constructor(e){this._core=e,this.__internal_bindMethods()}__internal_bindMethods(){this.getState=this.getState.bind(this),this.remove=this.remove.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this._core.getState()}subscribe(e){return this._core.subscribe(e)}}class hI extends hk{_composerApi;constructor(e,t){super(e),this._composerApi=t}remove(){let e=this._composerApi.getState();if(!e)throw Error("Composer is not available");return e.removeAttachment(this.getState().id)}}class hS extends hI{get source(){return"thread-composer"}}class h$ extends hI{get source(){return"edit-composer"}}class hj extends hk{get source(){return"message"}remove(){throw Error("Message attachments cannot be removed")}}let hE=Object.freeze([]),hT=Object.freeze({});class hC{_core;get path(){return this._core.path}constructor(e){this._core=e}__internal_bindMethods(){this.setText=this.setText.bind(this),this.setRunConfig=this.setRunConfig.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.addAttachment=this.addAttachment.bind(this),this.reset=this.reset.bind(this),this.clearAttachments=this.clearAttachments.bind(this),this.send=this.send.bind(this),this.cancel=this.cancel.bind(this),this.setRole=this.setRole.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.startDictation=this.startDictation.bind(this),this.stopDictation=this.stopDictation.bind(this),this.setQuote=this.setQuote.bind(this),this.unstable_on=this.unstable_on.bind(this)}setText(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setText(e)}setRunConfig(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setRunConfig(e)}addAttachment(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");return t.addAttachment(e)}reset(){let e=this._core.getState();if(!e)throw Error("Composer is not available");return e.reset()}clearAttachments(){let e=this._core.getState();if(!e)throw Error("Composer is not available");return e.clearAttachments()}send(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.send(e)}cancel(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.cancel()}setRole(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setRole(e)}startDictation(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.startDictation()}stopDictation(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.stopDictation()}setQuote(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setQuote(e)}subscribe(e){return this._core.subscribe(e)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let r=this._eventSubscriptionSubjects.get(e);return r||(r=new f0({event:e,binding:this._core}),this._eventSubscriptionSubjects.set(e,r)),r.subscribe(t)}}class hN extends hC{get path(){return this._core.path}get type(){return"thread"}_getState;constructor(e){const t=new fX({path:e.path,getState:()=>{let t;return t=e.getState(),Object.freeze({type:"thread",isEditing:t?.isEditing??!1,canCancel:t?.canCancel??!1,canSend:t?.canSend??!1,isEmpty:t?.isEmpty??!0,attachments:t?.attachments??hE,text:t?.text??"",role:t?.role??"user",runConfig:t?.runConfig??hT,attachmentAccept:t?.attachmentAccept??"",dictation:t?.dictation,quote:t?.quote,value:t?.text??""})},subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>t.subscribe(e)}),this._getState=t.getState.bind(t),this.__internal_bindMethods()}getState(){return this._getState()}getAttachmentByIndex(e){return new hS(new fY({path:{...this.path,attachmentSource:"thread-composer",attachmentSelector:{type:"index",index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:"thread-composer"}:fH},subscribe:e=>this._core.subscribe(e)}),this._core)}}class hA extends hC{_beginEdit;get path(){return this._core.path}get type(){return"edit"}_getState;constructor(e,t){const r=new fX({path:e.path,getState:()=>{let t;return t=e.getState(),Object.freeze({type:"edit",isEditing:t?.isEditing??!1,canCancel:t?.canCancel??!1,canSend:t?.canSend??!1,isEmpty:t?.isEmpty??!0,text:t?.text??"",role:t?.role??"user",attachments:t?.attachments??hE,runConfig:t?.runConfig??hT,attachmentAccept:t?.attachmentAccept??"",dictation:t?.dictation,quote:t?.quote,parentId:t?.parentId??null,sourceId:t?.sourceId??null,value:t?.text??""})},subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>r.subscribe(e)}),this._beginEdit=t,this._getState=r.getState.bind(r),this.__internal_bindMethods()}__internal_bindMethods(){super.__internal_bindMethods(),this.beginEdit=this.beginEdit.bind(this)}getState(){return this._getState()}beginEdit(){this._beginEdit()}getAttachmentByIndex(e){return new h$(new fY({path:{...this.path,attachmentSource:"edit-composer",attachmentSelector:{type:"index",index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:"edit-composer"}:fH},subscribe:e=>this._core.subscribe(e)}),this._core)}}let hR=Symbol.for("aui.tool-response");class hP{get[hR](){return!0}artifact;result;isError;modelContent;messages;constructor(e){void 0!==e.artifact&&(this.artifact=e.artifact),this.result=e.result,this.isError=e.isError??!1,void 0!==e.modelContent&&(this.modelContent=e.modelContent),void 0!==e.messages&&(this.messages=e.messages)}static[Symbol.hasInstance](e){return"object"==typeof e&&null!==e&&hR in e}static toResponse(e){return e instanceof hP?e:new hP({result:void 0===e?"<no result>":e})}}class hO{contentBinding;messageApi;threadApi;get path(){return this.contentBinding.path}constructor(e,t,r){this.contentBinding=e,this.messageApi=t,this.threadApi=r,this.__internal_bindMethods()}__internal_bindMethods(){this.addToolResult=this.addToolResult.bind(this),this.resumeToolCall=this.resumeToolCall.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this.contentBinding.getState()}addToolResult(e){let t=this.contentBinding.getState();if(!t)throw Error("Message part is not available");if("tool-call"!==t.type)throw Error("Tried to add tool result to non-tool message part");if(!this.messageApi)throw Error("Message API is not available. This is likely a bug in assistant-ui.");if(!this.threadApi)throw Error("Thread API is not available");let r=this.messageApi.getState();if(!r)throw Error("Message is not available");let n=t.toolName,i=t.toolCallId,a=hP.toResponse(e);this.threadApi.getState().addToolResult({messageId:r.id,toolName:n,toolCallId:i,result:a.result,artifact:a.artifact,isError:a.isError})}resumeToolCall(e){let t=this.contentBinding.getState();if(!t)throw Error("Message part is not available");if("tool-call"!==t.type)throw Error("Tried to resume tool call on non-tool message part");if(!this.threadApi)throw Error("Thread API is not available");let r=t.toolCallId;this.threadApi.getState().resumeToolCall({toolCallId:r,payload:e})}subscribe(e){return this.contentBinding.subscribe(e)}}let hM=Object.freeze({type:"complete"}),hz=(e,t)=>{let r=e.content[t];if(!r)return fH;let n=((e,t,r)=>{if("assistant"!==e.role)return hM;if("tool-call"===r.type)if(!r.result)return e.status;else return hM;let n=t===Math.max(0,e.content.length-1);return"requires-action"===e.status.type?hM:n?e.status:hM})(e,t,r);return Object.freeze({...r,...{[hv]:r[hv]},status:n})};class hD{_core;_threadBinding;get path(){return this._core.path}constructor(e,t){this._core=e,this._threadBinding=t,this.composer=new hA(new fQ({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.composer`,composerSource:"edit"},getState:this._getEditComposerRuntimeCore,subscribe:e=>this._threadBinding.subscribe(e)}),()=>this._threadBinding.getState().beginEdit(this._core.getState().id)),this.__internal_bindMethods()}__internal_bindMethods(){this.reload=this.reload.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getMessagePartByIndex=this.getMessagePartByIndex.bind(this),this.getMessagePartByToolCallId=this.getMessagePartByToolCallId.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.unstable_getCopyText=this.unstable_getCopyText.bind(this),this.speak=this.speak.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.submitFeedback=this.submitFeedback.bind(this),this.switchToBranch=this.switchToBranch.bind(this)}composer;_getEditComposerRuntimeCore=()=>this._threadBinding.getState().getEditComposer(this._core.getState().id);getState(){return this._core.getState()}reload(e={}){let t=this._getEditComposerRuntimeCore(),r=t??this._threadBinding.getState().composer,{runConfig:n=(t??r).runConfig}=e,i=this._core.getState();if("assistant"!==i.role)throw Error("Can only reload assistant messages");this._threadBinding.getState().startRun({parentId:i.parentId,sourceId:i.id,runConfig:n})}speak(){let e=this._core.getState();return this._threadBinding.getState().speak(e.id)}stopSpeaking(){let e=this._core.getState(),t=this._threadBinding.getState();if(t.speech?.messageId===e.id)this._threadBinding.getState().stopSpeaking();else throw Error("Message is not being spoken")}submitFeedback({type:e}){let t=this._core.getState();this._threadBinding.getState().submitFeedback({messageId:t.id,type:e})}switchToBranch({position:e,branchId:t}){let r=this._core.getState();if(t&&e)throw Error("May not specify both branchId and position");if(!t&&!e)throw Error("Must specify either branchId or position");let n=this._threadBinding.getState().getBranches(r.id),i=t;if("previous"===e?i=n[r.branchNumber-2]:"next"===e&&(i=n[r.branchNumber]),!i)throw Error("Branch not found");this._threadBinding.getState().switchToBranch(i)}unstable_getCopyText(){return h_(this.getState())}subscribe(e){return this._core.subscribe(e)}getMessagePartByIndex(e){if(e<0)throw Error("Message part index must be >= 0");return new hO(new fY({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.content[${e}]`,messagePartSelector:{type:"index",index:e}},getState:()=>hz(this.getState(),e),subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getMessagePartByToolCallId(e){return new hO(new fY({path:{...this.path,ref:this.path.ref+`${this.path.ref}.content[toolCallId=${JSON.stringify(e)}]`,messagePartSelector:{type:"toolCallId",toolCallId:e}},getState:()=>{let t=this._core.getState(),r=t.content.findIndex(t=>"tool-call"===t.type&&t.toolCallId===e);return -1===r?fH:hz(t,r)},subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getAttachmentByIndex(e){return new hj(new fY({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.attachments[${e}]`,attachmentSource:"message",attachmentSelector:{type:"index",index:e}},getState:()=>{let t=this.getState().attachments,r=t?.[e];return r?{...r,source:"message"}:fH},subscribe:e=>this._core.subscribe(e)}))}}class hU{get path(){return this._threadBinding.path}get __internal_threadBinding(){return this._threadBinding}_threadBinding;constructor(e,t){const r=new fY({path:e.path,getState:()=>{var r,n;let i;return r=e.getState(),n=t.getState(),i=r.messages.at(-1),Object.freeze({threadId:n.id,metadata:n,capabilities:r.capabilities,isDisabled:r.isDisabled,isLoading:r.isLoading,isRunning:r.isRunning??(i?.role==="assistant"&&"running"===i.status.type),messages:r.messages,state:r.state,suggestions:r.suggestions,extras:r.extras,speech:r.speech,voice:r.voice})},subscribe:r=>{let n=e.subscribe(r),i=t.subscribe(r);return()=>{n(),i()}}});this._threadBinding={path:e.path,getState:()=>e.getState(),getStateState:()=>r.getState(),outerSubscribe:t=>e.outerSubscribe(t),subscribe:t=>e.subscribe(t)},this.composer=new hN(new fQ({path:{...this.path,ref:`${this.path.ref}.composer`,composerSource:"thread"},getState:()=>this._threadBinding.getState().composer,subscribe:e=>this._threadBinding.subscribe(e)})),this.__internal_bindMethods()}__internal_bindMethods(){this.append=this.append.bind(this),this.resumeRun=this.resumeRun.bind(this),this.importExternalState=this.importExternalState.bind(this),this.exportExternalState=this.exportExternalState.bind(this),this.startRun=this.startRun.bind(this),this.cancelRun=this.cancelRun.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.connectVoice=this.connectVoice.bind(this),this.disconnectVoice=this.disconnectVoice.bind(this),this.muteVoice=this.muteVoice.bind(this),this.unmuteVoice=this.unmuteVoice.bind(this),this.getVoiceVolume=this.getVoiceVolume.bind(this),this.subscribeVoiceVolume=this.subscribeVoiceVolume.bind(this),this.export=this.export.bind(this),this.import=this.import.bind(this),this.reset=this.reset.bind(this),this.getMessageByIndex=this.getMessageByIndex.bind(this),this.getMessageById=this.getMessageById.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getModelContext=this.getModelContext.bind(this),this.getState=this.getState.bind(this)}composer;getState(){return this._threadBinding.getStateState()}append(e){var t;this._threadBinding.getState().append((t=this._threadBinding.getState().messages,"string"==typeof e?{createdAt:new Date,parentId:t.at(-1)?.id??null,sourceId:null,runConfig:{},role:"user",content:[{type:"text",text:e}],attachments:[],metadata:{custom:{}}}:{createdAt:e.createdAt??new Date,parentId:e.parentId??t.at(-1)?.id??null,sourceId:e.sourceId??null,role:e.role??"user",content:e.content,attachments:e.attachments??[],metadata:e.metadata??{custom:{}},runConfig:e.runConfig??{},startRun:e.startRun}))}subscribe(e){return this._threadBinding.subscribe(e)}getModelContext(){return this._threadBinding.getState().getModelContext()}startRun(e){return this._threadBinding.getState().startRun({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{}})}resumeRun(e){return this._threadBinding.getState().resumeRun({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{},...e.stream?{stream:e.stream}:{}})}exportExternalState(){return this._threadBinding.getState().exportExternalState()}importExternalState(e){this._threadBinding.getState().importExternalState(e)}cancelRun(){this._threadBinding.getState().cancelRun()}stopSpeaking(){return this._threadBinding.getState().stopSpeaking()}connectVoice(){this._threadBinding.getState().connectVoice()}disconnectVoice(){this._threadBinding.getState().disconnectVoice()}getVoiceVolume(){return this._threadBinding.getState().getVoiceVolume()}subscribeVoiceVolume(e){return this._threadBinding.getState().subscribeVoiceVolume(e)}muteVoice(){this._threadBinding.getState().muteVoice()}unmuteVoice(){this._threadBinding.getState().unmuteVoice()}export(){return this._threadBinding.getState().export()}import(e){this._threadBinding.getState().import(e)}reset(e){this._threadBinding.getState().reset(e)}getMessageByIndex(e){if(e<0)throw Error("Message index must be >= 0");return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[${e}]`,messageSelector:{type:"index",index:e}},()=>{let t=this._threadBinding.getState().messages,r=t[e];if(r)return{message:r,parentId:t[e-1]?.id??null,index:e}})}getMessageById(e){return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[messageId=${JSON.stringify(e)}]`,messageSelector:{type:"messageId",messageId:e}},()=>this._threadBinding.getState().getMessageById(e))}_getMessageRuntime(e,t){return new hD(new fY({path:e,getState:()=>{let{message:e,parentId:r,index:n}=t()??{},{messages:i,speech:a}=this._threadBinding.getState();if(!e||void 0===r||void 0===n)return fH;let o=this._threadBinding.getState().getBranches(e.id);return{...e,...{[hv]:e[hv]},index:n,isLast:i.at(-1)?.id===e.id,parentId:r,branchNumber:o.indexOf(e.id)+1,branchCount:o.length,speech:a?.messageId===e.id?a:void 0}},subscribe:e=>this._threadBinding.subscribe(e)}),this._threadBinding)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let r=this._eventSubscriptionSubjects.get(e);return r||(r=new f0({event:e,binding:this._threadBinding}),this._eventSubscriptionSubjects.set(e,r)),r.subscribe(t)}}let hL=Promise.resolve(),hZ=(e,t)=>{if(void 0===t)return fH;let r=e.getItemById(t);return r?{id:r.id,remoteId:r.remoteId,externalId:r.externalId,title:r.title,status:r.status,custom:r.custom,isMain:r.id===e.mainThreadId}:fH};class hF{_core;_runtimeFactory;_getState;constructor(e,t=hU){this._core=e,this._runtimeFactory=t;const r=new fX({path:{},getState:()=>({mainThreadId:e.mainThreadId,newThreadId:e.newThreadId,threadIds:e.threadIds,archivedThreadIds:e.archivedThreadIds,isLoading:e.isLoading,isLoadingMore:e.isLoadingMore??!1,hasMore:e.hasMore??!1,threadItems:e.threadItems}),subscribe:t=>e.subscribe(t)});this._getState=r.getState.bind(r),this._mainThreadListItemRuntime=new hg(new fY({path:{ref:"threadItems[main]",threadSelector:{type:"main"}},getState:()=>hZ(this._core,this._core.mainThreadId),subscribe:e=>this._core.subscribe(e)}),this._core),this.main=new t(new fQ({path:{ref:"threads.main",threadSelector:{type:"main"}},getState:()=>e.getMainThreadRuntimeCore(),subscribe:t=>e.subscribe(t)}),this._mainThreadListItemRuntime),this.__internal_bindMethods()}__internal_bindMethods(){this.switchToThread=this.switchToThread.bind(this),this.switchToNewThread=this.switchToNewThread.bind(this),this.getLoadThreadsPromise=this.getLoadThreadsPromise.bind(this),this.reload=this.reload.bind(this),this.loadMore=this.loadMore.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getById=this.getById.bind(this),this.getItemById=this.getItemById.bind(this),this.getItemByIndex=this.getItemByIndex.bind(this),this.getArchivedItemByIndex=this.getArchivedItemByIndex.bind(this)}switchToThread(e){return this._core.switchToThread(e)}switchToNewThread(){return this._core.switchToNewThread()}getLoadThreadsPromise(){return this._core.getLoadThreadsPromise()}reload(){return this._core.reload?.()??hL}loadMore(){return this._core.loadMore?.()??hL}getState(){return this._getState()}subscribe(e){return this._core.subscribe(e)}_mainThreadListItemRuntime;main;get mainItem(){return this._mainThreadListItemRuntime}getById(e){return new this._runtimeFactory(new fQ({path:{ref:`threads[threadId=${JSON.stringify(e)}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>this._core.getThreadRuntimeCore(e),subscribe:e=>this._core.subscribe(e)}),this.mainItem)}getItemByIndex(e){return new hg(new fY({path:{ref:`threadItems[${e}]`,threadSelector:{type:"index",index:e}},getState:()=>hZ(this._core,this._core.threadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getArchivedItemByIndex(e){return new hg(new fY({path:{ref:`archivedThreadItems[${e}]`,threadSelector:{type:"archiveIndex",index:e}},getState:()=>hZ(this._core,this._core.archivedThreadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getItemById(e){return new hg(new fY({path:{ref:`threadItems[threadId=${e}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>hZ(this._core,e),subscribe:e=>this._core.subscribe(e)}),this._core)}}class hB{_core;threads;_thread;constructor(e){this._core=e,this.threads=new hF(e.threads),this._thread=this.threads.main,this.__internal_bindMethods()}__internal_bindMethods(){this.registerModelContextProvider=this.registerModelContextProvider.bind(this)}get thread(){return this._thread}registerModelContextProvider(e){return this._core.registerModelContextProvider(e)}}class hV extends f5{runtime;endEditCallback;get canCancel(){return!0}get canSend(){return!this.isEmpty}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}_previousText;_previousAttachments;_nonTextPassthrough;_parentId;_sourceId;constructor(e,t,{parentId:r,message:n}){super(),this.runtime=e,this.endEditCallback=t,this._parentId=r,this._sourceId=n.id,this._previousText=h_(n),this.setText(this._previousText),this.setRole(n.role),"user"===n.role?(this._previousAttachments=[...n.attachments??[],...function(e){let t=[];for(let r of e)"text"!==r.type&&t.push(function(e){let t=f2();return"image"===e.type?{id:t,type:"image",name:e.filename??"image",content:[e],status:{type:"complete"}}:"file"===e.type?{id:t,type:"document",name:e.filename??"document",contentType:e.mimeType,content:[e],status:{type:"complete"}}:"audio"===e.type?{id:t,type:"audio",name:`audio.${e.audio.format}`,contentType:`audio/${e.audio.format}`,content:[e],status:{type:"complete"}}:{id:t,type:"data",name:e.name,content:[e],status:{type:"complete"}}}(r));return t}(n.content)],this._nonTextPassthrough=[]):(this._previousAttachments=n.attachments??[],this._nonTextPassthrough=n.content.filter(e=>"text"!==e.type)),this.setAttachments(this._previousAttachments),this.setRunConfig({...e.composer.runConfig})}get parentId(){return this._parentId}get sourceId(){return this._sourceId}async handleSend(e,t){var r,n;let i=h_(e),a=(r=e.attachments??[],n=this._previousAttachments,!(r.length===n.length&&r.every((e,t)=>e.id===n[t].id)));if(i!==this._previousText||a||t?.startRun){let r=this._nonTextPassthrough.length>0?[...e.content,...this._nonTextPassthrough]:e.content;this.runtime.append({...e,content:r,parentId:this._parentId,sourceId:this._sourceId,startRun:t?.startRun})}this.handleCancel()}handleCancel(){this.endEditCallback(),this._notifySubscribers()}}class hq{_contextProvider;_subscriptions=new Set;_isInitialized=!1;repository=new hf;_voiceMessages=[];_voiceGeneration=0;_cachedMergedMessages=null;_cachedVoiceGeneration=-1;_cachedMergedBase=null;_markVoiceMessagesDirty(){this._voiceGeneration++,this._cachedMergedMessages=null}_getBaseMessages(){return this.repository.getMessages()}get messages(){if(0===this._voiceMessages.length)return this._getBaseMessages();let e=this._getBaseMessages();return(this._cachedVoiceGeneration!==this._voiceGeneration||this._cachedMergedBase!==e)&&(this._cachedMergedMessages=[...e,...this._voiceMessages],this._cachedVoiceGeneration=this._voiceGeneration,this._cachedMergedBase=e),this._cachedMergedMessages}get state(){let e;for(let t of this.messages)"assistant"===t.role&&(e=t);return e?.metadata.unstable_state??null}composer=new f3(this);constructor(e){this._contextProvider=e}getModelContext(){return this._contextProvider.getModelContext()}_editComposers=new Map;getEditComposer(e){return this._editComposers.get(e)}beginEdit(e){if(this._editComposers.has(e))throw Error("Edit already in progress");this._editComposers.set(e,new hV(this,()=>this._editComposers.delete(e),this.repository.getMessage(e))),this._notifySubscribers()}getMessageById(e){try{return this.repository.getMessage(e)}catch{let t=this.repository.getMessages(),r=this._voiceMessages.findIndex(t=>t.id===e);if(-1!==r)return{parentId:r>0?this._voiceMessages[r-1].id:t.at(-1)?.id??null,message:this._voiceMessages[r],index:t.length+r};return}}getBranches(e){return this._voiceMessages.some(t=>t.id===e)?[]:this.repository.getBranches(e)}switchToBranch(e){this.repository.switchToBranch(e),this._notifySubscribers()}_notifySubscribers(){for(let e of this._subscriptions)e()}_notifyEventSubscribers(e,t){let r=this._eventSubscribers.get(e);if(r)for(let e of r)e(t)}subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}submitFeedback({messageId:e,type:t}){let r=this.adapters?.feedback;if(!r)throw Error("Feedback adapter not configured");let{message:n,parentId:i}=this.repository.getMessage(e);if(r.submit({message:n,type:t}),"assistant"===n.role){let e={...n,metadata:{...n.metadata,submittedFeedback:{type:t}}};this.repository.addOrUpdateMessage(i,e)}this._notifySubscribers()}_stopSpeaking;speech;speak(e){let t=this.adapters?.speech;if(!t)throw Error("Speech adapter not configured");let{message:r}=this.repository.getMessage(e);this._stopSpeaking?.();let n=t.speak(h_(r)),i=n.subscribe(()=>{"ended"===n.status.type?(this._stopSpeaking=void 0,this.speech=void 0):this.speech={messageId:e,status:n.status},this._notifySubscribers()});this.speech={messageId:e,status:n.status},this._notifySubscribers(),this._stopSpeaking=()=>{n.cancel(),i(),this.speech=void 0,this._stopSpeaking=void 0}}stopSpeaking(){if(!this._stopSpeaking)throw Error("No message is being spoken");this._stopSpeaking(),this._notifySubscribers()}_voiceSession;_voiceUnsubs=[];voice;_voiceVolume=0;_voiceVolumeSubscribers=new Set;getVoiceVolume=()=>this._voiceVolume;subscribeVoiceVolume=e=>(this._voiceVolumeSubscribers.add(e),()=>this._voiceVolumeSubscribers.delete(e));connectVoice(){let e=this.adapters?.voice;if(!e)throw Error("Voice adapter not configured");this.disconnectVoice();let t=e.connect({});this._voiceSession=t;let r=[],n="listening";this.voice={status:t.status,isMuted:t.isMuted,mode:n},this._voiceVolume=0,this._notifySubscribers(),r.push(t.onStatusChange(e=>{"ended"===e.type?(this._finishVoiceAssistantMessage(),this._voiceSession=void 0,this.voice=void 0):this.voice={status:e,isMuted:t.isMuted,mode:n},this._notifySubscribers()})),r.push(t.onModeChange(e=>{n=e,this.voice&&(this.voice={...this.voice,mode:e},this._notifySubscribers())})),r.push(t.onVolumeChange(e=>{for(let t of(this._voiceVolume=e,this._voiceVolumeSubscribers))t()})),r.push(t.onTranscript(e=>{this._handleVoiceTranscript(e)})),this._voiceUnsubs=r}_currentAssistantMsg=null;_handleVoiceTranscript(e){if(this.ensureInitialized(),"user"===e.role)this._finishVoiceAssistantMessage(),this._currentAssistantMsg=null,e.isFinal&&(this._voiceMessages.push({id:f2(),role:"user",content:[{type:"text",text:e.text}],metadata:{custom:{}},createdAt:new Date,status:{type:"complete",reason:"unknown"},attachments:[]}),this._markVoiceMessagesDirty(),this._notifySubscribers());else{if(this._currentAssistantMsg){let t=this._voiceMessages.indexOf(this._currentAssistantMsg);if(-1===t)return;let r={...this._currentAssistantMsg,content:[{type:"text",text:e.text}],...e.isFinal?{status:{type:"complete",reason:"stop"}}:{}};this._voiceMessages[t]=r,this._currentAssistantMsg=r}else this._currentAssistantMsg={id:f2(),role:"assistant",content:[{type:"text",text:e.text}],metadata:{unstable_state:this.state,unstable_annotations:[],unstable_data:[],steps:[],custom:{}},status:{type:"running"},createdAt:new Date},this._voiceMessages.push(this._currentAssistantMsg);e.isFinal&&(this._currentAssistantMsg=null),this._markVoiceMessagesDirty(),this._notifySubscribers()}}_finishVoiceAssistantMessage(){let e=this._voiceMessages.at(-1);if(e?.role==="assistant"&&"running"===e.status.type){let t=this._voiceMessages.length-1;this._voiceMessages[t]={...e,status:{type:"complete",reason:"stop"}},this._markVoiceMessagesDirty(),this._notifySubscribers()}}disconnectVoice(){for(let e of(this._finishVoiceAssistantMessage(),this._currentAssistantMsg=null,this._voiceUnsubs))e();for(let e of(this._voiceUnsubs=[],this._voiceSession?.disconnect(),this._voiceSession=void 0,this.voice=void 0,this._voiceVolume=0,this._voiceVolumeSubscribers))e();this._voiceMessages=[],this._markVoiceMessagesDirty(),this._notifySubscribers()}muteVoice(){if(!this._voiceSession)throw Error("No active voice session");this._voiceSession.mute(),this.voice={...this.voice,isMuted:!0},this._notifySubscribers()}unmuteVoice(){if(!this._voiceSession)throw Error("No active voice session");this._voiceSession.unmute(),this.voice={...this.voice,isMuted:!1},this._notifySubscribers()}ensureInitialized(){this._isInitialized||(this._isInitialized=!0,this._notifyEventSubscribers("initialize",{}))}export(){return this.repository.export()}import(e){this.ensureInitialized(),this.repository.clear(),this.repository.import(e),this._notifySubscribers()}reset(e){this.import(hc(e??[]))}_eventSubscribers=new Map;unstable_on(e,t){if("modelContextUpdate"===e)return this._contextProvider.subscribe?.(()=>t({}))??(()=>{});let r=this._eventSubscribers.get(e);return r||(r=new Set,this._eventSubscribers.set(e,r)),r.add(t),()=>{this._eventSubscribers.get(e)?.delete(t)}}}Object.freeze([]);let hW="__DEFAULT_ID__";Object.freeze({[hW]:{id:hW,remoteId:void 0,externalId:void 0,status:"regular",title:void 0}});let hJ=(e,t,r)=>r.reduce((e,r)=>r?.(e,t)??e,e);class hH extends fK{_pendingTransforms=[];_completedOptimistics=[];_baseValue;_cachedValue;constructor(e){super(),this._baseValue=e,this._cachedValue=e}_updateState(){this._cachedValue=this._pendingTransforms.reduce((e,t)=>hJ(e,t.task,[t.loading,t.optimistic]),this._baseValue),this._notifySubscribers()}get baseValue(){return this._baseValue}get value(){return this._cachedValue}update(e){this._baseValue=e,this._updateState()}async optimisticUpdate(e){let t=e.execute(),r={...e,task:t};try{this._pendingTransforms.push(r),this._updateState();let n=await t;for(let t of(this._baseValue=hJ(this._baseValue,n,[e.optimistic,e.then]),this._completedOptimistics))this._baseValue=t(this._baseValue);return e.optimistic&&this._completedOptimistics.push(e.optimistic),n}finally{let e=this._pendingTransforms.indexOf(r);e>-1&&this._pendingTransforms.splice(e,1),0===this._pendingTransforms.length&&(this._completedOptimistics.length=0),this._updateState()}}}let hK=Error("This is the empty thread, a placeholder for the main thread. You cannot perform any actions on this thread instance. This error is probably because you tried to call a thread method in your render function. Call the method inside a `useEffect` hook instead."),hG={getMessageById(){},getBranches:()=>[],switchToBranch(){throw hK},append(){throw hK},startRun(){throw hK},resumeRun(){throw hK},cancelRun(){throw hK},addToolResult(){throw hK},resumeToolCall(){throw hK},speak(){throw hK},stopSpeaking(){throw hK},connectVoice(){throw hK},disconnectVoice(){throw hK},getVoiceVolume:()=>0,subscribeVoiceVolume:()=>()=>{},muteVoice(){throw hK},unmuteVoice(){throw hK},submitFeedback(){throw hK},getModelContext:()=>({}),exportExternalState(){throw hK},importExternalState(){throw hK},composer:{attachments:[],attachmentAccept:"*",async addAttachment(){throw hK},async removeAttachment(){throw hK},isEditing:!0,canCancel:!1,canSend:!1,isEmpty:!0,text:"",setText(){throw hK},role:"user",setRole(){throw hK},runConfig:{},setRunConfig(){throw hK},async reset(){},async clearAttachments(){},send(){throw hK},cancel(){},dictation:void 0,startDictation(){throw hK},stopDictation(){},quote:void 0,setQuote(){throw hK},subscribe:()=>()=>{},unstable_on:()=>()=>{}},getEditComposer(){},beginEdit(){throw hK},speech:void 0,voice:void 0,capabilities:{switchToBranch:!1,switchBranchDuringRun:!1,edit:!1,reload:!1,cancel:!1,unstable_copy:!1,speech:!1,dictation:!1,voice:!1,attachments:!1,feedback:!1,queue:!1},isDisabled:!1,isSendDisabled:!1,isLoading:!0,messages:[],state:null,suggestions:[],extras:void 0,subscribe:()=>()=>{},import(){throw hK},export:()=>({messages:[]}),reset(){throw hK},unstable_on:()=>()=>{}},hY=(e,t)=>{for(let r of e){if(void 0!==t.threadIdMap[r.remoteId])continue;switch(r.status){case"regular":t.threadIds.push(r.remoteId);break;case"archived":t.archivedThreadIds.push(r.remoteId);break;default:{let e=r.status;throw Error(`Unsupported state: ${e}`)}}let e=r.remoteId;t.threadIdMap[r.remoteId]=e,t.threadData[e]={id:r.remoteId,remoteId:r.remoteId,externalId:r.externalId,status:r.status,title:r.title,custom:r.custom,initializeTask:Promise.resolve({remoteId:r.remoteId,externalId:r.externalId})}}return t},hX=(e,t)=>{let r=e.threadIdMap[t];if(void 0!==r)return e.threadData[r]},hQ=(e,t,r)=>{let n=hX(e,t);if(!n)return e;let{id:i,remoteId:a,status:o}=n;if(o===r)return e;let s={...e};switch(o){case"new":s.newThreadId=void 0;break;case"regular":s.threadIds=s.threadIds.filter(e=>e!==i);break;case"archived":s.archivedThreadIds=s.archivedThreadIds.filter(e=>e!==i);break;default:throw Error(`Unsupported state: ${o}`)}switch(r){case"regular":s.threadIds=[i,...s.threadIds];break;case"archived":s.archivedThreadIds=[i,...s.archivedThreadIds];break;case"deleted":s.threadData=Object.fromEntries(Object.entries(s.threadData).filter(([e])=>e!==i)),s.threadIdMap=Object.fromEntries(Object.entries(s.threadIdMap).filter(([e])=>e!==i&&e!==a));break;default:throw Error(`Unsupported state: ${r}`)}return"deleted"!==r&&(s.threadData={...s.threadData,[i]:{...n,status:r}}),s},h0=({runtime:e,children:t})=>{let r=tU({threadListItem:tB({runtime:e})});return(0,ew.jsx)(tw,{value:r,children:t})},h1=({detectorRef:e})=>((0,ek.useLayoutEffect)(()=>{e.current=!0},[e]),null);class h2 extends fK{useRuntimeHook;instances=new Map;useAliveThreadsKeysChanged=ra(()=>({}));parent;constructor(e,t){super(),this.parent=t,this.useRuntimeHook=ra(()=>({useRuntime:e}))}startThreadRuntime(e){return this.instances.has(e)||(this.instances.set(e,{}),this.useAliveThreadsKeysChanged.setState({},!0)),new Promise((t,r)=>{let n=()=>{let n=this.instances.get(e);if(n){if(!n.runtime)return;i(),t(n.runtime)}else i(),r(Error("Thread was deleted before runtime was started"))},i=this.subscribe(n);n()})}getThreadRuntimeCore(e){let t=this.instances.get(e);if(t)return t.runtime}stopThreadRuntime(e){this.instances.delete(e),this.useAliveThreadsKeysChanged.setState({},!0)}setRuntimeHook(e){this.useRuntimeHook.getState().useRuntime!==e&&this.useRuntimeHook.setState({useRuntime:e},!0)}_RuntimeBinder=({threadId:e,children:t})=>{let{useRuntime:r}=this.useRuntimeHook(),n=r(),i=n.thread.__internal_threadBinding,a=(0,ek.useCallback)(()=>{let t=this.instances.get(e);if(!t)throw Error("Thread not found. This is a bug in assistant-ui.");t.runtime=i.getState(),this._notifySubscribers()},[e,i]),o=(0,ek.useRef)(!1);o.current||a(),(0,ek.useEffect)(()=>(o.current=!0,a(),i.outerSubscribe(a)),[i,a]);let s=tU(),l=(0,ek.useRef)(void 0);return(0,ek.useEffect)(()=>{let e=i.getState(),t=e.__internal_setGetInitializePromise;"function"==typeof t&&t.call(e,()=>l.current)},[i]),(0,ek.useEffect)(()=>n.threads.main.unstable_on("initialize",()=>{if("new"===s.threadListItem().getState().status){l.current=s.threadListItem().initialize();let e=n.thread.unstable_on("runEnd",()=>{e(),s.threadListItem().generateTitle()})}}),[n,s]),(0,ew.jsx)(ew.Fragment,{children:t})};_OuterActiveThreadProvider=(0,ek.memo)(({threadId:e,provider:t})=>{let r=(0,ek.useMemo)(()=>new hF(this.parent).getItemById(e),[e]),n=(0,ek.useRef)(!1);return(0,ek.useEffect)(()=>{},[t]),(0,ew.jsx)(h0,{runtime:r,children:(0,ew.jsx)(t,{children:(0,ew.jsx)(this._RuntimeBinder,{threadId:e,children:(0,ew.jsx)(h1,{detectorRef:n})})})})});__internal_RenderThreadRuntimes=({provider:e})=>(this.useAliveThreadsKeysChanged(),Array.from(this.instances.keys()).map(t=>(0,ew.jsx)(this._OuterActiveThreadProvider,{threadId:t,provider:e},t)))}let h4=f1("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);class h6{_state;constructor(e=null){this._state=e}get state(){return this._state}append(e){this._state=e.reduce((e,t)=>h6.apply(e,t),this._state)}static apply(e,t){let r=t.type;switch(r){case"set":return h6.updatePath(e,t.path,()=>t.value);case"append-text":return h6.updatePath(e,t.path,e=>{if("string"!=typeof e)throw Error(`Expected string at path [${t.path.join(", ")}]`);return e+t.value});default:throw Error(`Invalid operation type: ${r}`)}}static updatePath(e,t,r){if(0===t.length)return r(e);if("object"!=typeof(e??={}))throw Error(`Invalid path: [${t.join(", ")}]`);let[n,...i]=t;if(Array.isArray(e)){let a=Number(n);if(Number.isNaN(a))throw Error(`Expected array index at [${t.join(", ")}]`);if(a>e.length||a<0)throw Error("Insert array index out of bounds");let o=[...e];return o[a]=h6.updatePath(o[a],i,r),o}let a={...e};return a[n]=h6.updatePath(a[n],i,r),a}}class h5{_streamStartTime;_firstTokenTime;_totalChunks=0;_toolCallIds=new Set;constructor(){this._streamStartTime=Date.now()}recordChunk(){this._totalChunks++}recordFirstToken(){void 0===this._firstTokenTime&&(this._firstTokenTime=Date.now())}recordToolCallStart(e){this._toolCallIds.add(e)}getTiming(e,t){let r=Date.now()-this._streamStartTime,n=e&&e>0?e:t?Math.ceil(t.length/4):void 0,i=n&&r>0?n/r*1e3:void 0;return{streamStartTime:this._streamStartTime,...void 0!==this._firstTokenTime?{firstTokenTime:this._firstTokenTime-this._streamStartTime}:void 0,totalStreamTime:r,...void 0!==n?{tokenCount:n}:void 0,...void 0!==i?{tokensPerSecond:i}:void 0,totalChunks:this._totalChunks,toolCallCount:this._toolCallIds.size}}}let h3=(e,t,r)=>{if(0===e.parts.length)throw Error("No parts available to update.");if(1!==t.path.length)throw Error("Nested paths are not supported yet.");let n=t.path[0],i=r(e.parts[n]);return{...e,parts:[...e.parts.slice(0,n),i,...e.parts.slice(n+1)],get content(){return this.parts}}},h9=(e,t)=>{if(e.status?.type==="incomplete"&&e.status?.reason==="error")return e;let r=h8(t);return{...e,status:r}},h8=e=>"tool-calls"===e.finishReason?{type:"requires-action",reason:"tool-calls"}:"stop"===e.finishReason||"unknown"===e.finishReason?{type:"complete",reason:e.finishReason}:{type:"incomplete",reason:e.finishReason},h7=(e,t)=>{let r=0;for(let e of t.metadata.steps)"finished"===e.state&&e.usage&&(r+=e.usage.outputTokens);let n="";for(let e of t.parts)("text"===e.type||"reasoning"===e.type)&&(n+=e.text);return e.getTiming(r>0?r:void 0,n||void 0)};class ge extends TransformStream{constructor({initialMessage:e,throttle:t,onError:r}={}){let n,i=e??(({unstable_state:e=null}={})=>({role:"assistant",status:{type:"running"},parts:[],get content(){return this.parts},metadata:{unstable_state:e,unstable_data:[],unstable_annotations:[],steps:[],custom:{}}}))();const a=new h5,o=t?(e=>{let t=!1;return()=>{t||(t=!0,queueMicrotask(()=>{t=!1,e()}))}})(()=>{n?.enqueue(i)}):()=>{n?.enqueue(i)};super({start(e){n=e},transform(e){var t,n;a.recordChunk();let s=e.type;switch(s){case"part-start":i=((e,t)=>{let r=t.part;if("text"===r.type||"reasoning"===r.type){let t={type:r.type,text:"",status:{type:"running"},...r.parentId&&{parentId:r.parentId}};return{...e,parts:[...e.parts,t],get content(){return this.parts}}}if("tool-call"===r.type){let t={type:"tool-call",state:"partial-call",status:{type:"running",isArgsComplete:!1},toolCallId:r.toolCallId,toolName:r.toolName,argsText:"",args:{},...r.parentId&&{parentId:r.parentId}};return{...e,parts:[...e.parts,t],get content(){return this.parts}}}if("source"===r.type){let t={type:"source",sourceType:r.sourceType,id:r.id,url:r.url,...r.title?{title:r.title}:void 0,...r.parentId&&{parentId:r.parentId}};return{...e,parts:[...e.parts,t],get content(){return this.parts}}}if("file"===r.type){let t={type:"file",mimeType:r.mimeType,data:r.data,...r.parentId&&{parentId:r.parentId}};return{...e,parts:[...e.parts,t],get content(){return this.parts}}}if("data"===r.type){let t={type:"data",name:r.name,data:r.data,...r.parentId&&{parentId:r.parentId}};return{...e,parts:[...e.parts,t],get content(){return this.parts}}}else throw Error(`Unsupported part type: ${r.type}`)})(i,e),"tool-call"===e.part.type&&a.recordToolCallStart(e.part.toolCallId);break;case"tool-call-args-text-finish":i=h3(i,e,e=>{if("tool-call"!==e.type)throw Error("Last is not a tool call");return"partial-call"!==e.state?e:{...e,state:"call"}});break;case"part-finish":i=h3(i,e,e=>({...e,status:{type:"complete",reason:"unknown"}}));break;case"text-delta":i=h3(i,e,t=>{if("text"===t.type||"reasoning"===t.type)return{...t,text:t.text+e.textDelta};if("tool-call"===t.type){let r=t.argsText+e.textDelta,n=ho(r)??t.args;return{...t,argsText:r,args:n}}throw Error("text-delta received but part is neither text nor tool-call")}),a.recordFirstToken();break;case"result":i=h3(i,e,t=>{if("tool-call"===t.type)return{...t,state:"result",...void 0!==e.artifact?{artifact:e.artifact}:{},result:e.result,isError:e.isError??!1,...void 0!==e.modelContent?{modelContent:e.modelContent}:{},...void 0!==e.messages?{messages:e.messages}:{},status:{type:"complete",reason:"stop"}};throw Error("Result chunk received but part is not a tool-call")});break;case"message-finish":i=h9(i,e);break;case"annotations":let l;i={...l=i,metadata:{...l.metadata,unstable_annotations:[...l.metadata.unstable_annotations,...e.annotations]}};break;case"data":let u;i={...u=i,metadata:{...u.metadata,unstable_data:[...u.metadata.unstable_data,...e.data]}};break;case"step-start":let d;i={...d=i,metadata:{...d.metadata,steps:[...d.metadata.steps,{state:"started",messageId:e.messageId}]}};break;case"step-finish":let c,p;p=(c=(t=i).metadata.steps.slice()).length-1,c.length>0&&c[p]?.state==="started"?c[p]={...c[p],state:"finished",finishReason:e.finishReason,usage:e.usage,isContinued:e.isContinued}:c.push({state:"finished",messageId:h4(),finishReason:e.finishReason,usage:e.usage,isContinued:e.isContinued}),i={...t,metadata:{...t.metadata,steps:c}};break;case"error":i={...i,status:{type:"incomplete",reason:"error",error:e.error}},r?.(e.error);break;case"update-state":let m;(m=new h6((n=i).metadata.unstable_state)).append(e.operations),i={...n,metadata:{...n.metadata,unstable_state:m.state}};break;default:throw Error(`Unsupported chunk type: ${s}`)}"running"!==i.status.type&&(i={...i,metadata:{...i.metadata,timing:h7(a,i)}}),o()},flush(e){if(i.status?.type==="running"){let t=i.parts?.some(e=>"tool-call"===e.type&&("call"===e.state||"partial-call"===e.state)&&void 0===e.result)??!1;i={...i=h9(i,{type:"message-finish",path:[],finishReason:t?"tool-calls":"unknown",usage:{inputTokens:0,outputTokens:0}}),metadata:{...i.metadata,timing:h7(a,i)}},e.enqueue(i)}}})}}class gt{readable;constructor(e){this.readable=e,this.readable=e}static fromAssistantStream(e){return new gt(e.pipeThrough(new ge))}async unstable_result(){let e;for await(let t of this)e=t;return e||{role:"assistant",status:{type:"complete",reason:"unknown"},parts:[],content:[],metadata:{unstable_state:null,unstable_data:[],unstable_annotations:[],steps:[],custom:{}}}}[Symbol.asyncIterator](){let e=this.readable.getReader();return{async next(){let{done:t,value:r}=await e.read();return t?{done:!0,value:void 0}:{done:!1,value:r}}}}tee(){let[e,t]=this.readable.tee();return[new gt(e),new gt(t)]}}let gr=(0,ek.createContext)(null),gn=({adapters:e,children:t})=>{let r=(0,ek.useContext)(gr);return(0,ew.jsx)(gr.Provider,{value:{...r,...e},children:t})},gi=()=>(0,ek.useContext)(gr);class ga extends fK{_options;_hookManager;_loadThreadsPromise;_loadMorePromise;_loadGeneration=0;_mainThreadId;_state=new hH({isLoading:!0,isLoadingMore:!1,cursor:void 0,newThreadId:void 0,threadIds:[],archivedThreadIds:[],threadIdMap:{},threadData:{}});get threadItems(){return this._state.value.threadData}getLoadThreadsPromise(){if(!this._loadThreadsPromise){let e=this._loadGeneration;this._loadThreadsPromise=this._state.optimisticUpdate({execute:()=>this._options.adapter.list(),loading:e=>({...e,isLoading:!0}),then:(t,r)=>{if(e!==this._loadGeneration)return t;let n=hY(r.threads,{threadIds:[],archivedThreadIds:[],threadIdMap:{},threadData:{}});return{...t,isLoading:!1,cursor:r.nextCursor||void 0,threadIds:n.threadIds,archivedThreadIds:n.archivedThreadIds,threadIdMap:{...t.threadIdMap,...n.threadIdMap},threadData:{...t.threadData,...n.threadData}}}}).catch(t=>{e===this._loadGeneration&&(console.error("[assistant-ui] thread list load failed:",t),this._loadThreadsPromise=void 0,this._state.update({...this._state.baseValue,isLoading:!1}))}).then(()=>{})}return this._loadThreadsPromise}loadMore(){if(this._loadMorePromise)return this._loadMorePromise;let e=this._state.value;if(void 0===e.cursor||e.isLoading)return Promise.resolve();let t=this._loadGeneration,r=this._options.adapter,n=e.cursor,i=this._state.optimisticUpdate({execute:()=>r.list({after:n}),loading:e=>({...e,isLoadingMore:!0}),then:(e,n)=>{if(t!==this._loadGeneration||r!==this._options.adapter)return e;let i=hY(n.threads,{threadIds:[...e.threadIds],archivedThreadIds:[...e.archivedThreadIds],threadIdMap:{...e.threadIdMap},threadData:{...e.threadData}});return{...e,isLoadingMore:!1,cursor:n.nextCursor||void 0,threadIds:i.threadIds,archivedThreadIds:i.archivedThreadIds,threadIdMap:i.threadIdMap,threadData:i.threadData}}}).catch(e=>{console.error("[assistant-ui] thread list loadMore failed:",e)}).then(()=>{this._loadMorePromise===i&&(this._loadMorePromise=void 0)});return this._loadMorePromise=i,i}contextProvider;constructor(e,t){super(),this.contextProvider=t,this._state.subscribe(()=>this._notifySubscribers()),this._hookManager=new h2(e.runtimeHook,this),this.useProvider=ra(()=>({Provider:e.adapter.unstable_Provider??ek.Fragment})),this.__internal_setOptions(e),this.switchToNewThread()}_initialThreadLoaded=!1;useProvider;__internal_setOptions(e){if(this._options===e)return;let t=void 0!==this._options&&this._options.adapter!==e.adapter;this._options=e;let r=e.adapter.unstable_Provider??ek.Fragment;r!==this.useProvider.getState().Provider&&this.useProvider.setState({Provider:r},!0),this._hookManager.setRuntimeHook(e.runtimeHook),t&&(this._loadGeneration++,this._loadThreadsPromise=void 0,this._loadMorePromise=void 0,this._state.update({...this._state.baseValue,cursor:void 0}))}__internal_load(){this.getLoadThreadsPromise();let e=this._options.threadId??this._options.initialThreadId;!this._initialThreadLoaded&&e&&(this._initialThreadLoaded=!0,this.switchToThread(e).catch(()=>{}))}reload(){return this._loadGeneration++,this._loadThreadsPromise=void 0,this._loadMorePromise=void 0,this._state.update({...this._state.baseValue,cursor:void 0}),this.getLoadThreadsPromise()}get isLoading(){return this._state.value.isLoading}get isLoadingMore(){return this._state.value.isLoadingMore}get hasMore(){return void 0!==this._state.value.cursor}get threadIds(){return this._state.value.threadIds}get archivedThreadIds(){return this._state.value.archivedThreadIds}get newThreadId(){return this._state.value.newThreadId}get mainThreadId(){return this._mainThreadId}getMainThreadRuntimeCore(){let e=this._hookManager.getThreadRuntimeCore(this._mainThreadId);return e||hG}getThreadRuntimeCore(e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");let r=this._hookManager.getThreadRuntimeCore(t.id);if(!r)throw Error("Thread not found");return r}getItemById(e){return hX(this._state.value,e)}async switchToThread(e){let t=this.getItemById(e);if(!t){let r=await this._options.adapter.fetch(e),n=this._state.value,i=r.remoteId,a={...n.threadData,[i]:{id:i,initializeTask:Promise.resolve({remoteId:r.remoteId,externalId:r.externalId}),remoteId:r.remoteId,externalId:r.externalId,status:r.status,title:r.title,custom:r.custom}},o={...n.threadIdMap,[r.remoteId]:i},s=n.threadIds.filter(e=>e!==r.remoteId),l=n.archivedThreadIds.filter(e=>e!==r.remoteId),u="regular"===r.status?[...s,r.remoteId]:s,d="archived"===r.status?[...l,r.remoteId]:l;this._state.update({...n,threadIds:u,archivedThreadIds:d,threadIdMap:o,threadData:a}),t=this.getItemById(e)}if(!t)throw Error("Thread not found");if(this._mainThreadId===t.id)return;let r=this._hookManager.startThreadRuntime(t.id);void 0!==this.mainThreadId?await r:r.then(()=>this._notifySubscribers()),"archived"===t.status&&await this.unarchive(t.id),this._mainThreadId=t.id,this._notifySubscribers()}async switchToNewThread(){for(;void 0!==this._state.baseValue.newThreadId&&void 0===this._state.value.newThreadId;)await this._state.waitForUpdate();let e=this._state.value,t=this._state.value.newThreadId;if(void 0===t){do t=`__LOCALID_${f2()}`;while(e.threadIdMap[t])let r=t;this._state.update({...e,newThreadId:t,threadIdMap:{...e.threadIdMap,[t]:r},threadData:{...e.threadData,[r]:{status:"new",id:t,remoteId:void 0,externalId:void 0,title:void 0,custom:void 0}}})}return this.switchToThread(t)}initialize=async e=>{if(this._state.value.newThreadId!==e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");if("new"===t.status)throw Error("Unexpected new state");return t.initializeTask}return this._state.optimisticUpdate({execute:()=>this._options.adapter.initialize(e),optimistic:t=>hQ(t,e,"regular"),loading:(t,r)=>({...t,threadData:{...t.threadData,[e]:{...t.threadData[e],initializeTask:r}}}),then:(t,{remoteId:r,externalId:n})=>{let i=hX(t,e);return i?{...t,threadIdMap:{...t.threadIdMap,[r]:e},threadData:{...t.threadData,[e]:{...i,initializeTask:Promise.resolve({remoteId:r,externalId:n}),remoteId:r,externalId:n}}}:t}})};generateTitle=async e=>{let t=this.getItemById(e);if(!t)throw Error("Thread not found");if("new"===t.status)throw Error("Thread is not yet initialized");let{remoteId:r}=await t.initializeTask,n=this._hookManager.getThreadRuntimeCore(t.id);if(!n)return;let i=n.messages,a=await this._options.adapter.generateTitle(r,i);for await(let e of gt.fromAssistantStream(a)){let r=e.parts.filter(e=>"text"===e.type)[0]?.text,n=this._state.baseValue,i=hX(n,t.id);i&&this._state.update({...n,threadData:{...n.threadData,[i.id]:{...i,title:r}}})}};rename(e,t){let r=this.getItemById(e);if(!r)throw Error("Thread not found");if("new"===r.status)throw Error("Thread is not yet initialized");return this._state.optimisticUpdate({execute:async()=>{let{remoteId:e}=await r.initializeTask;return this._options.adapter.rename(e,t)},optimistic:r=>{let n=hX(r,e);return n?{...r,threadData:{...r.threadData,[n.id]:{...n,title:t}}}:r}})}async _ensureThreadIsNotMain(e){if(e===this.newThreadId)throw Error("Cannot ensure new thread is not main");e===this._mainThreadId&&await this.switchToNewThread()}async archive(e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");if("regular"!==t.status)throw Error("Thread is not yet initialized or already archived");return await this._ensureThreadIsNotMain(t.id),this._state.optimisticUpdate({execute:async()=>{let{remoteId:e}=await t.initializeTask;return this._options.adapter.archive(e)},optimistic:e=>hQ(e,t.id,"archived")})}unarchive(e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");if("archived"!==t.status)throw Error("Thread is not archived");return this._state.optimisticUpdate({execute:async()=>{try{let{remoteId:e}=await t.initializeTask;return await this._options.adapter.unarchive(e)}catch(e){throw await this._ensureThreadIsNotMain(t.id),e}},optimistic:e=>hQ(e,t.id,"regular")})}async delete(e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");if("regular"!==t.status&&"archived"!==t.status)throw Error("Thread is not yet initialized");return await this._ensureThreadIsNotMain(t.id),this._hookManager.stopThreadRuntime(t.id),this._state.optimisticUpdate({execute:async()=>{let{remoteId:e}=await t.initializeTask;return await this._options.adapter.delete(e)},optimistic:e=>hQ(e,t.id,"deleted")})}async detach(e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");if("regular"!==t.status&&"archived"!==t.status)throw Error("Thread is not yet initialized");await this._ensureThreadIsNotMain(t.id),this._hookManager.stopThreadRuntime(t.id)}useBoundIds=ra(()=>[]);__internal_RenderComponent=()=>{let e=(0,ek.useId)();(0,ek.useEffect)(()=>(this.useBoundIds.setState(t=>[...t,e],!0),()=>{this.useBoundIds.setState(t=>t.filter(t=>t!==e),!0)}),[e]);let t=this.useBoundIds(),{Provider:r}=this.useProvider(),n={modelContext:this.contextProvider};return(0===t.length||t[0]===e)&&(0,ew.jsx)(gn,{adapters:n,children:(0,ew.jsx)(this._hookManager.__internal_RenderThreadRuntimes,{provider:r})})}}class go extends hh{threads;constructor(e){super(),this.threads=new ga(e,this._contextProvider)}get RenderComponent(){return this.threads.__internal_RenderComponent}}let gs=e=>{let t=(0,ek.useRef)(e.runtimeHook);t.current=e.runtimeHook;let r=(0,ek.useRef)(e.threadId??e.initialThreadId),n=(0,ek.useCallback)(()=>t.current(),[]),i=(0,ek.useMemo)(()=>({adapter:e.adapter,allowNesting:e.allowNesting,initialThreadId:r.current,runtimeHook:n}),[e.adapter,e.allowNesting,n]);if(null!==tU().threadListItem.source){if(!i.allowNesting)throw Error("useRemoteThreadListRuntime cannot be nested inside another RemoteThreadListRuntime. Set allowNesting: true to allow nesting (the inner runtime will become a no-op).");return n()}let a=(e=>{let[t]=(0,ek.useState)(()=>new go(e));return(0,ek.useEffect)(()=>{t.threads.__internal_setOptions(e),t.threads.__internal_load()},[t,e]),(0,ek.useMemo)(()=>new hB(t),[t])})(i),o=(0,ek.useRef)(e.threadId);return(0,ek.useEffect)(()=>{e.threadId!==o.current&&(o.current=e.threadId,e.threadId?a.threads.switchToThread(e.threadId).catch(()=>{}):a.threads.switchToNewThread().catch(()=>{}))},[a,e.threadId]),a},gl=e=>{try{let t=e.split(".")[1];if(!t)throw Error("Invalid JWT format");let r=t.replace(/-/g,"+").replace(/_/g,"/");for(;r.length%4!=0;)r+="=";let n=atob(r),i=JSON.parse(n).exp;if(!i||"number"!=typeof i)throw Error('JWT does not contain a valid "exp" field');return 1e3*i}catch(e){throw Error(`Unable to determine the token expiry: ${e}`)}};class gu{strategy="jwt";cachedToken=null;tokenExpiry=null;#t;constructor(e){this.#t=e}async getAuthHeaders(){let e=Date.now();if(this.cachedToken&&this.tokenExpiry&&this.tokenExpiry-e>3e4)return{Authorization:`Bearer ${this.cachedToken}`};let t=await this.#t();return!!t&&(this.cachedToken=t,this.tokenExpiry=gl(t),{Authorization:`Bearer ${t}`})}readAuthHeaders(e){let t=e.get("Authorization");if(!t)return;let[r,n]=t.split(" ");if("Bearer"!==r||!n)throw Error("Invalid auth header received");this.cachedToken=n,this.tokenExpiry=gl(n)}}class gd{strategy="api-key";#r;#n;#i;constructor(e,t,r){this.#r=e,this.#n=t,this.#i=r}async getAuthHeaders(){return{Authorization:`Bearer ${this.#r}`,"Aui-User-Id":this.#n,"Aui-Workspace-Id":this.#i}}readAuthHeaders(){}}let gc="aui:refresh_token";class gp{strategy="anon";baseUrl;jwtStrategy;constructor(e){this.baseUrl=e,this.jwtStrategy=new gu(async()=>{let e=Date.now(),t=localStorage.getItem(gc),r=t?JSON.parse(t):void 0;if(r)if(new Date(r.expires_at).getTime()-e>3e4){let e=await fetch(`${this.baseUrl}/v1/auth/tokens/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:r.token})});if(e.ok){let{access_token:t,refresh_token:r}=await e.json();return r&&localStorage.setItem(gc,JSON.stringify(r)),t}}else localStorage.removeItem(gc);let n=await fetch(`${this.baseUrl}/v1/auth/tokens/anonymous`,{method:"POST"});if(!n.ok)return null;let{access_token:i,refresh_token:a}=await n.json();return i&&a?(localStorage.setItem(gc,JSON.stringify(a)),i):null})}async getAuthHeaders(){return this.jwtStrategy.getAuthHeaders()}readAuthHeaders(e){this.jwtStrategy.readAuthHeaders(e)}}class gm extends Error{constructor(e){super(e),this.name="APIError"}}class gf{_auth;_baseUrl;constructor(e){if("authToken"in e)this._baseUrl=e.baseUrl,this._auth=new gu(e.authToken);else if("apiKey"in e)this._baseUrl=(e.baseUrl??"https://backend.assistant-api.com").replace(/\/$/,""),this._auth=new gd(e.apiKey,e.userId,e.workspaceId);else if("anonymous"in e)this._baseUrl=e.baseUrl,this._auth=new gp(e.baseUrl);else throw Error("Invalid configuration: Must provide authToken, apiKey, or anonymous configuration")}async initializeAuth(){return!!this._auth.getAuthHeaders()}async makeRawRequest(e,t={}){let r=await this._auth.getAuthHeaders();if(!r)throw Error("Authorization failed");let n={...r,...t.headers,"Content-Type":"application/json"},i=new URLSearchParams;if(t.query)for(let[e,r]of Object.entries(t.query))!1!==r&&(!0===r?i.set(e,"true"):i.set(e,r.toString()));let a=new URL(`${this._baseUrl}/v1${e}`);a.search=i.toString();let o=await fetch(a,{method:t.method??"GET",headers:n,body:t.body?JSON.stringify(t.body):null});if(this._auth.readAuthHeaders(o.headers),!o.ok){let e=await o.text();try{let t=JSON.parse(e);throw new gm(t.message)}catch(t){if(t instanceof gm)throw t;throw Error(`Request failed with status ${o.status}, ${e}`)}}return o}async makeRequest(e,t={}){return(await this.makeRawRequest(e,t)).json()}}class gh{cloud;constructor(e){this.cloud=e}async create(){return this.cloud.makeRequest("/auth/tokens",{method:"POST"})}}let gg={toResponse:(e,t)=>new Response(gg.toByteStream(e,t),{headers:t.headers??{}}),fromResponse:(e,t)=>gg.fromByteStream(e.body,t),toByteStream:(e,t)=>e.pipeThrough(t),fromByteStream:(e,t)=>e.pipeThrough(t)},gv=()=>{let e,t,r=new Promise((r,n)=>{e=r,t=n});if(!e||!t)throw Error("Failed to create promise");return{promise:r,resolve:e,reject:t}};class gy{_controller;_isClosed=!1;constructor(e){this._controller=e}append(e){return this._controller.enqueue({type:"text-delta",path:[],textDelta:e}),this}close(){this._isClosed||(this._isClosed=!0,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}}let gb=e=>new ReadableStream({start:t=>e.start?.(new gy(t)),pull:t=>e.pull?.(new gy(t)),cancel:t=>e.cancel?.(t)}),gx=()=>{let e;return[gb({start(t){e=t}}),e]};class gw{_controller;_isClosed=!1;_mergeTask;constructor(e){this._controller=e;const t=gb({start:e=>{this._argsTextController=e}});let r=!1;this._mergeTask=t.pipeTo(new WritableStream({write:e=>{switch(e.type){case"text-delta":r=!0,this._controller.enqueue(e);break;case"part-finish":r||this._controller.enqueue({type:"text-delta",textDelta:"{}",path:[]}),this._controller.enqueue({type:"tool-call-args-text-finish",path:[]});break;default:throw Error(`Unexpected chunk type: ${e.type}`)}}}))}get argsText(){return this._argsTextController}_argsTextController;async setResponse(e){this._argsTextController.close(),await Promise.resolve(),this._controller.enqueue({type:"result",path:[],...void 0!==e.artifact?{artifact:e.artifact}:{},result:e.result,isError:e.isError??!1,...void 0!==e.modelContent?{modelContent:e.modelContent}:{},...void 0!==e.messages?{messages:e.messages}:{}})}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}}class g_{value=-1;up(){return++this.value}}class gk extends TransformStream{constructor(e){super({transform(t,r){r.enqueue({...t,path:[e,...t.path]})}})}}TransformStream;class gI extends TransformStream{constructor(e){const t=new g_,r=new Map;super({transform(n,i){"part-start"===n.type&&0===n.path.length&&r.set(t.up(),e.up());let[a,...o]=n.path;if(void 0===a)return void i.enqueue(n);let s=r.get(a);if(void 0===s)throw Error("Path not found");i.enqueue({...n,path:[s,...o]})}})}}class gS{_state;_parentId;constructor(e){this._state=e||{merger:(()=>{let e,t,r=[],n=!1,i=i=>{i.promise||(i.promise=i.reader.read().then(({done:a,value:o})=>{i.promise=void 0,a?(r.splice(r.indexOf(i),1),n&&0===r.length&&e.close()):e.enqueue(o),t?.resolve(),t=void 0}).catch(n=>{console.error(n),r.forEach(e=>{e.reader.cancel()}),r.length=0,e.error(n),t?.reject(n),t=void 0}))};return{readable:new ReadableStream({start(t){e=t},pull:()=>(t=gv(),r.forEach(e=>{i(e)}),t.promise),cancel(){r.forEach(e=>{e.reader.cancel()}),r.length=0}}),isSealed:()=>n,seal(){n=!0,0===r.length&&e.close()},addStream(e){if(n)throw Error("Cannot add streams after the run callback has settled.");let t={reader:e.getReader()};r.push(t),i(t)},enqueue(e){this.addStream(new ReadableStream({start(t){t.enqueue(e),t.close()}}))}}})(),contentCounter:new g_}}get __internal_isClosed(){return this._state.merger.isSealed()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(e){this._state.closeSubscriber=e}_addPart(e,t){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:"part-start",part:e,path:[]}),this._state.merger.addStream(t.pipeThrough(new gk(this._state.contentCounter.value)))}merge(e){this._state.merger.addStream(e.pipeThrough(new gI(this._state.contentCounter)))}appendText(e){this._state.append?.kind!=="text"&&(this._state.append={kind:"text",controller:this.addTextPart()}),this._state.append.controller.append(e)}appendReasoning(e){this._state.append?.kind!=="reasoning"&&(this._state.append={kind:"reasoning",controller:this.addReasoningPart()}),this._state.append.controller.append(e)}addTextPart(){let[e,t]=gx();return this._addPart({type:"text"},e),t}addReasoningPart(){let[e,t]=gx();return this._addPart({type:"reasoning"},e),t}addToolCallPart(e){let t,r,n="string"==typeof e?{toolName:e}:e,i=n.toolName,a=n.toolCallId??h4(),[o,s]=[(r={start(e){t=e}},new ReadableStream({start:e=>r.start?.(new gw(e)),pull:e=>r.pull?.(new gw(e)),cancel:e=>r.cancel?.(e)})),t];return this._addPart({type:"tool-call",toolName:i,toolCallId:a,...this._parentId&&{parentId:this._parentId}},o),void 0!==n.argsText&&(s.argsText.append(n.argsText),s.argsText.close()),void 0!==n.args&&(s.argsText.append(JSON.stringify(n.args)),s.argsText.close()),void 0!==n.response&&s.setResponse(n.response),s}_finishedPartStream(){return new ReadableStream({start(e){e.enqueue({type:"part-finish",path:[]}),e.close()}})}_withParentIdOption(e){return this._parentId?{...e,parentId:this._parentId}:e}appendSource(e){this._addPart(this._withParentIdOption(e),this._finishedPartStream())}appendFile(e){this._addPart(this._withParentIdOption(e),this._finishedPartStream())}appendData(e){this._addPart(this._withParentIdOption(e),this._finishedPartStream())}enqueue(e){this._state.merger.enqueue(e),"part-start"===e.type&&0===e.path.length&&this._state.contentCounter.up()}withParentId(e){let t=new gS(this._state);return t._parentId=e,t}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}}function g$(e){let t=new gS;return(async()=>{try{await e(t)}catch(e){throw t.__internal_isClosed||t.enqueue({type:"error",path:[],error:String(e)}),e}finally{t.__internal_isClosed||t.close()}})(),t.__internal_getReadable()}function gj(){let e,{resolve:t,promise:r}=gv();return[g$(n=>((e=n).__internal_subscribeToClose(t),r)),e]}class gE extends TransformStream{constructor(e,t,r){let n;const[i,a]=gj();super({start:t=>(n=i.pipeTo(new WritableStream({write(e){t.enqueue(e)},abort(e){t.error(e)},close(){t.terminate()}})).catch(e=>{t.error(e)}),e.start?.(a)),transform:t=>e.transform?.(t,a),async flush(){await e.flush?.(a),a.close(),await n}},t,r)}}class gT extends TransformStream{constructor(e){super(),Object.defineProperty(this,"readable",{value:e(super.readable),writable:!1})}}class gC extends gT{constructor(){super(e=>{let t=new gE({transform(e,t){t.appendText(e)}});return e.pipeThrough(new TextDecoderStream).pipeThrough(t)})}}class gN{cloud;constructor(e){this.cloud=e}__internal_getAssistantOptions(e){return{api:`${this.cloud._baseUrl}/v1/runs/stream`,headers:async()=>{let e=await this.cloud._auth.getAuthHeaders();if(!e)throw Error("Authorization failed");return{...e,Accept:"text/plain"}},body:{assistant_id:e,response_format:"vercel-ai-data-stream/v1",thread_id:"unstable_todo"}}}async stream(e){let t=await this.cloud.makeRawRequest("/runs/stream",{method:"POST",headers:{Accept:"text/plain"},body:e});return gg.fromResponse(t,new gC)}async report(e){return this.cloud.makeRequest("/runs",{method:"POST",body:e})}}class gA{cloud;constructor(e){this.cloud=e}async list(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{query:t})}async create(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{method:"POST",body:t})}async update(e,t,r){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages/${encodeURIComponent(t)}`,{method:"PUT",body:r})}}class gR{cloud;messages;constructor(e){this.cloud=e,this.messages=new gA(e)}async list(e){return this.cloud.makeRequest("/threads",{query:e})}async get(e){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`)}async create(e){return this.cloud.makeRequest("/threads",{method:"POST",body:e})}async update(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"PUT",body:t})}async delete(e){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"DELETE"})}}class gP{cloud;constructor(e){this.cloud=e}async pdfToImages(e){return this.cloud.makeRequest("/files/pdf-to-images",{method:"POST",body:e})}async generatePresignedUploadUrl(e){return this.cloud.makeRequest("/files/attachments/generate-presigned-upload-url",{method:"POST",body:e})}}class gO{list(){return Promise.resolve({threads:[]})}rename(){return Promise.resolve()}archive(){return Promise.resolve()}unarchive(){return Promise.resolve()}delete(){return Promise.resolve()}initialize(e){return Promise.resolve({remoteId:e,externalId:void 0})}generateTitle(){return Promise.resolve(new ReadableStream)}fetch(e){return Promise.reject(Error("Thread not found"))}}class gM{cloud;idMapping={};constructor(e){this.cloud=e}async append(e,t,r,n,i){let a=r?await this.idMapping[r]??r:null,o=this.cloud.threads.messages.create(e,{parent_id:a,format:n,content:i}).then(({message_id:e})=>(this.idMapping[t]=e,e)).catch(e=>{throw this.idMapping[t]===o&&delete this.idMapping[t],e});return this.idMapping[t]=o,o.then(()=>{})}async update(e,t,r,n){let i=await this.getRemoteId(t);i&&await this.cloud.threads.messages.update(e,i,{content:n})}isPersisted(e){return e in this.idMapping}async getRemoteId(e){let t=this.idMapping[e];if(t)return t}async load(e,t){let{messages:r}=await this.cloud.threads.messages.list(e,t?{format:t}:void 0);for(let e of r)this.idMapping[e.id]=e.id;return r}reset(){this.idMapping={}}}function gz(e){return null!=e&&"object"==typeof e&&!Array.isArray(e)}function gD(e,t=0){return!(t>100)&&(null===e||"string"==typeof e||"boolean"==typeof e||("number"==typeof e?!Number.isNaN(e)&&Number.isFinite(e):Array.isArray(e)?e.every(e=>gD(e,t+1)):!!gz(e)&&Object.entries(e).every(([e,r])=>"string"==typeof e&&gD(r,t+1))))}function gU(e){let t=e.content,r=hd({id:e.id,createdAt:e.created_at,...t},e.id,{type:"complete",reason:"unknown"});return{parentId:e.parent_id,message:r}}let gL=new WeakMap;class gZ{cloudRef;aui;constructor(e,t){this.cloudRef=e,this.aui=t}get _persistence(){let e=this.aui.threadListItem();return gL.has(e)||gL.set(e,new gM(this.cloudRef.current)),gL.get(e)}withFormat(e){let t,r=this,n=(t=this._persistence,{append:async(r,n)=>{let i=e.getId(n.message),a=e.encode(n);return t.append(r,i,n.parentId,e.format,a)},update:t.update?async(r,n,i)=>{let a=e.encode(n);return t.update(r,i,e.format,a)}:void 0,load:async r=>({messages:(await t.load(r,e.format)).filter(t=>t.format===e.format).map(t=>e.decode({id:t.id,parent_id:t.parent_id,format:t.format,content:t.content})).reverse()}),isPersisted:e=>t.isPersisted(e)});return{async append(e){let{remoteId:t}=await r.aui.threadListItem().initialize();await n.append(t,e)},async update(e,t){let i=r.aui.threadListItem().getState().remoteId;i&&await n.update?.(i,e,t)},reportTelemetry(t,n){let i=t.map(t=>e.encode(t));r._reportRunTelemetry(e.format,i,n)},async load(){let e=r.aui.threadListItem().getState().remoteId;return e?n.load(e):{messages:[]}}}}async append({parentId:e,message:t}){let r,{remoteId:n}=await this.aui.threadListItem().initialize(),i=(r=t.status?.type==="running"?{type:"incomplete",reason:"cancelled"}:t.status,{role:t.role,content:t.content.map(e=>{let t=e.type;switch(t){case"text":return{type:"text",text:e.text};case"reasoning":return{type:"reasoning",text:e.text};case"source":if("url"===e.sourceType)return{type:"source",sourceType:"url",id:e.id,url:e.url,...null!=e.title?{title:e.title}:void 0,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:void 0};return{type:"source",sourceType:"document",id:e.id,title:e.title,mediaType:e.mediaType,...null!=e.filename?{filename:e.filename}:void 0,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:void 0};case"tool-call":return gD(e.result)||console.warn(`tool-call result is not JSON! ${JSON.stringify(e)}`),{type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,...JSON.stringify(e.args)===e.argsText?{args:e.args}:{argsText:e.argsText},...e.result?{result:e.result}:void 0,...e.isError?{isError:!0}:void 0};case"image":return{type:"image",image:e.image};case"file":return{type:"file",data:e.data,mimeType:e.mimeType,...e.filename?{filename:e.filename}:void 0};default:throw Error(`Message part type not supported by aui/v0: ${t}`)}}),metadata:t.metadata,...r?{status:r}:void 0});await this._persistence.append(n,t.id,e,"aui/v0",i),this.cloudRef.current.telemetry.enabled&&this._maybeReportRun(n,"aui/v0",i)}async load(){let e=this.aui.threadListItem().getState().remoteId;return e?{messages:(await this._persistence.load(e,"aui/v0")).filter(e=>"aui/v0"===e.format).map(gU).reverse()}:{messages:[]}}_reportRunTelemetry(e,t,r){if(!this.cloudRef.current.telemetry.enabled)return;let n=this.aui.threadListItem().getState().remoteId;if(!n)return;let i=function(e,t){if("ai-sdk/v6"===e)return function(e){let t,r=[],n=[],i=[],a=!1,o=0,s=0,l=0,u=0,d=!1,c=!1,p=!1,m=!1;for(let f of e){if("assistant"!==f.role)continue;a=!0;let{textParts:e,toolCalls:h,stepsData:g}=gH(f.parts??[]);r.push(...e),n.push(...h),i.push(...g),f.metadata&&(t=f.metadata);let v=gY(f.metadata);v&&(null!=v.inputTokens&&(o+=v.inputTokens,d=!0),null!=v.outputTokens&&(s+=v.outputTokens,c=!0),null!=v.reasoningTokens&&(l+=v.reasoningTokens,p=!0),null!=v.cachedInputTokens&&(u+=v.cachedInputTokens,m=!0))}return a?gK(r,n,i.length,t,i,{...d?{inputTokens:o}:void 0,...c?{outputTokens:s}:void 0,...p?{reasoningTokens:l}:void 0,...m?{cachedInputTokens:u}:void 0}):null}(t);for(let r=t.length-1;r>=0;r--){let n=gW(e,t[r]);if(n)return n}return null}(e,t);i&&this._sendReport(n,i,r?.durationMs,r?.stepTimestamps)}_maybeReportRun(e,t,r){let n=gW(t,r);n&&this._sendReport(e,n)}_sendReport(e,t,r,n){let i=function(e,t){if(!t)return e;if(!e)return t.map(e=>({...e}));let r=Math.min(e.length,t.length);return e.map((e,n)=>({...e,...n<r?t[n]:void 0}))}(t.steps,n),a={thread_id:e,status:t.status,...null!=t.totalSteps?{total_steps:t.totalSteps}:void 0,...t.toolCalls?{tool_calls:t.toolCalls}:void 0,...i?{steps:i}:void 0,...null!=t.inputTokens?{input_tokens:t.inputTokens}:void 0,...null!=t.outputTokens?{output_tokens:t.outputTokens}:void 0,...null!=t.reasoningTokens?{reasoning_tokens:t.reasoningTokens}:void 0,...null!=t.cachedInputTokens?{cached_input_tokens:t.cachedInputTokens}:void 0,...null!=r?{duration_ms:r}:void 0,...null!=t.outputText?{output_text:t.outputText}:void 0,...t.metadata?{metadata:t.metadata}:void 0,...t.modelId?{model_id:t.modelId}:void 0},{beforeReport:o}=this.cloudRef.current.telemetry,s=o?o(a):a;s&&this.cloudRef.current.runs.report(s).catch(()=>{})}}function gF(e){return e.length<=5e4?e:e.slice(0,5e4)}function gB(e){if(null!=e)try{return gF(JSON.stringify(e))}catch{return}}let gV=/^[A-Za-z0-9+/]{100,}={0,2}$/;function gq(e,t,r,n,i,a){let o={tool_name:e,tool_call_id:t},s=i??gB(r);void 0!==s&&(o.tool_args=s);let l="mcp"===a?function(e){if(null!=e){try{let t="string"==typeof e?JSON.parse(e):e;if(Array.isArray(t)){let e=t.map(e=>{if(e&&"object"==typeof e&&e.type&&("image"===e.type||"audio"===e.type)&&"string"==typeof e.data&&gV.test(e.data.slice(0,200))){let t=(3*e.data.length/4/1024).toFixed(1);return{...e,data:`[${e.type}: ${t}KB]`}}return e});return gF(JSON.stringify(e))}}catch{}return gB(e)}}(n):gB(n);return void 0!==l&&(o.tool_result=l),a&&(o.tool_source=a),o}function gW(e,t){switch(e){case"aui/v0":return function(e){let t,r,n,i;if("assistant"!==e.role)return null;let a=e.content?.filter(e=>"tool-call"===e.type&&e.toolName&&e.toolCallId).map(e=>gq(e.toolName,e.toolCallId,e.args,e.result,e.argsText)),o=e.content?.filter(e=>"text"===e.type&&e.text),s=o&&o.length>0?gF(o.map(e=>e.text).join("")):void 0,l=e.metadata?.steps;if(l&&l.length>0){let e=0,a=0,o=0,s=0,u=!1,d=!1,c=!1,p=!1;for(let t of l)t.usage?.inputTokens!=null&&(e+=t.usage.inputTokens,u=!0),t.usage?.outputTokens!=null&&(a+=t.usage.outputTokens,d=!0),t.usage?.reasoningTokens!=null&&(o+=t.usage.reasoningTokens,c=!0),t.usage?.cachedInputTokens!=null&&(s+=t.usage.cachedInputTokens,p=!0);t=u?e:void 0,r=d?a:void 0,n=c?o:void 0,i=p?s:void 0}let u=e.status?.type,d=u&&gJ[u]||"completed",c=e.metadata?.custom,p=e.metadata?.modelId??("string"==typeof e.metadata?.custom?.modelId?e.metadata.custom.modelId:void 0),m=l&&l.length>1?l.map(e=>({...e.usage?.inputTokens!=null?{input_tokens:e.usage.inputTokens}:void 0,...e.usage?.outputTokens!=null?{output_tokens:e.usage.outputTokens}:void 0,...e.usage?.reasoningTokens!=null?{reasoning_tokens:e.usage.reasoningTokens}:void 0,...e.usage?.cachedInputTokens!=null?{cached_input_tokens:e.usage.cachedInputTokens}:void 0})):void 0;return{status:d,...a&&a.length>0?{toolCalls:a}:void 0,...l?.length?{totalSteps:l.length}:void 0,...null!=t?{inputTokens:t}:void 0,...null!=r?{outputTokens:r}:void 0,...null!=n?{reasoningTokens:n}:void 0,...null!=i?{cachedInputTokens:i}:void 0,...null!=s?{outputText:s}:void 0,...c?{metadata:c}:void 0,...m?{steps:m}:void 0,...p?{modelId:p}:void 0}}(t);case"ai-sdk/v6":return function(e){if("assistant"!==e.role)return null;let{textParts:t,toolCalls:r,stepsData:n}=gH(e.parts??[]);return gK(t,r,n.length,e.metadata,n,gY(e.metadata))}(t);default:return null}}let gJ={error:"error",incomplete:"incomplete"};function gH(e){let t=[],r=[],n=[],i=null;for(let a of e)if("step-start"===a.type)null!==i&&n.push({tool_calls:i}),i=[];else if("text"===a.type&&a.text)t.push(a.text);else if(a.toolCallId&&("tool-call"===a.type||"dynamic-tool"===a.type?!!a.toolName:a.type.startsWith("tool-")||a.type.startsWith("dynamic-tool-"))){let e=function(e){let t="dynamic-tool"===e.type||e.type.startsWith("dynamic-tool-")?"mcp":void 0;return gq(e.toolName??e.type.slice(5),e.toolCallId,e.args??e.input,e.result??e.output,void 0,t)}(a);r.push(e),null!==i&&i.push(e)}return null!==i&&n.push({tool_calls:i}),{textParts:t,toolCalls:r,stepsData:n}}function gK(e,t,r,n,i,a){let o=e.length>0,s=o?gF(e.join("")):void 0,l=function(e){if(!e)return;if("string"==typeof e.modelId)return e.modelId;let t=e.custom;if("string"==typeof t?.modelId)return t.modelId}(n),u=i&&i.length>1?i.map(e=>({...e.tool_calls.length>0?{tool_calls:e.tool_calls}:void 0})):void 0;return{status:o?"completed":"incomplete",...t.length>0?{toolCalls:t}:void 0,...r>0?{totalSteps:r}:void 0,...a?.inputTokens!=null?{inputTokens:a.inputTokens}:void 0,...a?.outputTokens!=null?{outputTokens:a.outputTokens}:void 0,...a?.reasoningTokens!=null?{reasoningTokens:a.reasoningTokens}:void 0,...a?.cachedInputTokens!=null?{cachedInputTokens:a.cachedInputTokens}:void 0,...null!=s?{outputText:s}:void 0,...n?{metadata:n}:void 0,...u?{steps:u}:void 0,...l?{modelId:l}:void 0}}function gG(e){let t=e.inputTokens??e.promptTokens,r=e.outputTokens??e.completionTokens;if(null!=t||null!=r||null!=e.reasoningTokens||null!=e.cachedInputTokens)return{...null!=t?{inputTokens:t}:void 0,...null!=r?{outputTokens:r}:void 0,...null!=e.reasoningTokens?{reasoningTokens:e.reasoningTokens}:void 0,...null!=e.cachedInputTokens?{cachedInputTokens:e.cachedInputTokens}:void 0}}function gY(e){let t=e?.usage;if(t){let e=gG(t);if(e)return e}let r=e?.steps;if(r&&r.length>0){let e=0,t=0,n=0,i=0,a=!1,o=!1,s=!1,l=!1,u=!1;for(let d of r){if(!d.usage)continue;let r=gG(d.usage);r&&(null!=r.inputTokens&&(e+=r.inputTokens,a=!0),null!=r.outputTokens&&(t+=r.outputTokens,o=!0),null!=r.reasoningTokens&&(n+=r.reasoningTokens,s=!0),null!=r.cachedInputTokens&&(i+=r.cachedInputTokens,l=!0),u=!0)}if(u)return{...a?{inputTokens:e}:void 0,...o?{outputTokens:t}:void 0,...s?{reasoningTokens:n}:void 0,...l?{cachedInputTokens:i}:void 0}}}class gX{cloud;accept="*";constructor(e){this.cloud=e}uploadedUrls=new Map;async *add({file:e}){var t;let r=crypto.randomUUID(),n={id:r,type:(t=e.type).startsWith("image/")?"image":t.startsWith("text/")?"document":"file",name:e.name,contentType:e.type,file:e,status:{type:"running",reason:"uploading",progress:0}};yield n;try{let{signedUrl:t,publicUrl:i}=await this.cloud.files.generatePresignedUploadUrl({filename:e.name});await fetch(t,{method:"PUT",body:e,headers:{"Content-Type":e.type},mode:"cors"}),this.uploadedUrls.set(r,i),n={...n,status:{type:"requires-action",reason:"composer-send"}},yield n}catch{n={...n,status:{type:"incomplete",reason:"error"}},yield n}}async remove(e){this.uploadedUrls.delete(e.id)}async send(e){let t,r=this.uploadedUrls.get(e.id);if(!r)throw Error("Attachment not uploaded");return this.uploadedUrls.delete(e.id),t="image"===e.type?[{type:"image",image:r,filename:e.name}]:[{type:"file",data:r,mimeType:e.contentType??"",filename:e.name}],{...e,status:{type:"complete"},content:t}}}let gQ=void 0!==e_.default&&e_.default?.env?.NEXT_PUBLIC_ASSISTANT_BASE_URL,g0=gQ?new class{threads;auth;runs;files;telemetry;constructor(e){const t=new gf(e);this.threads=new gR(t),this.auth={tokens:new gh(t)},this.runs=new gN(t),this.files=new gP(t);const r=e.telemetry;this.telemetry=!1===r?{enabled:!1}:!0===r||void 0===r?{enabled:!0}:{enabled:!1!==r.enabled,...r}}}({baseUrl:gQ,anonymous:!0}):void 0;class g1 extends TransformStream{constructor(){const e=[];super({transform(t,r){if("part-start"===t.type)return 0!==t.path.length?void r.error(Error("Nested parts are not supported")):(e.push(t.part),void r.enqueue(t));if("text-delta"===t.type||"result"===t.type||"part-finish"===t.type||"tool-call-args-text-finish"===t.type){if(1!==t.path.length)return void r.error(Error(`${t.type} chunks must have a path of length 1`));let n=t.path[0];if(n<0||n>=e.length)return void r.error(Error(`Invalid path index: ${n}`));let i=e[n];return void r.enqueue({...t,meta:i})}r.enqueue(t)}})}}async function*g2(){let e=this.getReader();try{for(;;){let{done:t,value:r}=await e.read();if(t)break;yield r}}finally{e.releaseLock()}}function g4(e){return e[Symbol.asyncIterator]??=g2,e}function g6(e,t){let r=e;for(let e of t){if(null==r)return;r=r[e]}return r}class g5{resolve;reject;disposed=!1;fieldPath;constructor(e,t,r){this.resolve=e,this.reject=t,this.fieldPath=r}update(e){if(!this.disposed)try{if("complete"===hl(e,this.fieldPath)){let t=g6(e,this.fieldPath);void 0!==t&&(this.resolve(t),this.dispose())}}catch(e){this.reject(e),this.dispose()}}dispose(){this.disposed=!0}}class g3{controller;disposed=!1;fieldPath;constructor(e,t){this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{let t=g6(e,this.fieldPath);void 0!==t&&this.controller.enqueue(t),"complete"===hl(e,this.fieldPath)&&(this.controller.close(),this.dispose())}catch(e){this.controller.error(e),this.dispose()}}dispose(){this.disposed=!0}}class g9{controller;disposed=!1;fieldPath;lastValue=void 0;constructor(e,t){this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{let t=g6(e,this.fieldPath);if(void 0!==t&&"string"==typeof t){let e=t.substring(this.lastValue?.length||0);this.lastValue=t,this.controller.enqueue(e)}"complete"===hl(e,this.fieldPath)&&(this.controller.close(),this.dispose())}catch(e){this.controller.error(e),this.dispose()}}dispose(){this.disposed=!0}}class g8{controller;disposed=!1;fieldPath;processedIndexes=new Set;constructor(e,t){this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{let t=g6(e,this.fieldPath);if(!Array.isArray(t))return;for(let r=0;r<t.length;r++)if(!this.processedIndexes.has(r)){let n=[...this.fieldPath,r];"complete"===hl(e,n)&&(this.controller.enqueue(t[r]),this.processedIndexes.add(r))}"complete"===hl(e,this.fieldPath)&&(this.controller.close(),this.dispose())}catch(e){this.controller.error(e),this.dispose()}}dispose(){this.disposed=!0}}class g7{argTextDeltas;handles=new Set;args=ho("");constructor(e){this.argTextDeltas=e,this.processStream()}async processStream(){try{let e="",t=this.argTextDeltas.getReader();for(;;){let{value:r,done:n}=await t.read();if(n)break;e+=r;let i=ho(e);if(void 0!==i)for(let e of(this.args=i,this.handles))e.update(i)}}catch(e){for(let t of(console.error("Error processing argument stream:",e),this.handles))t.dispose()}}get(...e){return new Promise((t,r)=>{let n=new g5(t,r,e);if(this.args&&"complete"===hl(this.args,e)){let r=g6(this.args,e);if(void 0!==r)return void t(r)}this.handles.add(n),n.update(this.args)})}streamValues(...e){return g4(new ReadableStream({start:t=>{let r=new g3(t,e);this.handles.add(r),r.update(this.args)},cancel:()=>{for(let e of this.handles)if(e instanceof g3){e.dispose(),this.handles.delete(e);break}}}))}streamText(...e){return g4(new ReadableStream({start:t=>{let r=new g9(t,e);this.handles.add(r),r.update(this.args)},cancel:()=>{for(let e of this.handles)if(e instanceof g9){e.dispose(),this.handles.delete(e);break}}}))}forEach(...e){return g4(new ReadableStream({start:t=>{let r=new g8(t,e);this.handles.add(r),r.update(this.args)},cancel:()=>{for(let e of this.handles)if(e instanceof g8){e.dispose(),this.handles.delete(e);break}}}))}}class ve{promise;constructor(e){this.promise=e}get(){return this.promise}}class vt{args;response;writable;resolve;argsText="";constructor(){const e=new TransformStream;this.writable=e.writable,this.args=new g7(e.readable);const{promise:t,resolve:r}=gv();this.resolve=r,this.response=new ve(t)}async appendArgsTextDelta(e){let t=this.writable.getWriter();try{await t.write(e)}catch(e){console.warn(e)}finally{t.releaseLock()}this.argsText+=e}setResponse(e){this.resolve(e)}result={get:async()=>(await this.response.get()).result}}class vr extends gT{constructor(e){const t=new Map,r=new Map;super(n=>{let i=new TransformStream({transform(n,i){switch(("part-finish"!==n.type||"tool-call"!==n.meta.type)&&i.enqueue(n),n.type){case"part-start":if("tool-call"===n.part.type){let t=new vt;r.set(n.part.toolCallId,t),e.streamCall({reader:t,toolCallId:n.part.toolCallId,toolName:n.part.toolName})}break;case"text-delta":if("tool-call"===n.meta.type){let e=n.meta.toolCallId,t=r.get(e);if(!t)throw Error("No controller found for tool call");t.appendArgsTextDelta(n.textDelta)}break;case"result":{if("tool-call"!==n.meta.type)break;let{toolCallId:e}=n.meta,t=r.get(e);if(!t)throw Error("No controller found for tool call");t.setResponse(new hP({result:n.result,artifact:n.artifact,isError:n.isError,modelContent:n.modelContent}));break}case"tool-call-args-text-finish":{if("tool-call"!==n.meta.type)break;let{toolCallId:a,toolName:o}=n.meta,s=r.get(a);if(!s)throw Error("No controller found for tool call");let l=!1,u=function(e,t,r){try{let n=e();if("object"==typeof n&&null!==n&&"then"in n)return n.then(t,r);t(n)}catch(e){r(e)}}(()=>{let t;try{t=hi.default.parse(s.argsText)}catch(e){throw Error(`Function parameter parsing failed. ${JSON.stringify(e.message)}`)}let r=e.execute({toolCallId:a,toolName:o,args:t});return void 0!==r&&(l=!0,e.onExecutionStart?.(a,o)),r},t=>{if(l&&e.onExecutionEnd?.(a,o),void 0===t)return;let r=new hP({artifact:t.artifact,result:t.result,isError:t.isError,messages:t.messages,modelContent:t.modelContent});s.setResponse(r),i.enqueue({type:"result",path:n.path,...r})},t=>{l&&e.onExecutionEnd?.(a,o);let r=new hP({result:String(t),isError:!0});s.setResponse(r),i.enqueue({type:"result",path:n.path,...r})});u&&t.set(a,u);break}case"part-finish":{if("tool-call"!==n.meta.type)break;let{toolCallId:e}=n.meta,a=t.get(e);a?a.then(()=>{t.delete(e),r.delete(e),i.enqueue(n)}):i.enqueue(n)}}},async flush(){await Promise.all(t.values())}});return n.pipeThrough(new g1).pipeThrough(i)})}}let vn=(e,t,r)=>{if(e===t)return!0;if(r>100||null==e||null==t)return!1;if(Array.isArray(e))return!!Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>vn(e,t[n],r+1));if(Array.isArray(t)||!gz(e)||!gz(t))return!1;let n=Object.keys(e),i=Object.keys(t);return n.length===i.length&&n.every(n=>Object.hasOwn(t,n)&&vn(e[n],t[n],r+1))},vi=e=>{try{return JSON.parse(e),!0}catch{return!1}},va=e=>{try{return JSON.parse(e)}catch{return}},vo=(e,t)=>{let r=va(e),n=va(t);return void 0!==r&&void 0!==n&&!!gD(r)&&!!gD(n)&&vn(r,n,0)};function vs({state:e,getTools:t,onResult:r,setToolStatuses:n}){let i=(0,ek.useRef)(new Map),a=(0,ek.useRef)(new Map),o=(0,ek.useRef)(new Set),s=(0,ek.useRef)(new Set),l=(0,ek.useRef)(new Map),u=(0,ek.useRef)(new Map),d=(0,ek.useRef)(new AbortController),c=(0,ek.useRef)(0),p=(0,ek.useRef)([]),m=(0,ek.useRef)(0),f=(0,ek.useRef)(!0),h=e=>a.current.get(e)??e,g=()=>{let e=t();if(e)return Object.fromEntries(Object.entries(e).map(([e,t])=>{let r=t.execute,n=t.streamCall,i=t.toModelOutput;return[e,{...t,...void 0!==r&&{execute:(...[e,t])=>s.current.has(t.toolCallId)?new Promise(()=>{}):r(e,{...t,toolCallId:h(t.toolCallId)})},...void 0!==n&&{streamCall:(...[e,t])=>n(e,{...t,toolCallId:h(t.toolCallId)})},...void 0!==i&&{toModelOutput:e=>i({...e,toolCallId:h(e.toolCallId)})}}]}))},[v]=(0,ek.useState)(()=>{var e,t,m;let f,v,[y,b]=gj(),x=(e=()=>d.current?.signal??new AbortController().signal,t=(e,t)=>{let r=h(e);return new Promise((e,i)=>{let a=l.current.get(r);a&&a.reject(Error("Human input request was superseded by a new request")),l.current.set(r,{resolve:e,reject:i}),n(e=>({...e,[r]:{type:"interrupt",payload:{type:"human",payload:t}}}))})},m={onExecutionStart:e=>{if(s.current.has(e))return;let t=h(e),r=o.current.has(e);u.current.set(e,{logicalToolCallId:t,abandoned:r}),c.current++,r||n(e=>({...e,[t]:{type:"executing"}}))},onExecutionEnd:e=>{let t=u.current.get(e);if(t){let r;u.current.delete(e),c.current--,t.abandoned||n(e=>{let r={...e};return delete r[t.logicalToolCallId],r}),0===c.current&&(r=p.current,p.current=[],r.forEach(e=>e()))}}},f=g,v=e,new vr({execute:e=>(function(e,t,r,n){let i=e?.[r.toolName];if(i?.execute)return(async e=>{let a;if(t.aborted)return new hP({result:"Tool execution was cancelled.",isError:!0});let o=e;if("object"==typeof(a=i.parameters)&&null!==a&&"~standard"in a&&1===a["~standard"].version){let e=i.parameters["~standard"].validate(r.args);e instanceof Promise&&(e=await e),e.issues&&(o=i.experimental_onSchemaValidationError??(()=>{throw Error(`Function parameter validation failed. ${JSON.stringify(e.issues)}`)}))}let s=new Promise(e=>{let r=()=>{queueMicrotask(()=>{queueMicrotask(()=>{e(new hP({result:"Tool execution was cancelled.",isError:!0}))})})};t.aborted?r():t.addEventListener("abort",r,{once:!0})});return Promise.race([(async()=>{let e=await o(r.args,{toolCallId:r.toolCallId,abortSignal:t,human:e=>n(r.toolCallId,e)}),a=hP.toResponse(e);if(i.toModelOutput&&!a.isError&&void 0===a.modelContent)try{let e=await i.toModelOutput({toolCallId:r.toolCallId,input:r.args,output:a.result});return new hP({result:a.result,artifact:a.artifact,isError:a.isError,messages:a.messages,modelContent:e})}catch(e){console.warn(`[assistant-stream] tool "${r.toolName}" toModelOutput threw; falling back to default projection.`,e)}return a})(),s])})(i.execute)})(f(),v(),e,t),streamCall:({reader:e,...r})=>{var n,i;return n=f(),i=v(),void n?.[r.toolName]?.streamCall?.(e,{toolCallId:r.toolCallId,abortSignal:i,human:e=>t(r.toolCallId,e)})},onExecutionStart:m?.onExecutionStart,onExecutionEnd:m?.onExecutionEnd}));return y.pipeThrough(x).pipeThrough(new g1).pipeTo(new WritableStream({write(e){if("result"!==e.type)return;let t=e.meta.toolCallId,n=h(t),l=i.current.get(n);o.current.delete(t)?a.current.delete(t):!l&&s.current.has(t)||l?.hasResult||(t!==n&&a.current.delete(t),r({type:"add-tool-result",toolCallId:n,toolName:e.meta.toolName,result:e.result,isError:e.isError,...void 0!==e.artifact&&{artifact:e.artifact},...void 0!==e.modelContent&&{modelContent:e.modelContent}}))}})),b});(0,ek.useEffect)(()=>{let r=({toolName:r,argsText:n,hasResult:i})=>{let a;return!!i||((a=t()?.[r],a?.execute===void 0&&a?.streamCall===void 0)?!e.isRunning&&vi(n):vi(n))},n=(e,t)=>{if(!e.controller)return;o.current.add(e.streamId);let r=s.current.has(e.streamId);e.controller.argsText.close();let n=`${t}:rewrite:${m.current++}`;a.current.set(n,t);let i=v.addToolCallPart({toolName:e.toolName,toolCallId:n});r&&s.current.add(n),e.controller=i,e.streamId=n,e.argsText="",e.argsComplete=!1},l=e=>{let t=f.current;e.forEach(e=>{e.content.forEach(e=>{var a,o,d;let c,p;if("tool-call"!==e.type)return;let m=i.current.get(e.toolCallId);if(t){m?.controller||i.current.set(e.toolCallId,{toolName:e.toolName,argsText:e.argsText,hasResult:void 0!==e.result}),e.messages&&l(e.messages);return}let f=m;if(f&&!f.controller){if(e.argsText===f.argsText&&void 0!==e.result===f.hasResult){e.messages&&l(e.messages);return}i.current.delete(e.toolCallId),f=void 0}if(f||(a=e.toolCallId,o=e.toolName,d=void 0!==e.result,c=v.addToolCallPart({toolName:o,toolCallId:a}),d&&s.current.add(a),p={toolName:o,controller:c,streamId:a,argsText:"",hasResult:!1,argsComplete:!1},i.current.set(a,p),f=p),((e,t)=>{if(!e.controller)return;let i=void 0!==t.result;if(t.argsText!==e.argsText){let a=!0;if(e.argsComplete)vo(e.argsText,t.argsText)?(e.argsText=t.argsText,a=!1):e.hasResult||u.current.has(e.streamId)?(e.argsText=t.argsText,a=!1):n(e,t.toolCallId);else if(!t.argsText.startsWith(e.argsText))if(vi(e.argsText)&&vi(t.argsText)&&vo(e.argsText,t.argsText)){let n=r({toolName:t.toolName,argsText:t.argsText,hasResult:i});n&&e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=n,a=!1}else n(e,t.toolCallId);if(a){let n=t.argsText.slice(e.argsText.length);e.controller.argsText.append(n);let a=r({toolName:t.toolName,argsText:t.argsText,hasResult:i});a&&e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=a}}!e.argsComplete&&r({toolName:t.toolName,argsText:t.argsText,hasResult:i})&&(e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=!0)})(f,e),void 0!==e.result&&!f.hasResult){let{controller:t}=f;if(!t)return;f.hasResult=!0,f.argsComplete=!0,t.setResponse(new hP({result:e.result,artifact:e.artifact,isError:e.isError,...void 0!==e.modelContent?{modelContent:e.modelContent}:{}})),t.close()}e.messages&&l(e.messages)})})};l(e.messages),f.current=!1},[e,v,t]);let y=()=>(l.current.forEach(({reject:e})=>{e(Error("Tool execution aborted"))}),l.current.clear(),d.current.abort(),d.current=new AbortController,0===c.current)?Promise.resolve():new Promise(e=>{p.current.push(e)});return{reset:()=>{f.current=!0,i.current.clear(),y().finally(()=>{u.current.clear(),a.current.clear(),m.current=0})},abort:y,resume:(e,t)=>{let r=l.current.get(e);if(r)l.current.delete(e),n(t=>({...t,[e]:{type:"executing"}})),r.resolve(t);else throw Error(`Tool call ${e} is not waiting for human input`)}}}e.s(["AssistantRuntimeImpl",0,hB,"BaseAssistantRuntimeCore",0,hh,"CompositeContextProvider",0,t1,"DefaultThreadComposerRuntimeCore",0,f3,"MessageRepository",0,hf,"ThreadRuntimeImpl",0,hU,"fromThreadMessageLike",0,hd,"generateId",0,f2,"getAutoStatus",0,hn,"splitLocalRuntimeOptions",0,e=>{let{cloud:t,initialMessages:r,maxSteps:n,adapters:i,unstable_humanToolNames:a,...o}=e;return{localRuntimeOptions:{cloud:t,initialMessages:r,maxSteps:n,adapters:i,unstable_humanToolNames:a},otherOptions:o}},"useComposerInputPluginRegistryOptional",0,s7,"useSmooth",0,dj,"useSmoothStatus",0,dk,"useToolInvocations",0,vs,"withSmoothContextProvider",0,e=>{let t=(0,ek.forwardRef)((t,r)=>(0,ew.jsx)(dw,{children:(0,ew.jsx)(e,{...t,ref:r})}));return t.displayName=e.displayName,t}],31116);var vl=e.i(31116),vl=vl;function vu(){}function vd(){}let vc=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,vp=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,vm={};function vf(e,t){return((t||vm).jsx?vp:vc).test(e)}let vh=/[ \t\n\f\r]/g;function vg(e){return""===e.replace(vh,"")}class vv{constructor(e,t){this.attribute=t,this.property=e}}vv.prototype.attribute="",vv.prototype.booleanish=!1,vv.prototype.boolean=!1,vv.prototype.commaOrSpaceSeparated=!1,vv.prototype.commaSeparated=!1,vv.prototype.defined=!1,vv.prototype.mustUseProperty=!1,vv.prototype.number=!1,vv.prototype.overloadedBoolean=!1,vv.prototype.property="",vv.prototype.spaceSeparated=!1,vv.prototype.space=void 0;let vy=0,vb=v$(),vx=v$(),vw=v$(),v_=v$(),vk=v$(),vI=v$(),vS=v$();function v$(){return 2**++vy}e.s(["boolean",0,vb,"booleanish",0,vx,"commaOrSpaceSeparated",0,vS,"commaSeparated",0,vI,"number",0,v_,"overloadedBoolean",0,vw,"spaceSeparated",0,vk],744);var vj=e.i(744);let vE=Object.keys(vj);class vT extends vv{constructor(e,t,r,n){let i=-1;if(super(e,t),function(e,t,r){r&&(e[t]=r)}(this,"space",n),"number"==typeof r)for(;++i<vE.length;){const e=vE[i];!function(e,t,r){r&&(e[t]=r)}(this,vE[i],(r&vj[e])===vj[e])}}}function vC(e){return e.toLowerCase()}vT.prototype.defined=!0;let vN=/[A-Z]/g,vA=/-[a-z]/g,vR=/^data[-\w.:]+$/i;function vP(e){return"-"+e.toLowerCase()}function vO(e){return e.charAt(1).toUpperCase()}let vM={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};class vz{constructor(e,t,r){this.normal=t,this.property=e,r&&(this.space=r)}}function vD(e,t){let r={},n={};for(let t of e)Object.assign(r,t.property),Object.assign(n,t.normal);return new vz(r,n,t)}function vU(e){let t={},r={};for(let[n,i]of Object.entries(e.properties)){let a=new vT(n,e.transform(e.attributes||{},n),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(a.mustUseProperty=!0),t[n]=a,r[vC(n)]=n,r[vC(a.attribute)]=n}return new vz(t,r,e.space)}vz.prototype.normal={},vz.prototype.property={},vz.prototype.space=void 0;let vL=vU({properties:{ariaActiveDescendant:null,ariaAtomic:vx,ariaAutoComplete:null,ariaBusy:vx,ariaChecked:vx,ariaColCount:v_,ariaColIndex:v_,ariaColSpan:v_,ariaControls:vk,ariaCurrent:null,ariaDescribedBy:vk,ariaDetails:null,ariaDisabled:vx,ariaDropEffect:vk,ariaErrorMessage:null,ariaExpanded:vx,ariaFlowTo:vk,ariaGrabbed:vx,ariaHasPopup:null,ariaHidden:vx,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:vk,ariaLevel:v_,ariaLive:null,ariaModal:vx,ariaMultiLine:vx,ariaMultiSelectable:vx,ariaOrientation:null,ariaOwns:vk,ariaPlaceholder:null,ariaPosInSet:v_,ariaPressed:vx,ariaReadOnly:vx,ariaRelevant:null,ariaRequired:vx,ariaRoleDescription:vk,ariaRowCount:v_,ariaRowIndex:v_,ariaRowSpan:v_,ariaSelected:vx,ariaSetSize:v_,ariaSort:null,ariaValueMax:v_,ariaValueMin:v_,ariaValueNow:v_,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function vZ(e,t){return t in e?e[t]:t}function vF(e,t){return vZ(e,t.toLowerCase())}let vB=vU({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:vI,acceptCharset:vk,accessKey:vk,action:null,allow:null,allowFullScreen:vb,allowPaymentRequest:vb,allowUserMedia:vb,alt:null,as:null,async:vb,autoCapitalize:null,autoComplete:vk,autoFocus:vb,autoPlay:vb,blocking:vk,capture:null,charSet:null,checked:vb,cite:null,className:vk,cols:v_,colSpan:null,content:null,contentEditable:vx,controls:vb,controlsList:vk,coords:v_|vI,crossOrigin:null,data:null,dateTime:null,decoding:null,default:vb,defer:vb,dir:null,dirName:null,disabled:vb,download:vw,draggable:vx,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:vb,formTarget:null,headers:vk,height:v_,hidden:vw,high:v_,href:null,hrefLang:null,htmlFor:vk,httpEquiv:vk,id:null,imageSizes:null,imageSrcSet:null,inert:vb,inputMode:null,integrity:null,is:null,isMap:vb,itemId:null,itemProp:vk,itemRef:vk,itemScope:vb,itemType:vk,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:vb,low:v_,manifest:null,max:null,maxLength:v_,media:null,method:null,min:null,minLength:v_,multiple:vb,muted:vb,name:null,nonce:null,noModule:vb,noValidate:vb,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:vb,optimum:v_,pattern:null,ping:vk,placeholder:null,playsInline:vb,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:vb,referrerPolicy:null,rel:vk,required:vb,reversed:vb,rows:v_,rowSpan:v_,sandbox:vk,scope:null,scoped:vb,seamless:vb,selected:vb,shadowRootClonable:vb,shadowRootDelegatesFocus:vb,shadowRootMode:null,shape:null,size:v_,sizes:null,slot:null,span:v_,spellCheck:vx,src:null,srcDoc:null,srcLang:null,srcSet:null,start:v_,step:null,style:null,tabIndex:v_,target:null,title:null,translate:null,type:null,typeMustMatch:vb,useMap:null,value:vx,width:v_,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:vk,axis:null,background:null,bgColor:null,border:v_,borderColor:null,bottomMargin:v_,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:vb,declare:vb,event:null,face:null,frame:null,frameBorder:null,hSpace:v_,leftMargin:v_,link:null,longDesc:null,lowSrc:null,marginHeight:v_,marginWidth:v_,noResize:vb,noHref:vb,noShade:vb,noWrap:vb,object:null,profile:null,prompt:null,rev:null,rightMargin:v_,rules:null,scheme:null,scrolling:vx,standby:null,summary:null,text:null,topMargin:v_,valueType:null,version:null,vAlign:null,vLink:null,vSpace:v_,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:vb,disableRemotePlayback:vb,prefix:null,property:null,results:v_,security:null,unselectable:null},space:"html",transform:vF}),vV=vU({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:vS,accentHeight:v_,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:v_,amplitude:v_,arabicForm:null,ascent:v_,attributeName:null,attributeType:null,azimuth:v_,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:v_,by:null,calcMode:null,capHeight:v_,className:vk,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:v_,diffuseConstant:v_,direction:null,display:null,dur:null,divisor:v_,dominantBaseline:null,download:vb,dx:null,dy:null,edgeMode:null,editable:null,elevation:v_,enableBackground:null,end:null,event:null,exponent:v_,externalResourcesRequired:null,fill:null,fillOpacity:v_,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:vI,g2:vI,glyphName:vI,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:v_,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:v_,horizOriginX:v_,horizOriginY:v_,id:null,ideographic:v_,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:v_,k:v_,k1:v_,k2:v_,k3:v_,k4:v_,kernelMatrix:vS,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:v_,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:v_,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:v_,overlineThickness:v_,paintOrder:null,panose1:null,path:null,pathLength:v_,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:vk,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:v_,pointsAtY:v_,pointsAtZ:v_,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vS,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vS,rev:vS,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vS,requiredFeatures:vS,requiredFonts:vS,requiredFormats:vS,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:v_,specularExponent:v_,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:v_,strikethroughThickness:v_,string:null,stroke:null,strokeDashArray:vS,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:v_,strokeOpacity:v_,strokeWidth:null,style:null,surfaceScale:v_,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vS,tabIndex:v_,tableValues:null,target:null,targetX:v_,targetY:v_,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vS,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:v_,underlineThickness:v_,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:v_,values:null,vAlphabetic:v_,vMathematical:v_,vectorEffect:null,vHanging:v_,vIdeographic:v_,version:null,vertAdvY:v_,vertOriginX:v_,vertOriginY:v_,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:v_,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:vZ}),vq=vU({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),vW=vU({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:vF}),vJ=vU({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),vH=vD([vL,vB,vq,vW,vJ],"html"),vK=vD([vL,vV,vq,vW,vJ],"svg");var vG=e.i(15511);let vY=vQ("end"),vX=vQ("start");function vQ(e){return function(t){let r=t&&t.position&&t.position[e]||{};if("number"==typeof r.line&&r.line>0&&"number"==typeof r.column&&r.column>0)return{line:r.line,column:r.column,offset:"number"==typeof r.offset&&r.offset>-1?r.offset:void 0}}}function v0(e){return e&&"object"==typeof e?"position"in e||"type"in e?v2(e.position):"start"in e||"end"in e?v2(e):"line"in e||"column"in e?v1(e):"":""}function v1(e){return v4(e&&e.line)+":"+v4(e&&e.column)}function v2(e){return v1(e&&e.start)+"-"+v1(e&&e.end)}function v4(e){return e&&"number"==typeof e?e:1}class v6 extends Error{constructor(e,t,r){super(),"string"==typeof t&&(r=t,t=void 0);let n="",i={},a=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?n=e:!i.cause&&e&&(a=!0,n=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof r){const e=r.indexOf(":");-1===e?i.ruleId=r:(i.source=r.slice(0,e),i.ruleId=r.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=n,this.line=o?o.line:void 0,this.name=v0(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}v6.prototype.file="",v6.prototype.name="",v6.prototype.reason="",v6.prototype.message="",v6.prototype.stack="",v6.prototype.column=void 0,v6.prototype.line=void 0,v6.prototype.ancestors=void 0,v6.prototype.cause=void 0,v6.prototype.fatal=void 0,v6.prototype.place=void 0,v6.prototype.ruleId=void 0,v6.prototype.source=void 0;let v5={}.hasOwnProperty,v3=new Map,v9=/[A-Z]/g,v8=new Set(["table","tbody","thead","tfoot","tr"]),v7=new Set(["td","th"]),ye="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function yt(e,t,r){var n,i,a,o,s,l,u,d,c;let p,m,f,h,g,v,y,b,x,w,_;return"element"===t.type?(n=e,i=t,a=r,m=p=n.schema,"svg"===i.tagName.toLowerCase()&&"html"===p.space&&(n.schema=vK),n.ancestors.push(i),f=ya(n,i.tagName,!1),h=function(e,t){let r,n,i={};for(n in t.properties)if("children"!==n&&v5.call(t.properties,n)){let a=function(e,t,r){let n=function(e,t){let r=vC(t),n=t,i=vv;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&"data"===r.slice(0,4)&&vR.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(vA,vO);n="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!vA.test(e)){let r=e.replace(vN,vP);"-"!==r.charAt(0)&&(r="-"+r),t="data"+r}}i=vT}return new i(n,t)}(e.schema,t);if(!(null==r||"number"==typeof r&&Number.isNaN(r))){var i;let t;if(Array.isArray(r)&&(r=n.commaSeparated?(t={},(""===(i=r)[i.length-1]?[...i,""]:i).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()):r.join(" ").trim()),"style"===n.property){let t="object"==typeof r?r:function(e,t){try{return(0,vG.default)(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};let t=new v6("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=ye+"#cannot-parse-style-attribute",t}}(e,String(r));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,r={};for(t in e)v5.call(e,t)&&(r[function(e){let t=e.replace(v9,ys);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return r}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&n.space?vM[n.property]||n.property:n.attribute,r]}}(e,n,t.properties[n]);if(a){let[n,o]=a;e.tableCellAlignToStyle&&"align"===n&&"string"==typeof o&&v7.has(t.tagName)?r=o:i[n]=o}}return r&&((i.style||(i.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r),i}(n,i),g=yi(n,i),v8.has(i.tagName)&&(g=g.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&vg(e.value):vg(e))})),yr(n,h,f,i),yn(h,g),n.ancestors.pop(),n.schema=p,n.create(i,f,h,a)):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){let r=t.data.estree.body[0];return vu("ExpressionStatement"===r.type),e.evaluater.evaluateExpression(r.expression)}yo(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?(o=e,s=t,l=r,y=v=o.schema,"svg"===s.name&&"html"===v.space&&(o.schema=vK),o.ancestors.push(s),b=null===s.name?o.Fragment:ya(o,s.name,!0),x=function(e,t){let r={};for(let n of t.attributes)if("mdxJsxExpressionAttribute"===n.type)if(n.data&&n.data.estree&&e.evaluater){let t=n.data.estree.body[0];vu("ExpressionStatement"===t.type);let i=t.expression;vu("ObjectExpression"===i.type);let a=i.properties[0];vu("SpreadElement"===a.type),Object.assign(r,e.evaluater.evaluateExpression(a.argument))}else yo(e,t.position);else{let i,a=n.name;if(n.value&&"object"==typeof n.value)if(n.value.data&&n.value.data.estree&&e.evaluater){let t=n.value.data.estree.body[0];vu("ExpressionStatement"===t.type),i=e.evaluater.evaluateExpression(t.expression)}else yo(e,t.position);else i=null===n.value||n.value;r[a]=i}return r}(o,s),w=yi(o,s),yr(o,x,b,s),yn(x,w),o.ancestors.pop(),o.schema=v,o.create(s,b,x,l)):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);yo(e,t.position)}(e,t):"root"===t.type?(u=e,d=t,c=r,yn(_={},yi(u,d)),u.create(d,u.Fragment,_,c)):"text"===t.type?t.value:void 0}function yr(e,t,r,n){"string"!=typeof r&&r!==e.Fragment&&e.passNode&&(t.node=n)}function yn(e,t){if(t.length>0){let r=t.length>1?t:t[0];r&&(e.children=r)}}function yi(e,t){let r=[],n=-1,i=e.passKeys?new Map:v3;for(;++n<t.children.length;){let a,o=t.children[n];if(e.passKeys){let e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){let t=i.get(e)||0;a=e+"-"+t,i.set(e,t+1)}}let s=yt(e,o,a);void 0!==s&&r.push(s)}return r}function ya(e,t,r){let n;if(r)if(t.includes(".")){let e,r=t.split("."),i=-1;for(;++i<r.length;){let t=vf(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(i&&"Literal"===t.type),optional:!1}:t}vu(e,"always a result"),n=e}else n=vf(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else n={type:"Literal",value:t};if("Literal"===n.type){let t=n.value;return v5.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(n);yo(e)}function yo(e,t){let r=new v6("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=ye+"#cannot-handle-mdx-estrees-without-createevaluater",r}function ys(e){return"-"+e.toLowerCase()}let yl={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},yu={};function yd(e,t){let r=t||yu;return yc(e,"boolean"!=typeof r.includeImageAlt||r.includeImageAlt,"boolean"!=typeof r.includeHtml||r.includeHtml)}function yc(e,t,r){var n;if((n=e)&&"object"==typeof n){if("value"in e)return"html"!==e.type||r?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return yp(e.children,t,r)}return Array.isArray(e)?yp(e,t,r):""}function yp(e,t,r){let n=[],i=-1;for(;++i<e.length;)n[i]=yc(e[i],t,r);return n.join("")}function ym(e,t,r,n){let i,a=e.length,o=0;if(t=t<0?-t>a?0:a+t:t>a?a:t,r=r>0?r:0,n.length<1e4)(i=Array.from(n)).unshift(t,r),e.splice(...i);else for(r&&e.splice(t,r);o<n.length;)(i=n.slice(o,o+1e4)).unshift(t,0),e.splice(...i),o+=1e4,t+=1e4}function yf(e,t){return e.length>0?(ym(e,e.length,0,t),e):t}let yh={}.hasOwnProperty;function yg(e){let t={},r=-1;for(;++r<e.length;)!function(e,t){let r;for(r in t){let n,i=(yh.call(e,r)?e[r]:void 0)||(e[r]={}),a=t[r];if(a)for(n in a){yh.call(i,n)||(i[n]=[]);let e=a[n];!function(e,t){let r=-1,n=[];for(;++r<t.length;)("after"===t[r].add?e:n).push(t[r]);ym(e,0,0,n)}(i[n],Array.isArray(e)?e:e?[e]:[])}}}(t,e[r]);return t}let yv=yT(/[A-Za-z]/),yy=yT(/[\dA-Za-z]/),yb=yT(/[#-'*+\--9=?A-Z^-~]/);function yx(e){return null!==e&&(e<32||127===e)}let yw=yT(/\d/),y_=yT(/[\dA-Fa-f]/),yk=yT(/[!-/:-@[-`{-~]/);function yI(e){return null!==e&&e<-2}function yS(e){return null!==e&&(e<0||32===e)}function y$(e){return -2===e||-1===e||32===e}let yj=yT(/\p{P}|\p{S}/u),yE=yT(/\s/);function yT(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function yC(e,t,r,n){let i=n?n-1:1/0,a=0;return function(n){return y$(n)?(e.enter(r),function n(o){return y$(o)&&a++<i?(e.consume(o),n):(e.exit(r),t(o))}(n)):t(n)}}let yN={tokenize:function(e){let t,r=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),yC(e,r,"linePrefix"))},function(r){return e.enter("paragraph"),function r(n){let i=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=i),t=i,function t(n){if(null===n){e.exit("chunkText"),e.exit("paragraph"),e.consume(n);return}return yI(n)?(e.consume(n),e.exit("chunkText"),r):(e.consume(n),t)}(n)}(r)});return r}},yA={tokenize:function(e){let t,r,n,i=this,a=[],o=0;return s;function s(t){if(o<a.length){let r=a[o];return i.containerState=r[1],e.attempt(r[0].continuation,l,u)(t)}return u(t)}function l(e){if(o++,i.containerState._closeFlow){let r;i.containerState._closeFlow=void 0,t&&v();let n=i.events.length,a=n;for(;a--;)if("exit"===i.events[a][0]&&"chunkFlow"===i.events[a][1].type){r=i.events[a][1].end;break}g(o);let s=n;for(;s<i.events.length;)i.events[s][1].end={...r},s++;return ym(i.events,a+1,0,i.events.slice(n)),i.events.length=s,u(e)}return s(e)}function u(r){if(o===a.length){if(!t)return p(r);if(t.currentConstruct&&t.currentConstruct.concrete)return f(r);i.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(yR,d,c)(r)}function d(e){return t&&v(),g(o),p(e)}function c(e){return i.parser.lazy[i.now().line]=o!==a.length,n=i.now().offset,f(e)}function p(t){return i.containerState={},e.attempt(yR,m,f)(t)}function m(e){return o++,a.push([i.currentConstruct,i.containerState]),p(e)}function f(n){if(null===n){t&&v(),g(0),e.consume(n);return}return t=t||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:r}),function t(r){if(null===r){h(e.exit("chunkFlow"),!0),g(0),e.consume(r);return}return yI(r)?(e.consume(r),h(e.exit("chunkFlow")),o=0,i.interrupt=void 0,s):(e.consume(r),t)}(n)}function h(e,a){let s=i.sliceStream(e);if(a&&s.push(null),e.previous=r,r&&(r.next=e),r=e,t.defineSkip(e.start),t.write(s),i.parser.lazy[e.start.line]){let e,r,a=t.events.length;for(;a--;)if(t.events[a][1].start.offset<n&&(!t.events[a][1].end||t.events[a][1].end.offset>n))return;let s=i.events.length,l=s;for(;l--;)if("exit"===i.events[l][0]&&"chunkFlow"===i.events[l][1].type){if(e){r=i.events[l][1].end;break}e=!0}for(g(o),a=s;a<i.events.length;)i.events[a][1].end={...r},a++;ym(i.events,l+1,0,i.events.slice(s)),i.events.length=a}}function g(t){let r=a.length;for(;r-- >t;){let t=a[r];i.containerState=t[1],t[0].exit.call(i,e)}a.length=t}function v(){t.write([null]),r=void 0,t=void 0,i.containerState._closeFlow=void 0}}},yR={tokenize:function(e,t,r){return yC(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},yP={partial:!0,tokenize:function(e,t,r){return function(t){return y$(t)?yC(e,n,"linePrefix")(t):n(t)};function n(e){return null===e||yI(e)?t(e):r(e)}}};class yO{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let r=null==t?1/0:t;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,t,r){this.setCursor(Math.trunc(e));let n=this.right.splice(this.right.length-(t||0),1/0);return r&&yM(this.left,r),n.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),yM(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),yM(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);yM(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);yM(this.left,t.reverse())}}}function yM(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function yz(e){let t,r,n,i,a,o,s,l={},u=-1,d=new yO(e);for(;++u<d.length;){for(;u in l;)u=l[u];if(t=d.get(u),u&&"chunkFlow"===t[1].type&&"listItemPrefix"===d.get(u-1)[1].type&&((n=0)<(o=t[1]._tokenizer.events).length&&"lineEndingBlank"===o[n][1].type&&(n+=2),n<o.length&&"content"===o[n][1].type))for(;++n<o.length&&"content"!==o[n][1].type;)"chunkText"===o[n][1].type&&(o[n][1]._isInFirstContentOfListItem=!0,n++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let r,n,i=e.get(t)[1],a=e.get(t)[2],o=t-1,s=[],l=i._tokenizer;!l&&(l=a.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let u=l.events,d=[],c={},p=-1,m=i,f=0,h=0,g=[0];for(;m;){for(;e.get(++o)[1]!==m;);s.push(o),!m._tokenizer&&(r=a.sliceStream(m),m.next||r.push(null),n&&l.defineSkip(m.start),m._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(r),m._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),n=m,m=m.next}for(m=i;++p<u.length;)"exit"===u[p][0]&&"enter"===u[p-1][0]&&u[p][1].type===u[p-1][1].type&&u[p][1].start.line!==u[p][1].end.line&&(h=p+1,g.push(h),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(l.events=[],m?(m._tokenizer=void 0,m.previous=void 0):g.pop(),p=g.length;p--;){let t=u.slice(g[p],g[p+1]),r=s.pop();d.push([r,r+t.length-1]),e.splice(r,2,t)}for(d.reverse(),p=-1;++p<d.length;)c[f+d[p][0]]=f+d[p][1],f+=d[p][1]-d[p][0]-1;return c}(d,u)),u=l[u],s=!0);else if(t[1]._container){for(n=u,r=void 0;n--;)if("lineEnding"===(i=d.get(n))[1].type||"lineEndingBlank"===i[1].type)"enter"===i[0]&&(r&&(d.get(r)[1].type="lineEndingBlank"),i[1].type="lineEnding",r=n);else if("linePrefix"===i[1].type||"listItemIndent"===i[1].type);else break;r&&(t[1].end={...d.get(r)[1].start},(a=d.slice(r,u)).unshift(t),d.splice(r,u-r+1,a))}}return ym(e,0,1/0,d.slice(0)),!s}let yD={resolve:function(e){return yz(e),e},tokenize:function(e,t){let r;return function(t){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),n(t)};function n(t){return null===t?i(t):yI(t)?e.check(yU,a,i)(t):(e.consume(t),n)}function i(r){return e.exit("chunkContent"),e.exit("content"),t(r)}function a(t){return e.consume(t),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,n}}},yU={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),yC(e,i,"linePrefix")};function i(i){if(null===i||yI(i))return r(i);let a=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(n.parser.constructs.flow,r,t)(i)}}},yL={tokenize:function(e){let t=this,r=e.attempt(yP,function(n){return null===n?void e.consume(n):(e.enter("lineEndingBlank"),e.consume(n),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r)},e.attempt(this.parser.constructs.flowInitial,n,yC(e,e.attempt(this.parser.constructs.flow,n,e.attempt(yD,n)),"linePrefix")));return r;function n(n){return null===n?void e.consume(n):(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),t.currentConstruct=void 0,r)}}},yZ={resolveAll:yq()},yF=yV("string"),yB=yV("text");function yV(e){return{resolveAll:yq("text"===e?yW:void 0),tokenize:function(t){let r=this,n=this.parser.constructs[e],i=t.attempt(n,a,o);return a;function a(e){return l(e)?i(e):o(e)}function o(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),s)}function s(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),s)}function l(e){if(null===e)return!0;let t=n[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(r,r.previous))return!0}return!1}}}}function yq(e){return function(t,r){let n,i=-1;for(;++i<=t.length;)void 0===n?t[i]&&"data"===t[i][1].type&&(n=i,i++):t[i]&&"data"===t[i][1].type||(i!==n+2&&(t[n][1].end=t[i-1][1].end,t.splice(n+2,i-n-2),i=n+2),n=void 0);return e?e(t,r):t}}function yW(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||"lineEnding"===e[r][1].type)&&"data"===e[r-1][1].type){let n,i=e[r-1][1],a=t.sliceStream(i),o=a.length,s=-1,l=0;for(;o--;){let e=a[o];if("string"==typeof e){for(s=e.length;32===e.charCodeAt(s-1);)l++,s--;if(s)break;s=-1}else if(-2===e)n=!0,l++;else if(-1===e);else{o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(l=0),l){let a={type:r===e.length||n||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):(e.splice(r,0,["enter",a,t],["exit",a,t]),r+=2)}r++}return e}function yJ(e){return null===e||yS(e)||yE(e)?1:yj(e)?2:void 0}function yH(e,t,r){let n=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!n.includes(a)&&(t=a(t,r),n.push(a))}return t}let yK={name:"attention",resolveAll:function(e,t){let r,n,i,a,o,s,l,u,d=-1;for(;++d<e.length;)if("enter"===e[d][0]&&"attentionSequence"===e[d][1].type&&e[d][1]._close){for(r=d;r--;)if("exit"===e[r][0]&&"attentionSequence"===e[r][1].type&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[d][1]).charCodeAt(0)){if((e[r][1]._close||e[d][1]._open)&&(e[d][1].end.offset-e[d][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[d][1].end.offset-e[d][1].start.offset)%3))continue;s=e[r][1].end.offset-e[r][1].start.offset>1&&e[d][1].end.offset-e[d][1].start.offset>1?2:1;let c={...e[r][1].end},p={...e[d][1].start};yG(c,-s),yG(p,s),a={type:s>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},o={type:s>1?"strongSequence":"emphasisSequence",start:{...e[d][1].start},end:p},i={type:s>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[d][1].start}},n={type:s>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[d][1].start={...o.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=yf(l,[["enter",e[r][1],t],["exit",e[r][1],t]])),l=yf(l,[["enter",n,t],["enter",a,t],["exit",a,t],["enter",i,t]]),l=yf(l,yH(t.parser.constructs.insideSpan.null,e.slice(r+1,d),t)),l=yf(l,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",n,t]]),e[d][1].end.offset-e[d][1].start.offset?(u=2,l=yf(l,[["enter",e[d][1],t],["exit",e[d][1],t]])):u=0,ym(e,r-1,d-r+3,l),d=r+l.length-u-2;break}}for(d=-1;++d<e.length;)"attentionSequence"===e[d][1].type&&(e[d][1].type="data");return e},tokenize:function(e,t){let r,n=this.parser.constructs.attentionMarkers.null,i=this.previous,a=yJ(i);return function(o){return r=o,e.enter("attentionSequence"),function o(s){if(s===r)return e.consume(s),o;let l=e.exit("attentionSequence"),u=yJ(s),d=!u||2===u&&a||n.includes(s),c=!a||2===a&&u||n.includes(i);return l._open=!!(42===r?d:d&&(a||!c)),l._close=!!(42===r?c:c&&(u||!d)),t(s)}(o)}}};function yG(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let yY={continuation:{tokenize:function(e,t,r){let n=this;return function(t){return y$(t)?yC(e,i,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(n){return e.attempt(yY,t,r)(n)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,r){let n=this;return function(t){if(62===t){let r=n.containerState;return r.open||(e.enter("blockQuote",{_container:!0}),r.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return r(t)};function i(r){return y$(r)?(e.enter("blockQuotePrefixWhitespace"),e.consume(r),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(r))}}},yX={name:"characterEscape",tokenize:function(e,t,r){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),n};function n(n){return yk(n)?(e.enter("characterEscapeValue"),e.consume(n),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(n)}}},yQ=document.createElement("i");function y0(e){let t="&"+e+";";yQ.innerHTML=t;let r=yQ.textContent;return(59!==r.charCodeAt(r.length-1)||"semi"===e)&&r!==t&&r}let y1={name:"characterReference",tokenize:function(e,t,r){let n,i,a=this,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),s};function s(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),n=31,i=yy,u(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),n=6,i=y_,u):(e.enter("characterReferenceValue"),n=7,i=yw,u(t))}function u(s){if(59===s&&o){let n=e.exit("characterReferenceValue");return i!==yy||y0(a.sliceSerialize(n))?(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):r(s)}return i(s)&&o++<n?(e.consume(s),u):r(s)}}},y2={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return null===t?r(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return n.parser.lazy[n.now().line]?r(e):t(e)}}},y4={concrete:!0,name:"codeFenced",tokenize:function(e,t,r){let n,i=this,a={partial:!0,tokenize:function(e,t,r){let a=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o};function o(t){return e.enter("codeFencedFence"),y$(t)?yC(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===n?(e.enter("codeFencedFenceSequence"),function t(i){return i===n?(a++,e.consume(i),t):a>=s?(e.exit("codeFencedFenceSequence"),y$(i)?yC(e,u,"whitespace")(i):u(i)):r(i)}(t)):r(t)}function u(n){return null===n||yI(n)?(e.exit("codeFencedFence"),t(n)):r(n)}}},o=0,s=0;return function(t){var a;let u;return a=t,o=(u=i.events[i.events.length-1])&&"linePrefix"===u[1].type?u[2].sliceSerialize(u[1],!0).length:0,n=a,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(i){return i===n?(s++,e.consume(i),t):s<3?r(i):(e.exit("codeFencedFenceSequence"),y$(i)?yC(e,l,"whitespace")(i):l(i))}(a)};function l(a){return null===a||yI(a)?(e.exit("codeFencedFence"),i.interrupt?t(a):e.check(y2,d,f)(a)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||yI(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(i)):y$(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),yC(e,u,"whitespace")(i)):96===i&&i===n?r(i):(e.consume(i),t)}(a))}function u(t){return null===t||yI(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||yI(i)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(i)):96===i&&i===n?r(i):(e.consume(i),t)}(t))}function d(t){return e.attempt(a,f,c)(t)}function c(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),p}function p(t){return o>0&&y$(t)?yC(e,m,"linePrefix",o+1)(t):m(t)}function m(t){return null===t||yI(t)?e.check(y2,d,f)(t):(e.enter("codeFlowValue"),function t(r){return null===r||yI(r)?(e.exit("codeFlowValue"),m(r)):(e.consume(r),t)}(t))}function f(r){return e.exit("codeFenced"),t(r)}}},y6={name:"codeIndented",tokenize:function(e,t,r){let n=this;return function(t){return e.enter("codeIndented"),yC(e,i,"linePrefix",5)(t)};function i(t){let i=n.events[n.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?function t(r){return null===r?a(r):yI(r)?e.attempt(y5,t,a)(r):(e.enter("codeFlowValue"),function r(n){return null===n||yI(n)?(e.exit("codeFlowValue"),t(n)):(e.consume(n),r)}(r))}(t):r(t)}function a(r){return e.exit("codeIndented"),t(r)}}},y5={partial:!0,tokenize:function(e,t,r){let n=this;return i;function i(t){return n.parser.lazy[n.now().line]?r(t):yI(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):yC(e,a,"linePrefix",5)(t)}function a(e){let a=n.events[n.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):yI(e)?i(e):r(e)}}};function y3(e,t,r,n,i,a,o,s,l){let u=l||1/0,d=0;return function(t){return 60===t?(e.enter(n),e.enter(i),e.enter(a),e.consume(t),e.exit(a),c):null===t||32===t||41===t||yx(t)?r(t):(e.enter(n),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),f(t))};function c(r){return 62===r?(e.enter(a),e.consume(r),e.exit(a),e.exit(i),e.exit(n),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(r))}function p(t){return 62===t?(e.exit("chunkString"),e.exit(s),c(t)):null===t||60===t||yI(t)?r(t):(e.consume(t),92===t?m:p)}function m(t){return 60===t||62===t||92===t?(e.consume(t),p):p(t)}function f(i){return!d&&(null===i||41===i||yS(i))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(n),t(i)):d<u&&40===i?(e.consume(i),d++,f):41===i?(e.consume(i),d--,f):null===i||32===i||40===i||yx(i)?r(i):(e.consume(i),92===i?h:f)}function h(t){return 40===t||41===t||92===t?(e.consume(t),f):f(t)}}function y9(e,t,r,n,i,a){let o,s=this,l=0;return function(t){return e.enter(n),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u};function u(c){return l>999||null===c||91===c||93===c&&!o||94===c&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?r(c):93===c?(e.exit(a),e.enter(i),e.consume(c),e.exit(i),e.exit(n),t):yI(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(c))}function d(t){return null===t||91===t||93===t||yI(t)||l++>999?(e.exit("chunkString"),u(t)):(e.consume(t),o||(o=!y$(t)),92===t?c:d)}function c(t){return 91===t||92===t||93===t?(e.consume(t),l++,d):d(t)}}function y8(e,t,r,n,i,a){let o;return function(t){return 34===t||39===t||40===t?(e.enter(n),e.enter(i),e.consume(t),e.exit(i),o=40===t?41:t,s):r(t)};function s(r){return r===o?(e.enter(i),e.consume(r),e.exit(i),e.exit(n),t):(e.enter(a),l(r))}function l(t){return t===o?(e.exit(a),s(o)):null===t?r(t):yI(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),yC(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(t))}function u(t){return t===o||null===t||yI(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?d:u)}function d(t){return t===o||92===t?(e.consume(t),u):u(t)}}function y7(e,t){let r;return function n(i){return yI(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):y$(i)?yC(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}function be(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}let bt={partial:!0,tokenize:function(e,t,r){return function(t){return yS(t)?y7(e,n)(t):r(t)};function n(t){return y8(e,i,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return y$(t)?yC(e,a,"whitespace")(t):a(t)}function a(e){return null===e||yI(e)?t(e):r(e)}}},br=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],bn=["pre","script","style","textarea"],bi={partial:!0,tokenize:function(e,t,r){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),e.attempt(yP,t,r)}}},ba={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return yI(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):r(t)};function i(e){return n.parser.lazy[n.now().line]?r(e):t(e)}}},bo={name:"labelEnd",resolveAll:function(e){let t=-1,r=[];for(;++t<e.length;){let n=e[t][1];if(r.push(e[t]),"labelImage"===n.type||"labelLink"===n.type||"labelEnd"===n.type){let e="labelImage"===n.type?4:2;n.type="data",t+=e}}return e.length!==r.length&&ym(e,0,e.length,r),e},resolveTo:function(e,t){let r,n,i,a,o=e.length,s=0;for(;o--;)if(r=e[o][1],n){if("link"===r.type||"labelLink"===r.type&&r._inactive)break;"enter"===e[o][0]&&"labelLink"===r.type&&(r._inactive=!0)}else if(i){if("enter"===e[o][0]&&("labelImage"===r.type||"labelLink"===r.type)&&!r._balanced&&(n=o,"labelLink"!==r.type)){s=2;break}}else"labelEnd"===r.type&&(i=o);let l={type:"labelLink"===e[n][1].type?"link":"image",start:{...e[n][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[n][1].start},end:{...e[i][1].end}},d={type:"labelText",start:{...e[n+s+2][1].end},end:{...e[i-2][1].start}};return a=yf(a=[["enter",l,t],["enter",u,t]],e.slice(n+1,n+s+3)),a=yf(a,[["enter",d,t]]),a=yf(a,yH(t.parser.constructs.insideSpan.null,e.slice(n+s+4,i-3),t)),a=yf(a,[["exit",d,t],e[i-2],e[i-1],["exit",u,t]]),a=yf(a,e.slice(i+1)),a=yf(a,[["exit",l,t]]),ym(e,n,e.length,a),e},tokenize:function(e,t,r){let n,i,a=this,o=a.events.length;for(;o--;)if(("labelImage"===a.events[o][1].type||"labelLink"===a.events[o][1].type)&&!a.events[o][1]._balanced){n=a.events[o][1];break}return function(t){return n?n._inactive?d(t):(i=a.parser.defined.includes(be(a.sliceSerialize({start:n.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),s):r(t)};function s(t){return 40===t?e.attempt(bs,u,i?u:d)(t):91===t?e.attempt(bl,u,i?l:d)(t):i?u(t):d(t)}function l(t){return e.attempt(bu,u,d)(t)}function u(e){return t(e)}function d(e){return n._balanced=!0,r(e)}}},bs={tokenize:function(e,t,r){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),n};function n(t){return yS(t)?y7(e,i)(t):i(t)}function i(t){return 41===t?u(t):y3(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function a(t){return yS(t)?y7(e,s)(t):u(t)}function o(e){return r(e)}function s(t){return 34===t||39===t||40===t?y8(e,l,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):u(t)}function l(t){return yS(t)?y7(e,u)(t):u(t)}function u(n){return 41===n?(e.enter("resourceMarker"),e.consume(n),e.exit("resourceMarker"),e.exit("resource"),t):r(n)}}},bl={tokenize:function(e,t,r){let n=this;return function(t){return y9.call(n,e,i,a,"reference","referenceMarker","referenceString")(t)};function i(e){return n.parser.defined.includes(be(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(e):r(e)}function a(e){return r(e)}}},bu={tokenize:function(e,t,r){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),n};function n(n){return 93===n?(e.enter("referenceMarker"),e.consume(n),e.exit("referenceMarker"),e.exit("reference"),t):r(n)}}},bd={name:"labelStartImage",resolveAll:bo.resolveAll,tokenize:function(e,t,r){let n=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),a):r(t)}function a(e){return 94===e&&"_hiddenFootnoteSupport"in n.parser.constructs?r(e):t(e)}}},bc={name:"labelStartLink",resolveAll:bo.resolveAll,tokenize:function(e,t,r){let n=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in n.parser.constructs?r(e):t(e)}}},bp={name:"lineEnding",tokenize:function(e,t){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),yC(e,t,"linePrefix")}}},bm={name:"thematicBreak",tokenize:function(e,t,r){let n,i=0;return function(a){var o;return e.enter("thematicBreak"),n=o=a,function a(o){return o===n?(e.enter("thematicBreakSequence"),function t(r){return r===n?(e.consume(r),i++,t):(e.exit("thematicBreakSequence"),y$(r)?yC(e,a,"whitespace")(r):a(r))}(o)):i>=3&&(null===o||yI(o))?(e.exit("thematicBreak"),t(o)):r(o)}(o)}}},bf={continuation:{tokenize:function(e,t,r){let n=this;return n.containerState._closeFlow=void 0,e.check(yP,function(r){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,yC(e,t,"listItemIndent",n.containerState.size+1)(r)},function(r){return n.containerState.furtherBlankLines||!y$(r)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,i(r)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(bg,t,i)(r))});function i(i){return n.containerState._closeFlow=!0,n.interrupt=void 0,yC(e,e.attempt(bf,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,r){let n=this,i=n.events[n.events.length-1],a=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,o=0;return function(t){let i=n.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!n.containerState.marker||t===n.containerState.marker:yw(t)){if(n.containerState.type||(n.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(bm,r,s)(t):s(t);if(!n.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(i){return yw(i)&&++o<10?(e.consume(i),t):(!n.interrupt||o<2)&&(n.containerState.marker?i===n.containerState.marker:41===i||46===i)?(e.exit("listItemValue"),s(i)):r(i)}(t)}return r(t)};function s(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||t,e.check(yP,n.interrupt?r:l,e.attempt(bh,d,u))}function l(e){return n.containerState.initialBlankLine=!0,a++,d(e)}function u(t){return y$(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),d):r(t)}function d(r){return n.containerState.size=a+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(r)}}},bh={partial:!0,tokenize:function(e,t,r){let n=this;return yC(e,function(e){let i=n.events[n.events.length-1];return!y$(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):r(e)},"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},bg={partial:!0,tokenize:function(e,t,r){let n=this;return yC(e,function(e){let i=n.events[n.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===n.containerState.size?t(e):r(e)},"listItemIndent",n.containerState.size+1)}},bv={name:"setextUnderline",resolveTo:function(e,t){let r,n,i,a=e.length;for(;a--;)if("enter"===e[a][0]){if("content"===e[a][1].type){r=a;break}"paragraph"===e[a][1].type&&(n=a)}else"content"===e[a][1].type&&e.splice(a,1),i||"definition"!==e[a][1].type||(i=a);let o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[n][1].type="setextHeadingText",i?(e.splice(n,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e},tokenize:function(e,t,r){let n,i=this;return function(t){var o;let s,l=i.events.length;for(;l--;)if("lineEnding"!==i.events[l][1].type&&"linePrefix"!==i.events[l][1].type&&"content"!==i.events[l][1].type){s="paragraph"===i.events[l][1].type;break}return!i.parser.lazy[i.now().line]&&(i.interrupt||s)?(e.enter("setextHeadingLine"),n=t,o=t,e.enter("setextHeadingLineSequence"),function t(r){return r===n?(e.consume(r),t):(e.exit("setextHeadingLineSequence"),y$(r)?yC(e,a,"lineSuffix")(r):a(r))}(o)):r(t)};function a(n){return null===n||yI(n)?(e.exit("setextHeadingLine"),t(n)):r(n)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,r){let n,i=this;return function(t){var n;return e.enter("definition"),n=t,y9.call(i,e,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(n)};function a(t){return(n=be(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o):r(t)}function o(t){return yS(t)?y7(e,s)(t):s(t)}function s(t){return y3(e,l,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(bt,u,u)(t)}function u(t){return y$(t)?yC(e,d,"whitespace")(t):d(t)}function d(a){return null===a||yI(a)?(e.exit("definition"),i.parser.defined.push(n),t(a)):r(a)}}}},"disable",0,{null:[]},"document",0,{42:bf,43:bf,45:bf,48:bf,49:bf,50:bf,51:bf,52:bf,53:bf,54:bf,55:bf,56:bf,57:bf,62:yY},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let r,n,i=e.length-2,a=3;return"whitespace"===e[3][1].type&&(a+=2),i-2>a&&"whitespace"===e[i][1].type&&(i-=2),"atxHeadingSequence"===e[i][1].type&&(a===i-1||i-4>a&&"whitespace"===e[i-2][1].type)&&(i-=a+1===i?2:4),i>a&&(r={type:"atxHeadingText",start:e[a][1].start,end:e[i][1].end},n={type:"chunkText",start:e[a][1].start,end:e[i][1].end,contentType:"text"},ym(e,a,i-a+1,[["enter",r,t],["enter",n,t],["exit",n,t],["exit",r,t]])),e},tokenize:function(e,t,r){let n=0;return function(i){var a;return e.enter("atxHeading"),a=i,e.enter("atxHeadingSequence"),function i(a){return 35===a&&n++<6?(e.consume(a),i):null===a||yS(a)?(e.exit("atxHeadingSequence"),function r(n){return 35===n?(e.enter("atxHeadingSequence"),function t(n){return 35===n?(e.consume(n),t):(e.exit("atxHeadingSequence"),r(n))}(n)):null===n||yI(n)?(e.exit("atxHeading"),t(n)):y$(n)?yC(e,r,"whitespace")(n):(e.enter("atxHeadingText"),function t(n){return null===n||35===n||yS(n)?(e.exit("atxHeadingText"),r(n)):(e.consume(n),t)}(n))}(a)):r(a)}(a)}}},42:bm,45:[bv,bm],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,r){let n,i,a,o,s,l=this;return function(t){var r;return r=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(r),u};function u(o){return 33===o?(e.consume(o),d):47===o?(e.consume(o),i=!0,m):63===o?(e.consume(o),n=3,l.interrupt?t:A):yv(o)?(e.consume(o),a=String.fromCharCode(o),f):r(o)}function d(i){return 45===i?(e.consume(i),n=2,c):91===i?(e.consume(i),n=5,o=0,p):yv(i)?(e.consume(i),n=4,l.interrupt?t:A):r(i)}function c(n){return 45===n?(e.consume(n),l.interrupt?t:A):r(n)}function p(n){let i="CDATA[";return n===i.charCodeAt(o++)?(e.consume(n),o===i.length)?l.interrupt?t:I:p:r(n)}function m(t){return yv(t)?(e.consume(t),a=String.fromCharCode(t),f):r(t)}function f(o){if(null===o||47===o||62===o||yS(o)){let s=47===o,u=a.toLowerCase();return!s&&!i&&bn.includes(u)?(n=1,l.interrupt?t(o):I(o)):br.includes(a.toLowerCase())?(n=6,s)?(e.consume(o),h):l.interrupt?t(o):I(o):(n=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(o):i?function t(r){return y$(r)?(e.consume(r),t):_(r)}(o):g(o))}return 45===o||yy(o)?(e.consume(o),a+=String.fromCharCode(o),f):r(o)}function h(n){return 62===n?(e.consume(n),l.interrupt?t:I):r(n)}function g(t){return 47===t?(e.consume(t),_):58===t||95===t||yv(t)?(e.consume(t),v):y$(t)?(e.consume(t),g):_(t)}function v(t){return 45===t||46===t||58===t||95===t||yy(t)?(e.consume(t),v):y(t)}function y(t){return 61===t?(e.consume(t),b):y$(t)?(e.consume(t),y):g(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?r(t):34===t||39===t?(e.consume(t),s=t,x):y$(t)?(e.consume(t),b):function t(r){return null===r||34===r||39===r||47===r||60===r||61===r||62===r||96===r||yS(r)?y(r):(e.consume(r),t)}(t)}function x(t){return t===s?(e.consume(t),s=null,w):null===t||yI(t)?r(t):(e.consume(t),x)}function w(e){return 47===e||62===e||y$(e)?g(e):r(e)}function _(t){return 62===t?(e.consume(t),k):r(t)}function k(t){return null===t||yI(t)?I(t):y$(t)?(e.consume(t),k):r(t)}function I(t){return 45===t&&2===n?(e.consume(t),E):60===t&&1===n?(e.consume(t),T):62===t&&4===n?(e.consume(t),R):63===t&&3===n?(e.consume(t),A):93===t&&5===n?(e.consume(t),N):yI(t)&&(6===n||7===n)?(e.exit("htmlFlowData"),e.check(bi,P,S)(t)):null===t||yI(t)?(e.exit("htmlFlowData"),S(t)):(e.consume(t),I)}function S(t){return e.check(ba,$,P)(t)}function $(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),j}function j(t){return null===t||yI(t)?S(t):(e.enter("htmlFlowData"),I(t))}function E(t){return 45===t?(e.consume(t),A):I(t)}function T(t){return 47===t?(e.consume(t),a="",C):I(t)}function C(t){if(62===t){let r=a.toLowerCase();return bn.includes(r)?(e.consume(t),R):I(t)}return yv(t)&&a.length<8?(e.consume(t),a+=String.fromCharCode(t),C):I(t)}function N(t){return 93===t?(e.consume(t),A):I(t)}function A(t){return 62===t?(e.consume(t),R):45===t&&2===n?(e.consume(t),A):I(t)}function R(t){return null===t||yI(t)?(e.exit("htmlFlowData"),P(t)):(e.consume(t),R)}function P(r){return e.exit("htmlFlow"),t(r)}}},61:bv,95:bm,96:y4,126:y4},"flowInitial",0,{[-2]:y6,[-1]:y6,32:y6},"insideSpan",0,{null:[yK,yZ]},"string",0,{38:y1,92:yX},"text",0,{[-5]:bp,[-4]:bp,[-3]:bp,33:bd,38:y1,42:yK,60:[{name:"autolink",tokenize:function(e,t,r){let n=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return yv(t)?(e.consume(t),a):64===t?r(t):s(t)}function a(t){return 43===t||45===t||46===t||yy(t)?(n=1,function t(r){return 58===r?(e.consume(r),n=0,o):(43===r||45===r||46===r||yy(r))&&n++<32?(e.consume(r),t):(n=0,s(r))}(t)):s(t)}function o(n){return 62===n?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):null===n||32===n||60===n||yx(n)?r(n):(e.consume(n),o)}function s(t){return 64===t?(e.consume(t),l):yb(t)?(e.consume(t),s):r(t)}function l(i){return yy(i)?function i(a){return 46===a?(e.consume(a),n=0,l):62===a?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(a),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(a){if((45===a||yy(a))&&n++<63){let r=45===a?t:i;return e.consume(a),r}return r(a)}(a)}(i):r(i)}}},{name:"htmlText",tokenize:function(e,t,r){let n,i,a,o=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),s};function s(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),x):63===t?(e.consume(t),y):yv(t)?(e.consume(t),_):r(t)}function l(t){return 45===t?(e.consume(t),u):91===t?(e.consume(t),i=0,m):yv(t)?(e.consume(t),v):r(t)}function u(t){return 45===t?(e.consume(t),p):r(t)}function d(t){return null===t?r(t):45===t?(e.consume(t),c):yI(t)?(a=d,C(t)):(e.consume(t),d)}function c(t){return 45===t?(e.consume(t),p):d(t)}function p(e){return 62===e?T(e):45===e?c(e):d(e)}function m(t){let n="CDATA[";return t===n.charCodeAt(i++)?(e.consume(t),i===n.length?f:m):r(t)}function f(t){return null===t?r(t):93===t?(e.consume(t),h):yI(t)?(a=f,C(t)):(e.consume(t),f)}function h(t){return 93===t?(e.consume(t),g):f(t)}function g(t){return 62===t?T(t):93===t?(e.consume(t),g):f(t)}function v(t){return null===t||62===t?T(t):yI(t)?(a=v,C(t)):(e.consume(t),v)}function y(t){return null===t?r(t):63===t?(e.consume(t),b):yI(t)?(a=y,C(t)):(e.consume(t),y)}function b(e){return 62===e?T(e):y(e)}function x(t){return yv(t)?(e.consume(t),w):r(t)}function w(t){return 45===t||yy(t)?(e.consume(t),w):function t(r){return yI(r)?(a=t,C(r)):y$(r)?(e.consume(r),t):T(r)}(t)}function _(t){return 45===t||yy(t)?(e.consume(t),_):47===t||62===t||yS(t)?k(t):r(t)}function k(t){return 47===t?(e.consume(t),T):58===t||95===t||yv(t)?(e.consume(t),I):yI(t)?(a=k,C(t)):y$(t)?(e.consume(t),k):T(t)}function I(t){return 45===t||46===t||58===t||95===t||yy(t)?(e.consume(t),I):function t(r){return 61===r?(e.consume(r),S):yI(r)?(a=t,C(r)):y$(r)?(e.consume(r),t):k(r)}(t)}function S(t){return null===t||60===t||61===t||62===t||96===t?r(t):34===t||39===t?(e.consume(t),n=t,$):yI(t)?(a=S,C(t)):y$(t)?(e.consume(t),S):(e.consume(t),j)}function $(t){return t===n?(e.consume(t),n=void 0,E):null===t?r(t):yI(t)?(a=$,C(t)):(e.consume(t),$)}function j(t){return null===t||34===t||39===t||60===t||61===t||96===t?r(t):47===t||62===t||yS(t)?k(t):(e.consume(t),j)}function E(e){return 47===e||62===e||yS(e)?k(e):r(e)}function T(n){return 62===n?(e.consume(n),e.exit("htmlTextData"),e.exit("htmlText"),t):r(n)}function C(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),N}function N(t){return y$(t)?yC(e,A,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):A(t)}function A(t){return e.enter("htmlTextData"),a(t)}}}],91:bc,92:[{name:"hardBreakEscape",tokenize:function(e,t,r){return function(t){return e.enter("hardBreakEscape"),e.consume(t),n};function n(n){return yI(n)?(e.exit("hardBreakEscape"),t(n)):r(n)}}},yX],93:bo,95:yK,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,r,n=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[n][1].type||"space"===e[n][1].type)){for(t=i;++t<n;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[n][1].type="codeTextPadding",i+=2,n-=2;break}}for(t=i-1,n++;++t<=n;)void 0===r?t!==n&&"lineEnding"!==e[t][1].type&&(r=t):(t===n||"lineEnding"===e[t][1].type)&&(e[r][1].type="codeTextData",t!==r+2&&(e[r][1].end=e[t-1][1].end,e.splice(r+2,t-r-2),n-=t-r-2,t=r+2),r=void 0);return e},tokenize:function(e,t,r){let n,i,a=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(r){return 96===r?(e.consume(r),a++,t):(e.exit("codeTextSequence"),o(r))}(t)};function o(l){return null===l?r(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),o):96===l?(i=e.enter("codeTextSequence"),n=0,function r(o){return 96===o?(e.consume(o),n++,r):n===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(o)):(i.type="codeTextData",s(o))}(l)):yI(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):(e.enter("codeTextData"),s(l))}function s(t){return null===t||32===t||96===t||yI(t)?(e.exit("codeTextData"),o(t)):(e.consume(t),s)}}}}],4127);var by=e.i(4127);let bb=/[\0\t\n\r]/g;function bx(e,t){let r=Number.parseInt(e,t);return r<9||11===r||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(65535&r)==65535||(65535&r)==65534||r>1114111?"�":String.fromCodePoint(r)}let bw=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function b_(e,t,r){if(t)return t;if(35===r.charCodeAt(0)){let e=r.charCodeAt(1),t=120===e||88===e;return bx(r.slice(t?2:1),t?16:10)}return y0(r)||e}let bk={}.hasOwnProperty;function bI(e){return{line:e.line,column:e.column,offset:e.offset}}function bS(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+v0({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+v0({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+v0({start:t.start,end:t.end})+") is still open")}function b$(e){let t=this;t.parser=function(r){var n,i;let a,o,s,l;return"object"==typeof(n={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(i=n,n=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:n(v),autolinkProtocol:u,autolinkEmail:u,atxHeading:n(f),blockQuote:n(function(){return{type:"blockquote",children:[]}}),characterEscape:u,characterReference:u,codeFenced:n(m),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:n(m,i),codeText:n(function(){return{type:"inlineCode",value:""}},i),codeTextData:u,data:u,codeFlowValue:u,definition:n(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:n(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:n(h),hardBreakTrailing:n(h),htmlFlow:n(g,i),htmlFlowData:u,htmlText:n(g,i),htmlTextData:u,image:n(function(){return{type:"image",title:null,url:"",alt:null}}),label:i,link:n(v),listItem:n(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:n(y,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:n(y),paragraph:n(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:n(f),strong:n(function(){return{type:"strong",children:[]}}),thematicBreak:n(function(){return{type:"thematicBreak"}})},exit:{atxHeading:o(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:o(),autolinkEmail:function(e){d.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){d.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:o(),characterEscapeValue:d,characterReferenceMarkerHexadecimal:p,characterReferenceMarkerNumeric:p,characterReferenceValue:function(e){let t,r=this.sliceSerialize(e),n=this.data.characterReferenceType;n?(t=bx(r,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0):t=y0(r);let i=this.stack[this.stack.length-1];i.value+=t},characterReference:function(e){this.stack.pop().position.end=bI(e.end)},codeFenced:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:d,codeIndented:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:d,data:d,definition:o(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.label=t,r.identifier=be(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:o(),hardBreakEscape:o(c),hardBreakTrailing:o(c),htmlFlow:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:d,htmlText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:d,image:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),r=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===r.type?r.children=e.children:r.alt=t},labelText:function(e){let t=this.sliceSerialize(e),r=this.stack[this.stack.length-2];r.label=t.replace(bw,b_),r.identifier=be(t).toLowerCase()},lineEnding:function(e){let r=this.stack[this.stack.length-1];if(this.data.atHardBreak){r.children[r.children.length-1].position.end=bI(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(r.type)&&(u.call(this,e),d.call(this,e))},link:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:function(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.label=t,r.identifier=be(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:o(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:o(),thematicBreak:o()}};!function e(t,r){let n=-1;for(;++n<r.length;){let i=r[n];Array.isArray(i)?e(t,i):function(e,t){let r;for(r in t)if(bk.call(t,r))switch(r){case"canContainEols":{let n=t[r];n&&e[r].push(...n);break}case"transforms":{let n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{let n=t[r];n&&Object.assign(e[r],n)}}}(t,i)}}(t,(e||{}).mdastExtensions||[]);let r={};return function(e){let n={type:"root",children:[]},o={stack:[n],tokenStack:[],config:t,enter:a,exit:s,buffer:i,resume:l,data:r},u=[],d=-1;for(;++d<e.length;)("listOrdered"===e[d][1].type||"listUnordered"===e[d][1].type)&&("enter"===e[d][0]?u.push(d):d=function(e,t,r){let n,i,a,o,s=t-1,l=-1,u=!1;for(;++s<=r;){let t=e[s];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,o=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!n||o||l||a||(a=s),o=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:o=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(n){let o=s;for(i=void 0;o--;){let t=e[o];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",u=!0),t[1].type="lineEnding",i=o}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}a&&(!i||a<i)&&(n._spread=!0),n.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||s,0,["exit",n,t[2]]),s++,r++}if("listItemPrefix"===t[1].type){let i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};n=i,e.splice(s,0,["enter",i,t[2]]),s++,r++,a=void 0,o=!0}}}return e[t][1]._spread=u,r}(e,u.pop(),d));for(d=-1;++d<e.length;){let r=t[e[d][0]];bk.call(r,e[d][1].type)&&r[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},o),e[d][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||bS).call(o,void 0,e[0])}for(n.position={start:bI(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:bI(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)n=t.transforms[d](n)||n;return n};function n(e,t){return function(r){a.call(this,e(r),r),t&&t.call(this,r)}}function i(){this.stack.push({type:"fragment",children:[]})}function a(e,t,r){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,r||void 0]),e.position={start:bI(t.start),end:void 0}}function o(e){return function(t){e&&e.call(this,t),s.call(this,t)}}function s(e,t){let r=this.stack.pop(),n=this.tokenStack.pop();if(n)n[0].type!==e.type&&(t?t.call(this,e,n[0]):(n[1]||bS).call(this,e,n[0]));else throw Error("Cannot close `"+e.type+"` ("+v0({start:e.start,end:e.end})+"): it’s not open");r.position.end=bI(e.end)}function l(){return yd(this.stack.pop())}function u(e){let t=this.stack[this.stack.length-1].children,r=t[t.length-1];r&&"text"===r.type||((r={type:"text",value:""}).position={start:bI(e.start),end:void 0},t.push(r)),this.stack.push(r)}function d(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=bI(e.end)}function c(){this.data.atHardBreak=!0}function p(e){this.data.characterReferenceType=e.type}function m(){return{type:"code",lang:null,meta:null,value:""}}function f(){return{type:"heading",depth:0,children:[]}}function h(){return{type:"break"}}function g(){return{type:"html",value:""}}function v(){return{type:"link",title:null,url:"",children:[]}}function y(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(i)(function(e){for(;!yz(e););return e}((function(e){let t={constructs:yg([by,...(e||{}).extensions||[]]),content:r(yN),defined:[],document:r(yA),flow:r(yL),lazy:{},string:r(yF),text:r(yB)};return t;function r(e){return function(r){return function(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0},i={},a=[],o=[],s=[],l={attempt:f(function(e,t){h(e,t.from)}),check:f(m),consume:function(e){yI(e)?(n.line++,n.column=1,n.offset+=-3===e?2:1,g()):-1!==e&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),u.previous=e},enter:function(e,t){let r=t||{};return r.type=e,r.start=p(),u.events.push(["enter",r,u]),s.push(r),r},exit:function(e){let t=s.pop();return t.end=p(),u.events.push(["exit",t,u]),t},interrupt:f(m,{interrupt:!0})},u={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,g()},events:[],now:p,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let r,n=-1,i=[];for(;++n<e.length;){let a,o=e[n];if("string"==typeof o)a=o;else switch(o){case -5:a="\r";break;case -4:a="\n";break;case -3:a="\r\n";break;case -2:a=t?" ":" ";break;case -1:if(!t&&r)continue;a=" ";break;default:a=String.fromCharCode(o)}r=-2===o,i.push(a)}return i.join("")}(c(e),t)},sliceStream:c,write:function(e){return(o=yf(o,e),function(){let e;for(;n._index<o.length;){let r=o[n._index];if("string"==typeof r)for(e=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===e&&n._bufferIndex<r.length;){var t;t=r.charCodeAt(n._bufferIndex),d=d(t)}else d=d(r)}}(),null!==o[o.length-1])?[]:(h(t,0),u.events=yH(a,u.events,u),u.events)}},d=t.tokenize.call(u,l);return t.resolveAll&&a.push(t),u;function c(e){return function(e,t){let r,n=t.start._index,i=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;if(n===a)r=[e[n].slice(i,o)];else{if(r=e.slice(n,a),i>-1){let e=r[0];"string"==typeof e?r[0]=e.slice(i):r.shift()}o>0&&r.push(e[a].slice(0,o))}return r}(o,e)}function p(){let{_bufferIndex:e,_index:t,line:r,column:i,offset:a}=n;return{_bufferIndex:e,_index:t,line:r,column:i,offset:a}}function m(e,t){t.restore()}function f(e,t){return function(r,i,a){var o;let d,c,m,f;return Array.isArray(r)?h(r):"tokenize"in r?h([r]):(o=r,function(e){let t=null!==e&&o[e],r=null!==e&&o.null;return h([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(r)?r:r?[r]:[]])(e)});function h(e){return(d=e,c=0,0===e.length)?a:v(e[c])}function v(e){return function(r){let i,a,o,d,c;return(i=p(),a=u.previous,o=u.currentConstruct,d=u.events.length,c=Array.from(s),f={from:d,restore:function(){n=i,u.previous=a,u.currentConstruct=o,u.events.length=d,s=c,g()}},m=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name))?b(r):e.tokenize.call(t?Object.assign(Object.create(u),t):u,l,y,b)(r)}}function y(t){return e(m,f),i}function b(e){return(f.restore(),++c<d.length)?v(d[c]):a}}}function h(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&ym(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function g(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}(t,e,r)}}})(i).document().write((o=1,s="",l=!0,function(e,t,r){let n,i,u,d,c,p=[];for(e=s+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),u=0,s="",l&&(65279===e.charCodeAt(0)&&u++,l=void 0);u<e.length;){if(bb.lastIndex=u,d=(n=bb.exec(e))&&void 0!==n.index?n.index:e.length,c=e.charCodeAt(d),!n){s=e.slice(u);break}if(10===c&&u===d&&a)p.push(-3),a=void 0;else switch(a&&(p.push(-5),a=void 0),u<d&&(p.push(e.slice(u,d)),o+=d-u),c){case 0:p.push(65533),o++;break;case 9:for(i=4*Math.ceil(o/4),p.push(-2);o++<i;)p.push(-1);break;case 10:p.push(-4),o=1;break;default:a=!0,o=1}u=d+1}return r&&(a&&p.push(-5),s&&p.push(s),p.push(null)),p})(r,n,!0))))}}let bj="object"==typeof self?self:globalThis,bE=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw TypeError("unable to deserialize "+e)}return new bj[e](t)},bT=e=>{var t;let r,n;return(t=new Map,r=(e,r)=>(t.set(r,e),e),n=i=>{if(t.has(i))return t.get(i);let[a,o]=e[i];switch(a){case 0:case -1:return r(o,i);case 1:{let e=r([],i);for(let t of o)e.push(n(t));return e}case 2:{let e=r({},i);for(let[t,r]of o)e[n(t)]=n(r);return e}case 3:return r(new Date(o),i);case 4:{let{source:e,flags:t}=o;return r(new RegExp(e,t),i)}case 5:{let e=r(new Map,i);for(let[t,r]of o)e.set(n(t),n(r));return e}case 6:{let e=r(new Set,i);for(let t of o)e.add(n(t));return e}case 7:{let{name:e,message:t}=o;return r(bE(e,t),i)}case 8:return r(BigInt(o),i);case"BigInt":return r(Object(BigInt(o)),i);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{let{buffer:e}=new Uint8Array(o);return r(new DataView(e),o)}}return r(bE(a,o),i)})(0)},{toString:bC}={},{keys:bN}=Object,bA=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let r=bC.call(e).slice(8,-1);switch(r){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,r]}return r.includes("Array")?[1,r]:r.includes("Error")?[7,r]:[2,r]},bR=([e,t])=>0===e&&("function"===t||"symbol"===t),bP=(e,{json:t,lossy:r}={})=>{var n,i,a;let o,s,l=[];return(n=!(t||r),i=!!t,a=new Map,o=(e,t)=>{let r=l.push(e)-1;return a.set(t,r),r},s=e=>{if(a.has(e))return a.get(e);let[t,r]=bA(e);switch(t){case 0:{let i=e;switch(r){case"bigint":t=8,i=e.toString();break;case"function":case"symbol":if(n)throw TypeError("unable to serialize "+r);i=null;break;case"undefined":return o([-1],e)}return o([t,i],e)}case 1:{if(r){let t=e;return"DataView"===r?t=new Uint8Array(e.buffer):"ArrayBuffer"===r&&(t=new Uint8Array(e)),o([r,[...t]],e)}let n=[],i=o([t,n],e);for(let t of e)n.push(s(t));return i}case 2:{if(r)switch(r){case"BigInt":return o([r,e.toString()],e);case"Boolean":case"Number":case"String":return o([r,e.valueOf()],e)}if(i&&"toJSON"in e)return s(e.toJSON());let a=[],l=o([t,a],e);for(let t of bN(e))(n||!bR(bA(e[t])))&&a.push([s(t),s(e[t])]);return l}case 3:return o([t,e.toISOString()],e);case 4:{let{source:r,flags:n}=e;return o([t,{source:r,flags:n}],e)}case 5:{let r=[],i=o([t,r],e);for(let[t,i]of e)(n||!(bR(bA(t))||bR(bA(i))))&&r.push([s(t),s(i)]);return i}case 6:{let r=[],i=o([t,r],e);for(let t of e)(n||!bR(bA(t)))&&r.push(s(t));return i}}let{message:l}=e;return o([t,{name:r,message:l}],e)})(e),l},bO="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?bT(bP(e,t)):structuredClone(e):(e,t)=>bT(bP(e,t));function bM(e){let t=[],r=-1,n=0,i=0;for(;++r<e.length;){let a=e.charCodeAt(r),o="";if(37===a&&yy(e.charCodeAt(r+1))&&yy(e.charCodeAt(r+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(r+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o="�"}else o=String.fromCharCode(a);o&&(t.push(e.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return t.join("")+e.slice(n)}function bz(e,t){let r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function bD(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}let bU=function(e){var t,r;if(null==e)return bZ;if("function"==typeof e)return bL(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],r=-1;for(;++r<e.length;)t[r]=bU(e[r]);return bL(function(...e){let r=-1;for(;++r<t.length;)if(t[r].apply(this,e))return!0;return!1})}(e):(t=e,bL(function(e){let r;for(r in t)if(e[r]!==t[r])return!1;return!0}))}if("string"==typeof e){return r=e,bL(function(e){return e&&e.type===r})}throw Error("Expected function, string, or object as test")};function bL(e){return function(t,r,n){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof r?r:void 0,n||void 0))}}function bZ(){return!0}let bF=[];function bB(e,t,r,n){let i;"function"==typeof t&&"function"!=typeof r?(n=r,r=t):i=t;let a=bU(i),o=n?-1:1;(function e(i,s,l){let u=i&&"object"==typeof i?i:{};if("string"==typeof u.type){let e="string"==typeof u.tagName?u.tagName:"string"==typeof u.name?u.name:void 0;Object.defineProperty(d,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return d;function d(){var u;let d,c,p,m=bF;if((!t||a(i,s,l[l.length-1]||void 0))&&!1===(m=Array.isArray(u=r(i,l))?u:"number"==typeof u?[!0,u]:null==u?bF:[u])[0])return m;if("children"in i&&i.children&&i.children&&"skip"!==m[0])for(c=(n?i.children.length:-1)+o,p=l.concat(i);c>-1&&c<i.children.length;){if(!1===(d=e(i.children[c],c,p)())[0])return d;c="number"==typeof d[1]?d[1]:c+o}return m}})(e,void 0,[])()}function bV(e,t,r,n){let i,a,o;"function"==typeof t&&"function"!=typeof r?(a=void 0,o=t,i=r):(a=t,o=r,i=n),bB(e,a,function(e,t){let r=t[t.length-1],n=r?r.children.indexOf(e):void 0;return o(e,n,r)},i)}function bq(e,t){let r=t.referenceType,n="]";if("collapsed"===r?n+="[]":"full"===r&&(n+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+n}];let i=e.all(t),a=i[0];a&&"text"===a.type?a.value="["+a.value:i.unshift({type:"text",value:"["});let o=i[i.length-1];return o&&"text"===o.type?o.value+=n:i.push({type:"text",value:n}),i}function bW(e){let t=e.spread;return null==t?e.children.length>1:t}function bJ(e,t,r){let n=0,i=e.length;if(t){let t=e.codePointAt(n);for(;9===t||32===t;)n++,t=e.codePointAt(n)}if(r){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>n?e.slice(n,i):""}let bH={blockquote:function(e,t){let r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)},break:function(e,t){let r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:"\n"}]},code:function(e,t){let r=t.value?t.value+"\n":"",n={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(n.className=["language-"+i[0]]);let a={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a={type:"element",tagName:"pre",properties:{},children:[a=e.applyData(t,a)]},e.patch(t,a),a},delete:function(e,t){let r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},emphasis:function(e,t){let r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},footnoteReference:function(e,t){let r,n="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=bM(i.toLowerCase()),o=e.footnoteOrder.indexOf(i),s=e.footnoteCounts.get(i);void 0===s?(s=0,e.footnoteOrder.push(i),r=e.footnoteOrder.length):r=o+1,s+=1,e.footnoteCounts.set(i,s);let l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(r)}]};e.patch(t,l);let u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)},heading:function(e,t){let r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},html:function(e,t){if(e.options.allowDangerousHtml){let r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}},imageReference:function(e,t){let r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return bq(e,t);let i={src:bM(n.url||""),alt:t.alt};null!==n.title&&void 0!==n.title&&(i.title=n.title);let a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)},image:function(e,t){let r={src:bM(t.url)};null!==t.alt&&void 0!==t.alt&&(r.alt=t.alt),null!==t.title&&void 0!==t.title&&(r.title=t.title);let n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)},inlineCode:function(e,t){let r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);let n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)},linkReference:function(e,t){let r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return bq(e,t);let i={href:bM(n.url||"")};null!==n.title&&void 0!==n.title&&(i.title=n.title);let a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)},link:function(e,t){let r={href:bM(t.url)};null!==t.title&&void 0!==t.title&&(r.title=t.title);let n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},listItem:function(e,t,r){let n=e.all(t),i=r?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let r=e.children,n=-1;for(;!t&&++n<r.length;)t=bW(r[n])}return t}(r):bW(t),a={},o=[];if("boolean"==typeof t.checked){let e,r=n[0];r&&"element"===r.type&&"p"===r.tagName?e=r:(e={type:"element",tagName:"p",properties:{},children:[]},n.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s<n.length;){let e=n[s];(i||0!==s||"element"!==e.type||"p"!==e.tagName)&&o.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?o.push(e):o.push(...e.children)}let l=n[n.length-1];l&&(i||"element"!==l.type||"p"!==l.tagName)&&o.push({type:"text",value:"\n"});let u={type:"element",tagName:"li",properties:a,children:o};return e.patch(t,u),e.applyData(t,u)},list:function(e,t){let r={},n=e.all(t),i=-1;for("number"==typeof t.start&&1!==t.start&&(r.start=t.start);++i<n.length;){let e=n[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}let a={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(n,!0)};return e.patch(t,a),e.applyData(t,a)},paragraph:function(e,t){let r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},root:function(e,t){let r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)},strong:function(e,t){let r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},table:function(e,t){let r=e.all(t),n=r.shift(),i=[];if(n){let r={type:"element",tagName:"thead",properties:{},children:e.wrap([n],!0)};e.patch(t.children[0],r),i.push(r)}if(r.length>0){let n={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},a=vX(t.children[1]),o=vY(t.children[t.children.length-1]);a&&o&&(n.position={start:a,end:o}),i.push(n)}let a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)},tableCell:function(e,t){let r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},tableRow:function(e,t,r){let n=r?r.children:void 0,i=0===(n?n.indexOf(t):1)?"th":"td",a=r&&"table"===r.type?r.align:void 0,o=a?a.length:t.children.length,s=-1,l=[];for(;++s<o;){let r=t.children[s],n={},o=a?a[s]:void 0;o&&(n.align=o);let u={type:"element",tagName:i,properties:n,children:[]};r&&(u.children=e.all(r),e.patch(r,u),u=e.applyData(r,u)),l.push(u)}let u={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,u),e.applyData(t,u)},text:function(e,t){let r={type:"text",value:function(e){let t=String(e),r=/\r?\n|\r/g,n=r.exec(t),i=0,a=[];for(;n;)a.push(bJ(t.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(t);return a.push(bJ(t.slice(i),i>0,!1)),a.join("")}(String(t.value))};return e.patch(t,r),e.applyData(t,r)},thematicBreak:function(e,t){let r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)},toml:bK,yaml:bK,definition:bK,footnoteDefinition:bK};function bK(){}let bG={}.hasOwnProperty,bY={};function bX(e,t){e.position&&(t.position=function(e){let t=vX(e),r=vY(e);if(t&&r)return{start:t,end:r}}(e))}function bQ(e,t){let r=t;if(e&&e.data){let t=e.data.hName,n=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===r.type?r.tagName=t:r={type:"element",tagName:t,properties:{},children:"children"in r?r.children:[r]}),"element"===r.type&&i&&Object.assign(r.properties,bO(i)),"children"in r&&r.children&&null!=n&&(r.children=n)}return r}function b0(e,t){let r=[],n=-1;for(t&&r.push({type:"text",value:"\n"});++n<e.length;)n&&r.push({type:"text",value:"\n"}),r.push(e[n]);return t&&e.length>0&&r.push({type:"text",value:"\n"}),r}function b1(e){let t=0,r=e.charCodeAt(t);for(;9===r||32===r;)t++,r=e.charCodeAt(t);return e.slice(t)}function b2(e,t){let r,n,i,a,o=(r=t||bY,n=new Map,i=new Map,a={all:function(e){let t=[];if("children"in e){let r=e.children,n=-1;for(;++n<r.length;){let i=a.one(r[n],e);if(i){if(n&&"break"===r[n-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=b1(i.value)),!Array.isArray(i)&&"element"===i.type)){let e=i.children[0];e&&"text"===e.type&&(e.value=b1(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:bQ,definitionById:n,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...bH,...r.handlers},one:function(e,t){let r=e.type,n=a.handlers[r];if(bG.call(a.handlers,r)&&n)return n(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(r)){if("children"in e){let{children:t,...r}=e,n=bO(r);return n.children=a.all(e),n}return bO(e)}return(a.options.unknownHandler||function(e,t){let r=t.data||{},n="value"in t&&!(bG.call(r,"hProperties")||bG.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)})(a,e,t)},options:r,patch:bX,wrap:b0},bV(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?n:i,r=String(e.identifier).toUpperCase();t.has(r)||t.set(r,e)}}),a),s=o.one(e,void 0),l=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||bz,n=e.options.footnoteBackLabel||bD,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),u=bM(o.toLowerCase()),d=0,c=[],p=e.footnoteCounts.get(o);for(;void 0!==p&&++d<=p;){c.length>0&&c.push({type:"text",value:" "});let e="string"==typeof r?r:r(l,d);"string"==typeof e&&(e={type:"text",value:e}),c.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+u+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof n?n:n(l,d),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let m=a[a.length-1];if(m&&"element"===m.type&&"p"===m.tagName){let e=m.children[m.children.length-1];e&&"text"===e.type?e.value+=" ":m.children.push({type:"text",value:" "}),m.children.push(...c)}else a.push(...c);let f={type:"element",tagName:"li",properties:{id:t+"fn-"+u},children:e.wrap(a,!0)};e.patch(i,f),s.push(f)}if(0!==s.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...bO(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:"\n"}]}}(o),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&(vu("children"in u),u.children.push({type:"text",value:"\n"},l)),u}function b4(e,t){return e&&"run"in e?async function(r,n){let i=b2(r,{file:n,...t});await e.run(i,n)}:function(r,n){return b2(r,{file:n,...e||t})}}function b6(e){if(e)throw e}var b5=e.i(4100);function b3(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let b9=function(e,t){let r;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');xt(e);let n=0,i=-1,a=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;a--;)if(47===e.codePointAt(a)){if(r){n=a+1;break}}else i<0&&(r=!0,i=a+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let o=-1,s=t.length-1;for(;a--;)if(47===e.codePointAt(a)){if(r){n=a+1;break}}else o<0&&(r=!0,o=a+1),s>-1&&(e.codePointAt(a)===t.codePointAt(s--)?s<0&&(i=a):(s=-1,i=o));return n===i?i=o:i<0&&(i=e.length),e.slice(n,i)},b8=function(e){let t;if(xt(e),0===e.length)return".";let r=-1,n=e.length;for(;--n;)if(47===e.codePointAt(n)){if(t){r=n;break}}else t||(t=!0);return r<0?47===e.codePointAt(0)?"/":".":1===r&&47===e.codePointAt(0)?"//":e.slice(0,r)},b7=function(e){let t;xt(e);let r=e.length,n=-1,i=0,a=-1,o=0;for(;r--;){let s=e.codePointAt(r);if(47===s){if(t){i=r+1;break}continue}n<0&&(t=!0,n=r+1),46===s?a<0?a=r:1!==o&&(o=1):a>-1&&(o=-1)}return a<0||n<0||0===o||1===o&&a===n-1&&a===i+1?"":e.slice(a,n)},xe=function(...e){var t;let r,n,i,a=-1;for(;++a<e.length;)xt(e[a]),e[a]&&(i=void 0===i?e[a]:i+"/"+e[a]);return void 0===i?".":(xt(t=i),r=47===t.codePointAt(0),0!==(n=function(e,t){let r,n,i="",a=0,o=-1,s=0,l=-1;for(;++l<=e.length;){if(l<e.length)r=e.codePointAt(l);else if(47===r)break;else r=47;if(47===r){if(o===l-1||1===s);else if(o!==l-1&&2===s){if(i.length<2||2!==a||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2)){if(i.length>2){if((n=i.lastIndexOf("/"))!==i.length-1){n<0?(i="",a=0):a=(i=i.slice(0,n)).length-1-i.lastIndexOf("/"),o=l,s=0;continue}}else if(i.length>0){i="",a=0,o=l,s=0;continue}}t&&(i=i.length>0?i+"/..":"..",a=2)}else i.length>0?i+="/"+e.slice(o+1,l):i=e.slice(o+1,l),a=l-o-1;o=l,s=0}else 46===r&&s>-1?s++:s=-1}return i}(t,!r)).length||r||(n="."),n.length>0&&47===t.codePointAt(t.length-1)&&(n+="/"),r?"/"+n:n)};function xt(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function xr(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let xn=["history","path","basename","stem","extname","dirname"];class xi{constructor(e){let t,r;t=e?xr(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<xn.length;){const e=xn[n];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(r in t)xn.includes(r)||(this[r]=t[r])}get basename(){return"string"==typeof this.path?b9(this.path):void 0}set basename(e){xo(e,"basename"),xa(e,"basename"),this.path=xe(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?b8(this.path):void 0}set dirname(e){xs(this.basename,"dirname"),this.path=xe(e||"",this.basename)}get extname(){return"string"==typeof this.path?b7(this.path):void 0}set extname(e){if(xa(e,"extname"),xs(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=xe(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){xr(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!xr(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,r=-1;for(;++r<t.length;)if(37===t.codePointAt(r)&&50===t.codePointAt(r+1)){let e=t.codePointAt(r+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),xo(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?b9(this.path,this.extname):void 0}set stem(e){xo(e,"stem"),xa(e,"stem"),this.path=xe(this.dirname||"",e+(this.extname||""))}fail(e,t,r){let n=this.message(e,t,r);throw n.fatal=!0,n}info(e,t,r){let n=this.message(e,t,r);return n.fatal=void 0,n}message(e,t,r){let n=new v6(e,t,r);return this.path&&(n.name=this.path+":"+n.name,n.file=this.path),n.fatal=!1,this.messages.push(n),n}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function xa(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function xo(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function xs(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let xl=function(e){let t=this.constructor.prototype,r=t[e],n=function(){return r.apply(n,arguments)};return Object.setPrototypeOf(n,t),n},xu={}.hasOwnProperty;class xd extends xl{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],t={run:function(...t){let r=-1,n=t.pop();if("function"!=typeof n)throw TypeError("Expected function as last argument, not "+n);!function i(a,...o){let s=e[++r],l=-1;if(a)return void n(a);for(;++l<t.length;)(null===o[l]||void 0===o[l])&&(o[l]=t[l]);t=o,s?(function(e,t){let r;return function(...t){let a,o=e.length>t.length;o&&t.push(n);try{a=e.apply(this,t)}catch(e){if(o&&r)throw e;return n(e)}o||(a&&a.then&&"function"==typeof a.then?a.then(i,n):a instanceof Error?n(a):i(a))};function n(e,...i){r||(r=!0,t(e,...i))}function i(e){n(null,e)}})(s,i)(...o):n(null,...o)}(null,...t)},use:function(r){if("function"!=typeof r)throw TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}};return t}()}copy(){let e=new xd,t=-1;for(;++t<this.attachers.length;){let r=this.attachers[t];e.use(...r)}return e.data((0,b5.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(xf("data",this.frozen),this.namespace[e]=t,this):xu.call(this.namespace,e)&&this.namespace[e]||void 0:e?(xf("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let r=e.call(this,...t);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=xv(e),r=this.parser||this.Parser;return xp("parse",r),r(String(t),t)}process(e,t){let r=this;return this.freeze(),xp("process",this.parser||this.Parser),xm("process",this.compiler||this.Compiler),t?n(void 0,t):new Promise(n);function n(n,i){let a=xv(e),o=r.parse(a);function s(e,r){e||!r?i(e):n?n(r):(vu(t,"`done` is defined if `resolve` is not"),t(void 0,r))}r.run(o,a,function(e,t,n){var i,a;if(e||!t||!n)return s(e);let o=r.stringify(t,n);"string"==typeof(i=o)||(a=i)&&"object"==typeof a&&"byteLength"in a&&"byteOffset"in a?n.value=o:n.result=o,s(e,n)})}}processSync(e){let t,r=!1;return this.freeze(),xp("processSync",this.parser||this.Parser),xm("processSync",this.compiler||this.Compiler),this.process(e,function(e,n){r=!0,b6(e),t=n}),xg("processSync","process",r),vu(t,"we either bailed on an error or have a tree"),t}run(e,t,r){xh(e),this.freeze();let n=this.transformers;return r||"function"!=typeof t||(r=t,t=void 0),r?i(void 0,r):new Promise(i);function i(i,a){vu("function"!=typeof t,"`file` can’t be a `done` anymore, we checked");let o=xv(t);n.run(e,o,function(t,n,o){let s=n||e;t?a(t):i?i(s):(vu(r,"`done` is defined if `resolve` is not"),r(void 0,s,o))})}}runSync(e,t){let r,n=!1;return this.run(e,t,function(e,t){b6(e),r=t,n=!0}),xg("runSync","run",n),vu(r,"we either bailed on an error or have a tree"),r}stringify(e,t){this.freeze();let r=xv(t),n=this.compiler||this.Compiler;return xm("stringify",n),xh(e),n(e,r)}use(e,...t){let r=this.attachers,n=this.namespace;if(xf("use",this.frozen),null==e);else if("function"==typeof e)o(e,t);else if("object"==typeof e)Array.isArray(e)?a(e):i(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(e.plugins),e.settings&&(n.settings=(0,b5.default)(!0,n.settings,e.settings))}function a(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)o(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...r]=e;o(t,r)}else i(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function o(e,t){let n=-1,i=-1;for(;++n<r.length;)if(r[n][0]===e){i=n;break}if(-1===i)r.push([e,...t]);else if(t.length>0){let[n,...a]=t,o=r[i][1];b3(o)&&b3(n)&&(n=(0,b5.default)(!0,o,n)),r[i]=[e,n,...a]}}}}let xc=new xd().freeze();function xp(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function xm(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function xf(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function xh(e){if(!b3(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function xg(e,t,r){if(!r)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function xv(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new xi(e)}let xy=[],xb={allowDangerousHtml:!0},xx=/^(https?|ircs?|mailto|xmpp)$/i,xw=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function x_(e){var t;let r,n,i,a,o,s=(r=(t=e).rehypePlugins||xy,n=t.remarkPlugins||xy,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...xb}:xb,xc().use(b$).use(n).use(b4,i).use(r)),l=(a=e.children||"",o=new xi,"string"==typeof a?o.value=a:vd("Unexpected value `"+a+"` for `children` prop, expected `string`"),o);return function(e,t){let r=t.allowedElements,n=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||xk;for(let e of xw)Object.hasOwn(t,e.from)&&vd("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return r&&a&&vd("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),bV(e,function(e,t,i){if("raw"===e.type&&i&&"number"==typeof t)return o?i.children.splice(t,1):i.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in yl)if(Object.hasOwn(yl,t)&&Object.hasOwn(e.properties,t)){let r=e.properties[t],n=yl[t];(null===n||n.includes(e.tagName))&&(e.properties[t]=l(String(r||""),t,e))}}if("element"===e.type){let o=r?!r.includes(e.tagName):!!a&&a.includes(e.tagName);if(!o&&n&&"number"==typeof t&&(o=!n(e,t,i)),o&&i&&"number"==typeof t)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}),function(e,t){var r,n,i,a;let o;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let s=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=s,n=t.jsxDEV,o=function(e,t,i,a){let o=Array.isArray(i.children),s=vX(e);return n(t,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:r,lineNumber:s?s.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");i=t.jsx,a=t.jsxs,o=function(e,t,r,n){let o=Array.isArray(r.children)?a:i;return n?o(t,r,n):o(t,r)}}let l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:o,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:s,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?vK:vH,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},u=yt(l,e,void 0);return u&&"string"!=typeof u?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}(e,{Fragment:ew.Fragment,components:i,ignoreInvalidStyle:!0,jsx:ew.jsx,jsxs:ew.jsxs,passKeys:!0,passNode:!0})}(s.runSync(s.parse(l),l),e)}function xk(e){let t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),i=e.indexOf("/");return -1===t||-1!==i&&t>i||-1!==r&&t>r||-1!==n&&t>n||xx.test(e.slice(0,t))?e:""}let xI=(e,t)=>((e,t)=>{var r,n;if(!e||!t)return!1;let i=e=>{let{position:t,data:r,...n}=e||{};return n};return JSON.stringify(i(e.properties))===JSON.stringify(i(t.properties))&&(r=e.children,n=t.children,"string"==typeof r?r===n:JSON.stringify(r)===JSON.stringify(n))})(e.node,t.node),xS=(0,ek.createContext)(null),x$=()=>null!==(0,ek.useContext)(xS),xj=(0,ek.memo)(({children:e,...t})=>(0,ew.jsx)(xS.Provider,{value:t,children:e}),xI),xE=({node:e,...t})=>(0,ew.jsx)("pre",{...t}),xT=({node:e,...t})=>(0,ew.jsx)("code",{...t}),xC=({node:e,components:{Pre:t,Code:r},code:n})=>(0,ew.jsx)(t,{children:(0,ew.jsx)(r,{node:e,children:n})}),xN=()=>null,xA=({node:e,components:{Pre:t,Code:r,SyntaxHighlighter:n,CodeHeader:i},language:a,code:o})=>{let s=(0,ek.useMemo)(()=>({Pre:t,Code:r}),[t,r]),l=a?n:xC;return(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsx)(i,{node:e,language:a,code:o}),(0,ew.jsx)(l,{node:e,components:s,language:a??"unknown",code:o})]})};var xR=e.i(43794);let xP=({className:e,...t})=>({className:r,...n})=>({className:(0,xR.default)(e,r),...t,...n}),xO=({node:e,components:{Pre:t,Code:r,SyntaxHighlighter:n,CodeHeader:i},componentsByLanguage:a={},children:o,...s})=>{let l=xP((0,ek.useContext)(xS)),u=(0,na.useCallbackRef)(e=>(0,ew.jsx)(t,{...l(e)})),d=xP(s),c=(0,na.useCallbackRef)(e=>(0,ew.jsx)(r,{...d(e)})),p=/language-(\w+)/.exec(s.className||"")?.[1]??"";if("string"!=typeof o)return(0,ew.jsx)(xC,{node:e,components:{Pre:u,Code:c},code:o});let m=a[p]?.SyntaxHighlighter??n,f=a[p]?.CodeHeader??i;return(0,ew.jsx)(xA,{node:e,components:{Pre:u,Code:c,SyntaxHighlighter:m,CodeHeader:f},language:p||"unknown",code:o})},xM=(0,ek.memo)(({node:e,components:t,componentsByLanguage:r,...n})=>x$()?(0,ew.jsx)(xO,{node:e,components:t,componentsByLanguage:r,...n}):(0,ew.jsx)(t.Code,{...n}),(e,t)=>e.components===t.components&&e.componentsByLanguage===t.componentsByLanguage&&xI(e,t)),{useSmooth:xz,useSmoothStatus:xD,withSmoothContextProvider:xU}=vl,xL=({components:e,componentsByLanguage:t,smooth:r=!0,preprocess:n,...i})=>{let a=db(),{text:o}=xz((0,ek.useMemo)(()=>n?{...a,text:n(a.text)}:a,[a,n]),r),{pre:s=xE,code:l=xT,SyntaxHighlighter:u=xC,CodeHeader:d=xN}=e??{},c=(0,ek.useMemo)(()=>({Pre:s,Code:l,SyntaxHighlighter:u,CodeHeader:d}),[s,l,u,d]),p=(0,na.useCallbackRef)(e=>(0,ew.jsx)(xM,{components:c,componentsByLanguage:t,...e})),m=(0,ek.useMemo)(()=>{let{pre:t,code:r,SyntaxHighlighter:n,CodeHeader:i,...a}=e??{};return{...a,pre:xj,code:p}},[p,e]);return(0,ew.jsx)(x_,{components:m,...i,children:o})},xZ=(0,ek.forwardRef)(({className:e,containerProps:t,containerComponent:r="div",...n},i)=>{let a=xD();return(0,ew.jsx)(r,{"data-status":a.type,...t,className:(0,xR.default)(e,t?.className),ref:i,children:(0,ew.jsx)(xL,{...n})})});xZ.displayName="MarkdownTextPrimitive";let xF=xU(xZ);function xB(e,t){let r=String(e);if("string"!=typeof t)throw TypeError("Expected character");let n=0,i=r.indexOf(t);for(;-1!==i;)n++,i=r.indexOf(t,i+t.length);return n}let xV="phrasing",xq=["autolink","link","image","label"];function xW(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function xJ(e){this.config.enter.autolinkProtocol.call(this,e)}function xH(e){this.config.exit.autolinkProtocol.call(this,e)}function xK(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];vu("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function xG(e){this.config.exit.autolinkEmail.call(this,e)}function xY(e){this.exit(e)}function xX(e){!function(e,t,r){let n=bU((r||{}).ignore||[]),i=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let r=!e[0]||Array.isArray(e[0])?e:[e],n=-1;for(;++n<r.length;){var i;let e=r[n];t.push(["string"==typeof(i=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(i),"g"):i,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),a=-1;for(;++a<i.length;)bB(e,"text",o);function o(e,t){let r,o=-1;for(;++o<t.length;){let e=t[o],i=r?r.children:void 0;if(n(e,i?i.indexOf(e):void 0,r))return;r=e}if(r)return function(e,t){let r=t[t.length-1],n=i[a][0],o=i[a][1],s=0,l=r.children.indexOf(e),u=!1,d=[];n.lastIndex=0;let c=n.exec(e.value);for(;c;){let r=c.index,i={index:c.index,input:c.input,stack:[...t,e]},a=o(...c,i);if("string"==typeof a&&(a=a.length>0?{type:"text",value:a}:void 0),!1===a?n.lastIndex=r+1:(s!==r&&d.push({type:"text",value:e.value.slice(s,r)}),Array.isArray(a)?d.push(...a):a&&d.push(a),s=r+c[0].length,u=!0),!n.global)break;c=n.exec(e.value)}return u?(s<e.value.length&&d.push({type:"text",value:e.value.slice(s)}),r.children.splice(l,1,...d)):d=[e],l+d.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,xQ],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,x0]],{ignore:["link","linkReference"]})}function xQ(e,t,r,n,i){let a,o="";if(!x1(i))return!1;if(/^w/i.test(t)&&(r=t+r,t="",o="http://"),(a=r.split(".")).length<2||a[a.length-1]&&(/_/.test(a[a.length-1])||!/[a-zA-Z\d]/.test(a[a.length-1]))||a[a.length-2]&&(/_/.test(a[a.length-2])||!/[a-zA-Z\d]/.test(a[a.length-2])))return!1;let s=function(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")"),i=xB(e,"("),a=xB(e,")");for(;-1!==n&&i>a;)e+=r.slice(0,n+1),n=(r=r.slice(n+1)).indexOf(")"),a++;return[e,r]}(r+n);if(!s[0])return!1;let l={type:"link",title:null,url:o+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[l,{type:"text",value:s[1]}]:l}function x0(e,t,r,n){return!(!x1(n,!0)||/[-\d_]$/.test(r))&&{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function x1(e,t){let r=e.input.charCodeAt(e.index-1);return(0===e.index||yE(r)||yj(r))&&(!t||47!==r)}function x2(){this.buffer()}function x4(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function x6(){this.buffer()}function x5(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function x3(e){let t=this.resume(),r=this.stack[this.stack.length-1];vu("footnoteReference"===r.type),r.identifier=be(this.sliceSerialize(e)).toLowerCase(),r.label=t}function x9(e){this.exit(e)}function x8(e){let t=this.resume(),r=this.stack[this.stack.length-1];vu("footnoteDefinition"===r.type),r.identifier=be(this.sliceSerialize(e)).toLowerCase(),r.label=t}function x7(e){this.exit(e)}function we(e,t,r,n){let i=r.createTracker(n),a=i.move("[^"),o=r.enter("footnoteReference"),s=r.enter("reference");return a+=i.move(r.safe(r.associationId(e),{after:"]",before:a})),s(),o(),a+=i.move("]")}function wt(e,t,r){return 0===t?e:wr(e,t,r)}function wr(e,t,r){return(r?"":" ")+e}we.peek=function(){return"["};let wn=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function wi(e){this.enter({type:"delete",children:[]},e)}function wa(e){this.exit(e)}function wo(e,t,r,n){let i=r.createTracker(n),a=r.enter("strikethrough"),o=i.move("~~");return o+=r.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),a(),o}function ws(e){return e.length}function wl(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}wo.peek=function(){return"~"};function wu(e,t,r){let n=e.value||"",i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(n);)i+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++a<r.unsafe.length;){let e,t=r.unsafe[a],i=r.compilePattern(t);if(t.atBreak)for(;e=i.exec(n);){let t=e.index;10===n.charCodeAt(t)&&13===n.charCodeAt(t-1)&&t--,n=n.slice(0,t)+" "+n.slice(e.index+1)}}return i+n+i}wu.peek=function(){return"`"};bU(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let wd=function(e,t,r,n){let i=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(r),a=r.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(r);t&&"list"===t.type&&t.ordered&&(a=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===r.options.incrementListMarker?0:t.children.indexOf(e))+a);let o=a.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));let s=r.createTracker(n);s.move(a+" ".repeat(o-a.length)),s.shift(o);let l=r.enter("listItem"),u=r.indentLines(r.containerFlow(e,s.current()),function(e,t,r){return t?(r?"":" ".repeat(o))+e:(r?a:a+" ".repeat(o-a.length))+e});return l(),u};function wc(e){let t=e._align;vu(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function wp(e){this.exit(e),this.data.inTable=void 0}function wm(e){this.enter({type:"tableRow",children:[]},e)}function wf(e){this.exit(e)}function wh(e){this.enter({type:"tableCell",children:[]},e)}function wg(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,wv));let r=this.stack[this.stack.length-1];vu("inlineCode"===r.type),r.value=t,this.exit(e)}function wv(e,t){return"|"===t?t:e}function wy(e){let t=this.stack[this.stack.length-2];vu("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function wb(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];vu("paragraph"===e.type);let r=e.children[0];if(r&&"text"===r.type){let n,i=t.children,a=-1;for(;++a<i.length;){let e=i[a];if("paragraph"===e.type){n=e;break}}n===e&&(r.value=r.value.slice(1),0===r.value.length?e.children.shift():e.position&&r.position&&"number"==typeof r.position.start.offset&&(r.position.start.column++,r.position.start.offset++,e.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function wx(e,t,r,n){let i=e.children[0],a="boolean"==typeof e.checked&&i&&"paragraph"===i.type,o="["+(e.checked?"x":" ")+"] ",s=r.createTracker(n);a&&s.move(o);let l=wd(e,t,r,{...n,...s.current()});return a&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}let ww={tokenize:function(e,t,r){let n=0;return function t(a){return(87===a||119===a)&&n<3?(n++,e.consume(a),t):46===a&&3===n?(e.consume(a),i):r(a)};function i(e){return null===e?r(e):t(e)}},partial:!0},w_={tokenize:function(e,t,r){let n,i,a;return o;function o(t){return 46===t||95===t?e.check(wI,l,s)(t):null===t||yS(t)||yE(t)||45!==t&&yj(t)?l(t):(a=!0,e.consume(t),o)}function s(t){return 95===t?n=!0:(i=n,n=void 0),e.consume(t),o}function l(e){return i||n||!a?r(e):t(e)}},partial:!0},wk={tokenize:function(e,t){let r=0,n=0;return i;function i(o){return 40===o?(r++,e.consume(o),i):41===o&&n<r?a(o):33===o||34===o||38===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||60===o||63===o||93===o||95===o||126===o?e.check(wI,t,a)(o):null===o||yS(o)||yE(o)?t(o):(e.consume(o),i)}function a(t){return 41===t&&n++,e.consume(t),i}},partial:!0},wI={tokenize:function(e,t,r){return n;function n(o){return 33===o||34===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||63===o||95===o||126===o?(e.consume(o),n):38===o?(e.consume(o),a):93===o?(e.consume(o),i):60===o||null===o||yS(o)||yE(o)?t(o):r(o)}function i(e){return null===e||40===e||91===e||yS(e)||yE(e)?t(e):n(e)}function a(t){return yv(t)?function t(i){return 59===i?(e.consume(i),n):yv(i)?(e.consume(i),t):r(i)}(t):r(t)}},partial:!0},wS={tokenize:function(e,t,r){return function(t){return e.consume(t),n};function n(e){return yy(e)?r(e):t(e)}},partial:!0},w$={name:"wwwAutolink",tokenize:function(e,t,r){let n=this;return function(t){return 87!==t&&119!==t||!wN.call(n,n.previous)||wO(n.events)?r(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(ww,e.attempt(w_,e.attempt(wk,i),r),r)(t))};function i(r){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(r)}},previous:wN},wj={name:"protocolAutolink",tokenize:function(e,t,r){let n=this,i="",a=!1;return function(t){return(72===t||104===t)&&wA.call(n,n.previous)&&!wO(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),o):r(t)};function o(t){if(yv(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),o;if(58===t){let r=i.toLowerCase();if("http"===r||"https"===r)return e.consume(t),s}return r(t)}function s(t){return 47===t?(e.consume(t),a)?l:(a=!0,s):r(t)}function l(t){return null===t||yx(t)||yS(t)||yE(t)||yj(t)?r(t):e.attempt(w_,e.attempt(wk,u),r)(t)}function u(r){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(r)}},previous:wA},wE={name:"emailAutolink",tokenize:function(e,t,r){let n,i,a=this;return function(t){return!wP(t)||!wR.call(a,a.previous)||wO(a.events)?r(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(n){return wP(n)?(e.consume(n),t):64===n?(e.consume(n),o):r(n)}(t))};function o(t){return 46===t?e.check(wS,l,s)(t):45===t||95===t||yy(t)?(i=!0,e.consume(t),o):l(t)}function s(t){return e.consume(t),n=!0,o}function l(o){return i&&n&&yv(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(o)):r(o)}},previous:wR},wT={},wC=48;for(;wC<123;)wT[wC]=wE,58==++wC?wC=65:91===wC&&(wC=97);function wN(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||yS(e)}function wA(e){return!yv(e)}function wR(e){return!(47===e||wP(e))}function wP(e){return 43===e||45===e||46===e||95===e||yy(e)}function wO(e){let t=e.length,r=!1;for(;t--;){let n=e[t][1];if(("labelLink"===n.type||"labelImage"===n.type)&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}wT[43]=wE,wT[45]=wE,wT[46]=wE,wT[95]=wE,wT[72]=[wE,wj],wT[104]=[wE,wj],wT[87]=[wE,w$],wT[119]=[wE,w$];let wM={tokenize:function(e,t,r){let n=this;return yC(e,function(e){let i=n.events[n.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):r(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function wz(e,t,r){let n,i=this,a=i.events.length,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);for(;a--;){let e=i.events[a][1];if("labelImage"===e.type){n=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(a){if(!n||!n._balanced)return r(a);let s=be(i.sliceSerialize({start:n.end,end:i.now()}));return 94===s.codePointAt(0)&&o.includes(s.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a)):r(a)}}function wD(e,t){let r=e.length;for(;r--;)if("labelImage"===e[r][1].type&&"enter"===e[r][0]){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";let n={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[r+1],e[r+2],["enter",n,t],e[r+3],e[r+4],["enter",i,t],["exit",i,t],["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",n,t]];return e.splice(r,e.length-r+1,...s),e}function wU(e,t,r){let n,i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),o=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),s};function s(t){return 94!==t?r(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(s){if(o>999||93===s&&!n||null===s||91===s||yS(s))return r(s);if(93===s){e.exit("chunkString");let n=e.exit("gfmFootnoteCallString");return a.includes(be(i.sliceSerialize(n)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(s)}return yS(s)||(n=!0),o++,e.consume(s),92===s?u:l}function u(t){return 91===t||92===t||93===t?(e.consume(t),o++,l):l(t)}}function wL(e,t,r){let n,i,a=this,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]),s=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):r(t)}function u(t){if(s>999||93===t&&!i||null===t||91===t||yS(t))return r(t);if(93===t){e.exit("chunkString");let r=e.exit("gfmFootnoteDefinitionLabelString");return n=be(a.sliceSerialize(r)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),c}return yS(t)||(i=!0),s++,e.consume(t),92===t?d:u}function d(t){return 91===t||92===t||93===t?(e.consume(t),s++,u):u(t)}function c(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(n)||o.push(n),yC(e,p,"gfmFootnoteDefinitionWhitespace")):r(t)}function p(e){return t(e)}}function wZ(e,t,r){return e.check(yP,t,e.attempt(wM,t,r))}function wF(e){e.exit("gfmFootnoteDefinition")}class wB{constructor(){this.map=[]}add(e,t,r){!function(e,t,r,n){let i=0;if(0!==r||0!==n.length){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=r,e.map[i][2].push(...n);return}i+=1}e.map.push([t,r,n])}}(this,e,t,r)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,r=[];for(;t>0;)t-=1,r.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];r.push(e.slice()),e.length=0;let n=r.pop();for(;n;){for(let t of n)e.push(t);n=r.pop()}this.map.length=0}}function wV(e,t,r){let n,i=this,a=0,o=0;return function(e){let t=i.events.length-1;for(;t>-1;){let e=i.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let n=t>-1?i.events[t][1].type:null,a="tableHead"===n||"tableRow"===n?y:s;return a===y&&i.parser.lazy[i.now().line]?r(e):a(e)};function s(t){var r;return e.enter("tableHead"),e.enter("tableRow"),124===(r=t)||(n=!0,o+=1),l(r)}function l(t){return null===t?r(t):yI(t)?o>1?(o=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),c):r(t):y$(t)?yC(e,l,"whitespace")(t):(o+=1,n&&(n=!1,a+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),n=!0,l):(e.enter("data"),u(t))}function u(t){return null===t||124===t||yS(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?d:u)}function d(t){return 92===t||124===t?(e.consume(t),u):u(t)}function c(t){return(i.interrupt=!1,i.parser.lazy[i.now().line])?r(t):(e.enter("tableDelimiterRow"),n=!1,y$(t))?yC(e,p,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):p(t)}function p(t){return 45===t||58===t?f(t):124===t?(n=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),m):r(t)}function m(t){return y$(t)?yC(e,f,"whitespace")(t):f(t)}function f(t){return 58===t?(o+=1,n=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),h):45===t?(o+=1,h(t)):null===t||yI(t)?v(t):r(t)}function h(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(r){return 45===r?(e.consume(r),t):58===r?(n=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(r),e.exit("tableDelimiterMarker"),g):(e.exit("tableDelimiterFiller"),g(r))}(t)):r(t)}function g(t){return y$(t)?yC(e,v,"whitespace")(t):v(t)}function v(i){if(124===i)return p(i);if(null===i||yI(i))return n&&a===o?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(i)):r(i);return r(i)}function y(t){return e.enter("tableRow"),b(t)}function b(r){return 124===r?(e.enter("tableCellDivider"),e.consume(r),e.exit("tableCellDivider"),b):null===r||yI(r)?(e.exit("tableRow"),t(r)):y$(r)?yC(e,b,"whitespace")(r):(e.enter("data"),x(r))}function x(t){return null===t||124===t||yS(t)?(e.exit("data"),b(t)):(e.consume(t),92===t?w:x)}function w(t){return 92===t||124===t?(e.consume(t),x):x(t)}}function wq(e,t){let r,n,i,a=-1,o=!0,s=0,l=[0,0,0,0],u=[0,0,0,0],d=!1,c=0,p=new wB;for(;++a<e.length;){let m=e[a],f=m[1];"enter"===m[0]?"tableHead"===f.type?(d=!1,0!==c&&(wJ(p,t,c,r,n),n=void 0,c=0),r={type:"table",start:Object.assign({},f.start),end:Object.assign({},f.end)},p.add(a,0,[["enter",r,t]])):"tableRow"===f.type||"tableDelimiterRow"===f.type?(o=!0,i=void 0,l=[0,0,0,0],u=[0,a+1,0,0],d&&(d=!1,n={type:"tableBody",start:Object.assign({},f.start),end:Object.assign({},f.end)},p.add(a,0,[["enter",n,t]])),s="tableDelimiterRow"===f.type?2:n?3:1):s&&("data"===f.type||"tableDelimiterMarker"===f.type||"tableDelimiterFiller"===f.type)?(o=!1,0===u[2]&&(0!==l[1]&&(u[0]=u[1],i=wW(p,t,l,s,void 0,i),l=[0,0,0,0]),u[2]=a)):"tableCellDivider"===f.type&&(o?o=!1:(0!==l[1]&&(u[0]=u[1],i=wW(p,t,l,s,void 0,i)),u=[(l=u)[1],a,0,0])):"tableHead"===f.type?(d=!0,c=a):"tableRow"===f.type||"tableDelimiterRow"===f.type?(c=a,0!==l[1]?(u[0]=u[1],i=wW(p,t,l,s,a,i)):0!==u[1]&&(i=wW(p,t,u,s,a,i)),s=0):s&&("data"===f.type||"tableDelimiterMarker"===f.type||"tableDelimiterFiller"===f.type)&&(u[3]=a)}for(0!==c&&wJ(p,t,c,r,n),p.consume(t.events),a=-1;++a<t.events.length;){let e=t.events[a];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let r=!1,n=[];for(;t<e.length;){let i=e[t];if(r){if("enter"===i[0])"tableContent"===i[1].type&&n.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=n.length-1;n[e]="left"===n[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(r=!0);t+=1}return n}(t.events,a))}return e}function wW(e,t,r,n,i,a){0!==r[0]&&(a.end=Object.assign({},wH(t.events,r[0])),e.add(r[0],0,[["exit",a,t]]));let o=wH(t.events,r[1]);if(a={type:1===n?"tableHeader":2===n?"tableDelimiter":"tableData",start:Object.assign({},o),end:Object.assign({},o)},e.add(r[1],0,[["enter",a,t]]),0!==r[2]){let i=wH(t.events,r[2]),a=wH(t.events,r[3]),o={type:"tableContent",start:Object.assign({},i),end:Object.assign({},a)};if(e.add(r[2],0,[["enter",o,t]]),2!==n){let n=t.events[r[2]],i=t.events[r[3]];if(n[1].end=Object.assign({},i[1].end),n[1].type="chunkText",n[1].contentType="text",r[3]>r[2]+1){let t=r[2]+1,n=r[3]-r[2]-1;e.add(t,n,[])}}e.add(r[3]+1,0,[["exit",o,t]])}return void 0!==i&&(a.end=Object.assign({},wH(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function wJ(e,t,r,n,i){let a=[],o=wH(t.events,r);i&&(i.end=Object.assign({},o),a.push(["exit",i,t])),n.end=Object.assign({},o),a.push(["exit",n,t]),e.add(r+1,0,a)}function wH(e,t){let r=e[t],n="enter"===r[0]?"start":"end";return r[1][n]}let wK={name:"tasklistCheck",tokenize:function(e,t,r){let n=this;return function(t){return null===n.previous&&n._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),i):r(t)};function i(t){return yS(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),a):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),a):r(t)}function a(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):r(t)}function o(n){return yI(n)?t(n):y$(n)?e.check({tokenize:wG},t,r)(n):r(n)}}};function wG(e,t,r){return yC(e,function(e){return null===e?r(e):t(e)},"whitespace")}let wY={};function wX(e){let t,r,n,i=e||wY,a=this.data(),o=a.micromarkExtensions||(a.micromarkExtensions=[]),s=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),l=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);o.push(yg([{text:wT},{document:{91:{name:"gfmFootnoteDefinition",tokenize:wL,continuation:{tokenize:wZ},exit:wF}},text:{91:{name:"gfmFootnoteCall",tokenize:wU},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:wz,resolveTo:wD}}},(t=(i||{}).singleTilde,r={name:"strikethrough",tokenize:function(e,r,n){let i=this.previous,a=this.events,o=0;return function(s){return 126===i&&"characterEscape"!==a[a.length-1][1].type?n(s):(e.enter("strikethroughSequenceTemporary"),function a(s){let l=yJ(i);if(126===s)return o>1?n(s):(e.consume(s),o++,a);if(o<2&&!t)return n(s);let u=e.exit("strikethroughSequenceTemporary"),d=yJ(s);return u._open=!d||2===d&&!!l,u._close=!l||2===l&&!!d,r(s)}(s))}},resolveAll:function(e,t){let r=-1;for(;++r<e.length;)if("enter"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._close){let n=r;for(;n--;)if("exit"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._open&&e[r][1].end.offset-e[r][1].start.offset==e[n][1].end.offset-e[n][1].start.offset){e[r][1].type="strikethroughSequence",e[n][1].type="strikethroughSequence";let i={type:"strikethrough",start:Object.assign({},e[n][1].start),end:Object.assign({},e[r][1].end)},a={type:"strikethroughText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[r][1].start)},o=[["enter",i,t],["enter",e[n][1],t],["exit",e[n][1],t],["enter",a,t]],s=t.parser.constructs.insideSpan.null;s&&ym(o,o.length,0,yH(s,e.slice(n+1,r),t)),ym(o,o.length,0,[["exit",a,t],["enter",e[r][1],t],["exit",e[r][1],t],["exit",i,t]]),ym(e,n-1,r-n+3,o),r=n+o.length-2;break}}for(r=-1;++r<e.length;)"strikethroughSequenceTemporary"===e[r][1].type&&(e[r][1].type="data");return e}},null==t&&(t=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:wV,resolveAll:wq}}},{text:{91:wK}}])),s.push([{transforms:[xX],enter:{literalAutolink:xW,literalAutolinkEmail:xJ,literalAutolinkHttp:xJ,literalAutolinkWww:xJ},exit:{literalAutolink:xY,literalAutolinkEmail:xG,literalAutolinkHttp:xH,literalAutolinkWww:xK}},{enter:{gfmFootnoteCallString:x2,gfmFootnoteCall:x4,gfmFootnoteDefinitionLabelString:x6,gfmFootnoteDefinition:x5},exit:{gfmFootnoteCallString:x3,gfmFootnoteCall:x9,gfmFootnoteDefinitionLabelString:x8,gfmFootnoteDefinition:x7}},{canContainEols:["delete"],enter:{strikethrough:wi},exit:{strikethrough:wa}},{enter:{table:wc,tableData:wh,tableHeader:wh,tableRow:wm},exit:{codeText:wg,table:wp,tableData:wf,tableHeader:wf,tableRow:wf}},{exit:{taskListCheckValueChecked:wy,taskListCheckValueUnchecked:wy,paragraph:wb}}]),l.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:xV,notInConstruct:xq},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:xV,notInConstruct:xq},{character:":",before:"[ps]",after:"\\/",inConstruct:xV,notInConstruct:xq}]},(n=!1,i&&i.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:function(e,t,r,i){let a=r.createTracker(i),o=a.move("[^"),s=r.enter("footnoteDefinition"),l=r.enter("label");return o+=a.move(r.safe(r.associationId(e),{before:o,after:"]"})),l(),o+=a.move("]:"),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((n?"\n":" ")+r.indentLines(r.containerFlow(e,a.current()),n?wr:wt))),s(),o},footnoteReference:we},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:wn}],handlers:{delete:wo}},function(e){let t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,i=t.stringLength,a=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,r){let n=wu(e,t,r);return r.stack.includes("tableCell")&&(n=n.replace(/\|/g,"\\$&")),n},table:function(e,t,r,n){return s(function(e,t,r){let n=e.children,i=-1,a=[],o=t.enter("table");for(;++i<n.length;)a[i]=l(n[i],t,r);return o(),a}(e,r,n),e.align)},tableCell:o,tableRow:function(e,t,r,n){let i=s([l(e,r,n)]);return i.slice(0,i.indexOf("\n"))}}};function o(e,t,r,n){let i=r.enter("tableCell"),o=r.enter("phrasing"),s=r.containerPhrasing(e,{...n,before:a,after:a});return o(),i(),s}function s(e,t){return function(e,t){let r=t||{},n=(r.align||[]).concat(),i=r.stringLength||ws,a=[],o=[],s=[],l=[],u=0,d=-1;for(;++d<e.length;){let t=[],n=[],a=-1;for(e[d].length>u&&(u=e[d].length);++a<e[d].length;){var c;let o=null==(c=e[d][a])?"":String(c);if(!1!==r.alignDelimiters){let e=i(o);n[a]=e,(void 0===l[a]||e>l[a])&&(l[a]=e)}t.push(o)}o[d]=t,s[d]=n}let p=-1;if("object"==typeof n&&"length"in n)for(;++p<u;)a[p]=wl(n[p]);else{let e=wl(n);for(;++p<u;)a[p]=e}p=-1;let m=[],f=[];for(;++p<u;){let e=a[p],t="",n="";99===e?(t=":",n=":"):108===e?t=":":114===e&&(n=":");let i=!1===r.alignDelimiters?1:Math.max(1,l[p]-t.length-n.length),o=t+"-".repeat(i)+n;!1!==r.alignDelimiters&&((i=t.length+i+n.length)>l[p]&&(l[p]=i),f[p]=i),m[p]=o}o.splice(1,0,m),s.splice(1,0,f),d=-1;let h=[];for(;++d<o.length;){let e=o[d],t=s[d];p=-1;let n=[];for(;++p<u;){let i=e[p]||"",o="",s="";if(!1!==r.alignDelimiters){let e=l[p]-(t[p]||0),r=a[p];114===r?o=" ".repeat(e):99===r?e%2?(o=" ".repeat(e/2+.5),s=" ".repeat(e/2-.5)):s=o=" ".repeat(e/2):s=" ".repeat(e)}!1===r.delimiterStart||p||n.push("|"),!1!==r.padding&&(!1!==r.alignDelimiters||""!==i)&&(!1!==r.delimiterStart||p)&&n.push(" "),!1!==r.alignDelimiters&&n.push(o),n.push(i),!1!==r.alignDelimiters&&n.push(s),!1!==r.padding&&n.push(" "),(!1!==r.delimiterEnd||p!==u-1)&&n.push("|")}h.push(!1===r.delimiterEnd?n.join("").replace(/ +$/,""):n.join(""))}return h.join("\n")}(e,{align:t,alignDelimiters:n,padding:r,stringLength:i})}function l(e,t,r){let n=e.children,i=-1,a=[],s=t.enter("tableRow");for(;++i<n.length;)a[i]=o(n[i],e,t,r);return s(),a}}(i),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:wx}}]})}let wQ=/\.(?:png|jpe?g|webp|gif|svg)(?:[?#].*)?$/i,w0=/\.[A-Za-z0-9][A-Za-z0-9_-]{0,15}(?:[?#].*)?$/,w1=new Set(["localhost","127.0.0.1","::1"]),w2=/^\/(?:Users|home|tmp|var|private|Volumes|mnt|media|opt)\//i,w4=/^(?:[A-Za-z]:[\\/]|\/[A-Za-z]:[\\/])/,w6=/^\\\\[^\\/]+[\\/][^\\/]+[\\/]/;function w5(e){let t=e.trim();return t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1).trim():t}function w3(e){try{return decodeURIComponent(e)}catch{return e}}function w9(e){let t=w5(e);if(/^https?:\/\//i.test(t))try{let e=new URL(t);if(w1.has(e.hostname))return w3(e.pathname)}catch{return t}return t.startsWith("file://")?t:w3(t)}function w8(e){return w2.test(e)||w4.test(e)||w6.test(e)}function w7(e){let t=w9(e);if(!w0.test(t))return!1;if(t.startsWith("file://"))return!0;if(/^https?:\/\//i.test(t))try{let e=new URL(t);if(!w1.has(e.hostname))return!1;return w8(decodeURIComponent(e.pathname))}catch{return!1}return w8(t)}function _e(e){var t;let r=w9(e);if(t=r,!wQ.test(t))return!1;if(r.startsWith("file://"))return!0;if(/^https?:\/\//i.test(r))try{let e=new URL(r);if(!w1.has(e.hostname))return!1;return w8(decodeURIComponent(e.pathname))}catch{return!1}return w8(r)}function _t(e){let t=w9(e),r=t;if(t.startsWith("file://")||function(e){try{let t=new URL(e);return w1.has(t.hostname)}catch{return!1}}(t))try{r=decodeURIComponent(new URL(t).pathname)}catch{r=t}return r.split(/[?#]/,1)[0].replace(/\\/g,"/").split("/").filter(Boolean).at(-1)||"本地文件"}function _r(e){return _t(e)||"本地图片"}let _n=/(file:\/\/[^\s<>"']+\.[A-Za-z0-9][A-Za-z0-9_-]{0,15}(?:[?#][^\s<>"']*)?|https?:\/\/(?:localhost|127\.0\.0\.1|\[::1\])(?::\d+)?\/[^\s<>"']+\.[A-Za-z0-9][A-Za-z0-9_-]{0,15}(?:[?#][^\s<>"']*)?|\/(?:Users|home|tmp|var|private|Volumes|mnt|media|opt)\/[^\s<>"']+\.[A-Za-z0-9][A-Za-z0-9_-]{0,15}(?:[?#][^\s<>"']*)?|(?:[A-Za-z]:[\\/]|\\\\)[^\s<>"']+\.[A-Za-z0-9][A-Za-z0-9_-]{0,15}(?:[?#][^\s<>"']*)?)/gi;function _i(e){return e.replace(_n,(e,t,r,n)=>{let i;if(!w7(e)||(i=n.slice(Math.max(0,r-3),r)).endsWith("](")||i.endsWith("](<")||"<"===i)return e;let a=_e(e)?_r(e):_t(e),o=w5(e).replaceAll(">","%3E");return`[${a}](<${o}>)`})}function _a(e){var t;let r;return!_e(r=w5(e))&&(/^data:image\//i.test(r)||(/^https?:\/\//i.test(r)||r.startsWith("/")&&!r.startsWith("//"))&&(t=r,wQ.test(t)))?e:null}let _o=(0,ek.memo)(()=>(0,ew.jsx)(xF,{remarkPlugins:[wX],smooth:!1,className:"aui-md",components:_s,preprocess:_i})),_s=((e={})=>Object.fromEntries(Object.entries(e??{}).map(([e,t])=>t?[e,(0,ek.memo)(({node:e,...r})=>(0,ew.jsx)(t,{...r}),xI)]:[e,t])))({h1:({className:e,...t})=>(0,ew.jsx)("h1",{className:(0,r4.cn)("aui-md-h1 mb-2 scroll-m-20 font-semibold text-base first:mt-0 last:mb-0",e),...t}),h2:({className:e,...t})=>(0,ew.jsx)("h2",{className:(0,r4.cn)("aui-md-h2 mt-3 mb-1.5 scroll-m-20 font-semibold text-sm first:mt-0 last:mb-0",e),...t}),h3:({className:e,...t})=>(0,ew.jsx)("h3",{className:(0,r4.cn)("aui-md-h3 mt-2.5 mb-1 scroll-m-20 font-semibold text-sm first:mt-0 last:mb-0",e),...t}),h4:({className:e,...t})=>(0,ew.jsx)("h4",{className:(0,r4.cn)("aui-md-h4 mt-2 mb-1 scroll-m-20 font-medium text-sm first:mt-0 last:mb-0",e),...t}),h5:({className:e,...t})=>(0,ew.jsx)("h5",{className:(0,r4.cn)("aui-md-h5 mt-2 mb-1 font-medium text-sm first:mt-0 last:mb-0",e),...t}),h6:({className:e,...t})=>(0,ew.jsx)("h6",{className:(0,r4.cn)("aui-md-h6 mt-2 mb-1 font-medium text-sm first:mt-0 last:mb-0",e),...t}),p:({className:e,...t})=>(0,ew.jsx)("div",{className:(0,r4.cn)("aui-md-p my-2 leading-[1.6] first:mt-0 last:mb-0 md:my-2.5 md:leading-[1.7]",e),...t}),a:({className:e,href:t,children:r,...n})=>{let i="string"==typeof t?t:"";if(_e(i))return(0,ew.jsx)(_d,{path:i,className:e});if(w7(i))return(0,ew.jsx)(_c,{path:i,className:e});let a=_a(i);return a?(0,ew.jsx)(_l,{href:a,className:e}):(0,ew.jsx)("a",{href:t,className:(0,r4.cn)("aui-md-a text-primary underline underline-offset-2 hover:text-primary/80",e),...n,children:r})},img:({className:e,src:t,alt:r,...n})=>{let i="string"==typeof t?t:"";if(_e(i))return(0,ew.jsx)(_d,{path:i,className:e});let a=_a(i);return a?(0,ew.jsx)(_u,{src:a,alt:r,className:e,...n}):null},blockquote:({className:e,...t})=>(0,ew.jsx)("blockquote",{className:(0,r4.cn)("aui-md-blockquote my-2.5 border-muted-foreground/30 border-s-2 ps-3 text-muted-foreground italic",e),...t}),ul:({className:e,...t})=>(0,ew.jsx)("ul",{className:(0,r4.cn)("aui-md-ul my-2 ms-4 list-disc marker:text-muted-foreground [&>li]:mt-1",e),...t}),ol:({className:e,...t})=>(0,ew.jsx)("ol",{className:(0,r4.cn)("aui-md-ol my-2 ms-4 list-decimal marker:text-muted-foreground [&>li]:mt-1",e),...t}),hr:({className:e,...t})=>(0,ew.jsx)("hr",{className:(0,r4.cn)("aui-md-hr my-2 border-muted-foreground/20",e),...t}),table:({className:e,...t})=>(0,ew.jsx)("table",{className:(0,r4.cn)("aui-md-table my-2 w-full border-separate border-spacing-0 overflow-y-auto",e),...t}),th:({className:e,...t})=>(0,ew.jsx)("th",{className:(0,r4.cn)("aui-md-th bg-muted px-2 py-1 text-start font-medium first:rounded-ss-lg last:rounded-se-lg [[align=center]]:text-center [[align=right]]:text-right",e),...t}),td:({className:e,...t})=>(0,ew.jsx)("td",{className:(0,r4.cn)("aui-md-td border-muted-foreground/20 border-s border-b px-2 py-1 text-start last:border-e [[align=center]]:text-center [[align=right]]:text-right",e),...t}),tr:({className:e,...t})=>(0,ew.jsx)("tr",{className:(0,r4.cn)("aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-es-lg [&:last-child>td:last-child]:rounded-ee-lg",e),...t}),li:({className:e,...t})=>(0,ew.jsx)("li",{className:(0,r4.cn)("aui-md-li leading-[1.6] md:leading-[1.7]",e),...t}),sup:({className:e,...t})=>(0,ew.jsx)("sup",{className:(0,r4.cn)("aui-md-sup [&>a]:text-xs [&>a]:no-underline",e),...t}),pre:({className:e,...t})=>(0,ew.jsx)("pre",{className:(0,r4.cn)("aui-md-pre overflow-x-auto rounded-t-none rounded-b-lg border border-border/50 border-t-0 bg-muted/30 p-3 text-xs leading-relaxed",e),...t}),code:function({className:e,...t}){let r=x$();return(0,ew.jsx)("code",{className:(0,r4.cn)(!r&&"aui-md-inline-code rounded-md border border-border/50 bg-muted/50 px-1.5 py-0.5 font-mono text-[0.85em]",e),...t})},CodeHeader:({language:e,code:t})=>{let{isCopied:r,copyToClipboard:n}=(({copiedDuration:e=3e3}={})=>{let[t,r]=(0,ek.useState)(!1);return{isCopied:t,copyToClipboard:t=>{t&&"u">typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(t).then(()=>{r(!0),setTimeout(()=>r(!1),e)},()=>{})}}})();return(0,ew.jsxs)("div",{className:"aui-code-header-root mt-2.5 flex items-center justify-between rounded-t-lg border border-border/50 border-b-0 bg-muted/50 px-3 py-1.5 text-xs",children:[(0,ew.jsx)("span",{className:"aui-code-header-language font-medium text-muted-foreground lowercase",children:e}),(0,ew.jsxs)(r9,{tooltip:"复制",onClick:()=>{t&&!r&&n(t)},children:[!r&&(0,ew.jsx)(oo,{}),r&&(0,ew.jsx)(a4,{})]})]})}});function _l({href:e,className:t}){return(0,ew.jsx)(_u,{src:e,alt:"图片",className:t})}function _u({src:e,alt:t,className:r}){return"string"!=typeof e?null:(0,ew.jsx)(fJ.Root,{className:(0,r4.cn)("my-2",r),children:(0,ew.jsx)(fJ.Zoom,{src:e,alt:t||"Image content",children:(0,ew.jsx)(fJ.Preview,{src:e,alt:t||"Image content"})})})}function _d({path:e,className:t}){let r=_r(e),n=`/api/local-files/image?path=${encodeURIComponent(w9(e))}`;return(0,ew.jsxs)(fJ.Root,{className:(0,r4.cn)("my-2",t),children:[(0,ew.jsx)(fJ.Zoom,{src:n,alt:r,children:(0,ew.jsx)(fJ.Preview,{src:n,alt:r})}),(0,ew.jsx)(fJ.Filename,{children:r})]})}function _c({path:e,className:t}){let r=_t(e),n=()=>{fetch("/api/local-files/open",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:e})}).catch(()=>{})};return(0,ew.jsxs)(fR.Root,{role:"button",tabIndex:0,className:(0,r4.cn)("my-1.5 flex w-fit cursor-pointer",t),onClick:n,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),n())},children:[(0,ew.jsx)(fR.Icon,{}),(0,ew.jsx)(fR.Name,{children:r})]})}let _p=rB("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),_m=rB("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);function _f(e){return!!(e&&"object"==typeof e&&!Array.isArray(e))}function _h(e){return"string"==typeof e?e.trim():""}function _g(e){return _f(e)?Object.values(e).filter(e=>_f(e)).sort((e,t)=>(Number(e.updatedAt)||0)-(Number(t.updatedAt)||0)):[]}function _v(e){if(null===e)return"null";if("string"==typeof e)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function _y({icon:e,title:t,subtitle:r,children:n}){return(0,ew.jsxs)("section",{className:"rounded-md border border-border/70 bg-muted/20",children:[(0,ew.jsxs)("header",{className:"flex min-w-0 items-center gap-2 border-b px-3 py-2",children:[(0,ew.jsx)(e,{className:"size-4 shrink-0 text-muted-foreground"}),(0,ew.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ew.jsx)("p",{className:"truncate font-medium text-xs",children:t}),r?(0,ew.jsx)("p",{className:"truncate text-muted-foreground text-[11px]",children:r}):null]})]}),(0,ew.jsx)("div",{className:"min-w-0 p-3",children:n})]})}function _b({label:e,value:t,className:r}){return(0,ew.jsxs)("div",{className:"min-w-0",children:[(0,ew.jsx)("p",{className:"mb-1 font-medium text-muted-foreground text-[11px]",children:e}),(0,ew.jsx)("pre",{className:(0,r4.cn)("max-h-56 overflow-auto rounded-sm bg-background px-3 py-2 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-words",r),children:t||" "})]})}function _x({diff:e}){let t=_h(e.path)||"diff",r=_h(e.oldText),n=_h(e.newText);return(0,ew.jsx)(_y,{icon:oX,title:"Diff",subtitle:t,children:r||n?(0,ew.jsxs)("div",{className:"grid min-w-0 gap-2 md:grid-cols-2",children:[(0,ew.jsx)(_b,{label:"Before",value:r,className:"bg-red-500/5"}),(0,ew.jsx)(_b,{label:"After",value:n,className:"bg-green-500/5"})]}):(0,ew.jsx)(_b,{label:"Raw",value:_v(e)})})}function _w({terminal:e}){let t=_h(e.terminalId)||"terminal",r=_h(e.output)||_h(e.stdout)||_h(e.stderr)||_h(e.text);return(0,ew.jsx)(_y,{icon:_m,title:"Terminal",subtitle:t,children:(0,ew.jsx)(_b,{label:"Output",value:r||_v(e)})})}function __({resource:e,kind:t}){let r,n,i=(r=_f(e.resource)?e.resource:{},_h(e.uri)||_h(r.uri)||_h(e.name)),a=_h(e.title)||_h(e.name)||("resource"===t?"Resource":"Resource link"),o=_h(e.mimeType)||(_f(e.resource)?_h(e.resource.mimeType):""),s="resource"===t?(n=_f(e.resource)?e.resource:{},_h(e.text)||_h(n.text)):"";return(0,ew.jsx)(_y,{icon:"resource"===t?cr:_p,title:a,subtitle:i,children:(0,ew.jsxs)("div",{className:"flex flex-col gap-2 text-xs",children:[o?(0,ew.jsx)("p",{className:"text-muted-foreground",children:o}):null,i?(0,ew.jsx)("code",{className:"rounded-sm bg-background px-2 py-1 font-mono text-[11px] break-all",children:i}):null,s?(0,ew.jsx)(_b,{label:"Preview",value:s}):null,i||s?null:(0,ew.jsx)(_b,{label:"Raw",value:_v(e)})]})})}function _k({item:e}){return(0,ew.jsx)(_y,{icon:cr,title:"ACP block",subtitle:"unknown",children:(0,ew.jsx)(_b,{label:"Raw",value:_v(e)})})}function _I({toolCallId:e,className:t}){let r=rS(e=>e.message.metadata?.custom),n=(0,ek.useMemo)(()=>e?function(e,t){let r={diffs:[],terminals:[],resources:[],resourceLinks:[],unknown:[]},n=e?.acpToolContent;if(!_f(n))return r;let i=n.byToolCallId;if(!_f(i))return r;let a=i[t];return _f(a)?{diffs:_g(a.diffs),terminals:_g(a.terminals),resources:_g(a.resources),resourceLinks:_g(a.resourceLinks),unknown:_g(a.unknown)}:r}(r,e):{diffs:[],terminals:[],resources:[],resourceLinks:[],unknown:[]},[r,e]);return e&&(n.diffs.length>0||n.terminals.length>0||n.resources.length>0||n.resourceLinks.length>0||n.unknown.length>0)?(0,ew.jsxs)("div",{className:(0,r4.cn)("flex flex-col gap-2 px-4",t),children:[n.diffs.map(e=>(0,ew.jsx)(_x,{diff:e},`diff-${_v(e)}`)),n.terminals.map(e=>(0,ew.jsx)(_w,{terminal:e},`terminal-${_v(e)}`)),n.resources.map(e=>(0,ew.jsx)(__,{resource:e,kind:"resource"},`resource-${_v(e)}`)),n.resourceLinks.map(e=>(0,ew.jsx)(__,{resource:e,kind:"resource_link"},`resource-link-${_v(e)}`)),n.unknown.map(e=>(0,ew.jsx)(_k,{item:e},`unknown-${_v(e)}`))]}):null}function _S({className:e,open:t,onOpenChange:r,defaultOpen:n=!1,children:i,...a}){let o,s,l=(0,ek.useRef)(null),[u,d]=(0,ek.useState)(n),c=(o=(0,ek.useRef)(null),s=(0,ek.useRef)(null),(0,ek.useEffect)(()=>()=>s.current?.(),[]),(0,ek.useCallback)(()=>{if(s.current?.(),!o.current){let e=l.current;for(;e;){let{overflowY:t}=getComputedStyle(e);if("auto"===t||"scroll"===t){o.current=e;break}e=e.parentElement}}let e=o.current;if(!e)return;let t=e.scrollTop,r=()=>{e.scrollTop=t};e.addEventListener("scroll",r);let n=window.setTimeout(()=>{e.removeEventListener("scroll",r),s.current=null},200);s.current=()=>{window.clearTimeout(n),e.removeEventListener("scroll",r)}},[l,200])),p=void 0!==t,m=p?t:u,f=(0,ek.useCallback)(e=>{e||c(),p||d(e),r?.(e)},[c,p,r]);return(0,ew.jsx)(oj,{ref:l,"data-slot":"tool-fallback-root",open:m,onOpenChange:f,className:(0,r4.cn)("aui-tool-fallback-root group/tool-fallback-root my-2 w-full rounded-lg border py-2.5 first:mt-0 last:mb-0 md:my-2.5 md:py-3",e),style:{"--animation-duration":"200ms"},...a,children:i})}let _$={running:a6,complete:a4,incomplete:fm,"requires-action":a2};function _j({toolName:e,status:t,className:r,...n}){let i=t?.type??"complete",a="running"===i,o=t?.type==="incomplete"&&"cancelled"===t.reason,s=_$[i],l=o?"已取消工具":"已使用工具",u=(0,ew.jsx)("b",{children:e});return(0,ew.jsxs)(oE,{"data-slot":"tool-fallback-trigger","aria-label":`${l}: ${e}`,className:(0,r4.cn)("aui-tool-fallback-trigger group/trigger flex w-full items-center gap-2 px-3 text-[13px] transition-colors md:px-4 md:text-sm",r),...n,children:[(0,ew.jsx)(s,{"data-slot":"tool-fallback-trigger-icon",className:(0,r4.cn)("aui-tool-fallback-trigger-icon size-3.5 shrink-0 md:size-4",o&&"text-muted-foreground",a&&"animate-spin")}),(0,ew.jsxs)("span",{"data-slot":"tool-fallback-trigger-label",className:(0,r4.cn)("aui-tool-fallback-trigger-label-wrapper relative min-w-0 flex-1 text-start leading-snug",o&&"text-muted-foreground line-through"),title:e,children:[(0,ew.jsx)("span",{className:"aui-tool-fallback-trigger-label line-clamp-2 break-words",children:u}),a&&(0,ew.jsx)("span",{"aria-hidden":!0,"data-slot":"tool-fallback-trigger-shimmer",className:"aui-tool-fallback-trigger-shimmer shimmer pointer-events-none absolute inset-0 line-clamp-2 break-words motion-reduce:animate-none",children:u})]}),(0,ew.jsx)(oa,{"data-slot":"tool-fallback-trigger-chevron",className:(0,r4.cn)("aui-tool-fallback-trigger-chevron size-3.5 shrink-0 md:size-4","transition-transform duration-(--animation-duration) ease-out","group-data-[state=closed]/trigger:-rotate-90","group-data-[state=open]/trigger:rotate-0")})]})}function _E({className:e,children:t,...r}){return(0,ew.jsx)(oT,{"data-slot":"tool-fallback-content",className:(0,r4.cn)("aui-tool-fallback-content relative overflow-hidden text-[13px] outline-none md:text-sm","group/collapsible-content ease-out","data-[state=closed]:animate-collapsible-up","data-[state=open]:animate-collapsible-down","data-[state=closed]:fill-mode-forwards","data-[state=closed]:pointer-events-none","data-[state=open]:duration-(--animation-duration)","data-[state=closed]:duration-(--animation-duration)",e),...r,children:(0,ew.jsx)("div",{className:"mt-2.5 flex flex-col gap-2 border-t pt-2 md:mt-3",children:t})})}function _T({argsText:e,className:t,...r}){return e?(0,ew.jsx)("div",{"data-slot":"tool-fallback-args",className:(0,r4.cn)("aui-tool-fallback-args px-3 md:px-4",t),...r,children:(0,ew.jsx)("pre",{className:"aui-tool-fallback-args-value max-h-40 overflow-auto rounded-md bg-muted/30 px-3 py-2 font-mono text-xs leading-relaxed whitespace-pre-wrap break-words",children:e})}):null}function _C({result:e,className:t,...r}){return void 0===e?null:(0,ew.jsxs)("div",{"data-slot":"tool-fallback-result",className:(0,r4.cn)("aui-tool-fallback-result border-t border-dashed px-3 pt-2 md:px-4",t),...r,children:[(0,ew.jsx)("p",{className:"aui-tool-fallback-result-header font-semibold",children:"结果:"}),(0,ew.jsx)("pre",{className:"aui-tool-fallback-result-content max-h-56 overflow-auto rounded-md bg-muted/30 px-3 py-2 font-mono text-xs leading-relaxed whitespace-pre-wrap break-words",children:null===e?"无结构化结果":"string"==typeof e?e:JSON.stringify(e,null,2)})]})}function _N({status:e,className:t,...r}){if(e?.type!=="incomplete")return null;let n=e.error,i=n?"string"==typeof n?n:JSON.stringify(n):null;if(!i)return null;let a="cancelled"===e.reason;return(0,ew.jsxs)("div",{"data-slot":"tool-fallback-error",className:(0,r4.cn)("aui-tool-fallback-error px-3 md:px-4",t),...r,children:[(0,ew.jsx)("p",{className:"aui-tool-fallback-error-header font-semibold text-muted-foreground",children:a?"取消原因:":"错误:"}),(0,ew.jsx)("p",{className:"aui-tool-fallback-error-reason text-muted-foreground",children:i})]})}let _A=(0,ek.memo)(({toolName:e,argsText:t,result:r,status:n,toolCallId:i})=>{let a=n?.type==="running"&&void 0!==r?{type:"complete"}:n,o=a?.type==="incomplete"&&"cancelled"===a.reason;return(0,ew.jsxs)(_S,{className:(0,r4.cn)(o&&"border-muted-foreground/30 bg-muted/30"),children:[(0,ew.jsx)(_j,{toolName:e,status:a}),(0,ew.jsxs)(_E,{children:[(0,ew.jsx)(_N,{status:a}),(0,ew.jsx)(_T,{argsText:t,className:(0,r4.cn)(o&&"opacity-60")}),(0,ew.jsx)(_I,{toolCallId:i,className:(0,r4.cn)(o&&"opacity-60")}),!o&&(0,ew.jsx)(_C,{result:r})]})]})});function _R(e){return"string"==typeof e?e.trim():""}_A.displayName="ToolFallback",_A.Root=_S,_A.Trigger=_j,_A.Content=_E,_A.Args=_T,_A.Result=_C,_A.Error=_N;function _P(e){return e.flatMap(e=>{if(!aE(e))return[];let t=_R(e.fieldName);if(!t)return[];let r=Array.isArray(e.options)?e.options.flatMap(e=>{if(!aE(e))return[];let t=_R(e.id);return t?[{id:t,label:_R(e.label)||_R(e.title)||t,..._R(e.description)?{description:_R(e.description)}:{},...!0===e.disabled?{disabled:!0}:{},...!0===e.recommended?{recommended:!0}:{}}]:[]}):[];return 0===r.length?[]:[{fieldName:t,fieldTitle:_R(e.fieldTitle)||_R(e.title)||t,..._R(e.fieldDescription)?{fieldDescription:_R(e.fieldDescription)}:{},selectionMode:"single"===e.selectionMode?"single":"multi",options:r,defaultValue:Array.isArray(e.defaultValue)||"string"==typeof e.defaultValue||null===e.defaultValue?e.defaultValue:null,minSelections:"number"==typeof e.minSelections?e.minSelections:void 0,maxSelections:"number"==typeof e.maxSelections?e.maxSelections:void 0,required:!1!==e.required,allowCustomInput:!1!==e.allowCustomInput,customInputLabel:_R(e.customInputLabel)||"自定义"}]})}async function _O(e,t=3e3){let r=Date.now()+t;for(;Date.now()<r;){if(!e.thread().getState().isRunning)return;await new Promise(e=>window.setTimeout(e,50))}}function _M({request:e,question:t,stepIndex:r,stepCount:n,onSubmit:i,onCancel:a,submitting:o}){let s=t.minSelections??+(!1!==t.required),l="single"===t.selectionMode?1:t.maxSelections;return(0,ew.jsxs)("div",{children:[n>1&&(0,ew.jsxs)("div",{className:"mb-2 text-muted-foreground text-xs",children:[r+1," / ",n]}),(0,ew.jsxs)("div",{className:"mb-2",children:[(0,ew.jsx)("div",{className:"font-medium text-sm",children:t.fieldTitle}),t.fieldDescription&&(0,ew.jsx)("div",{className:"mt-1 text-muted-foreground text-xs",children:t.fieldDescription})]}),(0,ew.jsx)(fy,{id:`${e.requestId}-${t.fieldName}`,options:t.options,selectionMode:t.selectionMode,defaultValue:t.defaultValue,minSelections:s,maxSelections:l,allowCustomInput:!1!==t.allowCustomInput,customInputLabel:t.customInputLabel??"自定义",className:"my-0 border-0 bg-transparent p-0 shadow-none",actions:[{id:"cancel",label:"取消",variant:"outline"},{id:"confirm",label:"确认"}],isActionDisabled:()=>o,onAction:(e,t)=>{"cancel"===e?a():i(t)}},`${e.requestId}-${t.fieldName}`)]})}function _z(e){let t=tU(),r=rS(e=>e.threadListItem.remoteId),n=rS(e=>e.threads.mainThreadId),{provider:i,workspacePath:a}=aq(),o=r??n,s=(0,ek.useMemo)(()=>(function(e){if(!aE(e))return null;let t=aE(e.structuredContent)?e.structuredContent:e;return"answered"===t.status&&"string"==typeof t.requestId&&"accept"===t.action&&aE(t.content)?{status:"answered",requestId:t.requestId,action:"accept",content:t.content}:"cancelled"===t.status&&"string"==typeof t.requestId?{status:"cancelled",requestId:t.requestId,action:"cancel"}:"user_no_response"===t.status&&"string"==typeof t.requestId?{status:"user_no_response",requestId:t.requestId,instruction:_R(t.instruction)}:null})(e.result),[e.result]),l=(0,ek.useMemo)(()=>{var t;return(t=e).toolName===aS?t.args:av(t.args)?.args},[e]),u=(0,ek.useMemo)(()=>(function e(t){return aE(t)?Array.isArray(t.questions)?_P(t.questions):aE(t.question)?_P([t.question]):aE(t.arguments)?e(t.arguments):aE(t.args)?e(t.args):[]:[]})(l),[l]),d=(0,ek.useMemo)(()=>(function e(t){return aE(t)&&(_R(t.message)||(aE(t.arguments)?e(t.arguments):"")||(aE(t.args)?e(t.args):""))||"请选择"})(l),[l]),c=(0,ek.useMemo)(()=>(function e(t){return!!aE(t)&&(!0===t.__acpUiDevReviewLocalRequest||(aE(t.arguments)?e(t.arguments):!!aE(t.args)&&e(t.args)))})(l),[l]),p=(0,ek.useMemo)(()=>Math.min(function e(t){if(!aE(t))return 0;let r=t.__acpUiDevReviewInitialStepIndex;return"number"==typeof r&&Number.isFinite(r)?Math.max(0,Math.floor(r)):aE(t.arguments)?e(t.arguments):aE(t.args)?e(t.args):0}(l),Math.max(u.length-1,0)),[l,u.length]),[m,f]=(0,ek.useState)(null),[h,g]=(0,ek.useState)({}),[v,y]=(0,ek.useState)(0),[b,x]=(0,ek.useState)(!1),[w,_]=(0,ek.useState)(null),k=(0,ek.useRef)(null);(0,ek.useEffect)(()=>{if(c&&u.length>0)return;if(s?.requestId)return void a1.getUserChoiceRequest({workspacePath:a,requestId:s.requestId}).then(({request:e})=>f(e)).catch(()=>{});let t=window.setInterval(()=>{a1.getUserChoiceRequest({workspacePath:a,threadId:r,toolCallId:e.toolCallId}).then(({request:e})=>{if(e){f(e),window.clearInterval(t);return}return a1.getUserChoiceRequest({workspacePath:a,threadId:r}).then(({request:e})=>{e&&(f(e),window.clearInterval(t))})}).catch(()=>{})},500);return()=>window.clearInterval(t)},[u.length,c,e.toolCallId,s?.requestId,r,a]);let I=(0,ek.useMemo)(()=>c&&0!==u.length?{requestId:`dev-review-${e.toolCallId}`,workspacePath:a??"",threadId:r??null,toolCallId:e.toolCallId,message:d,questions:u,waitTimeoutMs:12e4,status:"pending",createdAt:"",updatedAt:"",expiresAt:""}:null,[d,u,c,e.toolCallId,r,a]),S=m??I,$=S?.requestId??null;(0,ek.useEffect)(()=>{k.current!==$&&(k.current=$,_(null),g({}),y(p))},[p,$]);let j=S?.questions&&S.questions.length>0?S.questions:u,E=S?.message||d,T=j[v],C=s?.status==="user_no_response"?w:s??w,N=s?C?.status==="answered"?"answered":C?.status==="cancelled"?"cancelled":S?"pending":"expired":C?"answered"===C.status?"answered":"cancelled"===C.status?"cancelled":"expired":S?"pending":"loading",A="answered"===N?fc:"cancelled"===N||"expired"===N?fm:fp,R=async e=>{let r,n=t.thread();n.getState().isRunning&&(n.cancelRun(),await Promise.allSettled([a1.cancelChat({threadId:o,provider:i,workspacePath:a})]),await _O(t)),await Promise.resolve(n.append({role:"user",content:[{type:"text",text:(r="action"in e?e.action:e.status,[aj,`requestId: ${e.requestId}`,`action: ${r}`,"content:",JSON.stringify(e,null,2)].join("\n"))}],startRun:!0}))},P=async e=>{x(!0);try{if(S===I)return void _(e);await a1.answerUserChoiceRequest({workspacePath:a,requestId:e.requestId,answer:e}),_(e),(s?.status==="user_no_response"||function(e){if(!e)return!1;if("expired"===e.status)return!0;let t=Date.parse(e.expiresAt);return Number.isFinite(t)&&Date.now()>=t}(m))&&await R(e)}finally{x(!1)}},O=C?.status==="answered"?Object.entries(C.content).map(([e,t])=>{let r=j.find(t=>t.fieldName===e);return`${r?.fieldTitle??e}: ${Array.isArray(t)?t.join("、")||"未选择":t||"未选择"}`}).join(";"):C?.status==="cancelled"?"已取消":"";return(0,ew.jsxs)("div",{"data-slot":"tool-ui-user-choice",className:"my-2.5 w-full rounded-lg border bg-card p-4 shadow-xs",children:[(0,ew.jsxs)("div",{className:"mb-3 flex items-start gap-3",children:[(0,ew.jsx)(A,{className:(0,r4.cn)("mt-0.5 size-4 shrink-0","answered"===N?"text-emerald-600 dark:text-emerald-400":"pending"===N?"text-primary":"text-muted-foreground")}),(0,ew.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ew.jsx)("div",{className:"break-words font-medium text-base leading-snug",children:E}),(0,ew.jsx)("div",{className:"mt-1 text-muted-foreground text-xs",children:"loading"===N?"准备选项":"pending"===N?"等待选择":O})]})]}),C&&O?(0,ew.jsx)("div",{className:"rounded-md border bg-muted/40 px-3 py-2 text-sm",children:O}):T&&S?(0,ew.jsx)(_M,{request:S,question:T,stepIndex:v,stepCount:j.length,onSubmit:e=>{if(!T||!S)return;let t={...h,[T.fieldName]:"multi"===T.selectionMode?Array.isArray(e)?e:e?[e]:[]:Array.isArray(e)?e[0]??null:e};(g(t),v<j.length-1)?y(e=>e+1):P({status:"answered",requestId:S.requestId,action:"accept",content:t})},onCancel:()=>void P({status:"cancelled",requestId:S.requestId,action:"cancel"}),submitting:b},`${S.requestId}-${T.fieldName}-${v}`):(0,ew.jsx)("div",{className:"rounded-md border bg-muted/40 px-3 py-2 text-muted-foreground text-sm",children:"正在准备选项..."})]})}let _D=[{id:"image-generation",canRender:function(e){var t;if(e.toolName===ac)return!0;let r=av(e.args);return e.toolName===ap&&(r?.toolName===ad||r?.toolName===ac||am(t=r?.args)&&t.server===au&&t.tool===ad)},render:e=>(0,ew.jsx)(oK,{...e})},{id:"user-choice",canRender:function(e){var t;if(e.toolName===aS)return!0;let r=av(e.args);return e.toolName===ap&&(r?.toolName===aI||r?.toolName===aS||aE(t=r?.args)&&t.server===ak&&t.tool===aI)},render:e=>(0,ew.jsx)(_z,{...e})}],_U=()=>(0,ew.jsx)(ct.Error,{children:(0,ew.jsx)(fs.Root,{className:"aui-message-error-root mt-2 rounded-md border border-destructive bg-destructive/10 p-3 text-destructive text-sm dark:bg-destructive/5 dark:text-red-200",children:(0,ew.jsx)(fs.Message,{className:"aui-message-error-message line-clamp-2"})})}),_L=()=>(0,ew.jsxs)(ct.Root,{"data-slot":"aui_assistant-message-root","data-role":"assistant",className:"fade-in slide-in-from-bottom-1 relative animate-in duration-150 [contain-intrinsic-size:auto_300px] [content-visibility:auto]",children:[(0,ew.jsxs)("div",{"data-slot":"aui_assistant-message-content",className:"wrap-break-word px-1.5 text-sm text-foreground leading-[1.6] md:px-2 md:text-base md:leading-relaxed [&>[data-slot=image-root]]:my-2",children:[(0,ew.jsx)(ct.Parts,{children:({part:e})=>{if("text"===e.type)return(0,ew.jsx)(_o,{});if("image"===e.type)return(0,ew.jsx)(fJ,{...e});if("file"===e.type)return(0,ew.jsx)(fR,{...e});if("tool-call"===e.type){let t;if("acp.elicitation.option_list"===e.toolName)return(0,ew.jsx)(f_,{...e});let r=(t=_D.find(t=>t.canRender(e)))?t.render(e):null;return r||(e.toolUI??(0,ew.jsx)(_A,{...e}))}return null}}),(0,ew.jsx)(_U,{})]}),(0,ew.jsxs)("div",{"data-slot":"aui_assistant-message-footer",className:(0,r4.cn)("ms-2 flex items-center","-mb-7.5 min-h-7.5 pt-1.5"),children:[(0,ew.jsx)(_q,{}),(0,ew.jsx)(_Z,{})]})]}),_Z=()=>(0,ew.jsxs)(m8.Root,{hideWhenRunning:!0,autohide:"not-last",className:"aui-assistant-action-bar-root col-start-3 row-start-2 -ms-1 flex gap-1 text-muted-foreground",children:[(0,ew.jsx)(m8.Copy,{asChild:!0,children:(0,ew.jsxs)(r9,{tooltip:"复制",children:[(0,ew.jsx)(sn,{condition:e=>e.message.isCopied,children:(0,ew.jsx)(a4,{})}),(0,ew.jsx)(sn,{condition:e=>!e.message.isCopied,children:(0,ew.jsx)(oo,{})})]})}),(0,ew.jsx)(m8.Reload,{asChild:!0,children:(0,ew.jsx)(r9,{tooltip:"重新生成",children:(0,ew.jsx)(i3,{})})}),(0,ew.jsxs)(mX.Root,{children:[(0,ew.jsx)(mX.Trigger,{asChild:!0,children:(0,ew.jsx)(r9,{tooltip:"更多",className:"data-[state=open]:bg-accent",children:(0,ew.jsx)(fu,{})})}),(0,ew.jsx)(mX.Content,{side:"bottom",align:"start",className:"aui-action-bar-more-content z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",children:(0,ew.jsx)(m8.ExportMarkdown,{asChild:!0,children:(0,ew.jsxs)(mX.Item,{className:"aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground",children:[(0,ew.jsx)(os,{className:"size-4"}),"导出为 Markdown"]})})})]})]}),_F=()=>rS(e=>e.message.content.some(e=>{var t;return"text"===e.type&&"string"==typeof(t=e.text)&&t.trimStart().startsWith(aj)}))?null:(0,ew.jsxs)(ct.Root,{"data-slot":"aui_user-message-root",className:"fade-in slide-in-from-bottom-1 grid animate-in auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] content-start gap-y-2 px-2 duration-150 [contain-intrinsic-size:auto_60px] [content-visibility:auto] [&:where(>*)]:col-start-2","data-role":"user",children:[(0,ew.jsx)(cj,{}),(0,ew.jsxs)("div",{className:"aui-user-message-content-wrapper relative col-start-2 min-w-0",children:[(0,ew.jsx)("div",{className:"aui-user-message-content wrap-break-word peer rounded-2xl bg-muted px-3.5 py-2 text-sm text-foreground leading-[1.55] md:px-4 md:py-2.5 md:text-base md:leading-normal empty:hidden [&>[data-slot=image-root]]:my-2",children:(0,ew.jsx)(ct.Parts,{components:{Image:fJ,File:fR}})}),(0,ew.jsx)("div",{className:"aui-user-action-bar-wrapper absolute start-0 top-1/2 -translate-x-full -translate-y-1/2 pe-2 peer-empty:hidden rtl:translate-x-full",children:(0,ew.jsx)(_B,{})})]}),(0,ew.jsx)(_q,{"data-slot":"aui_user-branch-picker",className:"col-span-full col-start-1 row-start-3 -me-1 justify-end"})]}),_B=()=>(0,ew.jsx)(m8.Root,{hideWhenRunning:!0,autohide:"not-last",className:"aui-user-action-bar-root flex flex-col items-end",children:(0,ew.jsx)(m8.Edit,{asChild:!0,children:(0,ew.jsx)(r9,{tooltip:"编辑",className:"aui-user-action-edit p-4",children:(0,ew.jsx)(fd,{})})})}),_V=()=>(0,ew.jsx)(ct.Root,{"data-slot":"aui_edit-composer-wrapper",className:"flex flex-col px-2",children:(0,ew.jsxs)(l0.Root,{className:"aui-edit-composer-root ms-auto flex w-full max-w-[85%] flex-col rounded-2xl bg-muted",children:[(0,ew.jsx)(l0.Input,{className:"aui-edit-composer-input min-h-14 w-full resize-none bg-transparent p-4 text-foreground text-sm outline-none",autoFocus:!0}),(0,ew.jsxs)("div",{className:"aui-edit-composer-footer mx-3 mb-3 flex items-center gap-2 self-end",children:[(0,ew.jsx)(l0.Cancel,{asChild:!0,children:(0,ew.jsx)(r5,{variant:"ghost",size:"sm",children:"取消"})}),(0,ew.jsx)(l0.Send,{asChild:!0,children:(0,ew.jsx)(r5,{size:"sm",children:"更新"})})]})]})}),_q=({className:e,...t})=>(0,ew.jsxs)(fi.Root,{hideWhenSingleBranch:!0,className:(0,r4.cn)("aui-branch-picker-root -ms-2 me-2 inline-flex items-center text-muted-foreground text-xs",e),...t,children:[(0,ew.jsx)(fi.Previous,{asChild:!0,children:(0,ew.jsx)(r9,{tooltip:"上一个版本",children:(0,ew.jsx)(fl,{})})}),(0,ew.jsxs)("span",{className:"aui-branch-picker-state font-medium",children:[(0,ew.jsx)(fi.Number,{})," / ",(0,ew.jsx)(fi.Count,{})]}),(0,ew.jsx)(fi.Next,{asChild:!0,children:(0,ew.jsx)(r9,{tooltip:"下一个版本",children:(0,ew.jsx)(uj,{})})})]}),_W=()=>(0,ew.jsx)("div",{"data-slot":"aui_message-group",className:"mb-8 flex flex-col gap-y-6 empty:hidden md:mb-10 md:gap-y-8",children:(0,ew.jsx)(sD.Messages,{children:()=>(0,ew.jsx)(_J,{})})}),_J=()=>{let e=rS(e=>e.message.role);return rS(e=>e.message.composer.isEditing)?(0,ew.jsx)(_V,{}):"user"===e?(0,ew.jsx)(_F,{}):(0,ew.jsx)(_L,{})};var sD=sD;let _H=rB("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),_K=()=>(0,ew.jsx)(sD.ScrollToBottom,{asChild:!0,children:(0,ew.jsx)(r9,{tooltip:"滚动到底部",variant:"outline",className:"aui-thread-scroll-to-bottom absolute -top-12 z-10 self-center rounded-full p-4 disabled:invisible dark:border-border dark:bg-background dark:hover:bg-accent",children:(0,ew.jsx)(_H,{})})}),_G=({isHistoryRoute:e=!1})=>{let t=rS(e=>e.thread.messages.length),r=rS(e=>e.thread.isLoading),n=function({isHistoryRoute:e,isLoading:t,messageCount:r}){let[n,i]=(0,ek.useState)(!1);return(0,ek.useEffect)(()=>{if(!e||t||r>0)return void i(!1);let n=window.setTimeout(()=>i(!0),450);return()=>window.clearTimeout(n)},[e,t,r]),n}({isHistoryRoute:e,isLoading:r,messageCount:t}),i=e&&0===t&&(r||!n);return(0,ew.jsx)(sD.Root,{className:"aui-root aui-thread-root @container flex h-full flex-col bg-background",style:{"--thread-max-width":"44rem","--composer-radius":"24px","--composer-padding":"10px"},children:(0,ew.jsx)(sD.Viewport,{turnAnchor:"top","data-slot":"aui_thread-viewport",className:"relative flex flex-1 flex-col overflow-x-auto overflow-y-auto scroll-smooth",children:(0,ew.jsxs)("div",{className:"mx-auto flex w-full max-w-(--thread-max-width) flex-1 flex-col px-3 pt-14 sm:px-4 lg:pt-4",children:[(0,ew.jsx)(sn,{condition:()=>i,children:(0,ew.jsx)(cB,{})}),(0,ew.jsx)(sn,{condition:()=>0===t&&(!e||n),children:(0,ew.jsx)(cL,{isHistoryRoute:e})}),(0,ew.jsx)(_W,{}),(0,ew.jsxs)(sD.ViewportFooter,{className:"aui-thread-viewport-footer sticky bottom-0 mt-auto flex flex-col gap-0 overflow-visible rounded-t-(--composer-radius) bg-background pb-4 md:pb-6",children:[(0,ew.jsx)(_K,{}),(0,ew.jsx)(cO,{}),(0,ew.jsx)(cC,{})]})]})})})},_Y=rB("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);e.s([],77208),e.i(77208);var mL=mL,mL=mL;let _X=mL.createDropdownMenuScope(),_Q=({__scopeThreadListItemMore:e,...t})=>{let r=_X(e);return(0,ew.jsx)(mL.Root,{...r,...t})};_Q.displayName="ThreadListItemMorePrimitive.Root";let _0=(0,ek.forwardRef)(({__scopeThreadListItemMore:e,...t},r)=>{let n=_X(e);return(0,ew.jsx)(mV,{...n,...t,ref:r})});_0.displayName="ThreadListItemMorePrimitive.Trigger";var mL=mL;let _1=(0,ek.forwardRef)(({__scopeThreadListItemMore:e,portalProps:t,sideOffset:r=4,...n},i)=>{let a=_X(e);return(0,ew.jsx)(mL.Portal,{...a,...t,children:(0,ew.jsx)(mq,{...a,...n,ref:i,sideOffset:r})})});_1.displayName="ThreadListItemMorePrimitive.Content";let _2=(0,ek.forwardRef)(({__scopeThreadListItemMore:e,...t},r)=>{let n=_X(e);return(0,ew.jsx)(mW,{...n,...t,ref:r})});_2.displayName="ThreadListItemMorePrimitive.Item";let _4=(0,ek.forwardRef)(({__scopeThreadListItemMore:e,...t},r)=>{let n=_X(e);return(0,ew.jsx)(mJ,{...n,...t,ref:r})});_4.displayName="ThreadListItemMorePrimitive.Separator",e.s(["Content",0,_1,"Item",0,_2,"Root",0,_Q,"Separator",0,_4,"Trigger",0,_0],19358);var _6=e.i(19358),_6=_6;e.s([],78036),e.i(78036);let _5=(0,ek.forwardRef)((e,t)=>{let r=rS(e=>e.threads.mainThreadId===e.threadListItem.id);return(0,ew.jsx)(rk.div,{...r?{"data-active":"true","aria-current":"true"}:null,...e,ref:t})});_5.displayName="ThreadListItemPrimitive.Root";let _3=rP("ThreadListItemPrimitive.Archive",()=>{let e,{archive:t}=(e=tU(),{archive:(0,ek.useCallback)(()=>{e.threadListItem().archive()},[e])});return t}),_9=rP("ThreadListItemPrimitive.Unarchive",()=>{let e,{unarchive:t}=(e=tU(),{unarchive:(0,ek.useCallback)(()=>{e.threadListItem().unarchive()},[e])});return t}),_8=rP("ThreadListItemPrimitive.Delete",()=>{let e,{delete:t}=(e=tU(),{delete:(0,ek.useCallback)(()=>{e.threadListItem().delete()},[e])});return t}),_7=rP("ThreadListItemPrimitive.Trigger",()=>{let e,{switchTo:t}=(e=tU(),{switchTo:(0,ek.useCallback)(()=>{e.threadListItem().switchTo()},[e])});return t}),ke=({fallback:e})=>{let t=rS(e=>e.threadListItem.title);return(0,ew.jsx)(ew.Fragment,{children:t||e})};ke.displayName="ThreadListItemPrimitive.Title",e.s(["Archive",0,_3,"Delete",0,_8,"Root",0,_5,"Title",0,ke,"Trigger",0,_7,"Unarchive",0,_9],48995);var kt=e.i(48995),kt=kt,rz=rz;let kr=rB("archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]),kn=rB("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),ki=rB("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),ka=rB("trash",[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);var ko=Symbol("radix.slottable");function ks(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===ko}var kl=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(ks);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,ew.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,ew.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ew.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),ku=ek.forwardRef((e,t)=>(0,ew.jsx)(kl.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));ku.displayName="Label",e.s(["Label",0,ku,"Root",0,ku],73741);var kd=e.i(73741),kd=kd;function kc({className:e,...t}){return(0,ew.jsx)(kd.Root,{"data-slot":"label",className:(0,r4.cn)("flex select-none items-center gap-2 font-medium text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",e),...t})}var kp=e.i(35804),km=Symbol("radix.slottable");function kf(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===km}var kh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(kf);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,ew.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,ew.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ew.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),kg="Switch",[kv,ky]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,ew.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(kg),[kb,kx]=kv(kg),kw=ek.forwardRef((e,t)=>{let{__scopeSwitch:r,name:n,checked:i,defaultChecked:a,required:o,disabled:s,value:l="on",onCheckedChange:u,form:d,...c}=e,[p,m]=ek.useState(null),f=(0,rh.useComposedRefs)(t,e=>m(e)),h=ek.useRef(!1),g=!p||d||!!p.closest("form"),[v,y]=(0,ne.useControllableState)({prop:i,defaultProp:a??!1,onChange:u,caller:kg});return(0,ew.jsxs)(kb,{scope:r,checked:v,disabled:s,children:[(0,ew.jsx)(kh.button,{type:"button",role:"switch","aria-checked":v,"aria-required":o,"data-state":kS(v),"data-disabled":s?"":void 0,disabled:s,value:l,...c,ref:f,onClick:(0,rI.composeEventHandlers)(e.onClick,e=>{y(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,ew.jsx)(kI,{control:p,bubbles:!h.current,name:n,value:l,checked:v,required:o,disabled:s,form:d,style:{transform:"translateX(-100%)"}})]})});kw.displayName=kg;var k_="SwitchThumb",kk=ek.forwardRef((e,t)=>{let{__scopeSwitch:r,...n}=e,i=kx(k_,r);return(0,ew.jsx)(kh.span,{"data-state":kS(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});kk.displayName=k_;var kI=ek.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...i},a)=>{let o,s=ek.useRef(null),l=(0,rh.useComposedRefs)(s,a),u=(o=ek.useRef({value:r,previous:r}),ek.useMemo(()=>(o.current.value!==r&&(o.current.previous=o.current.value,o.current.value=r),o.current.previous),[r])),d=(0,kp.useSize)(t);return ek.useEffect(()=>{let e=s.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(u!==r&&t){let i=new Event("click",{bubbles:n});t.call(e,r),e.dispatchEvent(i)}},[u,r,n]),(0,ew.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:l,style:{...i.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function kS(e){return e?"checked":"unchecked"}kI.displayName="SwitchBubbleInput",e.s(["Root",0,kw,"Switch",0,kw,"SwitchThumb",0,kk,"Thumb",0,kk,"createSwitchScope",0,ky],57287);var k$=e.i(57287),k$=k$;function kj({className:e,...t}){return(0,ew.jsx)(k$.Root,{"data-slot":"switch",className:(0,r4.cn)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",e),...t,children:(0,ew.jsx)(k$.Thumb,{"data-slot":"switch-thumb",className:(0,r4.cn)("pointer-events-none block size-4 rounded-full bg-background ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground")})})}var kE=Symbol("radix.slottable");function kT(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===kE}var kC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(kT);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,ew.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,ew.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ew.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),kN="Tabs",[kA,kR]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,ew.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(kN,[pu]),kP=pu(),[kO,kM]=kA(kN),kz=ek.forwardRef((e,t)=>{let{__scopeTabs:r,value:n,onValueChange:i,defaultValue:a,orientation:o="horizontal",dir:s,activationMode:l="automatic",...u}=e,d=c4(s),[c,p]=(0,ne.useControllableState)({prop:n,onChange:i,defaultProp:a??"",caller:kN});return(0,ew.jsx)(kO,{scope:r,baseId:(0,r7.useId)(),value:c,onValueChange:p,orientation:o,dir:d,activationMode:l,children:(0,ew.jsx)(kC.div,{dir:d,"data-orientation":o,...u,ref:t})})});kz.displayName=kN;var kD="TabsList",kU=ek.forwardRef((e,t)=>{let{__scopeTabs:r,loop:n=!0,...i}=e,a=kM(kD,r),o=kP(r);return(0,ew.jsx)(pp,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:n,children:(0,ew.jsx)(kC.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:t})})});kU.displayName=kD;var kL="TabsTrigger",kZ=ek.forwardRef((e,t)=>{let{__scopeTabs:r,value:n,disabled:i=!1,...a}=e,o=kM(kL,r),s=kP(r),l=kV(o.baseId,n),u=kq(o.baseId,n),d=n===o.value;return(0,ew.jsx)(ph,{asChild:!0,...s,focusable:!i,active:d,children:(0,ew.jsx)(kC.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...a,ref:t,onMouseDown:(0,rI.composeEventHandlers)(e.onMouseDown,e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():o.onValueChange(n)}),onKeyDown:(0,rI.composeEventHandlers)(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&o.onValueChange(n)}),onFocus:(0,rI.composeEventHandlers)(e.onFocus,()=>{let e="manual"!==o.activationMode;d||i||!e||o.onValueChange(n)})})})});kZ.displayName=kL;var kF="TabsContent",kB=ek.forwardRef((e,t)=>{let{__scopeTabs:r,value:n,forceMount:i,children:a,...o}=e,s=kM(kF,r),l=kV(s.baseId,n),u=kq(s.baseId,n),d=n===s.value,c=ek.useRef(d);return ek.useEffect(()=>{let e=requestAnimationFrame(()=>c.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,ew.jsx)(ng.Presence,{present:i||d,children:({present:r})=>(0,ew.jsx)(kC.div,{"data-state":d?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":l,hidden:!r,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:c.current?"0s":void 0},children:r&&a})})});function kV(e,t){return`${e}-trigger-${t}`}function kq(e,t){return`${e}-content-${t}`}kB.displayName=kF,e.s(["Content",0,kB,"List",0,kU,"Root",0,kz,"Tabs",0,kz,"TabsContent",0,kB,"TabsList",0,kU,"TabsTrigger",0,kZ,"Trigger",0,kZ,"createTabsScope",0,kR],26209);var kW=e.i(26209),kW=kW;function kJ({className:e,...t}){return(0,ew.jsx)(kW.Root,{"data-slot":"tabs",className:(0,r4.cn)("flex flex-col gap-4",e),...t})}function kH({className:e,...t}){return(0,ew.jsx)(kW.List,{"data-slot":"tabs-list",className:(0,r4.cn)("inline-flex h-9 w-fit items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t})}function kK({className:e,...t}){return(0,ew.jsx)(kW.Trigger,{"data-slot":"tabs-trigger",className:(0,r4.cn)("inline-flex h-7 min-w-0 flex-1 items-center justify-center whitespace-nowrap rounded-sm px-3 font-medium text-sm outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-xs",e),...t})}function kG({className:e,...t}){return(0,ew.jsx)(kW.Content,{"data-slot":"tabs-content",className:(0,r4.cn)("outline-none",e),...t})}function kY({trigger:e}){let{builtinToolSettings:t,hostImageGenerationSettings:r,runtimeBuiltinToolSettings:n,setBuiltinToolSettings:i,setHostImageGenerationSettings:a}=aq(),o=!!r,s=aw(n[al]),l=ag(s),u=aC(t[a_]),d=e=>{o?a(t=>e(aw({...s,...ah(t)??{}}))):i(al,t=>e(aw(t)))},c=(e,t)=>{d(r=>({...r,[e]:t}))},p=(e,t)=>{d(r=>{let n={...r,[e]:t};return{...n,enabled:n.enabled&&ag(n)}})},m=(e,t)=>{i(a_,r=>({...aC(r),[e]:t}))};return(0,ew.jsxs)(a5,{children:[(0,ew.jsx)(a3,{asChild:!0,children:e}),(0,ew.jsxs)(oe,{className:"sm:max-w-xl",children:[(0,ew.jsxs)(ot,{children:[(0,ew.jsx)(on,{children:"工具设置"}),(0,ew.jsx)(oi,{children:"配置内置工具的连接信息和交互行为。"})]}),(0,ew.jsxs)(kJ,{defaultValue:"image-generation",children:[(0,ew.jsxs)(kH,{className:"grid w-full grid-cols-2",children:[(0,ew.jsx)(kK,{value:"image-generation",children:"图片生成"}),(0,ew.jsx)(kK,{value:"user-choice",children:"用户选择"})]}),(0,ew.jsxs)(kG,{value:"image-generation",className:"grid gap-4",children:[(0,ew.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-md border px-3 py-2",children:[(0,ew.jsxs)("div",{className:"min-w-0",children:[(0,ew.jsx)(kc,{htmlFor:"image-generation-enabled",children:"图片生成工具"}),(0,ew.jsx)("p",{className:"mt-1 text-muted-foreground text-xs",children:"填写 API Base URL、API Key 和模型后可开启。"})]}),(0,ew.jsx)(kj,{id:"image-generation-enabled",checked:s.enabled&&l,disabled:!l,onCheckedChange:e=>c("enabled",e)})]}),(0,ew.jsx)(kX,{id:"image-generation-base-url",label:"API Base URL",placeholder:"https://api.openai.com/v1",value:s.baseUrl??"",onValueChange:e=>p("baseUrl",e)}),(0,ew.jsx)(kX,{id:"image-generation-api-key",label:"API Key",placeholder:"sk-...",type:"password",value:s.apiKey??"",onValueChange:e=>p("apiKey",e)}),(0,ew.jsx)(kX,{id:"image-generation-model",label:"模型",placeholder:"gpt-image-1",value:s.model??"",onValueChange:e=>p("model",e)}),(0,ew.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-md border px-3 py-2",children:[(0,ew.jsxs)("div",{className:"min-w-0",children:[(0,ew.jsx)(kc,{htmlFor:"image-generation-preserve-prompt",children:"保留原始提示词"}),(0,ew.jsx)("p",{className:"mt-1 text-muted-foreground text-xs",children:"请求图片 API 时在 prompt 前加入不要改写提示,记录仍显示原始提示词。"})]}),(0,ew.jsx)(kj,{id:"image-generation-preserve-prompt",checked:s.preservePrompt,onCheckedChange:e=>c("preservePrompt",e)})]})]}),(0,ew.jsxs)(kG,{value:"user-choice",className:"grid gap-4",children:[(0,ew.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-md border px-3 py-2",children:[(0,ew.jsxs)("div",{className:"min-w-0",children:[(0,ew.jsx)(kc,{htmlFor:"user-choice-enabled",children:"用户选择工具"}),(0,ew.jsx)("p",{className:"mt-1 text-muted-foreground text-xs",children:"允许模型通过 MCP 发起单选、多选或多题选择。"})]}),(0,ew.jsx)(kj,{id:"user-choice-enabled",checked:u.enabled,onCheckedChange:e=>m("enabled",e)})]}),(0,ew.jsx)(kX,{id:"user-choice-timeout-ms",label:"等待超时(毫秒)",type:"number",value:String(u.waitTimeoutMs),onValueChange:e=>m("waitTimeoutMs",Number.parseInt(e,10))}),(0,ew.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ew.jsx)(kc,{htmlFor:"user-choice-custom-input",children:"允许自定义输入"}),(0,ew.jsx)(kj,{id:"user-choice-custom-input",checked:u.allowCustomInput,onCheckedChange:e=>m("allowCustomInput",e)})]}),(0,ew.jsx)(kX,{id:"user-choice-custom-input-label",label:"自定义选项文案",value:u.customInputLabel,onValueChange:e=>m("customInputLabel",e)})]})]}),(0,ew.jsx)(or,{showCloseButton:!0})]})]})}function kX({id:e,label:t,value:r,onValueChange:n,placeholder:i,type:a="text"}){return(0,ew.jsxs)("div",{className:"grid gap-2",children:[(0,ew.jsx)(kc,{htmlFor:e,children:t}),(0,ew.jsx)(ff,{id:e,type:a,value:r,placeholder:i,onChange:e=>n(e.currentTarget.value)})]})}function kQ({className:e,...t}){return(0,ew.jsx)("div",{"data-slot":"skeleton",className:(0,r4.cn)("animate-pulse rounded-md bg-accent",e),...t})}let k0=["thread-list-skeleton-1","thread-list-skeleton-2","thread-list-skeleton-3","thread-list-skeleton-4","thread-list-skeleton-5"],k1=({openInNewWindowHref:e,localNewThreadHref:t,onNewThreadClick:r})=>(0,ew.jsxs)(rz.Root,{className:"aui-root aui-thread-list-root flex w-full min-w-0 flex-col gap-1",children:[(0,ew.jsx)(k3,{}),(0,ew.jsx)(k2,{openInNewWindowHref:e,localNewThreadHref:t,onNewThreadClick:r}),(0,ew.jsx)(sn,{condition:e=>e.threads.isLoading&&0===e.threads.threadIds.length,children:(0,ew.jsx)(k4,{})}),(0,ew.jsxs)(sn,{condition:e=>!e.threads.isLoading||e.threads.threadIds.length>0,children:[(0,ew.jsx)(rz.Items,{children:()=>(0,ew.jsx)(k5,{})}),(0,ew.jsx)(sn,{condition:e=>e.threads.hasMore,children:(0,ew.jsx)(k6,{})})]})]}),k2=({openInNewWindowHref:e,localNewThreadHref:t,onNewThreadClick:r})=>{let n=(0,ew.jsxs)(r5,{variant:"ghost",className:"aui-thread-list-new h-9 w-full min-w-0 justify-start gap-2 rounded-lg px-3 text-sm hover:bg-muted",onClick:r,children:[(0,ew.jsx)(rV,{className:"size-4"}),(0,ew.jsx)("span",{className:"truncate",children:"新建对话"})]});return(0,ew.jsxs)("div",{className:"aui-thread-list-top-actions mb-2 flex flex-col gap-1",children:[(0,ew.jsx)(kY,{trigger:(0,ew.jsxs)(r5,{type:"button",variant:"ghost",className:"aui-thread-list-settings h-9 w-full min-w-0 justify-start gap-2 rounded-lg px-3 text-sm hover:bg-muted data-[state=open]:bg-muted",children:[(0,ew.jsx)(ki,{className:"size-4"}),(0,ew.jsx)("span",{className:"truncate",children:"设置"})]})}),t?n:(0,ew.jsx)(rz.New,{asChild:!0,children:n}),e?(0,ew.jsx)(r5,{asChild:!0,variant:"ghost",className:"aui-thread-list-open-window h-9 w-full min-w-0 justify-start gap-2 rounded-lg px-3 text-sm hover:bg-muted",children:(0,ew.jsxs)("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[(0,ew.jsx)(kn,{className:"size-4"}),(0,ew.jsx)("span",{className:"truncate",children:"新窗口打开"})]})}):null]})},k4=()=>(0,ew.jsx)("div",{className:"flex flex-col gap-1",children:k0.map(e=>(0,ew.jsx)("div",{role:"status","aria-label":"正在加载对话",className:"aui-thread-list-skeleton-wrapper flex h-9 items-center px-3",children:(0,ew.jsx)(kQ,{className:"aui-thread-list-skeleton h-4 w-full"})},e))}),k6=()=>(0,ew.jsx)(rz.LoadMore,{asChild:!0,children:(0,ew.jsxs)(r5,{variant:"ghost",className:"aui-thread-list-load-more h-9 justify-center rounded-lg px-3 text-muted-foreground text-sm hover:bg-muted hover:text-foreground",children:[(0,ew.jsx)(sn,{condition:e=>!e.threads.isLoadingMore,children:"加载更多"}),(0,ew.jsx)(sn,{condition:e=>e.threads.isLoadingMore,children:"正在加载..."})]})}),k5=()=>(0,ew.jsxs)(kt.Root,{className:"aui-thread-list-item group/thread-list-item flex h-9 w-full min-w-0 items-center rounded-lg transition-colors hover:bg-muted focus-visible:bg-muted focus-visible:outline-none data-active:bg-muted",children:[(0,ew.jsxs)(kt.Trigger,{className:"aui-thread-list-item-trigger flex h-full min-w-0 flex-1 items-center px-3 text-start text-sm",children:[(0,ew.jsx)("span",{className:"aui-thread-list-item-title min-w-0 flex-1 truncate",children:(0,ew.jsx)(kt.Title,{fallback:"新对话"})}),(0,ew.jsx)(k9,{})]}),(0,ew.jsx)(k8,{})]}),k3=()=>{let e=tU(),t=rS(e=>e.thread.isRunning),r=(0,ek.useRef)(t);return(0,ek.useEffect)(()=>{let n=r.current;r.current=t,n&&!t&&e.threads().reload().catch(()=>{})},[e,t]),null},k9=()=>{let e,t=rS(e=>e.threadListItem.remoteId),r=rS(e=>e.threadListItem.custom),n=rS(e=>e.threads.mainThreadId===e.threadListItem.id),i=rS(e=>e.thread.isRunning),a="string"==typeof(e=r?.workspacePath)&&e.trim()?e.trim():void 0,o=n?i:null,[s,l]=(0,ek.useState)(null),[u,d]=(0,ek.useState)(0),c=(0,ek.useRef)(`${n}:${o}`),p=(0,ek.useMemo)(()=>({refreshToken:u,remoteId:t,workspacePath:a}),[u,t,a]);return((0,ek.useEffect)(()=>{let e=`${n}:${o}`;c.current!==e&&(c.current=e,n&&d(e=>e+1))},[n,o]),(0,ek.useEffect)(()=>{let e=!1;return p.remoteId?(a1.getConversationRuntime(p.remoteId,p.workspacePath).then(t=>{if(!e){var r;l("queued"===(r=t.metadata?.runState)||"running"===r?"running":null)}}).catch(()=>{e||l(null)}),()=>{e=!0}):void l(null)},[p]),"running"!==s)?null:(0,ew.jsx)("span",{className:"aui-thread-list-item-run-status ms-2 inline-flex size-3 shrink-0 items-center justify-center",role:"img","aria-label":"对话运行中",title:"对话运行中",children:(0,ew.jsx)("span",{className:"block size-3 animate-spin rounded-full border border-foreground/70 border-t-transparent motion-reduce:animate-none"})})},k8=()=>(0,ew.jsxs)(_6.Root,{children:[(0,ew.jsx)(_6.Trigger,{asChild:!0,children:(0,ew.jsxs)(r5,{variant:"ghost",size:"icon",className:"aui-thread-list-item-more me-0 h-7 w-0 overflow-hidden p-0 opacity-0 transition-[width,margin,opacity,background-color,color] group-hover/thread-list-item:me-2 group-hover/thread-list-item:w-7 group-hover/thread-list-item:opacity-100 group-focus-within/thread-list-item:me-2 group-focus-within/thread-list-item:w-7 group-focus-within/thread-list-item:opacity-100 data-[state=open]:me-2 data-[state=open]:w-7 data-[state=open]:bg-accent data-[state=open]:opacity-100",children:[(0,ew.jsx)(fu,{className:"size-4"}),(0,ew.jsx)("span",{className:"sr-only",children:"更多选项"})]})}),(0,ew.jsxs)(_6.Content,{side:"bottom",align:"start",className:"aui-thread-list-item-more-content z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",children:[(0,ew.jsx)(kt.Archive,{asChild:!0,children:(0,ew.jsxs)(_6.Item,{className:"aui-thread-list-item-more-item flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground",children:[(0,ew.jsx)(kr,{className:"size-4"}),"归档"]})}),(0,ew.jsx)(kt.Delete,{asChild:!0,children:(0,ew.jsxs)(_6.Item,{className:"aui-thread-list-item-more-item flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-destructive text-sm outline-none hover:bg-destructive/10 hover:text-destructive focus:bg-destructive/10 focus:text-destructive",children:[(0,ew.jsx)(ka,{className:"size-4"}),"删除"]})})]})]}),k7=rB("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),Ie=rB("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),It="acp-ui-theme";function Ir(e){document.documentElement.classList.toggle("dark","dark"===e),document.documentElement.style.colorScheme=e}function In(){let[e,t]=(0,ek.useState)("light");(0,ek.useEffect)(()=>{let e="dark"===window.localStorage.getItem(It)?"dark":"light";t(e),Ir(e)},[]);let r="dark"===e?"light":"dark";return(0,ew.jsx)(r9,{type:"button",tooltip:"dark"===e?"切换到浅色主题":"切换到深色主题","aria-label":"dark"===e?"切换到浅色主题":"切换到深色主题",className:"size-8 text-muted-foreground hover:text-foreground",onClick:()=>{t(r),window.localStorage.setItem(It,r),Ir(r)},children:(0,ew.jsx)("dark"===e?Ie:k7,{className:"size-4"})})}var Ii=Symbol("radix.slottable");function Ia(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Ii}var Io=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(Ia);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,ew.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,ew.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ew.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),Is="ScrollArea",[Il,Iu]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,ew.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(Is),[Id,Ic]=Il(Is),Ip=ek.forwardRef((e,t)=>{let{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:a=600,...o}=e,[s,l]=ek.useState(null),[u,d]=ek.useState(null),[c,p]=ek.useState(null),[m,f]=ek.useState(null),[h,g]=ek.useState(null),[v,y]=ek.useState(0),[b,x]=ek.useState(0),[w,_]=ek.useState(!1),[k,I]=ek.useState(!1),S=(0,rh.useComposedRefs)(t,e=>l(e)),$=c4(i);return(0,ew.jsx)(Id,{scope:r,type:n,dir:$,scrollHideDelay:a,scrollArea:s,viewport:u,onViewportChange:d,content:c,onContentChange:p,scrollbarX:m,onScrollbarXChange:f,scrollbarXEnabled:w,onScrollbarXEnabledChange:_,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:k,onScrollbarYEnabledChange:I,onCornerWidthChange:y,onCornerHeightChange:x,children:(0,ew.jsx)(Io.div,{dir:$,...o,ref:S,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":b+"px",...e.style}})})});Ip.displayName=Is;var Im="ScrollAreaViewport",If=ek.forwardRef((e,t)=>{let{__scopeScrollArea:r,children:n,nonce:i,...a}=e,o=Ic(Im,r),s=ek.useRef(null),l=(0,rh.useComposedRefs)(t,s,o.onViewportChange);return(0,ew.jsxs)(ew.Fragment,{children:[(0,ew.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),(0,ew.jsx)(Io.div,{"data-radix-scroll-area-viewport":"",...a,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:(0,ew.jsx)("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});If.displayName=Im;var Ih="ScrollAreaScrollbar",Ig=ek.forwardRef((e,t)=>{let{forceMount:r,...n}=e,i=Ic(Ih,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s="horizontal"===e.orientation;return ek.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),"hover"===i.type?(0,ew.jsx)(Iv,{...n,ref:t,forceMount:r}):"scroll"===i.type?(0,ew.jsx)(Iy,{...n,ref:t,forceMount:r}):"auto"===i.type?(0,ew.jsx)(Ib,{...n,ref:t,forceMount:r}):"always"===i.type?(0,ew.jsx)(Ix,{...n,ref:t}):null});Ig.displayName=Ih;var Iv=ek.forwardRef((e,t)=>{let{forceMount:r,...n}=e,i=Ic(Ih,e.__scopeScrollArea),[a,o]=ek.useState(!1);return ek.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let r=()=>{window.clearTimeout(t),o(!0)},n=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[i.scrollArea,i.scrollHideDelay]),(0,ew.jsx)(ng.Presence,{present:r||a,children:(0,ew.jsx)(Ib,{"data-state":a?"visible":"hidden",...n,ref:t})})}),Iy=ek.forwardRef((e,t)=>{var r;let{forceMount:n,...i}=e,a=Ic(Ih,e.__scopeScrollArea),o="horizontal"===e.orientation,s=ID(()=>u("SCROLL_END"),100),[l,u]=(r={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},ek.useReducer((e,t)=>r[e][t]??e,"hidden"));return ek.useEffect(()=>{if("idle"===l){let e=window.setTimeout(()=>u("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,a.scrollHideDelay,u]),ek.useEffect(()=>{let e=a.viewport,t=o?"scrollLeft":"scrollTop";if(e){let r=e[t],n=()=>{let n=e[t];r!==n&&(u("SCROLL"),s()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[a.viewport,o,u,s]),(0,ew.jsx)(ng.Presence,{present:n||"hidden"!==l,children:(0,ew.jsx)(Ix,{"data-state":"hidden"===l?"hidden":"visible",...i,ref:t,onPointerEnter:(0,rI.composeEventHandlers)(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:(0,rI.composeEventHandlers)(e.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),Ib=ek.forwardRef((e,t)=>{let r=Ic(Ih,e.__scopeScrollArea),{forceMount:n,...i}=e,[a,o]=ek.useState(!1),s="horizontal"===e.orientation,l=ID(()=>{if(r.viewport){let e=r.viewport.offsetWidth<r.viewport.scrollWidth,t=r.viewport.offsetHeight<r.viewport.scrollHeight;o(s?e:t)}},10);return IU(r.viewport,l),IU(r.content,l),(0,ew.jsx)(ng.Presence,{present:n||a,children:(0,ew.jsx)(Ix,{"data-state":a?"visible":"hidden",...i,ref:t})})}),Ix=ek.forwardRef((e,t)=>{let{orientation:r="vertical",...n}=e,i=Ic(Ih,e.__scopeScrollArea),a=ek.useRef(null),o=ek.useRef(0),[s,l]=ek.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=IR(s.viewport,s.content),d={...n,sizes:s,onSizesChange:l,hasThumb:!!(u>0&&u<1),onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function c(e,t){return function(e,t,r,n="ltr"){let i=IP(r),a=t||i/2,o=r.scrollbar.paddingStart+a,s=r.scrollbar.size-r.scrollbar.paddingEnd-(i-a),l=r.content-r.viewport;return IM([o,s],"ltr"===n?[0,l]:[-1*l,0])(e)}(e,o.current,s,t)}return"horizontal"===r?(0,ew.jsx)(Iw,{...d,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=IO(i.viewport.scrollLeft,s,i.dir);a.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=c(e,i.dir))}}):"vertical"===r?(0,ew.jsx)(I_,{...d,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=IO(i.viewport.scrollTop,s);a.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=c(e))}}):null}),Iw=ek.forwardRef((e,t)=>{let{sizes:r,onSizesChange:n,...i}=e,a=Ic(Ih,e.__scopeScrollArea),[o,s]=ek.useState(),l=ek.useRef(null),u=(0,rh.useComposedRefs)(t,l,a.onScrollbarXChange);return ek.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),(0,ew.jsx)(IS,{"data-orientation":"horizontal",...i,ref:u,sizes:r,style:{bottom:0,left:"rtl"===a.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===a.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":IP(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(a.viewport){var n,i;let o=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(o),n=o,i=r,n>0&&n<i&&t.preventDefault()}},onResize:()=>{l.current&&a.viewport&&o&&n({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:IA(o.paddingLeft),paddingEnd:IA(o.paddingRight)}})}})}),I_=ek.forwardRef((e,t)=>{let{sizes:r,onSizesChange:n,...i}=e,a=Ic(Ih,e.__scopeScrollArea),[o,s]=ek.useState(),l=ek.useRef(null),u=(0,rh.useComposedRefs)(t,l,a.onScrollbarYChange);return ek.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),(0,ew.jsx)(IS,{"data-orientation":"vertical",...i,ref:u,sizes:r,style:{top:0,right:"ltr"===a.dir?0:void 0,left:"rtl"===a.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":IP(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(a.viewport){var n,i;let o=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(o),n=o,i=r,n>0&&n<i&&t.preventDefault()}},onResize:()=>{l.current&&a.viewport&&o&&n({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:IA(o.paddingTop),paddingEnd:IA(o.paddingBottom)}})}})}),[Ik,II]=Il(Ih),IS=ek.forwardRef((e,t)=>{let{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:d,onResize:c,...p}=e,m=Ic(Ih,r),[f,h]=ek.useState(null),g=(0,rh.useComposedRefs)(t,e=>h(e)),v=ek.useRef(null),y=ek.useRef(""),b=m.viewport,x=n.content-n.viewport,w=(0,na.useCallbackRef)(d),_=(0,na.useCallbackRef)(l),k=ID(c,10);function I(e){v.current&&u({x:e.clientX-v.current.left,y:e.clientY-v.current.top})}return ek.useEffect(()=>{let e=e=>{let t=e.target;f?.contains(t)&&w(e,x)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[b,f,x,w]),ek.useEffect(_,[n,_]),IU(f,k),IU(m.content,k),(0,ew.jsx)(Ik,{scope:r,scrollbar:f,hasThumb:i,onThumbChange:(0,na.useCallbackRef)(a),onThumbPointerUp:(0,na.useCallbackRef)(o),onThumbPositionChange:_,onThumbPointerDown:(0,na.useCallbackRef)(s),children:(0,ew.jsx)(Io.div,{...p,ref:g,style:{position:"absolute",...p.style},onPointerDown:(0,rI.composeEventHandlers)(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),v.current=f.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),I(e))}),onPointerMove:(0,rI.composeEventHandlers)(e.onPointerMove,I),onPointerUp:(0,rI.composeEventHandlers)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=y.current,m.viewport&&(m.viewport.style.scrollBehavior=""),v.current=null})})})}),I$="ScrollAreaThumb",Ij=ek.forwardRef((e,t)=>{let{forceMount:r,...n}=e,i=II(I$,e.__scopeScrollArea);return(0,ew.jsx)(ng.Presence,{present:r||i.hasThumb,children:(0,ew.jsx)(IE,{ref:t,...n})})}),IE=ek.forwardRef((e,t)=>{let{__scopeScrollArea:r,style:n,...i}=e,a=Ic(I$,r),o=II(I$,r),{onThumbPositionChange:s}=o,l=(0,rh.useComposedRefs)(t,e=>o.onThumbChange(e)),u=ek.useRef(void 0),d=ID(()=>{u.current&&(u.current(),u.current=void 0)},100);return ek.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{d(),u.current||(u.current=Iz(e,s),s())};return s(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[a.viewport,d,s]),(0,ew.jsx)(Io.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:(0,rI.composeEventHandlers)(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;o.onThumbPointerDown({x:r,y:n})}),onPointerUp:(0,rI.composeEventHandlers)(e.onPointerUp,o.onThumbPointerUp)})});Ij.displayName=I$;var IT="ScrollAreaCorner",IC=ek.forwardRef((e,t)=>{let r=Ic(IT,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return"scroll"!==r.type&&n?(0,ew.jsx)(IN,{...e,ref:t}):null});IC.displayName=IT;var IN=ek.forwardRef((e,t)=>{let{__scopeScrollArea:r,...n}=e,i=Ic(IT,r),[a,o]=ek.useState(0),[s,l]=ek.useState(0),u=!!(a&&s);return IU(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),l(e)}),IU(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),u?(0,ew.jsx)(Io.div,{...n,ref:t,style:{width:a,height:s,position:"absolute",right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:0,...e.style}}):null});function IA(e){return e?parseInt(e,10):0}function IR(e,t){let r=e/t;return isNaN(r)?0:r}function IP(e){let t=IR(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd;return Math.max((e.scrollbar.size-r)*t,18)}function IO(e,t,r="ltr"){let n=IP(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=function(e,[t,r]){return Math.min(r,Math.max(t,e))}(e,"ltr"===r?[0,o]:[-1*o,0]);return IM([0,o],[0,a-n])(s)}function IM(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}var Iz=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return!function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=r.left!==a.left,s=r.top!==a.top;(o||s)&&t(),r=a,n=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(n)};function ID(e,t){let r=(0,na.useCallbackRef)(e),n=ek.useRef(0);return ek.useEffect(()=>()=>window.clearTimeout(n.current),[]),ek.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function IU(e,t){let r=(0,na.useCallbackRef)(t);(0,od.useLayoutEffect)(()=>{let t=0;if(e){let n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}e.s(["Corner",0,IC,"Root",0,Ip,"ScrollArea",0,Ip,"ScrollAreaCorner",0,IC,"ScrollAreaScrollbar",0,Ig,"ScrollAreaThumb",0,Ij,"ScrollAreaViewport",0,If,"Scrollbar",0,Ig,"Thumb",0,Ij,"Viewport",0,If,"createScrollAreaScope",0,Iu],60805);var IL=e.i(60805),IL=IL;function IZ({className:e,children:t,...r}){return(0,ew.jsxs)(IL.Root,{"data-slot":"scroll-area",className:(0,r4.cn)("relative overflow-hidden",e),...r,children:[(0,ew.jsx)(IL.Viewport,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] [&>div]:!block",children:t}),(0,ew.jsx)(IF,{}),(0,ew.jsx)(IL.Corner,{})]})}function IF({className:e,orientation:t="vertical",...r}){return(0,ew.jsx)(IL.ScrollAreaScrollbar,{"data-slot":"scroll-area-scrollbar",orientation:t,className:(0,r4.cn)("flex touch-none p-px transition-colors select-none","vertical"===t&&"h-full w-2 border-l border-l-transparent","horizontal"===t&&"h-2 flex-col border-t border-t-transparent",e),...r,children:(0,ew.jsx)(IL.ScrollAreaThumb,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}let IB=rB("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]),IV=rB("panel-left-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);var rX=rX;let Iq=ek.createContext(null);function IW(){let e=ek.useContext(Iq);if(!e)throw Error("useSidebar must be used within a SidebarProvider.");return e}function IJ({defaultOpen:e=!0,open:t,onOpenChange:r,className:n,style:i,children:a,...o}){let s=function(){let[e,t]=ek.useState(void 0);return ek.useEffect(()=>{let e=window.matchMedia("(max-width: 767px)"),r=()=>{t(window.innerWidth<768)};return e.addEventListener("change",r),t(window.innerWidth<768),()=>e.removeEventListener("change",r)},[]),!!e}(),[l,u]=ek.useState(!1),[d,c]=ek.useState(e),p=t??d,m=ek.useCallback(e=>{let t="function"==typeof e?e(p):e;r?r(t):c(t),document.cookie=`sidebar_state=${t}; path=/; max-age=604800`},[r,p]),f=ek.useCallback(()=>s?u(e=>!e):m(e=>!e),[s,m]);ek.useEffect(()=>{let e=e=>{"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[f]);let h=p?"expanded":"collapsed",g=ek.useMemo(()=>({state:h,open:p,setOpen:m,isMobile:s,openMobile:l,setOpenMobile:u,toggleSidebar:f}),[h,p,m,s,l,f]);return(0,ew.jsx)(Iq.Provider,{value:g,children:(0,ew.jsx)(r3.TooltipProvider,{delayDuration:0,children:(0,ew.jsx)("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":"16rem","--sidebar-width-icon":"3rem",...i},className:(0,r4.cn)("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",n),...o,children:a})})})}function IH({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:n,children:i,...a}){let{isMobile:o,state:s,openMobile:l,setOpenMobile:u}=IW();return"none"===r?(0,ew.jsx)("div",{"data-slot":"sidebar",className:(0,r4.cn)("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",n),...a,children:i}):o?(0,ew.jsx)(iF,{open:l,onOpenChange:u,...a,children:(0,ew.jsxs)(iq,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":"18rem"},side:e,children:[(0,ew.jsxs)(iW,{className:"sr-only",children:[(0,ew.jsx)(iJ,{children:"侧边栏"}),(0,ew.jsx)(iH,{children:"显示移动端侧边栏。"})]}),(0,ew.jsx)("div",{className:"flex h-full w-full flex-col",children:i})]})}):(0,ew.jsxs)("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":s,"data-collapsible":"collapsed"===s?r:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[(0,ew.jsx)("div",{"data-slot":"sidebar-gap",className:(0,r4.cn)("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===t||"inset"===t?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),(0,ew.jsx)("div",{"data-slot":"sidebar-container",className:(0,r4.cn)("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex","left"===e?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===t||"inset"===t?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",n),...a,children:(0,ew.jsx)("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm",children:i})})]})}function IK({className:e,onClick:t,...r}){let{open:n,toggleSidebar:i}=IW(),a=n?"收起侧边栏":"展开侧边栏";return(0,ew.jsxs)(r5,{"data-sidebar":"trigger","data-slot":"sidebar-trigger","aria-label":a,variant:"ghost",size:"icon",className:(0,r4.cn)("size-7",e),onClick:e=>{t?.(e),i()},...r,children:[(0,ew.jsx)(n?IB:IV,{}),(0,ew.jsx)("span",{className:"sr-only",children:a})]})}function IG({className:e,...t}){let{toggleSidebar:r}=IW();return(0,ew.jsx)("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"切换侧边栏",tabIndex:-1,onClick:r,title:"切换侧边栏",className:(0,r4.cn)("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})}function IY({className:e,...t}){return(0,ew.jsx)("main",{"data-slot":"sidebar-inset",className:(0,r4.cn)("relative flex w-full flex-1 flex-col bg-background","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",e),...t})}function IX({className:e,...t}){return(0,ew.jsx)("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:(0,r4.cn)("flex flex-col gap-2 p-2",e),...t})}function IQ({className:e,...t}){return(0,ew.jsx)("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:(0,r4.cn)("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function I0({className:e,...t}){return(0,ew.jsx)("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:(0,r4.cn)("flex w-full min-w-0 flex-col gap-1",e),...t})}function I1({className:e,...t}){return(0,ew.jsx)("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:(0,r4.cn)("group/menu-item relative",e),...t})}let I2=r2("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function I4({asChild:e=!1,isActive:t=!1,variant:r="default",size:n="default",tooltip:i,className:a,...o}){let s=e?rX.Root:"button",{isMobile:l,state:u}=IW(),d=(0,ew.jsx)(s,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":n,"data-active":t,className:(0,r4.cn)(I2({variant:r,size:n}),a),...o});return i?("string"==typeof i&&(i={children:i}),(0,ew.jsxs)(r3.Tooltip,{children:[(0,ew.jsx)(r3.TooltipTrigger,{asChild:!0,children:d}),(0,ew.jsx)(r3.TooltipContent,{side:"right",align:"center",hidden:"collapsed"!==u||l,...i})]})):d}function I6({workspacePath:e,workspaceTitle:t,openInNewWindowHref:r,localNewThreadHref:n,onNewThreadClick:i,...a}){let o=e?.trim()||"当前项目",s=t?.trim()||function(e){let t=e.replace(/\\/g,"/").replace(/\/+$/g,"");if(!t||"/"===t)return t||"当前项目";let r=t.split("/").filter(Boolean);return r[r.length-1]??t}(o);return(0,ew.jsxs)(IH,{...a,children:[(0,ew.jsx)(IX,{className:"aui-sidebar-header mb-2 border-b",children:(0,ew.jsxs)("div",{className:"aui-sidebar-header-content flex items-center justify-between",children:[(0,ew.jsx)(I0,{className:"min-w-0 flex-1",children:(0,ew.jsx)(I1,{children:(0,ew.jsx)(I4,{size:"lg",asChild:!0,children:(0,ew.jsxs)("div",{children:[(0,ew.jsx)(_Y,{className:"aui-sidebar-header-icon size-4"}),(0,ew.jsxs)("div",{className:"aui-sidebar-header-heading me-2 min-w-0 space-y-1 leading-none",children:[(0,ew.jsx)("span",{className:"aui-sidebar-header-title block min-w-0 truncate font-semibold",title:s,children:s}),(0,ew.jsx)("span",{className:"aui-sidebar-header-description block min-w-0 truncate text-sidebar-foreground/60 text-xs",title:o,children:o})]})]})})})}),(0,ew.jsx)(In,{})]})}),(0,ew.jsx)(IQ,{className:"aui-sidebar-content overflow-hidden px-0",children:(0,ew.jsx)(IZ,{className:"aui-thread-list-scroll-area min-h-0 flex-1",children:(0,ew.jsx)("div",{className:"aui-thread-list-scroll-content w-full min-w-0 px-2",children:(0,ew.jsx)(k1,{openInNewWindowHref:r,localNewThreadHref:n,onNewThreadClick:i})})})}),(0,ew.jsx)(IG,{})]})}var I5=e.i(67034),I3="vercel.ai.error",I9=Symbol.for(I3),I8=class e extends(I=Error,k=I9,I){constructor({name:e,message:t,cause:r}){super(t),this[k]=!0,this.name=e,this.cause=r}static isInstance(t){return e.hasMarker(t,I3)}static hasMarker(e,t){let r=Symbol.for(t);return null!=e&&"object"==typeof e&&r in e&&"boolean"==typeof e[r]&&!0===e[r]}},I7="AI_APICallError",Se=`vercel.ai.error.${I7}`,St=Symbol.for(Se),Sr=class extends($=I8,S=St,$){constructor({message:e,url:t,requestBodyValues:r,statusCode:n,responseHeaders:i,responseBody:a,cause:o,isRetryable:s=null!=n&&(408===n||409===n||429===n||n>=500),data:l}){super({name:I7,message:e,cause:o}),this[S]=!0,this.url=t,this.requestBodyValues=r,this.statusCode=n,this.responseHeaders=i,this.responseBody=a,this.isRetryable=s,this.data=l}static isInstance(e){return I8.hasMarker(e,Se)}},Sn="AI_EmptyResponseBodyError",Si=`vercel.ai.error.${Sn}`,Sa=Symbol.for(Si),So=class extends(E=I8,j=Sa,E){constructor({message:e="Empty response body"}={}){super({name:Sn,message:e}),this[j]=!0}static isInstance(e){return I8.hasMarker(e,Si)}};function Ss(e){return null==e?"unknown error":"string"==typeof e?e:e instanceof Error?e.message:JSON.stringify(e)}var Sl="AI_InvalidArgumentError",Su=`vercel.ai.error.${Sl}`,Sd=Symbol.for(Su),Sc=class extends(C=I8,T=Sd,C){constructor({message:e,cause:t,argument:r}){super({name:Sl,message:e,cause:t}),this[T]=!0,this.argument=r}static isInstance(e){return I8.hasMarker(e,Su)}},Sp=Symbol.for("vercel.ai.error.AI_InvalidPromptError");Symbol.for("vercel.ai.error.AI_InvalidResponseDataError");var Sm="AI_JSONParseError",Sf=`vercel.ai.error.${Sm}`,Sh=Symbol.for(Sf),Sg=class extends(A=I8,N=Sh,A){constructor({text:e,cause:t}){super({name:Sm,message:`JSON parsing failed: Text: ${e}.
|
|
8
|
+
Error message: ${Ss(t)}`,cause:t}),this[N]=!0,this.text=e}static isInstance(e){return I8.hasMarker(e,Sf)}},Sv=Symbol.for("vercel.ai.error.AI_LoadAPIKeyError");Symbol.for("vercel.ai.error.AI_LoadSettingError");Symbol.for("vercel.ai.error.AI_NoContentGeneratedError");Symbol.for("vercel.ai.error.AI_NoSuchModelError");Symbol.for("vercel.ai.error.AI_TooManyEmbeddingValuesForCallError");var Sy="AI_TypeValidationError",Sb=`vercel.ai.error.${Sy}`,Sx=Symbol.for(Sb),Sw=class e extends(P=I8,R=Sx,P){constructor({value:e,cause:t,context:r}){let n="Type validation failed";if((null==r?void 0:r.field)&&(n+=` for ${r.field}`),(null==r?void 0:r.entityName)||(null==r?void 0:r.entityId)){n+=" (";const e=[];r.entityName&&e.push(r.entityName),r.entityId&&e.push(`id: "${r.entityId}"`),n+=e.join(", "),n+=")"}super({name:Sy,message:`${n}: Value: ${JSON.stringify(e)}.
|
|
9
|
+
Error message: ${Ss(t)}`,cause:t}),this[R]=!0,this.value=e,this.context=r}static isInstance(e){return I8.hasMarker(e,Sb)}static wrap({value:t,cause:r,context:n}){var i,a,o;return e.isInstance(r)&&r.value===t&&(null==(i=r.context)?void 0:i.field)===(null==n?void 0:n.field)&&(null==(a=r.context)?void 0:a.entityName)===(null==n?void 0:n.entityName)&&(null==(o=r.context)?void 0:o.entityId)===(null==n?void 0:n.entityId)?r:new e({value:t,cause:r,context:n})}},S_=Symbol.for("vercel.ai.error.AI_UnsupportedFunctionalityError");let Sk=Object.freeze({status:"aborted"});function SI(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:o,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in r||(r[t]=i[t].bind(r))}}let i=r?.Parent??Object;class a extends i{}function o(e){var t;let i=r?.Parent?new a:this;for(let r of(n(i,e),(t=i._zod).deferred??(t.deferred=[]),i._zod.deferred))r();return i}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}let SS=Symbol("zod_brand");class S$ extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Sj extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(O=globalThis).__zod_globalConfig??(O.__zod_globalConfig={});let SE=globalThis.__zod_globalConfig;function ST(e){return e&&Object.assign(SE,e),SE}function SC(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function SN(e,t="|"){return e.map(e=>SQ(e)).join(t)}function SA(e,t){return"bigint"==typeof t?t.toString():t}function SR(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function SP(e){return null==e}function SO(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function SM(e,t){let r=e/t,n=Math.round(r),i=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<i?0:r-n}e.s(["$ZodAsyncError",0,S$,"$ZodEncodeError",0,Sj,"$brand",0,SS,"$constructor",0,SI,"NEVER",0,Sk,"config",0,ST,"globalConfig",0,SE],97753);let Sz=Symbol("evaluating");function SD(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Sz)return void 0===n&&(n=Sz,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function SU(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function SL(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function SZ(e){return JSON.stringify(e)}function SF(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}let SB="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function SV(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let Sq=SR(()=>{if(SE.jitless||"u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function SW(e){if(!1===SV(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==SV(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function SJ(e){return SW(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let SH=new Set(["string","number","symbol"]),SK=new Set(["string","number","bigint","boolean","symbol","undefined"]);function SG(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function SY(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function SX(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}function SQ(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}function S0(e){return Object.keys(e).filter(t=>"optional"===e[t]._zod.optin&&"optional"===e[t]._zod.optout)}let S1={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},S2={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function S4(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function S6(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function S5(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function S3(e){return"string"==typeof e?e:e?.message}function S9(e,t,r){let n=e.message?e.message:S3(e.inst?._zod.def?.error?.(e))??S3(t?.error?.(e))??S3(r.customError?.(e))??S3(r.localeError?.(e))??"Invalid input",{inst:i,continue:a,input:o,...s}=e;return s.path??(s.path=[]),s.message=n,t?.reportInput&&(s.input=o),s}function S8(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function S7(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function $e(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":if(null===e)return"null";if(Array.isArray(e))return"array";if(e&&Object.getPrototypeOf(e)!==Object.prototype&&"constructor"in e&&e.constructor)return e.constructor.name}return t}function $t(...e){let[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}function $r(e){let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r}function $n(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}e.s(["BIGINT_FORMAT_RANGES",0,S2,"Class",0,class{constructor(...e){}},"NUMBER_FORMAT_RANGES",0,S1,"aborted",0,S4,"allowsEval",0,Sq,"assert",0,function(e){},"assertEqual",0,function(e){return e},"assertIs",0,function(e){},"assertNever",0,function(e){throw Error("Unexpected value in exhaustive check")},"assertNotEqual",0,function(e){return e},"assignProp",0,SU,"base64ToUint8Array",0,$r,"base64urlToUint8Array",0,function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return $r(t+r)},"cached",0,SR,"captureStackTrace",0,SB,"cleanEnum",0,function(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])},"cleanRegex",0,SO,"clone",0,SY,"cloneDef",0,function(e){return SL(e._zod.def)},"createTransparentProxy",0,function(e){let t;return new Proxy({},{get:(r,n,i)=>(t??(t=e()),Reflect.get(t,n,i)),set:(r,n,i,a)=>(t??(t=e()),Reflect.set(t,n,i,a)),has:(r,n)=>(t??(t=e()),Reflect.has(t,n)),deleteProperty:(r,n)=>(t??(t=e()),Reflect.deleteProperty(t,n)),ownKeys:r=>(t??(t=e()),Reflect.ownKeys(t)),getOwnPropertyDescriptor:(r,n)=>(t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)),defineProperty:(r,n,i)=>(t??(t=e()),Reflect.defineProperty(t,n,i))})},"defineLazy",0,SD,"esc",0,SZ,"escapeRegex",0,SG,"explicitlyAborted",0,S6,"extend",0,function(e,t){if(!SW(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let r=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=SL(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return SU(this,"shape",r),r}});return SY(e,n)},"finalizeIssue",0,S9,"floatSafeRemainder",0,SM,"getElementAtPath",0,function(e,t){return t?t.reduce((e,t)=>e?.[t],e):e},"getEnumValues",0,SC,"getLengthableOrigin",0,S7,"getParsedType",0,e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(null===e)return"null";if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return"promise";if("u">typeof Map&&e instanceof Map)return"map";if("u">typeof Set&&e instanceof Set)return"set";if("u">typeof Date&&e instanceof Date)return"date";if("u">typeof File&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},"getSizableOrigin",0,S8,"hexToUint8Array",0,function(e){let t=e.replace(/^0x/,"");if(t.length%2!=0)throw Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)r[e/2]=Number.parseInt(t.slice(e,e+2),16);return r},"isObject",0,SV,"isPlainObject",0,SW,"issue",0,$t,"joinValues",0,SN,"jsonStringifyReplacer",0,SA,"merge",0,function(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=SL(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return SU(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return SY(e,r)},"mergeDefs",0,SL,"normalizeParams",0,SX,"nullish",0,SP,"numKeys",0,function(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t},"objectClone",0,function(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))},"omit",0,function(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=SL(e._zod.def,{get shape(){let n={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return SU(this,"shape",n),n},checks:[]});return SY(e,i)},"optionalKeys",0,S0,"parsedType",0,$e,"partial",0,function(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=SL(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t in r){if(!(t in n))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(let t in n)i[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return SU(this,"shape",i),i},checks:[]});return SY(t,i)},"pick",0,function(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=SL(e._zod.def,{get shape(){let e={};for(let n in t){if(!(n in r.shape))throw Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return SU(this,"shape",e),e},checks:[]});return SY(e,i)},"prefixIssues",0,S5,"primitiveTypes",0,SK,"promiseAllObject",0,function(e){let t=Object.keys(e);return Promise.all(t.map(t=>e[t])).then(e=>{let r={};for(let n=0;n<t.length;n++)r[t[n]]=e[n];return r})},"propertyKeyTypes",0,SH,"randomString",0,function(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r},"required",0,function(e,t,r){let n=SL(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t in r){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(let t in n)i[t]=new e({type:"nonoptional",innerType:n[t]});return SU(this,"shape",i),i}});return SY(t,n)},"safeExtend",0,function(e,t){if(!SW(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=SL(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return SU(this,"shape",r),r}});return SY(e,r)},"shallowClone",0,SJ,"slugify",0,SF,"stringifyPrimitive",0,SQ,"uint8ArrayToBase64",0,$n,"uint8ArrayToBase64url",0,function(e){return $n(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},"uint8ArrayToHex",0,function(e){return Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("")},"unwrapMessage",0,S3],22143);let $i=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,SA,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},$a=SI("$ZodError",$i),$o=SI("$ZodError",$i,{Parent:Error});function $s(e,t=e=>e.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function $l(e,t=e=>e.message){let r={_errors:[]},n=(e,i=[])=>{for(let a of e.issues)if("invalid_union"===a.code&&a.errors.length)a.errors.map(e=>n({issues:e},[...i,...a.path]));else if("invalid_key"===a.code)n({issues:a.issues},[...i,...a.path]);else if("invalid_element"===a.code)n({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(0===e.length)r._errors.push(t(a));else{let n=r,i=0;for(;i<e.length;){let r=e[i];i===e.length-1?(n[r]=n[r]||{_errors:[]},n[r]._errors.push(t(a))):n[r]=n[r]||{_errors:[]},n=n[r],i++}}}};return n(e),r}function $u(e,t=e=>e.message){let r={errors:[]},n=(e,i=[])=>{var a,o;for(let s of e.issues)if("invalid_union"===s.code&&s.errors.length)s.errors.map(e=>n({issues:e},[...i,...s.path]));else if("invalid_key"===s.code)n({issues:s.issues},[...i,...s.path]);else if("invalid_element"===s.code)n({issues:s.issues},[...i,...s.path]);else{let e=[...i,...s.path];if(0===e.length){r.errors.push(t(s));continue}let n=r,l=0;for(;l<e.length;){let r=e[l],i=l===e.length-1;"string"==typeof r?(n.properties??(n.properties={}),(a=n.properties)[r]??(a[r]={errors:[]}),n=n.properties[r]):(n.items??(n.items=[]),(o=n.items)[r]??(o[r]={errors:[]}),n=n.items[r]),i&&n.errors.push(t(s)),l++}}};return n(e),r}function $d(e){let t=[];for(let r of e.map(e=>"object"==typeof e?e.key:e))"number"==typeof r?t.push(`[${r}]`):"symbol"==typeof r?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function $c(e){let t=[];for(let r of[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length))t.push(`✖ ${r.message}`),r.path?.length&&t.push(` → at ${$d(r.path)}`);return t.join("\n")}e.s(["$ZodError",0,$a,"$ZodRealError",0,$o,"flattenError",0,$s,"formatError",0,$l,"prettifyError",0,$c,"toDotPath",0,$d,"treeifyError",0,$u],74969);let $p=e=>(t,r,n,i)=>{let a=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new S$;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>S9(e,a,ST())));throw SB(t,i?.callee),t}return o.value},$m=$p($o),$f=e=>async(t,r,n,i)=>{let a=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>S9(e,a,ST())));throw SB(t,i?.callee),t}return o.value},$h=$f($o),$g=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new S$;return a.issues.length?{success:!1,error:new(e??$a)(a.issues.map(e=>S9(e,i,ST())))}:{success:!0,data:a.value}},$v=$g($o),$y=e=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>S9(e,i,ST())))}:{success:!0,data:a.value}},$b=$y($o),$x=e=>(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return $p(e)(t,r,i)},$w=$x($o),$_=e=>(t,r,n)=>$p(e)(t,r,n),$k=$_($o),$I=e=>async(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return $f(e)(t,r,i)},$S=$I($o),$$=e=>async(t,r,n)=>$f(e)(t,r,n),$j=$$($o),$E=e=>(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return $g(e)(t,r,i)},$T=$E($o),$C=e=>(t,r,n)=>$g(e)(t,r,n),$N=$C($o),$A=e=>async(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return $y(e)(t,r,i)},$R=$A($o),$P=e=>async(t,r,n)=>$y(e)(t,r,n),$O=$P($o);e.s(["_decode",0,$_,"_decodeAsync",0,$$,"_encode",0,$x,"_encodeAsync",0,$I,"_parse",0,$p,"_parseAsync",0,$f,"_safeDecode",0,$C,"_safeDecodeAsync",0,$P,"_safeEncode",0,$E,"_safeEncodeAsync",0,$A,"_safeParse",0,$g,"_safeParseAsync",0,$y,"decode",0,$k,"decodeAsync",0,$j,"encode",0,$w,"encodeAsync",0,$S,"parse",0,$m,"parseAsync",0,$h,"safeDecode",0,$N,"safeDecodeAsync",0,$O,"safeEncode",0,$T,"safeEncodeAsync",0,$R,"safeParse",0,$v,"safeParseAsync",0,$b],3108);let $M=(e,t)=>{$a.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>$l(e,t)},flatten:{value:t=>$s(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,SA,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,SA,2)}},isEmpty:{get:()=>0===e.issues.length}})},$z=SI("ZodError",$M),$D=SI("ZodError",$M,{Parent:Error});e.s(["ZodError",0,$z,"ZodRealError",0,$D],89282);let $U=$p($D),$L=$f($D),$Z=$g($D),$F=$y($D),$B=$x($D),$V=$_($D),$q=$I($D),$W=$$($D),$J=$E($D),$H=$C($D),$K=$A($D),$G=$P($D);e.s(["decode",0,$V,"decodeAsync",0,$W,"encode",0,$B,"encodeAsync",0,$q,"parse",0,$U,"parseAsync",0,$L,"safeDecode",0,$H,"safeDecodeAsync",0,$G,"safeEncode",0,$J,"safeEncodeAsync",0,$K,"safeParse",0,$Z,"safeParseAsync",0,$F],364);let $Y=Symbol("ZodOutput"),$X=Symbol("ZodInput");class $Q{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function $0(){return new $Q}(M=globalThis).__zod_globalRegistry??(M.__zod_globalRegistry=$0());let $1=globalThis.__zod_globalRegistry;function $2(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??$1,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function $4(e,t,r={path:[],schemaPath:[]}){var n;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,r.schemaPath.includes(e)&&(a.cycle=r.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,n);else{let r=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,r,n)}let a=e._zod.parent;a&&(o.ref||(o.ref=a),$4(a,t,n),t.seen.get(a).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(o.schema,l),"input"===t.io&&function e(t,r){let n=r??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);let i=t._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return e(i.element,n);if("set"===i.type)return e(i.valueType,n);if("lazy"===i.type)return e(i.getter(),n);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type)return e(i.innerType,n);if("intersection"===i.type)return e(i.left,n)||e(i.right,n);if("record"===i.type||"map"===i.type)return e(i.keyType,n)||e(i.valueType,n);if("pipe"===i.type)return!!t._zod.traits.has("$ZodCodec")||e(i.in,n)||e(i.out,n);if("object"===i.type){for(let t in i.shape)if(e(i.shape[t],n))return!0;return!1}if("union"===i.type){for(let t of i.options)if(e(t,n))return!0;return!1}if("tuple"===i.type){for(let t of i.items)if(e(t,n))return!0;if(i.rest&&e(i.rest,n))return!0}return!1}(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&"_prefault"in o.schema&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function $6(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let t of e.seen.entries()){let r=e.metadataRegistry.get(t[0])?.id;if(r){let e=n.get(r);if(e&&e!==t[0])throw Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(r,t[0])}}let i=t=>{if(t[1].schema.$ref)return;let n=t[1],{ref:i,defId:a}=(t=>{let n="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let r=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(r)return{ref:i(r)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i("__shared")}#/${n}/${a}`}}if(t[1]===r)return{ref:"#"};let i=`#/${n}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}})(t);n.def={...n.schema},a&&(n.defId=a);let o=n.schema;for(let e in o)delete o[e];o.$ref=i};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
|
|
10
|
+
|
|
11
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let n=r[1];if(t===r[0]){i(r);continue}if(e.external){let n=e.external.registry.get(r[0])?.id;if(t!==r[0]&&n){i(r);continue}}if(e.metadataRegistry.get(r[0])?.id||n.cycle||n.count>1&&"ref"===e.reused){i(r);continue}}}function $5(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=t=>{let r=e.seen.get(t);if(null===r.ref)return;let i=r.def??r.schema,a={...i},o=r.ref;if(r.ref=null,o){n(o);let r=e.seen.get(o),s=r.schema;if(s.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in a||delete i[e]);if(s.$ref&&r.def)for(let e in i)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(i[e])===JSON.stringify(r.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){n(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:r.path??[]})};for(let t of[...e.seen.entries()].reverse())n(t[0]);let i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let r=e.external.registry.get(t)?.id;if(!r)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(r)}Object.assign(i,r.def??r.schema);let a=e.metadataRegistry.get(t)?.id;void 0!==a&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{let r=JSON.parse(JSON.stringify(i));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:$9(t,"input",e.processors),output:$9(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}e.s(["$ZodRegistry",0,$Q,"$input",0,$X,"$output",0,$Y,"globalRegistry",0,$1,"registry",0,$0],25527);let $3=(e,t={})=>r=>{let n=$2({...r,processors:t});return $4(e,n),$6(n,e),$5(n,e)},$9=(e,t,r={})=>n=>{let{libraryOptions:i,target:a}=n??{},o=$2({...i??{},target:a,io:t,processors:r});return $4(e,o),$6(o,e),$5(o,e)};e.s(["createStandardJSONSchemaMethod",0,$9,"createToJSONSchemaMethod",0,$3,"extractDefs",0,$6,"finalize",0,$5,"initializeContext",0,$2,"process",0,$4],34966);let $8={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},$7=(e,t,r,n)=>{r.type="string";let{minimum:i,maximum:a,format:o,patterns:s,contentEncoding:l}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof a&&(r.maxLength=a),o&&(r.format=$8[o]??o,""===r.format&&delete r.format,"time"===o&&delete r.format),l&&(r.contentEncoding=l),s&&s.size>0){let e=[...s];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}},je=(e,t,r,n)=>{let{minimum:i,maximum:a,format:o,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;"string"==typeof o&&o.includes("int")?r.type="integer":r.type="number";let d="number"==typeof u&&u>=(i??-1/0),c="number"==typeof l&&l<=(a??1/0),p="draft-04"===t.target||"openapi-3.0"===t.target;d?p?(r.minimum=u,r.exclusiveMinimum=!0):r.exclusiveMinimum=u:"number"==typeof i&&(r.minimum=i),c?p?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l:"number"==typeof a&&(r.maximum=a),"number"==typeof s&&(r.multipleOf=s)},jt=(e,t,r,n)=>{r.type="boolean"},jr=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")},jn=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Symbols cannot be represented in JSON Schema")},ji=(e,t,r,n)=>{"openapi-3.0"===t.target?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},ja=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Undefined cannot be represented in JSON Schema")},jo=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Void cannot be represented in JSON Schema")},js=(e,t,r,n)=>{r.not={}},jl=(e,t,r,n)=>{},ju=(e,t,r,n)=>{},jd=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Date cannot be represented in JSON Schema")},jc=(e,t,r,n)=>{let i=SC(e._zod.def.entries);i.every(e=>"number"==typeof e)&&(r.type="number"),i.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=i},jp=(e,t,r,n)=>{let i=e._zod.def,a=[];for(let e of i.values)if(void 0===e){if("throw"===t.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e)if("throw"===t.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");else a.push(Number(e));else a.push(e);if(0===a.length);else if(1===a.length){let e=a[0];r.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?r.enum=[e]:r.const=e}else a.every(e=>"number"==typeof e)&&(r.type="number"),a.every(e=>"string"==typeof e)&&(r.type="string"),a.every(e=>"boolean"==typeof e)&&(r.type="boolean"),a.every(e=>null===e)&&(r.type="null"),r.enum=a},jm=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("NaN cannot be represented in JSON Schema")},jf=(e,t,r,n)=>{let i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");r.type="string",r.pattern=i.source},jh=(e,t,r,n)=>{let i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:o,mime:s}=e._zod.bag;void 0!==a&&(i.minLength=a),void 0!==o&&(i.maxLength=o),s?1===s.length?(i.contentMediaType=s[0],Object.assign(r,i)):(Object.assign(r,i),r.anyOf=s.map(e=>({contentMediaType:e}))):Object.assign(r,i)},jg=(e,t,r,n)=>{r.type="boolean"},jv=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")},jy=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Function types cannot be represented in JSON Schema")},jb=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")},jx=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Map cannot be represented in JSON Schema")},jw=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Set cannot be represented in JSON Schema")},j_=(e,t,r,n)=>{let i=e._zod.def,{minimum:a,maximum:o}=e._zod.bag;"number"==typeof a&&(r.minItems=a),"number"==typeof o&&(r.maxItems=o),r.type="array",r.items=$4(i.element,t,{...n,path:[...n.path,"items"]})},jk=(e,t,r,n)=>{let i=e._zod.def;r.type="object",r.properties={};let a=i.shape;for(let e in a)r.properties[e]=$4(a[e],t,{...n,path:[...n.path,"properties",e]});let o=new Set([...new Set(Object.keys(a))].filter(e=>{let r=i.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));o.size>0&&(r.required=Array.from(o)),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=$4(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)},jI=(e,t,r,n)=>{let i=e._zod.def,a=!1===i.inclusive,o=i.options.map((e,r)=>$4(e,t,{...n,path:[...n.path,a?"oneOf":"anyOf",r]}));a?r.oneOf=o:r.anyOf=o},jS=(e,t,r,n)=>{let i=e._zod.def,a=$4(i.left,t,{...n,path:[...n.path,"allOf",0]}),o=$4(i.right,t,{...n,path:[...n.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length;r.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},j$=(e,t,r,n)=>{let i=e._zod.def;r.type="array";let a="draft-2020-12"===t.target?"prefixItems":"items",o="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",s=i.items.map((e,r)=>$4(e,t,{...n,path:[...n.path,a,r]})),l=i.rest?$4(i.rest,t,{...n,path:[...n.path,o,..."openapi-3.0"===t.target?[i.items.length]:[]]}):null;"draft-2020-12"===t.target?(r.prefixItems=s,l&&(r.items=l)):"openapi-3.0"===t.target?(r.items={anyOf:s},l&&r.items.anyOf.push(l),r.minItems=s.length,l||(r.maxItems=s.length)):(r.items=s,l&&(r.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;"number"==typeof u&&(r.minItems=u),"number"==typeof d&&(r.maxItems=d)},jj=(e,t,r,n)=>{let i=e._zod.def;r.type="object";let a=i.keyType,o=a._zod.bag,s=o?.patterns;if("loose"===i.mode&&s&&s.size>0){let e=$4(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});for(let t of(r.patternProperties={},s))r.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(r.propertyNames=$4(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),r.additionalProperties=$4(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let l=a._zod.values;if(l){let e=[...l].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e)}},jE=(e,t,r,n)=>{let i=e._zod.def,a=$4(i.innerType,t,n),o=t.seen.get(e);"openapi-3.0"===t.target?(o.ref=i.innerType,r.nullable=!0):r.anyOf=[a,{type:"null"}]},jT=(e,t,r,n)=>{let i=e._zod.def;$4(i.innerType,t,n),t.seen.get(e).ref=i.innerType},jC=(e,t,r,n)=>{let i=e._zod.def;$4(i.innerType,t,n),t.seen.get(e).ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},jN=(e,t,r,n)=>{let i=e._zod.def;$4(i.innerType,t,n),t.seen.get(e).ref=i.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},jA=(e,t,r,n)=>{let i,a=e._zod.def;$4(a.innerType,t,n),t.seen.get(e).ref=a.innerType;try{i=a.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},jR=(e,t,r,n)=>{let i=e._zod.def,a=i.in._zod.traits.has("$ZodTransform"),o="input"===t.io?a?i.out:i.in:i.out;$4(o,t,n),t.seen.get(e).ref=o},jP=(e,t,r,n)=>{let i=e._zod.def;$4(i.innerType,t,n),t.seen.get(e).ref=i.innerType,r.readOnly=!0},jO=(e,t,r,n)=>{let i=e._zod.def;$4(i.innerType,t,n),t.seen.get(e).ref=i.innerType},jM=(e,t,r,n)=>{let i=e._zod.def;$4(i.innerType,t,n),t.seen.get(e).ref=i.innerType},jz=(e,t,r,n)=>{let i=e._zod.innerType;$4(i,t,n),t.seen.get(e).ref=i},jD={string:$7,number:je,boolean:jt,bigint:jr,symbol:jn,null:ji,undefined:ja,void:jo,never:js,any:jl,unknown:ju,date:jd,enum:jc,literal:jp,nan:jm,template_literal:jf,file:jh,success:jg,custom:jv,function:jy,transform:jb,map:jx,set:jw,array:j_,object:jk,union:jI,intersection:jS,tuple:j$,record:jj,nullable:jE,nonoptional:jT,default:jC,prefault:jN,catch:jA,pipe:jR,readonly:jP,promise:jO,optional:jM,lazy:jz};function jU(e,t){if("_idmap"in e){let r=$2({...t,processors:jD}),n={};for(let t of e._idmap.entries()){let[e,n]=t;$4(n,r)}let i={};for(let a of(r.external={registry:e,uri:t?.uri,defs:n},e._idmap.entries())){let[e,t]=a;$6(r,t),i[e]=$5(r,t)}return Object.keys(n).length>0&&(i.__shared={["draft-2020-12"===r.target?"$defs":"definitions"]:n}),{schemas:i}}let r=$2({...t,processors:jD});return $4(e,r),$6(r,e),$5(r,e)}(f=z||(z={})).assertEqual=e=>{},f.assertIs=function(e){},f.assertNever=function(e){throw Error()},f.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},f.getValidEnumValues=e=>{let t=f.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let n of t)r[n]=e[n];return f.objectValues(r)},f.objectValues=e=>f.objectKeys(e).map(function(t){return e[t]}),f.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},f.find=(e,t)=>{for(let r of e)if(t(r))return r},f.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,f.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},f.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(D||(D={})).mergeShapes=(e,t)=>({...e,...t});let jL=z.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),jZ=e=>{switch(typeof e){case"undefined":return jL.undefined;case"string":return jL.string;case"number":return Number.isNaN(e)?jL.nan:jL.number;case"boolean":return jL.boolean;case"function":return jL.function;case"bigint":return jL.bigint;case"symbol":return jL.symbol;case"object":if(Array.isArray(e))return jL.array;if(null===e)return jL.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return jL.promise;if("u">typeof Map&&e instanceof Map)return jL.map;if("u">typeof Set&&e instanceof Set)return jL.set;if("u">typeof Date&&e instanceof Date)return jL.date;return jL.object;default:return jL.unknown}},jF=z.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class jB extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){let r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof jB))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,z.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t=Object.create(null),r=[];for(let n of this.issues)if(n.path.length>0){let r=n.path[0];t[r]=t[r]||[],t[r].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}jB.create=e=>new jB(e);let jV=(e,t)=>{let r;switch(e.code){case jF.invalid_type:r=e.received===jL.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case jF.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,z.jsonStringifyReplacer)}`;break;case jF.unrecognized_keys:r=`Unrecognized key(s) in object: ${z.joinValues(e.keys,", ")}`;break;case jF.invalid_union:r="Invalid input";break;case jF.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${z.joinValues(e.options)}`;break;case jF.invalid_enum_value:r=`Invalid enum value. Expected ${z.joinValues(e.options)}, received '${e.received}'`;break;case jF.invalid_arguments:r="Invalid function arguments";break;case jF.invalid_return_type:r="Invalid function return type";break;case jF.invalid_date:r="Invalid date";break;case jF.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:z.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case jF.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case jF.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case jF.custom:r="Invalid input";break;case jF.invalid_intersection_types:r="Intersection results could not be merged";break;case jF.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case jF.not_finite:r="Number must be finite";break;default:r=t.defaultError,z.assertNever(e)}return{message:r}};(h=U||(U={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},h.toString=e=>"string"==typeof e?e:e?.message;let jq=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,a=[...r,...i.path||[]],o={...i,path:a};if(void 0!==i.message)return{...i,path:a,message:i.message};let s="";for(let e of n.filter(e=>!!e).slice().reverse())s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function jW(e,t){let r=jq({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,jV,void 0].filter(e=>!!e)});e.common.issues.push(r)}class jJ{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if("aborted"===n.status)return jH;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return jJ.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:t,value:i}=n;if("aborted"===t.status||"aborted"===i.status)return jH;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||n.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let jH=Object.freeze({status:"aborted"}),jK=e=>({status:"dirty",value:e}),jG=e=>({status:"valid",value:e}),jY=e=>"u">typeof Promise&&e instanceof Promise;class jX{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let jQ=(e,t)=>{if("valid"===t.status)return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new jB(e.common.issues);return this._error=t,this._error}}};function j0(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return"invalid_enum_value"===t.code?{message:a??i.defaultError}:void 0===i.data?{message:a??n??i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:a??r??i.defaultError}},description:i}}class j1{get description(){return this._def.description}_getType(e){return jZ(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:jZ(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new jJ,ctx:{common:e.parent.common,data:e.data,parsedType:jZ(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(jY(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jZ(e)},n=this._parseSync({data:e,path:r.path,parent:r});return jQ(r,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jZ(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return"valid"===r.status?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>"valid"===e.status?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jZ(e)},n=this._parse({data:e,path:r.path,parent:r});return jQ(r,await (jY(n)?n:Promise.resolve(n)))}refine(e,t){return this._refinement((r,n)=>{let i=e(r),a=()=>n.addIssue({code:jF.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"u">typeof Promise&&i instanceof Promise?i.then(e=>!!e||(a(),!1)):!!i||(a(),!1)})}refinement(e,t){return this._refinement((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1))}_refinement(e){return new ED({schema:this,typeName:L.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return EU.create(this,this._def)}nullable(){return EL.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ew.create(this)}promise(){return Ez.create(this,this._def)}or(e){return Ek.create([this,e],this._def)}and(e){return E$.create(this,e,this._def)}transform(e){return new ED({...j0(this._def),schema:this,typeName:L.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new EZ({...j0(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:L.ZodDefault})}brand(){return new EV({typeName:L.ZodBranded,type:this,...j0(this._def)})}catch(e){return new EF({...j0(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:L.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return Eq.create(this,e)}readonly(){return EW.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let j2=/^c[^\s-]{8,}$/i,j4=/^[0-9a-z]+$/,j6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,j5=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,j3=/^[a-z0-9_-]{21}$/i,j9=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,j8=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,j7=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ee=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Et=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Er=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,En=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ei=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ea=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Eo="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Es=RegExp(`^${Eo}$`);function El(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}class Eu extends j1{_parse(e){var r,n,i,a;let o;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==jL.string){let t=this._getOrReturnCtx(e);return jW(t,{code:jF.invalid_type,expected:jL.string,received:t.parsedType}),jH}let s=new jJ;for(let l of this._def.checks)if("min"===l.kind)e.data.length<l.value&&(jW(o=this._getOrReturnCtx(e,o),{code:jF.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),s.dirty());else if("max"===l.kind)e.data.length>l.value&&(jW(o=this._getOrReturnCtx(e,o),{code:jF.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),s.dirty());else if("length"===l.kind){let t=e.data.length>l.value,r=e.data.length<l.value;(t||r)&&(o=this._getOrReturnCtx(e,o),t?jW(o,{code:jF.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):r&&jW(o,{code:jF.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),s.dirty())}else if("email"===l.kind)j7.test(e.data)||(jW(o=this._getOrReturnCtx(e,o),{validation:"email",code:jF.invalid_string,message:l.message}),s.dirty());else if("emoji"===l.kind)t||(t=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),t.test(e.data)||(jW(o=this._getOrReturnCtx(e,o),{validation:"emoji",code:jF.invalid_string,message:l.message}),s.dirty());else if("uuid"===l.kind)j5.test(e.data)||(jW(o=this._getOrReturnCtx(e,o),{validation:"uuid",code:jF.invalid_string,message:l.message}),s.dirty());else if("nanoid"===l.kind)j3.test(e.data)||(jW(o=this._getOrReturnCtx(e,o),{validation:"nanoid",code:jF.invalid_string,message:l.message}),s.dirty());else if("cuid"===l.kind)j2.test(e.data)||(jW(o=this._getOrReturnCtx(e,o),{validation:"cuid",code:jF.invalid_string,message:l.message}),s.dirty());else if("cuid2"===l.kind)j4.test(e.data)||(jW(o=this._getOrReturnCtx(e,o),{validation:"cuid2",code:jF.invalid_string,message:l.message}),s.dirty());else if("ulid"===l.kind)j6.test(e.data)||(jW(o=this._getOrReturnCtx(e,o),{validation:"ulid",code:jF.invalid_string,message:l.message}),s.dirty());else if("url"===l.kind)try{new URL(e.data)}catch{jW(o=this._getOrReturnCtx(e,o),{validation:"url",code:jF.invalid_string,message:l.message}),s.dirty()}else"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(e.data)||(jW(o=this._getOrReturnCtx(e,o),{validation:"regex",code:jF.invalid_string,message:l.message}),s.dirty())):"trim"===l.kind?e.data=e.data.trim():"includes"===l.kind?e.data.includes(l.value,l.position)||(jW(o=this._getOrReturnCtx(e,o),{code:jF.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),s.dirty()):"toLowerCase"===l.kind?e.data=e.data.toLowerCase():"toUpperCase"===l.kind?e.data=e.data.toUpperCase():"startsWith"===l.kind?e.data.startsWith(l.value)||(jW(o=this._getOrReturnCtx(e,o),{code:jF.invalid_string,validation:{startsWith:l.value},message:l.message}),s.dirty()):"endsWith"===l.kind?e.data.endsWith(l.value)||(jW(o=this._getOrReturnCtx(e,o),{code:jF.invalid_string,validation:{endsWith:l.value},message:l.message}),s.dirty()):"datetime"===l.kind?(function(e){let t=`${Eo}T${El(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)})(l).test(e.data)||(jW(o=this._getOrReturnCtx(e,o),{code:jF.invalid_string,validation:"datetime",message:l.message}),s.dirty()):"date"===l.kind?Es.test(e.data)||(jW(o=this._getOrReturnCtx(e,o),{code:jF.invalid_string,validation:"date",message:l.message}),s.dirty()):"time"===l.kind?RegExp(`^${El(l)}$`).test(e.data)||(jW(o=this._getOrReturnCtx(e,o),{code:jF.invalid_string,validation:"time",message:l.message}),s.dirty()):"duration"===l.kind?j8.test(e.data)||(jW(o=this._getOrReturnCtx(e,o),{validation:"duration",code:jF.invalid_string,message:l.message}),s.dirty()):"ip"===l.kind?(r=e.data,!(("v4"===(n=l.version)||!n)&&Ee.test(r)||("v6"===n||!n)&&Er.test(r))&&1&&(jW(o=this._getOrReturnCtx(e,o),{validation:"ip",code:jF.invalid_string,message:l.message}),s.dirty())):"jwt"===l.kind?!function(e,t){if(!j9.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));if("object"!=typeof i||null===i||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)return!1;return!0}catch{return!1}}(e.data,l.alg)&&(jW(o=this._getOrReturnCtx(e,o),{validation:"jwt",code:jF.invalid_string,message:l.message}),s.dirty()):"cidr"===l.kind?(i=e.data,!(("v4"===(a=l.version)||!a)&&Et.test(i)||("v6"===a||!a)&&En.test(i))&&1&&(jW(o=this._getOrReturnCtx(e,o),{validation:"cidr",code:jF.invalid_string,message:l.message}),s.dirty())):"base64"===l.kind?Ei.test(e.data)||(jW(o=this._getOrReturnCtx(e,o),{validation:"base64",code:jF.invalid_string,message:l.message}),s.dirty()):"base64url"===l.kind?Ea.test(e.data)||(jW(o=this._getOrReturnCtx(e,o),{validation:"base64url",code:jF.invalid_string,message:l.message}),s.dirty()):z.assertNever(l);return{status:s.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:jF.invalid_string,...U.errToObj(r)})}_addCheck(e){return new Eu({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...U.errToObj(e)})}url(e){return this._addCheck({kind:"url",...U.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...U.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...U.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...U.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...U.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...U.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...U.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...U.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...U.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...U.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...U.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...U.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...U.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...U.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...U.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...U.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...U.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...U.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...U.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...U.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...U.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...U.errToObj(t)})}nonempty(e){return this.min(1,U.errToObj(e))}trim(){return new Eu({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Eu({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Eu({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Eu.create=e=>new Eu({checks:[],typeName:L.ZodString,coerce:e?.coerce??!1,...j0(e)});class Ed extends j1{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==jL.number){let t=this._getOrReturnCtx(e);return jW(t,{code:jF.invalid_type,expected:jL.number,received:t.parsedType}),jH}let r=new jJ;for(let n of this._def.checks)"int"===n.kind?z.isInteger(e.data)||(jW(t=this._getOrReturnCtx(e,t),{code:jF.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(jW(t=this._getOrReturnCtx(e,t),{code:jF.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(jW(t=this._getOrReturnCtx(e,t),{code:jF.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(e.data,n.value)&&(jW(t=this._getOrReturnCtx(e,t),{code:jF.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(jW(t=this._getOrReturnCtx(e,t),{code:jF.not_finite,message:n.message}),r.dirty()):z.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,U.toString(t))}gt(e,t){return this.setLimit("min",e,!1,U.toString(t))}lte(e,t){return this.setLimit("max",e,!0,U.toString(t))}lt(e,t){return this.setLimit("max",e,!1,U.toString(t))}setLimit(e,t,r,n){return new Ed({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:U.toString(n)}]})}_addCheck(e){return new Ed({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:U.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:U.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:U.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:U.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:U.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:U.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&z.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;else"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return Number.isFinite(t)&&Number.isFinite(e)}}Ed.create=e=>new Ed({checks:[],typeName:L.ZodNumber,coerce:e?.coerce||!1,...j0(e)});class Ec extends j1{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==jL.bigint)return this._getInvalidInput(e);let r=new jJ;for(let n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(jW(t=this._getOrReturnCtx(e,t),{code:jF.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(jW(t=this._getOrReturnCtx(e,t),{code:jF.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(jW(t=this._getOrReturnCtx(e,t),{code:jF.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):z.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return jW(t,{code:jF.invalid_type,expected:jL.bigint,received:t.parsedType}),jH}gte(e,t){return this.setLimit("min",e,!0,U.toString(t))}gt(e,t){return this.setLimit("min",e,!1,U.toString(t))}lte(e,t){return this.setLimit("max",e,!0,U.toString(t))}lt(e,t){return this.setLimit("max",e,!1,U.toString(t))}setLimit(e,t,r,n){return new Ec({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:U.toString(n)}]})}_addCheck(e){return new Ec({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:U.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:U.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Ec.create=e=>new Ec({checks:[],typeName:L.ZodBigInt,coerce:e?.coerce??!1,...j0(e)});class Ep extends j1{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==jL.boolean){let t=this._getOrReturnCtx(e);return jW(t,{code:jF.invalid_type,expected:jL.boolean,received:t.parsedType}),jH}return jG(e.data)}}Ep.create=e=>new Ep({typeName:L.ZodBoolean,coerce:e?.coerce||!1,...j0(e)});class Em extends j1{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==jL.date){let t=this._getOrReturnCtx(e);return jW(t,{code:jF.invalid_type,expected:jL.date,received:t.parsedType}),jH}if(Number.isNaN(e.data.getTime()))return jW(this._getOrReturnCtx(e),{code:jF.invalid_date}),jH;let r=new jJ;for(let n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(jW(t=this._getOrReturnCtx(e,t),{code:jF.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(jW(t=this._getOrReturnCtx(e,t),{code:jF.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):z.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Em({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:U.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:U.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Em.create=e=>new Em({checks:[],coerce:e?.coerce||!1,typeName:L.ZodDate,...j0(e)});class Ef extends j1{_parse(e){if(this._getType(e)!==jL.symbol){let t=this._getOrReturnCtx(e);return jW(t,{code:jF.invalid_type,expected:jL.symbol,received:t.parsedType}),jH}return jG(e.data)}}Ef.create=e=>new Ef({typeName:L.ZodSymbol,...j0(e)});class Eh extends j1{_parse(e){if(this._getType(e)!==jL.undefined){let t=this._getOrReturnCtx(e);return jW(t,{code:jF.invalid_type,expected:jL.undefined,received:t.parsedType}),jH}return jG(e.data)}}Eh.create=e=>new Eh({typeName:L.ZodUndefined,...j0(e)});class Eg extends j1{_parse(e){if(this._getType(e)!==jL.null){let t=this._getOrReturnCtx(e);return jW(t,{code:jF.invalid_type,expected:jL.null,received:t.parsedType}),jH}return jG(e.data)}}Eg.create=e=>new Eg({typeName:L.ZodNull,...j0(e)});class Ev extends j1{constructor(){super(...arguments),this._any=!0}_parse(e){return jG(e.data)}}Ev.create=e=>new Ev({typeName:L.ZodAny,...j0(e)});class Ey extends j1{constructor(){super(...arguments),this._unknown=!0}_parse(e){return jG(e.data)}}Ey.create=e=>new Ey({typeName:L.ZodUnknown,...j0(e)});class Eb extends j1{_parse(e){let t=this._getOrReturnCtx(e);return jW(t,{code:jF.invalid_type,expected:jL.never,received:t.parsedType}),jH}}Eb.create=e=>new Eb({typeName:L.ZodNever,...j0(e)});class Ex extends j1{_parse(e){if(this._getType(e)!==jL.undefined){let t=this._getOrReturnCtx(e);return jW(t,{code:jF.invalid_type,expected:jL.void,received:t.parsedType}),jH}return jG(e.data)}}Ex.create=e=>new Ex({typeName:L.ZodVoid,...j0(e)});class Ew extends j1{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==jL.array)return jW(t,{code:jF.invalid_type,expected:jL.array,received:t.parsedType}),jH;if(null!==n.exactLength){let e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(jW(t,{code:e?jF.too_big:jF.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(jW(t,{code:jF.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(jW(t,{code:jF.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>n.type._parseAsync(new jX(t,e,t.path,r)))).then(e=>jJ.mergeArray(r,e));let i=[...t.data].map((e,r)=>n.type._parseSync(new jX(t,e,t.path,r)));return jJ.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new Ew({...this._def,minLength:{value:e,message:U.toString(t)}})}max(e,t){return new Ew({...this._def,maxLength:{value:e,message:U.toString(t)}})}length(e,t){return new Ew({...this._def,exactLength:{value:e,message:U.toString(t)}})}nonempty(e){return this.min(1,e)}}Ew.create=(e,t)=>new Ew({type:e,minLength:null,maxLength:null,exactLength:null,typeName:L.ZodArray,...j0(t)});class E_ extends j1{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=z.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==jL.object){let t=this._getOrReturnCtx(e);return jW(t,{code:jF.invalid_type,expected:jL.object,received:t.parsedType}),jH}let{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Eb&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=n[e],i=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new jX(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof Eb){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of a)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)a.length>0&&(jW(r,{code:jF.unrecognized_keys,keys:a}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of a){let n=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new jX(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e}).then(e=>jJ.mergeObjectSync(t,e)):jJ.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return U.errToObj,new E_({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{let n=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:U.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new E_({...this._def,unknownKeys:"strip"})}passthrough(){return new E_({...this._def,unknownKeys:"passthrough"})}extend(e){return new E_({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new E_({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:L.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new E_({...this._def,catchall:e})}pick(e){let t={};for(let r of z.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new E_({...this._def,shape:()=>t})}omit(e){let t={};for(let r of z.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new E_({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof E_){let r={};for(let n in t.shape){let i=t.shape[n];r[n]=EU.create(e(i))}return new E_({...t._def,shape:()=>r})}if(t instanceof Ew)return new Ew({...t._def,type:e(t.element)});if(t instanceof EU)return EU.create(e(t.unwrap()));if(t instanceof EL)return EL.create(e(t.unwrap()));if(t instanceof Ej)return Ej.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of z.objectKeys(this.shape)){let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}return new E_({...this._def,shape:()=>t})}required(e){let t={};for(let r of z.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof EU;)e=e._def.innerType;t[r]=e}return new E_({...this._def,shape:()=>t})}keyof(){return EP(z.objectKeys(this.shape))}}E_.create=(e,t)=>new E_({shape:()=>e,unknownKeys:"strip",catchall:Eb.create(),typeName:L.ZodObject,...j0(t)}),E_.strictCreate=(e,t)=>new E_({shape:()=>e,unknownKeys:"strict",catchall:Eb.create(),typeName:L.ZodObject,...j0(t)}),E_.lazycreate=(e,t)=>new E_({shape:e,unknownKeys:"strip",catchall:Eb.create(),typeName:L.ZodObject,...j0(t)});class Ek extends j1{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new jB(e.ctx.common.issues));return jW(t,{code:jF.invalid_union,unionErrors:r}),jH});{let e,n=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=n.map(e=>new jB(e));return jW(t,{code:jF.invalid_union,unionErrors:i}),jH}}get options(){return this._def.options}}Ek.create=(e,t)=>new Ek({options:e,typeName:L.ZodUnion,...j0(t)});let EI=e=>{if(e instanceof EA)return EI(e.schema);if(e instanceof ED)return EI(e.innerType());if(e instanceof ER)return[e.value];if(e instanceof EO)return e.options;if(e instanceof EM)return z.objectValues(e.enum);else if(e instanceof EZ)return EI(e._def.innerType);else if(e instanceof Eh)return[void 0];else if(e instanceof Eg)return[null];else if(e instanceof EU)return[void 0,...EI(e.unwrap())];else if(e instanceof EL)return[null,...EI(e.unwrap())];else if(e instanceof EV)return EI(e.unwrap());else if(e instanceof EW)return EI(e.unwrap());else if(e instanceof EF)return EI(e._def.innerType);else return[]};class ES extends j1{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==jL.object)return jW(t,{code:jF.invalid_type,expected:jL.object,received:t.parsedType}),jH;let r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(jW(t,{code:jF.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),jH)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let r of t){let t=EI(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(n.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,r)}}return new ES({typeName:L.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...j0(r)})}}class E$ extends j1{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if("aborted"===e.status||"aborted"===n.status)return jH;let i=function e(t,r){let n=jZ(t),i=jZ(r);if(t===r)return{valid:!0,data:t};if(n===jL.object&&i===jL.object){let n=z.objectKeys(r),i=z.objectKeys(t).filter(e=>-1!==n.indexOf(e)),a={...t,...r};for(let n of i){let i=e(t[n],r[n]);if(!i.valid)return{valid:!1};a[n]=i.data}return{valid:!0,data:a}}if(n===jL.array&&i===jL.array){if(t.length!==r.length)return{valid:!1};let n=[];for(let i=0;i<t.length;i++){let a=e(t[i],r[i]);if(!a.valid)return{valid:!1};n.push(a.data)}return{valid:!0,data:n}}if(n===jL.date&&i===jL.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,n.value);return i.valid?(("dirty"===e.status||"dirty"===n.status)&&t.dirty(),{status:t.value,value:i.data}):(jW(r,{code:jF.invalid_intersection_types}),jH)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>n(e,t)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}E$.create=(e,t,r)=>new E$({left:e,right:t,typeName:L.ZodIntersection,...j0(r)});class Ej extends j1{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==jL.array)return jW(r,{code:jF.invalid_type,expected:jL.array,received:r.parsedType}),jH;if(r.data.length<this._def.items.length)return jW(r,{code:jF.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),jH;!this._def.rest&&r.data.length>this._def.items.length&&(jW(r,{code:jF.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...r.data].map((e,t)=>{let n=this._def.items[t]||this._def.rest;return n?n._parse(new jX(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(n).then(e=>jJ.mergeArray(t,e)):jJ.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Ej({...this._def,rest:e})}}Ej.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ej({items:e,typeName:L.ZodTuple,rest:null,...j0(t)})};class EE extends j1{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==jL.object)return jW(r,{code:jF.invalid_type,expected:jL.object,received:r.parsedType}),jH;let n=[],i=this._def.keyType,a=this._def.valueType;for(let e in r.data)n.push({key:i._parse(new jX(r,e,r.path,e)),value:a._parse(new jX(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?jJ.mergeObjectAsync(t,n):jJ.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new EE(t instanceof j1?{keyType:e,valueType:t,typeName:L.ZodRecord,...j0(r)}:{keyType:Eu.create(),valueType:e,typeName:L.ZodRecord,...j0(t)})}}class ET extends j1{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==jL.map)return jW(r,{code:jF.invalid_type,expected:jL.map,received:r.parsedType}),jH;let n=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([e,t],a)=>({key:n._parse(new jX(r,e,r.path,[a,"key"])),value:i._parse(new jX(r,t,r.path,[a,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of a){let n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return jH;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of a){let n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return jH;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}ET.create=(e,t,r)=>new ET({valueType:t,keyType:e,typeName:L.ZodMap,...j0(r)});class EC extends j1{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==jL.set)return jW(r,{code:jF.invalid_type,expected:jL.set,received:r.parsedType}),jH;let n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(jW(r,{code:jF.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(jW(r,{code:jF.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let r=new Set;for(let n of e){if("aborted"===n.status)return jH;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}let o=[...r.data.values()].map((e,t)=>i._parse(new jX(r,e,r.path,t)));return r.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(e,t){return new EC({...this._def,minSize:{value:e,message:U.toString(t)}})}max(e,t){return new EC({...this._def,maxSize:{value:e,message:U.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}EC.create=(e,t)=>new EC({valueType:e,minSize:null,maxSize:null,typeName:L.ZodSet,...j0(t)});class EN extends j1{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==jL.function)return jW(t,{code:jF.invalid_type,expected:jL.function,received:t.parsedType}),jH;function r(e,r){return jq({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,jV,jV].filter(e=>!!e),issueData:{code:jF.invalid_arguments,argumentsError:r}})}function n(e,r){return jq({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,jV,jV].filter(e=>!!e),issueData:{code:jF.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Ez){let e=this;return jG(async function(...t){let o=new jB([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(r(t,e)),o}),l=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(l,i).catch(e=>{throw o.addIssue(n(l,e)),o})})}{let e=this;return jG(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new jB([r(t,o.error)]);let s=Reflect.apply(a,this,o.data),l=e._def.returns.safeParse(s,i);if(!l.success)throw new jB([n(s,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new EN({...this._def,args:Ej.create(e).rest(Ey.create())})}returns(e){return new EN({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new EN({args:e||Ej.create([]).rest(Ey.create()),returns:t||Ey.create(),typeName:L.ZodFunction,...j0(r)})}}class EA extends j1{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}EA.create=(e,t)=>new EA({getter:e,typeName:L.ZodLazy,...j0(t)});class ER extends j1{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return jW(t,{received:t.data,code:jF.invalid_literal,expected:this._def.value}),jH}return{status:"valid",value:e.data}}get value(){return this._def.value}}function EP(e,t){return new EO({values:e,typeName:L.ZodEnum,...j0(t)})}ER.create=(e,t)=>new ER({value:e,typeName:L.ZodLiteral,...j0(t)});class EO extends j1{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return jW(t,{expected:z.joinValues(r),received:t.parsedType,code:jF.invalid_type}),jH}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return jW(t,{received:t.data,code:jF.invalid_enum_value,options:r}),jH}return jG(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return EO.create(e,{...this._def,...t})}exclude(e,t=this._def){return EO.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}EO.create=EP;class EM extends j1{_parse(e){let t=z.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==jL.string&&r.parsedType!==jL.number){let e=z.objectValues(t);return jW(r,{expected:z.joinValues(e),received:r.parsedType,code:jF.invalid_type}),jH}if(this._cache||(this._cache=new Set(z.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=z.objectValues(t);return jW(r,{received:r.data,code:jF.invalid_enum_value,options:e}),jH}return jG(e.data)}get enum(){return this._def.values}}EM.create=(e,t)=>new EM({values:e,typeName:L.ZodNativeEnum,...j0(t)});class Ez extends j1{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==jL.promise&&!1===t.common.async?(jW(t,{code:jF.invalid_type,expected:jL.promise,received:t.parsedType}),jH):jG((t.parsedType===jL.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ez.create=(e,t)=>new Ez({type:e,typeName:L.ZodPromise,...j0(t)});class ED extends j1{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===L.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{jW(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){let e=n.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return jH;let n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?jH:"dirty"===n.status||"dirty"===t.value?jK(n.value):n});{if("aborted"===t.value)return jH;let n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?jH:"dirty"===n.status||"dirty"===t.value?jK(n.value):n}}if("refinement"===n.type){let e=e=>{let t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?jH:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?jH:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}}if("transform"===n.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>"valid"!==e.status?jH:Promise.resolve(n.transform(e.value,i)).then(e=>({status:t.value,value:e})));else{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if("valid"!==e.status)return jH;let a=n.transform(e.value,i);if(a instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}z.assertNever(n)}}ED.create=(e,t,r)=>new ED({schema:e,typeName:L.ZodEffects,effect:t,...j0(r)}),ED.createWithPreprocess=(e,t,r)=>new ED({schema:t,effect:{type:"preprocess",transform:e},typeName:L.ZodEffects,...j0(r)});class EU extends j1{_parse(e){return this._getType(e)===jL.undefined?jG(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}EU.create=(e,t)=>new EU({innerType:e,typeName:L.ZodOptional,...j0(t)});class EL extends j1{_parse(e){return this._getType(e)===jL.null?jG(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}EL.create=(e,t)=>new EL({innerType:e,typeName:L.ZodNullable,...j0(t)});class EZ extends j1{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===jL.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}EZ.create=(e,t)=>new EZ({innerType:e,typeName:L.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...j0(t)});class EF extends j1{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return jY(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new jB(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new jB(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}EF.create=(e,t)=>new EF({innerType:e,typeName:L.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...j0(t)});class EB extends j1{_parse(e){if(this._getType(e)!==jL.nan){let t=this._getOrReturnCtx(e);return jW(t,{code:jF.invalid_type,expected:jL.nan,received:t.parsedType}),jH}return{status:"valid",value:e.data}}}EB.create=e=>new EB({typeName:L.ZodNaN,...j0(e)}),Symbol("zod_brand");class EV extends j1{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Eq extends j1{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?jH:"dirty"===e.status?(t.dirty(),jK(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?jH:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new Eq({in:e,out:t,typeName:L.ZodPipeline})}}class EW extends j1{_parse(e){let t=this._def.innerType._parse(e),r=e=>("valid"===e.status&&(e.value=Object.freeze(e.value)),e);return jY(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}EW.create=(e,t)=>new EW({innerType:e,typeName:L.ZodReadonly,...j0(t)}),E_.lazycreate,(g=L||(L={})).ZodString="ZodString",g.ZodNumber="ZodNumber",g.ZodNaN="ZodNaN",g.ZodBigInt="ZodBigInt",g.ZodBoolean="ZodBoolean",g.ZodDate="ZodDate",g.ZodSymbol="ZodSymbol",g.ZodUndefined="ZodUndefined",g.ZodNull="ZodNull",g.ZodAny="ZodAny",g.ZodUnknown="ZodUnknown",g.ZodNever="ZodNever",g.ZodVoid="ZodVoid",g.ZodArray="ZodArray",g.ZodObject="ZodObject",g.ZodUnion="ZodUnion",g.ZodDiscriminatedUnion="ZodDiscriminatedUnion",g.ZodIntersection="ZodIntersection",g.ZodTuple="ZodTuple",g.ZodRecord="ZodRecord",g.ZodMap="ZodMap",g.ZodSet="ZodSet",g.ZodFunction="ZodFunction",g.ZodLazy="ZodLazy",g.ZodLiteral="ZodLiteral",g.ZodEnum="ZodEnum",g.ZodEffects="ZodEffects",g.ZodNativeEnum="ZodNativeEnum",g.ZodOptional="ZodOptional",g.ZodNullable="ZodNullable",g.ZodDefault="ZodDefault",g.ZodCatch="ZodCatch",g.ZodPromise="ZodPromise",g.ZodBranded="ZodBranded",g.ZodPipeline="ZodPipeline",g.ZodReadonly="ZodReadonly",Eu.create,Ed.create,EB.create,Ec.create,Ep.create,Em.create,Ef.create,Eh.create,Eg.create,Ev.create,Ey.create,Eb.create,Ex.create,Ew.create,E_.create,E_.strictCreate,Ek.create,ES.create,E$.create,Ej.create,EE.create,ET.create,EC.create,EN.create,EA.create,ER.create,EO.create,EM.create,Ez.create,ED.create,EU.create,EL.create,ED.createWithPreprocess,Eq.create;class EJ extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function EH(e){}function EK(e,t,r){return 100===r&&97===e.charCodeAt(t+1)&&116===e.charCodeAt(t+2)&&97===e.charCodeAt(t+3)&&58===e.charCodeAt(t+4)}function EG(e,t,r){return 101===r&&118===e.charCodeAt(t+1)&&101===e.charCodeAt(t+2)&&110===e.charCodeAt(t+3)&&116===e.charCodeAt(t+4)&&58===e.charCodeAt(t+5)}class EY extends TransformStream{constructor({onError:e,onRetry:t,onComment:r}={}){let n;super({start(i){n=function(e){if("function"==typeof e)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=EH,onError:r=EH,onRetry:n=EH,onComment:i}=e,a=[],o=!0,s,l="",u=0,d;function c(e){let r=0;if(-1===e.indexOf("\r")){let n=e.indexOf(`
|
|
12
|
+
`,r);for(;-1!==n;){if(r===n){u>0&&t({id:s,event:d,data:l}),s=void 0,l="",u=0,d=void 0,r=n+1,n=e.indexOf(`
|
|
13
|
+
`,r);continue}let i=e.charCodeAt(r);if(EK(e,r,i)){let i=32===e.charCodeAt(r+5)?r+6:r+5,a=e.slice(i,n);if(0===u&&10===e.charCodeAt(n+1)){t({id:s,event:d,data:a}),s=void 0,l="",d=void 0,r=n+2,n=e.indexOf(`
|
|
14
|
+
`,r);continue}l=0===u?a:`${l}
|
|
15
|
+
${a}`,u++}else EG(e,r,i)?d=e.slice(32===e.charCodeAt(r+6)?r+7:r+6,n)||void 0:p(e,r,n);r=n+1,n=e.indexOf(`
|
|
16
|
+
`,r)}return e.slice(r)}for(;r<e.length;){let t=e.indexOf("\r",r),n=e.indexOf(`
|
|
17
|
+
`,r),i=-1;if(-1!==t&&-1!==n?i=t<n?t:n:-1!==t?i=t===e.length-1?-1:t:-1!==n&&(i=n),-1===i)break;p(e,r,i),r=i+1,13===e.charCodeAt(r-1)&&10===e.charCodeAt(r)&&r++}return e.slice(r)}function p(e,r,n){if(r===n)return void(u>0&&t({id:s,event:d,data:l}),s=void 0,l="",u=0,d=void 0);let a=e.charCodeAt(r);if(EK(e,r,a)){let t=32===e.charCodeAt(r+5)?r+6:r+5,i=e.slice(t,n);l=0===u?i:`${l}
|
|
18
|
+
${i}`,u++;return}if(EG(e,r,a)){d=e.slice(32===e.charCodeAt(r+6)?r+7:r+6,n)||void 0;return}if(105===a&&100===e.charCodeAt(r+1)&&58===e.charCodeAt(r+2)){let t=e.slice(32===e.charCodeAt(r+3)?r+4:r+3,n);s=t.includes("\0")?void 0:t;return}if(58===a){i&&i(e.slice(r,n).slice(32===e.charCodeAt(r+1)?2:1));return}let o=e.slice(r,n),c=o.indexOf(":");if(-1===c)return void m(o,"",o);let p=o.slice(0,c),f=32===o.charCodeAt(c+1)?2:1;m(p,o.slice(c+f),o)}function m(e,t,i){switch(e){case"event":d=t||void 0;break;case"data":l=0===u?t:`${l}
|
|
19
|
+
${t}`,u++;break;case"id":s=t.includes("\0")?void 0:t;break;case"retry":/^\d+$/.test(t)?n(parseInt(t,10)):r(new EJ(`Invalid \`retry\` value: "${t}"`,{type:"invalid-retry",value:t,line:i}));break;default:r(new EJ(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:"unknown-field",field:e,value:t,line:i}))}}return{feed:function(e){if(o&&(o=!1,239===e.charCodeAt(0)&&187===e.charCodeAt(1)&&191===e.charCodeAt(2)&&(e=e.slice(3))),0===a.length){let t=c(e);""!==t&&a.push(t);return}if(-1===e.indexOf(`
|
|
20
|
+
`)&&-1===e.indexOf("\r"))return void a.push(e);a.push(e);let t=a.join("");a.length=0;let r=c(t);""!==r&&a.push(r)},reset:function(e={}){if(e.consume&&a.length>0){let e=a.join("");p(e,0,e.length)}o=!0,s=void 0,l="",u=0,d=void 0,a.length=0}}}({onEvent:e=>{i.enqueue(e)},onError(t){"terminate"===e?i.error(t):"function"==typeof e&&e(t)},onRetry:t,onComment:r})},transform(e){n.feed(e)}})}}function EX(...e){return e.reduce((e,t)=>({...e,...null!=t?t:{}}),{})}function EQ(e){return Object.fromEntries([...e.headers])}var{btoa:E0,atob:E1}=globalThis;function E2(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return E0(t)}var E4="AI_DownloadError",E6=`vercel.ai.error.${E4}`,E5=Symbol.for(E6),E3=class extends(F=I8,Z=E5,F){constructor({url:e,statusCode:t,statusText:r,cause:n,message:i=null==n?`Failed to download ${e}: ${t} ${r}`:`Failed to download ${e}: ${n}`}){super({name:E4,message:i,cause:n}),this[Z]=!0,this.url=e,this.statusCode=t,this.statusText=r}static isInstance(e){return I8.hasMarker(e,E6)}};async function E9({response:e,url:t,maxBytes:r=0x80000000}){let n=e.headers.get("content-length");if(null!=n){let e=parseInt(n,10);if(!isNaN(e)&&e>r)throw new E3({url:t,message:`Download of ${t} exceeded maximum size of ${r} bytes (Content-Length: ${e}).`})}let i=e.body;if(null==i)return new Uint8Array(0);let a=i.getReader(),o=[],s=0;try{for(;;){let{done:e,value:n}=await a.read();if(e)break;if((s+=n.length)>r)throw new E3({url:t,message:`Download of ${t} exceeded maximum size of ${r} bytes.`});o.push(n)}}finally{try{await a.cancel()}finally{a.releaseLock()}}let l=new Uint8Array(s),u=0;for(let e of o)l.set(e,u),u+=e.length;return l}function E8(e){let t;try{t=new URL(e)}catch(t){throw new E3({url:e,message:`Invalid URL: ${e}`})}if("data:"===t.protocol)return;if("http:"!==t.protocol&&"https:"!==t.protocol)throw new E3({url:e,message:`URL scheme must be http, https, or data, got ${t.protocol}`});let r=t.hostname;if(!r)throw new E3({url:e,message:"URL must have a hostname"});if("localhost"===r||r.endsWith(".local")||r.endsWith(".localhost"))throw new E3({url:e,message:`URL with hostname ${r} is not allowed`});if(r.startsWith("[")&&r.endsWith("]")){if(function(e){let t=e.toLowerCase();if("::1"===t||"::"===t)return!0;if(t.startsWith("::ffff:")){let e=t.slice(7);if(E7(e))return Te(e);let r=e.split(":");if(2===r.length){let e=parseInt(r[0],16),t=parseInt(r[1],16);if(!isNaN(e)&&!isNaN(t))return Te(`${e>>8&255}.${255&e}.${t>>8&255}.${255&t}`)}}return!!(t.startsWith("fc")||t.startsWith("fd")||t.startsWith("fe80"))}(r.slice(1,-1)))throw new E3({url:e,message:`URL with IPv6 address ${r} is not allowed`});return}if(E7(r)){if(Te(r))throw new E3({url:e,message:`URL with IP address ${r} is not allowed`});return}}function E7(e){let t=e.split(".");return 4===t.length&&t.every(e=>{let t=Number(e);return Number.isInteger(t)&&t>=0&&t<=255&&String(t)===e})}function Te(e){let[t,r]=e.split(".").map(Number);return 0===t||10===t||127===t||169===t&&254===r||172===t&&!!(r>=16)&&!!(r<=31)||192===t&&168===r}var Tt=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:n="-"}={})=>{let i=()=>{let e=r.length,n=Array(t);for(let i=0;i<t;i++)n[i]=r[Math.random()*e|0];return n.join("")};if(null==e)return i;if(r.includes(n))throw new Sc({argument:"separator",message:`The separator "${n}" must not be part of the alphabet "${r}".`});return()=>`${e}${n}${i()}`},Tr=Tt();function Tn(e){return(e instanceof Error||e instanceof DOMException)&&("AbortError"===e.name||"ResponseAborted"===e.name||"TimeoutError"===e.name)}var Ti=["fetch failed","failed to fetch"],Ta=["ConnectionRefused","ConnectionClosed","FailedToOpenSocket","ECONNRESET","ECONNREFUSED","ETIMEDOUT","EPIPE"];function To({error:e,url:t,requestBodyValues:r}){if(Tn(e))return e;if(e instanceof TypeError&&Ti.includes(e.message.toLowerCase())){let n=e.cause;if(null!=n)return new Sr({message:`Cannot connect to API: ${n.message}`,cause:n,url:t,requestBodyValues:r,isRetryable:!0})}return!function(e){if(!(e instanceof Error))return!1;let t=e.code;return!!("string"==typeof t&&Ta.includes(t))}(e)?e:new Sr({message:`Cannot connect to API: ${e.message}`,cause:e,url:t,requestBodyValues:r,isRetryable:!0})}function Ts(e=globalThis){var t,r,n;return e.window?"runtime/browser":(null==(t=e.navigator)?void 0:t.userAgent)?`runtime/${e.navigator.userAgent.toLowerCase()}`:(null==(n=null==(r=e.process)?void 0:r.versions)?void 0:n.node)?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function Tl(e){if(null==e)return{};let t={};if(e instanceof Headers)e.forEach((e,r)=>{t[r.toLowerCase()]=e});else for(let[r,n]of(Array.isArray(e)||(e=Object.entries(e)),e))null!=n&&(t[r.toLowerCase()]=n);return t}function Tu(e,...t){let r=new Headers(Tl(e)),n=r.get("user-agent")||"";return r.set("user-agent",[n,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}var Td="4.0.27",Tc=()=>globalThis.fetch,Tp=async({url:e,headers:t={},successfulResponseHandler:r,failedResponseHandler:n,abortSignal:i,fetch:a=Tc()})=>{try{let o=await a(e,{method:"GET",headers:Tu(t,`ai-sdk/provider-utils/${Td}`,Ts()),signal:i}),s=EQ(o);if(!o.ok){let t;try{t=await n({response:o,url:e,requestBodyValues:{}})}catch(t){if(Tn(t)||Sr.isInstance(t))throw t;throw new Sr({message:"Failed to process error response",cause:t,statusCode:o.status,url:e,responseHeaders:s,requestBodyValues:{}})}throw t.value}try{return await r({response:o,url:e,requestBodyValues:{}})}catch(t){if(t instanceof Error&&(Tn(t)||Sr.isInstance(t)))throw t;throw new Sr({message:"Failed to process successful response",cause:t,statusCode:o.status,url:e,responseHeaders:s,requestBodyValues:{}})}}catch(t){throw To({error:t,url:e,requestBodyValues:{}})}};function Tm({settingValue:e,environmentVariableName:t}){return"string"==typeof e?e:null!=e||void 0===e_.default?void 0:null!=(e=e_.default.env[t])&&"string"==typeof e?e:void 0}var Tf=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,Th=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function Tg(e){let t=JSON.parse(e);return null===t||"object"!=typeof t||!1===Tf.test(e)&&!1===Th.test(e)?t:function(e){let t=[e];for(;t.length;){let e=t;for(let r of(t=[],e)){if(Object.prototype.hasOwnProperty.call(r,"__proto__")||Object.prototype.hasOwnProperty.call(r,"constructor")&&null!==r.constructor&&"object"==typeof r.constructor&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw SyntaxError("Object contains forbidden prototype property");for(let e in r){let n=r[e];n&&"object"==typeof n&&t.push(n)}}}return e}(t)}function Tv(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch(t){return Tg(e)}try{return Tg(e)}finally{Error.stackTraceLimit=t}}function Ty(e){if("object"===e.type||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;let{properties:t}=e;if(null!=t)for(let e of Object.keys(t))t[e]=Tb(t[e])}null!=e.items&&(e.items=Array.isArray(e.items)?e.items.map(Tb):Tb(e.items)),null!=e.anyOf&&(e.anyOf=e.anyOf.map(Tb)),null!=e.allOf&&(e.allOf=e.allOf.map(Tb)),null!=e.oneOf&&(e.oneOf=e.oneOf.map(Tb));let{definitions:t}=e;if(null!=t)for(let e of Object.keys(t))t[e]=Tb(t[e]);return e}function Tb(e){return"boolean"==typeof e?e:Ty(e)}var Tx=Symbol("Let zodToJsonSchema decide on which parser to use"),Tw={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"};function T_(e,t){return TB(e.type._def,t)}var Tk=void 0,TI=/^[cC][^\s-]{8,}$/,TS=/^[0-9a-z]+$/,T$=/^[0-9A-HJKMNP-TV-Z]{26}$/,Tj=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,TE=()=>(void 0===Tk&&(Tk=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Tk),TT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,TC=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,TN=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,TA=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,TR=/^[a-zA-Z0-9_-]{21}$/,TP=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function TO(e,t){let r={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":r.minLength="number"==typeof r.minLength?Math.max(r.minLength,n.value):n.value;break;case"max":r.maxLength="number"==typeof r.maxLength?Math.min(r.maxLength,n.value):n.value;break;case"email":switch(t.emailStrategy){case"format:email":TD(r,"email",n.message,t);break;case"format:idn-email":TD(r,"idn-email",n.message,t);break;case"pattern:zod":TU(r,Tj,n.message,t)}break;case"url":TD(r,"uri",n.message,t);break;case"uuid":TD(r,"uuid",n.message,t);break;case"regex":TU(r,n.regex,n.message,t);break;case"cuid":TU(r,TI,n.message,t);break;case"cuid2":TU(r,TS,n.message,t);break;case"startsWith":TU(r,RegExp(`^${TM(n.value,t)}`),n.message,t);break;case"endsWith":TU(r,RegExp(`${TM(n.value,t)}$`),n.message,t);break;case"datetime":TD(r,"date-time",n.message,t);break;case"date":TD(r,"date",n.message,t);break;case"time":TD(r,"time",n.message,t);break;case"duration":TD(r,"duration",n.message,t);break;case"length":r.minLength="number"==typeof r.minLength?Math.max(r.minLength,n.value):n.value,r.maxLength="number"==typeof r.maxLength?Math.min(r.maxLength,n.value):n.value;break;case"includes":TU(r,RegExp(TM(n.value,t)),n.message,t);break;case"ip":"v6"!==n.version&&TD(r,"ipv4",n.message,t),"v4"!==n.version&&TD(r,"ipv6",n.message,t);break;case"base64url":TU(r,TA,n.message,t);break;case"jwt":TU(r,TP,n.message,t);break;case"cidr":"v6"!==n.version&&TU(r,TT,n.message,t),"v4"!==n.version&&TU(r,TC,n.message,t);break;case"emoji":TU(r,TE(),n.message,t);break;case"ulid":TU(r,T$,n.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":TD(r,"binary",n.message,t);break;case"contentEncoding:base64":r.contentEncoding="base64";break;case"pattern:zod":TU(r,TN,n.message,t)}break;case"nanoid":TU(r,TR,n.message,t)}return r}function TM(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)Tz.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}var Tz=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function TD(e,t,r,n){var i;e.format||(null==(i=e.anyOf)?void 0:i.some(e=>e.format))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})):e.format=t}function TU(e,t,r,n){var i;e.pattern||(null==(i=e.allOf)?void 0:i.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:TL(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):e.pattern=TL(t,n)}function TL(e,t){var r;if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},i=n.i?e.source.toLowerCase():e.source,a="",o=!1,s=!1,l=!1;for(let e=0;e<i.length;e++){if(o){a+=i[e],o=!1;continue}if(n.i){if(s){if(i[e].match(/[a-z]/)){l?(a+=i[e],a+=`${i[e-2]}-${i[e]}`.toUpperCase(),l=!1):"-"===i[e+1]&&(null==(r=i[e+2])?void 0:r.match(/[a-z]/))?(a+=i[e],l=!0):a+=`${i[e]}${i[e].toUpperCase()}`;continue}}else if(i[e].match(/[a-z]/)){a+=`[${i[e]}${i[e].toUpperCase()}]`;continue}}if(n.m){if("^"===i[e]){a+=`(^|(?<=[\r
|
|
21
|
+
]))`;continue}else if("$"===i[e]){a+=`($|(?=[\r
|
|
22
|
+
]))`;continue}}if(n.s&&"."===i[e]){a+=s?`${i[e]}\r
|
|
23
|
+
`:`[${i[e]}\r
|
|
24
|
+
]`;continue}a+=i[e],"\\"===i[e]?o=!0:s&&"]"===i[e]?s=!1:s||"["!==i[e]||(s=!0)}try{new RegExp(a)}catch(r){return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return a}function TZ(e,t){var r,n,i,a,o,s;let l={type:"object",additionalProperties:null!=(r=TB(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?r:t.allowedAdditionalProperties};if((null==(n=e.keyType)?void 0:n._def.typeName)===L.ZodString&&(null==(i=e.keyType._def.checks)?void 0:i.length)){let{type:r,...n}=TO(e.keyType._def,t);return{...l,propertyNames:n}}if((null==(a=e.keyType)?void 0:a._def.typeName)===L.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===L.ZodBranded&&e.keyType._def.type._def.typeName===L.ZodString&&(null==(s=e.keyType._def.type._def.checks)?void 0:s.length)){let{type:r,...n}=T_(e.keyType._def,t);return{...l,propertyNames:n}}return l}var TF={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function TB(e,t,r=!1){var n;let i=t.seen.get(e);if(t.override){let a=null==(n=t.override)?void 0:n.call(t,e,t,i,r);if(a!==Tx)return a}if(i&&!r){let e=TV(i,t);if(void 0!==e)return e}let a={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,a);let o=((e,t,r)=>{var n,i,a,o,s,l;switch(t){case L.ZodString:return TO(e,r);case L.ZodNumber:let u={type:"number"};if(!e.checks)return u;for(let t of e.checks)switch(t.kind){case"int":u.type="integer";break;case"min":t.inclusive?u.minimum=t.value:u.exclusiveMinimum=t.value;break;case"max":t.inclusive?u.maximum=t.value:u.exclusiveMaximum=t.value;break;case"multipleOf":u.multipleOf=t.value}return u;case L.ZodObject:return function(e,t){let r={type:"object",properties:{}},n=[],i=e.shape();for(let e in i){let a=i[e];if(void 0===a||void 0===a._def)continue;let o=function(e){try{return e.isOptional()}catch(e){return!0}}(a),s=TB(a._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==s&&(r.properties[e]=s,o||n.push(e))}n.length&&(r.required=n);let a=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return TB(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==a&&(r.additionalProperties=a),r}(e,r);case L.ZodBigInt:let d={type:"integer",format:"int64"};if(!e.checks)return d;for(let t of e.checks)switch(t.kind){case"min":t.inclusive?d.minimum=t.value:d.exclusiveMinimum=t.value;break;case"max":t.inclusive?d.maximum=t.value:d.exclusiveMaximum=t.value;break;case"multipleOf":d.multipleOf=t.value}return d;case L.ZodBoolean:return{type:"boolean"};case L.ZodDate:return function e(t,r,n){let i=null!=n?n:r.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((n,i)=>e(t,r,n))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":var a=t;let o={type:"integer",format:"unix-time"};for(let e of a.checks)switch(e.kind){case"min":o.minimum=e.value;break;case"max":o.maximum=e.value}return o}}(e,r);case L.ZodUndefined:return{not:{}};case L.ZodNull:return{type:"null"};case L.ZodArray:let c;return c={type:"array"},(null==(a=e.type)?void 0:a._def)&&(null==(s=null==(o=e.type)?void 0:o._def)?void 0:s.typeName)!==L.ZodAny&&(c.items=TB(e.type._def,{...r,currentPath:[...r.currentPath,"items"]})),e.minLength&&(c.minItems=e.minLength.value),e.maxLength&&(c.maxItems=e.maxLength.value),e.exactLength&&(c.minItems=e.exactLength.value,c.maxItems=e.exactLength.value),c;case L.ZodUnion:case L.ZodDiscriminatedUnion:let p,m=e.options instanceof Map?Array.from(e.options.values()):e.options;if(m.every(e=>e._def.typeName in TF&&(!e._def.checks||!e._def.checks.length))){let e=m.reduce((e,t)=>{let r=TF[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e},[]);return{type:e.length>1?e:e[0]}}if(m.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){let e=m.reduce((e,t)=>{let r=typeof t._def.value;switch(r){case"string":case"number":case"boolean":return[...e,r];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===m.length){let t=e.filter((e,t,r)=>r.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:m.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(m.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:m.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return n=e,i=r,(p=(n.options instanceof Map?Array.from(n.options.values()):n.options).map((e,t)=>TB(e._def,{...i,currentPath:[...i.currentPath,"anyOf",`${t}`]})).filter(e=>!!e&&(!i.strictUnions||"object"==typeof e&&Object.keys(e).length>0))).length?{anyOf:p}:void 0;case L.ZodIntersection:let f,h;return f=[TB(e.left._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),TB(e.right._def,{...r,currentPath:[...r.currentPath,"allOf","1"]})].filter(e=>!!e),h=[],f.forEach(e=>{if((!("type"in e)||"string"!==e.type)&&"allOf"in e)h.push(...e.allOf);else{let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){let{additionalProperties:r,...n}=e;t=n}h.push(t)}}),h.length?{allOf:h}:void 0;case L.ZodTuple:return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,t)=>TB(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:TB(e.rest._def,{...r,currentPath:[...r.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,t)=>TB(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])};case L.ZodRecord:return TZ(e,r);case L.ZodLiteral:let g;return"bigint"!=(g=typeof e.value)&&"number"!==g&&"boolean"!==g&&"string"!==g?{type:Array.isArray(e.value)?"array":"object"}:{type:"bigint"===g?"integer":g,const:e.value};case L.ZodEnum:return{type:"string",enum:Array.from(e.values)};case L.ZodNativeEnum:let v,y,b;return v=e.values,{type:1===(b=Array.from(new Set((y=Object.keys(e.values).filter(e=>"number"!=typeof v[v[e]]).map(e=>v[e])).map(e=>typeof e)))).length?"string"===b[0]?"string":"number":["string","number"],enum:y};case L.ZodNullable:if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[TF[e.innerType._def.typeName],"null"]};let x=TB(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","0"]});return x&&{anyOf:[x,{type:"null"}]};case L.ZodOptional:if(r.currentPath.toString()===(null==(l=r.propertyPath)?void 0:l.toString()))return TB(e.innerType._def,r);let w=TB(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","1"]});return w?{anyOf:[{not:{}},w]}:{};case L.ZodMap:if("record"===r.mapStrategy)return TZ(e,r);return{type:"array",maxItems:125,items:{type:"array",items:[TB(e.keyType._def,{...r,currentPath:[...r.currentPath,"items","items","0"]})||{},TB(e.valueType._def,{...r,currentPath:[...r.currentPath,"items","items","1"]})||{}],minItems:2,maxItems:2}};case L.ZodSet:let _;return _={type:"array",uniqueItems:!0,items:TB(e.valueType._def,{...r,currentPath:[...r.currentPath,"items"]})},e.minSize&&(_.minItems=e.minSize.value),e.maxSize&&(_.maxItems=e.maxSize.value),_;case L.ZodLazy:return()=>e.getter()._def;case L.ZodPromise:return TB(e.type._def,r);case L.ZodNaN:case L.ZodNever:return{not:{}};case L.ZodEffects:return"input"===r.effectStrategy?TB(e.schema._def,r):{};case L.ZodAny:case L.ZodUnknown:return{};case L.ZodDefault:return{...TB(e.innerType._def,r),default:e.defaultValue()};case L.ZodBranded:return T_(e,r);case L.ZodReadonly:case L.ZodCatch:return TB(e.innerType._def,r);case L.ZodPipeline:if("input"===r.pipeStrategy)return TB(e.in._def,r);if("output"===r.pipeStrategy)return TB(e.out._def,r);let k=TB(e.in._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),I=TB(e.out._def,{...r,currentPath:[...r.currentPath,"allOf",k?"1":"0"]});return{allOf:[k,I].filter(e=>void 0!==e)};case L.ZodFunction:case L.ZodVoid:case L.ZodSymbol:default:return}})(e,e.typeName,t),s="function"==typeof o?TB(o(),t):o;if(s&&Tq(e,t,s),t.postProcess){let r=t.postProcess(s,e,t);return a.jsonSchema=s,r}return a.jsonSchema=s,s}var TV=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:((e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")})(t.currentPath,e.path)};case"none":case"seen":if(e.path.length<t.currentPath.length&&e.path.every((e,r)=>t.currentPath[r]===e))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),{};return"seen"===t.$refStrategy?{}:void 0}},Tq=(e,t,r)=>(e.description&&(r.description=e.description),r),TW=Symbol.for("vercel.ai.schema");function TJ(e){let t;return()=>(null==t&&(t=e()),t)}function TH(e,{validate:t}={}){return{[TW]:!0,_type:void 0,get jsonSchema(){return"function"==typeof e&&(e=e()),e},validate:t}}function TK(e){var t;return null==e?TH({properties:{},additionalProperties:!1}):"object"==typeof e&&null!==e&&TW in e&&!0===e[TW]&&"jsonSchema"in e&&"validate"in e?e:"~standard"in e?"zod"===e["~standard"].vendor?TG(e):(t=e,TH(()=>Ty(t["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async e=>{let r=await t["~standard"].validate(e);return"value"in r?{success:!0,value:r.value}:{success:!1,error:new Sw({value:e,cause:r.issues})}}})):e()}function TG(e,t){var r,n;let i;if("_zod"in e){let n;return n=null!=(r=null==t?void 0:t.useReferences)&&r,TH(()=>Ty(jU(e,{target:"draft-7",io:"input",reused:n?"ref":"inline"})),{validate:async t=>{let r=await $F(e,t);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}return i=null!=(n=null==t?void 0:t.useReferences)&&n,TH(()=>((e,t)=>{var r;let n,i,a=(i=void 0!==(n="string"==typeof t?{...Tw,name:t}:{...Tw,...t}).name?[...n.basePath,n.definitionPath,n.name]:n.basePath,{...n,currentPath:i,propertyPath:void 0,seen:new Map(Object.entries(n.definitions).map(([e,t])=>[t._def,{def:t._def,path:[...n.basePath,n.definitionPath,e],jsonSchema:void 0}]))}),o="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>{var n;return{...e,[t]:null!=(n=TB(r._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?n:{}}},{}):void 0,s="string"==typeof t?t:(null==t?void 0:t.nameStrategy)==="title"||null==t?void 0:t.name,l=null!=(r=TB(e._def,void 0===s?a:{...a,currentPath:[...a.basePath,a.definitionPath,s]},!1))?r:{},u="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==u&&(l.title=u);let d=void 0===s?o?{...l,[a.definitionPath]:o}:l:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,s].join("/"),[a.definitionPath]:{...o,[s]:l}};return d.$schema="http://json-schema.org/draft-07/schema#",d})(e,{$refStrategy:i?"root":"none"}),{validate:async t=>{let r=await e.safeParseAsync(t);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}async function TY({value:e,schema:t,context:r}){let n=await TX({value:e,schema:t,context:r});if(!n.success)throw Sw.wrap({value:e,cause:n.error,context:r});return n.value}async function TX({value:e,schema:t,context:r}){let n=TK(t);try{if(null==n.validate)return{success:!0,value:e,rawValue:e};let t=await n.validate(e);if(t.success)return{success:!0,value:t.value,rawValue:e};return{success:!1,error:Sw.wrap({value:e,cause:t.error,context:r}),rawValue:e}}catch(t){return{success:!1,error:Sw.wrap({value:e,cause:t,context:r}),rawValue:e}}}async function TQ({text:e,schema:t}){try{let r=Tv(e);if(null==t)return r;return TY({value:r,schema:t})}catch(t){if(Sg.isInstance(t)||Sw.isInstance(t))throw t;throw new Sg({text:e,cause:t})}}async function T0({text:e,schema:t}){try{let r=Tv(e);if(null==t)return{success:!0,value:r,rawValue:r};return await TX({value:r,schema:t})}catch(t){return{success:!1,error:Sg.isInstance(t)?t:new Sg({text:e,cause:t}),rawValue:void 0}}}function T1({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new EY).pipeThrough(new TransformStream({async transform({data:e},r){"[DONE]"!==e&&r.enqueue(await T0({text:e,schema:t}))}}))}var T2=()=>globalThis.fetch,T4=async({url:e,headers:t,body:r,failedResponseHandler:n,successfulResponseHandler:i,abortSignal:a,fetch:o})=>T6({url:e,headers:{"Content-Type":"application/json",...t},body:{content:JSON.stringify(r),values:r},failedResponseHandler:n,successfulResponseHandler:i,abortSignal:a,fetch:o}),T6=async({url:e,headers:t={},body:r,successfulResponseHandler:n,failedResponseHandler:i,abortSignal:a,fetch:o=T2()})=>{try{let s=await o(e,{method:"POST",headers:Tu(t,`ai-sdk/provider-utils/${Td}`,Ts()),body:r.content,signal:a}),l=EQ(s);if(!s.ok){let t;try{t=await i({response:s,url:e,requestBodyValues:r.values})}catch(t){if(Tn(t)||Sr.isInstance(t))throw t;throw new Sr({message:"Failed to process error response",cause:t,statusCode:s.status,url:e,responseHeaders:l,requestBodyValues:r.values})}throw t.value}try{return await n({response:s,url:e,requestBodyValues:r.values})}catch(t){if(t instanceof Error&&(Tn(t)||Sr.isInstance(t)))throw t;throw new Sr({message:"Failed to process successful response",cause:t,statusCode:s.status,url:e,responseHeaders:l,requestBodyValues:r.values})}}catch(t){throw To({error:t,url:e,requestBodyValues:r.values})}};function T5({id:e,inputSchema:t,outputSchema:r,supportsDeferredResults:n}){return({execute:i,needsApproval:a,toModelOutput:o,onInputStart:s,onInputDelta:l,onInputAvailable:u,...d})=>({type:"provider",id:e,args:d,inputSchema:t,outputSchema:r,execute:i,needsApproval:a,toModelOutput:o,onInputStart:s,onInputDelta:l,onInputAvailable:u,supportsDeferredResults:n})}async function T3(e){return"function"==typeof e&&(e=e()),Promise.resolve(e)}var T9=({errorSchema:e,errorToMessage:t,isRetryable:r})=>async({response:n,url:i,requestBodyValues:a})=>{let o=await n.text(),s=EQ(n);if(""===o.trim())return{responseHeaders:s,value:new Sr({message:n.statusText,url:i,requestBodyValues:a,statusCode:n.status,responseHeaders:s,responseBody:o,isRetryable:null==r?void 0:r(n)})};try{let l=await TQ({text:o,schema:e});return{responseHeaders:s,value:new Sr({message:t(l),url:i,requestBodyValues:a,statusCode:n.status,responseHeaders:s,responseBody:o,data:l,isRetryable:null==r?void 0:r(n,l)})}}catch(e){return{responseHeaders:s,value:new Sr({message:n.statusText,url:i,requestBodyValues:a,statusCode:n.status,responseHeaders:s,responseBody:o,isRetryable:null==r?void 0:r(n)})}}},T8=e=>async({response:t,url:r,requestBodyValues:n})=>{let i=await t.text(),a=await T0({text:i,schema:e}),o=EQ(t);if(!a.success)throw new Sr({message:"Invalid JSON response",cause:a.error,statusCode:t.status,responseHeaders:o,responseBody:i,url:r,requestBodyValues:n});return{responseHeaders:o,value:a.value,rawValue:a.rawValue}};function T7(){let e,t,r;return{localeError:(e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}},t={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;return`Invalid input: expected ${e}, received ${i}`}case"invalid_value":if(1===n.values.length)return`Invalid input: expected ${SQ(n.values[0])}`;return`Invalid option: expected one of ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Too big: expected ${n.origin??"value"} to have ${t}${n.maximum.toString()} ${r.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Too small: expected ${n.origin} to have ${t}${n.minimum.toString()} ${r.unit}`;return`Too small: expected ${n.origin} to be ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Invalid string: must start with "${n.prefix}"`;if("ends_with"===n.format)return`Invalid string: must end with "${n.suffix}"`;if("includes"===n.format)return`Invalid string: must include "${n.includes}"`;if("regex"===n.format)return`Invalid string: must match pattern ${n.pattern}`;return`Invalid ${t[n.format]??n.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${SN(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":if(n.options&&Array.isArray(n.options)&&n.options.length>0){let e=n.options.map(e=>`'${e}'`).join(" | ");return`Invalid discriminator value. Expected ${e}`}return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}})}}ST(T7()),e.s([],98821),e.i(98821),e.s([],92135),e.i(92135),e.i(97753),e.i(3108),e.i(74969);let Ce=/^[cC][0-9a-z]{6,}$/,Ct=/^[0-9a-z]+$/,Cr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Cn=/^[0-9a-vA-V]{20}$/,Ci=/^[A-Za-z0-9]{27}$/,Ca=/^[a-zA-Z0-9_-]{21}$/,Co=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Cs=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Cl=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Cu=Cl(4),Cd=Cl(6),Cc=Cl(7),Cp=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Cm=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u;function Cf(){return RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}let Ch=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Cg=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Cv=e=>{let t=SG(e??":");return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Cy=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Cb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Cx=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Cw=/^[A-Za-z0-9_-]*$/,C_=/^https?$/,Ck=/^\+[1-9]\d{6,14}$/,CI="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",CS=RegExp(`^${CI}$`);function C$(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Cj(e){return RegExp(`^${C$(e)}$`)}function CE(e){let t=C$({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return RegExp(`^${CI}T(?:${n})$`)}let CT=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return RegExp(`^${t}$`)},CC=/^-?\d+n?$/,CN=/^-?\d+$/,CA=/^-?\d+(?:\.\d+)?$/,CR=/^(?:true|false)$/i,CP=/^null$/i,CO=/^undefined$/i,CM=/^[^A-Z]*$/,Cz=/^[^a-z]*$/;function CD(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function CU(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}let CL=CD(22,"=="),CZ=CU(22),CF=CD(27,"="),CB=CU(27),CV=CD(43,"="),Cq=CU(43),CW=CD(64,""),CJ=CU(64),CH=CD(86,"=="),CK=CU(86);e.s(["base64",0,Cx,"base64url",0,Cw,"bigint",0,CC,"boolean",0,CR,"browserEmail",0,/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,"cidrv4",0,Cy,"cidrv6",0,Cb,"cuid",0,Ce,"cuid2",0,Ct,"date",0,CS,"datetime",0,CE,"domain",0,/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,"duration",0,Co,"e164",0,Ck,"email",0,Cp,"emoji",0,Cf,"extendedDuration",0,/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,"guid",0,Cs,"hex",0,/^[0-9a-fA-F]*$/,"hostname",0,/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,"html5Email",0,/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,"httpProtocol",0,C_,"idnEmail",0,Cm,"integer",0,CN,"ipv4",0,Ch,"ipv6",0,Cg,"ksuid",0,Ci,"lowercase",0,CM,"mac",0,Cv,"md5_base64",0,CL,"md5_base64url",0,CZ,"md5_hex",0,/^[0-9a-fA-F]{32}$/,"nanoid",0,Ca,"null",0,CP,"number",0,CA,"rfc5322Email",0,/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,"sha1_base64",0,CF,"sha1_base64url",0,CB,"sha1_hex",0,/^[0-9a-fA-F]{40}$/,"sha256_base64",0,CV,"sha256_base64url",0,Cq,"sha256_hex",0,/^[0-9a-fA-F]{64}$/,"sha384_base64",0,CW,"sha384_base64url",0,CJ,"sha384_hex",0,/^[0-9a-fA-F]{96}$/,"sha512_base64",0,CH,"sha512_base64url",0,CK,"sha512_hex",0,/^[0-9a-fA-F]{128}$/,"string",0,CT,"time",0,Cj,"ulid",0,Cr,"undefined",0,CO,"unicodeEmail",0,Cm,"uppercase",0,Cz,"uuid",0,Cl,"uuid4",0,Cu,"uuid6",0,Cd,"uuid7",0,Cc,"xid",0,Cn],82358);let CG=SI("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),CY={number:"number",bigint:"bigint",object:"date"},CX=SI("$ZodCheckLessThan",(e,t)=>{CG.init(e,t);let r=CY[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),CQ=SI("$ZodCheckGreaterThan",(e,t)=>{CG.init(e,t);let r=CY[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),C0=SI("$ZodCheckMultipleOf",(e,t)=>{CG.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===SM(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),C1=SI("$ZodCheckNumberFormat",(e,t)=>{CG.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,a]=S1[t.format];e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,n.minimum=i,n.maximum=a,r&&(n.pattern=CN)}),e._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s))return void o.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}))}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),C2=SI("$ZodCheckBigIntFormat",(e,t)=>{CG.init(e,t);let[r,n]=S2[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=i=>{let a=i.value;a<r&&i.issues.push({origin:"bigint",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>n&&i.issues.push({origin:"bigint",input:a,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),C4=SI("$ZodCheckMaxSize",(e,t)=>{var r;CG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!SP(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;n.size<=t.maximum||r.issues.push({origin:S8(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),C6=SI("$ZodCheckMinSize",(e,t)=>{var r;CG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!SP(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;n.size>=t.minimum||r.issues.push({origin:S8(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),C5=SI("$ZodCheckSizeEquals",(e,t)=>{var r;CG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!SP(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=r=>{let n=r.value,i=n.size;if(i===t.size)return;let a=i>t.size;r.issues.push({origin:S8(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),C3=SI("$ZodCheckMaxLength",(e,t)=>{var r;CG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!SP(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;if(n.length<=t.maximum)return;let i=S7(n);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),C9=SI("$ZodCheckMinLength",(e,t)=>{var r;CG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!SP(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;if(n.length>=t.minimum)return;let i=S7(n);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),C8=SI("$ZodCheckLengthEquals",(e,t)=>{var r;CG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!SP(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let n=r.value,i=n.length;if(i===t.length)return;let a=S7(n),o=i>t.length;r.issues.push({origin:a,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),C7=SI("$ZodCheckStringFormat",(e,t)=>{var r,n;CG.init(e,t),e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Ne=SI("$ZodCheckRegex",(e,t)=>{C7.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Nt=SI("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=CM),C7.init(e,t)}),Nr=SI("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Cz),C7.init(e,t)}),Nn=SI("$ZodCheckIncludes",(e,t)=>{CG.init(e,t);let r=SG(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),Ni=SI("$ZodCheckStartsWith",(e,t)=>{CG.init(e,t);let r=RegExp(`^${SG(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Na=SI("$ZodCheckEndsWith",(e,t)=>{CG.init(e,t);let r=RegExp(`.*${SG(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function No(e,t,r){e.issues.length&&t.issues.push(...S5(r,e.issues))}let Ns=SI("$ZodCheckProperty",(e,t)=>{CG.init(e,t),e._zod.check=e=>{let r=t.schema._zod.run({value:e.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(r=>No(r,e,t.property));No(r,e,t.property)}}),Nl=SI("$ZodCheckMimeType",(e,t)=>{CG.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),Nu=SI("$ZodCheckOverwrite",(e,t)=>{CG.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});e.s(["$ZodCheck",0,CG,"$ZodCheckBigIntFormat",0,C2,"$ZodCheckEndsWith",0,Na,"$ZodCheckGreaterThan",0,CQ,"$ZodCheckIncludes",0,Nn,"$ZodCheckLengthEquals",0,C8,"$ZodCheckLessThan",0,CX,"$ZodCheckLowerCase",0,Nt,"$ZodCheckMaxLength",0,C3,"$ZodCheckMaxSize",0,C4,"$ZodCheckMimeType",0,Nl,"$ZodCheckMinLength",0,C9,"$ZodCheckMinSize",0,C6,"$ZodCheckMultipleOf",0,C0,"$ZodCheckNumberFormat",0,C1,"$ZodCheckOverwrite",0,Nu,"$ZodCheckProperty",0,Ns,"$ZodCheckRegex",0,Ne,"$ZodCheckSizeEquals",0,C5,"$ZodCheckStartsWith",0,Ni,"$ZodCheckStringFormat",0,C7,"$ZodCheckUpperCase",0,Nr],55605);class Nd{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}e.s(["Doc",0,Nd],98530);let Nc={major:4,minor:4,patch:3};e.s(["version",0,Nc],98477);let Np=SI("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Nc;let n=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&n.unshift(e),n))for(let r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let n,i=S4(e);for(let a of t){if(a._zod.def.when){if(S6(e)||!a._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&r?.async===!1)throw new S$;if(n||o instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(i||(i=S4(e,t)))});else{if(e.issues.length===t)continue;i||(i=S4(e,t))}}return n?n.then(()=>e):e},r=(r,i,a)=>{if(S4(r))return r.aborted=!0,r;let o=t(i,n,a);if(o instanceof Promise){if(!1===a.async)throw new S$;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if("backward"===a.direction){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,i,a)):r(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(!1===a.async)throw new S$;return o.then(e=>t(e,n,a))}return t(o,n,a)}}SD(e,"~standard",()=>({validate:t=>{try{let r=$v(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return $b(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Nm=SI("$ZodString",(e,t)=>{Np.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??CT(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(e){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Nf=SI("$ZodStringFormat",(e,t)=>{C7.init(e,t),Nm.init(e,t)}),Nh=SI("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Cs),Nf.init(e,t)}),Ng=SI("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Cl(e))}else t.pattern??(t.pattern=Cl());Nf.init(e,t)}),Nv=SI("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Cp),Nf.init(e,t)}),Ny=SI("$ZodURL",(e,t)=>{Nf.init(e,t),e._zod.check=r=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===C_.source&&!/^https?:\/\//i.test(n))return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});let i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Nb=SI("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Cf()),Nf.init(e,t)}),Nx=SI("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ca),Nf.init(e,t)}),Nw=SI("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ce),Nf.init(e,t)}),N_=SI("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ct),Nf.init(e,t)}),Nk=SI("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Cr),Nf.init(e,t)}),NI=SI("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Cn),Nf.init(e,t)}),NS=SI("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ci),Nf.init(e,t)}),N$=SI("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=CE(t)),Nf.init(e,t)}),Nj=SI("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=CS),Nf.init(e,t)}),NE=SI("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Cj(t)),Nf.init(e,t)}),NT=SI("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Co),Nf.init(e,t)}),NC=SI("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ch),Nf.init(e,t),e._zod.bag.format="ipv4"}),NN=SI("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Cg),Nf.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),NA=SI("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Cv(t.delimiter)),Nf.init(e,t),e._zod.bag.format="mac"}),NR=SI("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Cy),Nf.init(e,t)}),NP=SI("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Cb),Nf.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(2!==n.length)throw Error();let[e,t]=n;if(!t)throw Error();let r=Number(t);if(`${r}`!==t||r<0||r>128)throw Error();new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function NO(e){if(""===e)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let NM=SI("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Cx),Nf.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{NO(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Nz(e){if(!Cw.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return NO(t.padEnd(4*Math.ceil(t.length/4),"="))}let ND=SI("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Cw),Nf.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Nz(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),NU=SI("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ck),Nf.init(e,t)});function NL(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}let NZ=SI("$ZodJWT",(e,t)=>{Nf.init(e,t),e._zod.check=r=>{NL(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),NF=SI("$ZodCustomStringFormat",(e,t)=>{Nf.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),NB=SI("$ZodNumber",(e,t)=>{Np.init(e,t),e._zod.pattern=e._zod.bag.pattern??CA,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;let a="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...a?{received:a}:{}}),r}}),NV=SI("$ZodNumberFormat",(e,t)=>{C1.init(e,t),NB.init(e,t)}),Nq=SI("$ZodBoolean",(e,t)=>{Np.init(e,t),e._zod.pattern=CR,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),NW=SI("$ZodBigInt",(e,t)=>{Np.init(e,t),e._zod.pattern=CC,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(e){}return"bigint"==typeof r.value||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),NJ=SI("$ZodBigIntFormat",(e,t)=>{C2.init(e,t),NW.init(e,t)}),NH=SI("$ZodSymbol",(e,t)=>{Np.init(e,t),e._zod.parse=(t,r)=>{let n=t.value;return"symbol"==typeof n||t.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),t}}),NK=SI("$ZodUndefined",(e,t)=>{Np.init(e,t),e._zod.pattern=CO,e._zod.values=new Set([void 0]),e._zod.parse=(t,r)=>{let n=t.value;return void 0===n||t.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),t}}),NG=SI("$ZodNull",(e,t)=>{Np.init(e,t),e._zod.pattern=CP,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let n=t.value;return null===n||t.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),t}}),NY=SI("$ZodAny",(e,t)=>{Np.init(e,t),e._zod.parse=e=>e}),NX=SI("$ZodUnknown",(e,t)=>{Np.init(e,t),e._zod.parse=e=>e}),NQ=SI("$ZodNever",(e,t)=>{Np.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),N0=SI("$ZodVoid",(e,t)=>{Np.init(e,t),e._zod.parse=(t,r)=>{let n=t.value;return void 0===n||t.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),t}}),N1=SI("$ZodDate",(e,t)=>{Np.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(e){}let i=r.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:e}),r}});function N2(e,t,r){e.issues.length&&t.issues.push(...S5(r,e.issues)),t.value[r]=e.value}let N4=SI("$ZodArray",(e,t)=>{Np.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},n);s instanceof Promise?a.push(s.then(t=>N2(t,r,e))):N2(s,r,e)}return a.length?Promise.all(a).then(()=>r):r}});function N6(e,t,r,n,i,a){let o=r in n;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...S5(r,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}void 0===e.value?o&&(t.value[r]=void 0):t.value[r]=e.value}function N5(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${r}": expected a Zod schema`);let r=S0(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function N3(e,t,r,n,i,a){let o=[],s=i.keySet,l=i.catchall._zod,u=l.def.type,d="optional"===l.optin,c="optional"===l.optout;for(let i in t){if("__proto__"===i||s.has(i))continue;if("never"===u){o.push(i);continue}let a=l.run({value:t[i],issues:[]},n);a instanceof Promise?e.push(a.then(e=>N6(e,r,i,t,d,c))):N6(a,r,i,t,d,c)}return(o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:a}),e.length)?Promise.all(e).then(()=>r):r}let N9=SI("$ZodObject",(e,t)=>{let r;Np.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let i=SR(()=>N5(t));SD(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let n=e[t]._zod;if(n.values)for(let e of(r[t]??(r[t]=new Set),n.values))r[t].add(e)}return r});let a=t.catchall;e._zod.parse=(t,n)=>{r??(r=i.value);let o=t.value;if(!SV(o))return t.issues.push({expected:"object",code:"invalid_type",input:o,inst:e}),t;t.value={};let s=[],l=r.shape;for(let e of r.keys){let r=l[e],i="optional"===r._zod.optin,a="optional"===r._zod.optout,u=r._zod.run({value:o[e],issues:[]},n);u instanceof Promise?s.push(u.then(r=>N6(r,t,e,o,i,a))):N6(u,t,e,o,i,a)}return a?N3(s,o,t,n,i.value,e):s.length?Promise.all(s).then(()=>t):t}}),N8=SI("$ZodObjectJIT",(e,t)=>{let r,n;N9.init(e,t);let i=e._zod.parse,a=SR(()=>N5(t)),o=!SE.jitless,s=o&&Sq.value,l=t.catchall;e._zod.parse=(u,d)=>{n??(n=a.value);let c=u.value;return SV(c)?o&&s&&d?.async===!1&&!0!==d.jitless?(r||(r=(e=>{let t=new Nd(["shape","payload","ctx"]),r=a.value,n=e=>{let t=SZ(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let i=Object.create(null),o=0;for(let e of r.keys)i[e]=`key_${o++}`;for(let a of(t.write("const newResult = {};"),r.keys)){let r=i[a],o=SZ(a),s=e[a],l=s?._zod?.optin==="optional",u=s?._zod?.optout==="optional";t.write(`const ${r} = ${n(a)};`),l&&u?t.write(`
|
|
25
|
+
if (${r}.issues.length) {
|
|
26
|
+
if (${o} in input) {
|
|
27
|
+
payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
|
|
28
|
+
...iss,
|
|
29
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
30
|
+
})));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (${r}.value === undefined) {
|
|
35
|
+
if (${o} in input) {
|
|
36
|
+
newResult[${o}] = undefined;
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
newResult[${o}] = ${r}.value;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
`):l?t.write(`
|
|
43
|
+
if (${r}.issues.length) {
|
|
44
|
+
payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
|
|
45
|
+
...iss,
|
|
46
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
47
|
+
})));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (${r}.value === undefined) {
|
|
51
|
+
if (${o} in input) {
|
|
52
|
+
newResult[${o}] = undefined;
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
newResult[${o}] = ${r}.value;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
`):t.write(`
|
|
59
|
+
const ${r}_present = ${o} in input;
|
|
60
|
+
if (${r}.issues.length) {
|
|
61
|
+
payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
|
|
62
|
+
...iss,
|
|
63
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
64
|
+
})));
|
|
65
|
+
}
|
|
66
|
+
if (!${r}_present && !${r}.issues.length) {
|
|
67
|
+
payload.issues.push({
|
|
68
|
+
code: "invalid_type",
|
|
69
|
+
expected: "nonoptional",
|
|
70
|
+
input: undefined,
|
|
71
|
+
path: [${o}]
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (${r}_present) {
|
|
76
|
+
if (${r}.value === undefined) {
|
|
77
|
+
newResult[${o}] = undefined;
|
|
78
|
+
} else {
|
|
79
|
+
newResult[${o}] = ${r}.value;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
`)}t.write("payload.value = newResult;"),t.write("return payload;");let s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),u=r(u,d),l)?N3([],c,u,d,n,e):u:i(u,d):(u.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),u)}});function N7(e,t,r,n){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let i=e.filter(e=>!S4(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>S9(e,n,ST())))}),t)}let Ae=SI("$ZodUnion",(e,t)=>{Np.init(e,t),SD(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),SD(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),SD(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),SD(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>SO(e.source)).join("|")})$`)}});let r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(n,i)=>{if(r)return r(n,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:n.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(0===t.issues.length)return t;o.push(t)}}return a?Promise.all(o).then(t=>N7(t,n,e,i)):N7(o,n,e,i)}});function At(e,t,r,n){let i=e.filter(e=>0===e.issues.length);return 1===i.length?t.value=i[0].value:0===i.length?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>S9(e,n,ST())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t}let Ar=SI("$ZodXor",(e,t)=>{Ae.init(e,t),t.inclusive=!1;let r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(n,i)=>{if(r)return r(n,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:n.value,issues:[]},i);t instanceof Promise?(o.push(t),a=!0):o.push(t)}return a?Promise.all(o).then(t=>At(t,n,e,i)):At(o,n,e,i)}}),An=SI("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ae.init(e,t);let r=e._zod.parse;SD(e._zod,"propValues",()=>{let e={};for(let r of t.options){let n=r._zod.propValues;if(!n||0===Object.keys(n).length)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let[t,r]of Object.entries(n))for(let n of(e[t]||(e[t]=new Set),r))e[t].add(n)}return e});let n=SR(()=>{let e=t.options,r=new Map;for(let n of e){let e=n._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let t of e){if(r.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,n)}}return r});e._zod.parse=(i,a)=>{let o=i.value;if(!SV(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:e}),i;let s=n.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||"backward"===a.direction?r(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Ai=SI("$ZodIntersection",(e,t)=>{Np.init(e,t),e._zod.parse=(e,r)=>{let n=e.value,i=t.left._zod.run({value:n,issues:[]},r),a=t.right._zod.run({value:n,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,r])=>Aa(e,t,r)):Aa(e,i,a)}});function Aa(e,t,r){let n,i=new Map;for(let r of t.issues)if("unrecognized_keys"===r.code)for(let e of(n??(n=r),r.keys))i.has(e)||i.set(e,{}),i.get(e).l=!0;else e.issues.push(r);for(let t of r.issues)if("unrecognized_keys"===t.code)for(let e of t.keys)i.has(e)||i.set(e,{}),i.get(e).r=!0;else e.issues.push(t);let a=[...i].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&n&&e.issues.push({...n,keys:a}),S4(e))return e;let o=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(SW(t)&&SW(r)){let n=Object.keys(r),i=Object.keys(t).filter(e=>-1!==n.indexOf(e)),a={...t,...r};for(let n of i){let i=e(t[n],r[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};a[n]=i.data}return{valid:!0,data:a}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let i=0;i<t.length;i++){let a=e(t[i],r[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}(t.value,r.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}let Ao=SI("$ZodTuple",(e,t)=>{Np.init(e,t);let r=t.items;e._zod.parse=(n,i)=>{let a=n.value;if(!Array.isArray(a))return n.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let o=[],s=As(r,"optin"),l=As(r,"optout");if(!t.rest){if(a.length<s)return n.issues.push({code:"too_small",minimum:s,inclusive:!0,input:a,inst:e,origin:"array"}),n;a.length>r.length&&n.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:a,inst:e,origin:"array"})}let u=Array(r.length);for(let e=0;e<r.length;e++){let t=r[e]._zod.run({value:a[e],issues:[]},i);t instanceof Promise?o.push(t.then(t=>{u[e]=t})):u[e]=t}if(t.rest){let e=r.length-1;for(let s of a.slice(r.length)){e++;let r=t.rest._zod.run({value:s,issues:[]},i);r instanceof Promise?o.push(r.then(t=>Al(t,n,e))):Al(r,n,e)}}return o.length?Promise.all(o).then(()=>Au(u,n,r,a,l)):Au(u,n,r,a,l)}});function As(e,t){for(let r=e.length-1;r>=0;r--)if("optional"!==e[r]._zod[t])return r+1;return 0}function Al(e,t,r){e.issues.length&&t.issues.push(...S5(r,e.issues)),t.value[r]=e.value}function Au(e,t,r,n,i){for(let a=0;a<r.length;a++){let r=e[a],o=a<n.length;if(r.issues.length){if(!o&&a>=i){t.value.length=a;break}t.issues.push(...S5(a,r.issues))}t.value[a]=r.value}for(let e=t.value.length-1;e>=n.length;e--)if("optional"===r[e]._zod.optout&&void 0===t.value[e])t.value.length=e;else break;return t}let Ad=SI("$ZodRecord",(e,t)=>{Np.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!SW(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let a=[],o=t.keyType._zod.values;if(o){let s;r.value={};let l=new Set;for(let s of o)if("string"==typeof s||"number"==typeof s||"symbol"==typeof s){l.add("number"==typeof s?s.toString():s);let o=t.keyType._zod.run({value:s,issues:[]},n);if(o instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(o.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(e=>S9(e,n,ST())),input:s,path:[s],inst:e});continue}let u=o.value,d=t.valueType._zod.run({value:i[s],issues:[]},n);d instanceof Promise?a.push(d.then(e=>{e.issues.length&&r.issues.push(...S5(s,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...S5(s,d.issues)),r.value[u]=d.value)}for(let e in i)l.has(e)||(s=s??[]).push(e);s&&s.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:s})}else for(let o of(r.value={},Reflect.ownKeys(i))){if("__proto__"===o||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},n);if(s instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof o&&CA.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},n);if(e instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===e.issues.length&&(s=e)}if(s.issues.length){"loose"===t.mode?r.value[o]=i[o]:r.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>S9(e,n,ST())),input:o,path:[o],inst:e});continue}let l=t.valueType._zod.run({value:i[o],issues:[]},n);l instanceof Promise?a.push(l.then(e=>{e.issues.length&&r.issues.push(...S5(o,e.issues)),r.value[s.value]=e.value})):(l.issues.length&&r.issues.push(...S5(o,l.issues)),r.value[s.value]=l.value)}return a.length?Promise.all(a).then(()=>r):r}}),Ac=SI("$ZodMap",(e,t)=>{Np.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let a=[];for(let[o,s]of(r.value=new Map,i)){let l=t.keyType._zod.run({value:o,issues:[]},n),u=t.valueType._zod.run({value:s,issues:[]},n);l instanceof Promise||u instanceof Promise?a.push(Promise.all([l,u]).then(([t,a])=>{Ap(t,a,r,o,i,e,n)})):Ap(l,u,r,o,i,e,n)}return a.length?Promise.all(a).then(()=>r):r}});function Ap(e,t,r,n,i,a,o){e.issues.length&&(SH.has(typeof n)?r.issues.push(...S5(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:i,inst:a,issues:e.issues.map(e=>S9(e,o,ST()))})),t.issues.length&&(SH.has(typeof n)?r.issues.push(...S5(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:i,inst:a,key:n,issues:t.issues.map(e=>S9(e,o,ST()))})),r.value.set(e.value,t.value)}let Am=SI("$ZodSet",(e,t)=>{Np.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let a=[];for(let e of(r.value=new Set,i)){let i=t.valueType._zod.run({value:e,issues:[]},n);i instanceof Promise?a.push(i.then(e=>Af(e,r))):Af(i,r)}return a.length?Promise.all(a).then(()=>r):r}});function Af(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}let Ah=SI("$ZodEnum",(e,t)=>{Np.init(e,t);let r=SC(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=RegExp(`^(${r.filter(e=>SH.has(typeof e)).map(e=>"string"==typeof e?SG(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{let a=t.value;return n.has(a)||t.issues.push({code:"invalid_value",values:r,input:a,inst:e}),t}}),Ag=SI("$ZodLiteral",(e,t)=>{if(Np.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?SG(e):e?SG(e.toString()):String(e)).join("|")})$`),e._zod.parse=(n,i)=>{let a=n.value;return r.has(a)||n.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),n}}),Av=SI("$ZodFile",(e,t)=>{Np.init(e,t),e._zod.parse=(t,r)=>{let n=t.value;return n instanceof File||t.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),t}}),Ay=SI("$ZodTransform",(e,t)=>{Np.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new Sj(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(r.value=e,r.fallback=!0,r));if(i instanceof Promise)throw new S$;return r.value=i,r.fallback=!0,r}});function Ab(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let Ax=SI("$ZodOptional",(e,t)=>{Np.init(e,t),e._zod.optin="optional",e._zod.optout="optional",SD(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),SD(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${SO(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let n=e.value,i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(e=>Ab(e,n)):Ab(i,n)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),Aw=SI("$ZodExactOptional",(e,t)=>{Ax.init(e,t),SD(e._zod,"values",()=>t.innerType._zod.values),SD(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),A_=SI("$ZodNullable",(e,t)=>{Np.init(e,t),SD(e._zod,"optin",()=>t.innerType._zod.optin),SD(e._zod,"optout",()=>t.innerType._zod.optout),SD(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${SO(e.source)}|null)$`):void 0}),SD(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),Ak=SI("$ZodDefault",(e,t)=>{Np.init(e,t),e._zod.optin="optional",SD(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>AI(e,t)):AI(n,t)}});function AI(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let AS=SI("$ZodPrefault",(e,t)=>{Np.init(e,t),e._zod.optin="optional",SD(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),A$=SI("$ZodNonOptional",(e,t)=>{Np.init(e,t),SD(e._zod,"values",()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(t=>Aj(t,e)):Aj(i,e)}});function Aj(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}let AE=SI("$ZodSuccess",(e,t)=>{Np.init(e,t),e._zod.parse=(e,r)=>{if("backward"===r.direction)throw new Sj("ZodSuccess");let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(t=>(e.value=0===t.issues.length,e)):(e.value=0===n.issues.length,e)}}),AT=SI("$ZodCatch",(e,t)=>{Np.init(e,t),e._zod.optin="optional",SD(e._zod,"optout",()=>t.innerType._zod.optout),SD(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>S9(e,r,ST()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>S9(e,r,ST()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),AC=SI("$ZodNaN",(e,t)=>{Np.init(e,t),e._zod.parse=(t,r)=>("number"==typeof t.value&&Number.isNaN(t.value)||t.issues.push({input:t.value,inst:e,expected:"nan",code:"invalid_type"}),t)}),AN=SI("$ZodPipe",(e,t)=>{Np.init(e,t),SD(e._zod,"values",()=>t.in._zod.values),SD(e._zod,"optin",()=>t.in._zod.optin),SD(e._zod,"optout",()=>t.out._zod.optout),SD(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){let n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>AA(e,t.in,r)):AA(n,t.in,r)}let n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>AA(e,t.out,r)):AA(n,t.out,r)}});function AA(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}let AR=SI("$ZodCodec",(e,t)=>{Np.init(e,t),SD(e._zod,"values",()=>t.in._zod.values),SD(e._zod,"optin",()=>t.in._zod.optin),SD(e._zod,"optout",()=>t.out._zod.optout),SD(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("forward"===(r.direction||"forward")){let n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>AP(e,t,r)):AP(n,t,r)}{let n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>AP(e,t,r)):AP(n,t,r)}}});function AP(e,t,r){if(e.issues.length)return e.aborted=!0,e;if("forward"===(r.direction||"forward")){let n=t.transform(e.value,e);return n instanceof Promise?n.then(n=>AO(e,n,t.out,r)):AO(e,n,t.out,r)}{let n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(n=>AO(e,n,t.in,r)):AO(e,n,t.in,r)}}function AO(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}let AM=SI("$ZodPreprocess",(e,t)=>{AN.init(e,t)}),Az=SI("$ZodReadonly",(e,t)=>{Np.init(e,t),SD(e._zod,"propValues",()=>t.innerType._zod.propValues),SD(e._zod,"values",()=>t.innerType._zod.values),SD(e._zod,"optin",()=>t.innerType?._zod?.optin),SD(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(AD):AD(n)}});function AD(e){return e.value=Object.freeze(e.value),e}let AU=SI("$ZodTemplateLiteral",(e,t)=>{Np.init(e,t);let r=[];for(let e of t.parts)if("object"==typeof e&&null!==e){if(!e._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);let t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw Error(`Invalid template literal part: ${e._zod.traits}`);let n=+!!t.startsWith("^"),i=t.endsWith("$")?t.length-1:t.length;r.push(t.slice(n,i))}else if(null===e||SK.has(typeof e))r.push(SG(`${e}`));else throw Error(`Invalid template literal part: ${e}`);e._zod.pattern=RegExp(`^${r.join("")}$`),e._zod.parse=(r,n)=>("string"!=typeof r.value?r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source})),r)}),AL=SI("$ZodFunction",(e,t)=>(Np.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if("function"!=typeof t)throw Error("implement() must be called with a function");return function(...r){let n=Reflect.apply(t,this,e._def.input?$m(e._def.input,r):r);return e._def.output?$m(e._def.output,n):n}},e.implementAsync=t=>{if("function"!=typeof t)throw Error("implementAsync() must be called with a function");return async function(...r){let n=e._def.input?await $h(e._def.input,r):r,i=await Reflect.apply(t,this,n);return e._def.output?await $h(e._def.output,i):i}},e._zod.parse=(t,r)=>("function"!=typeof t.value?t.issues.push({code:"invalid_type",expected:"function",input:t.value,inst:e}):e._def.output&&"promise"===e._def.output._zod.def.type?t.value=e.implementAsync(t.value):t.value=e.implement(t.value),t),e.input=(...t)=>{let r=e.constructor;return new r(Array.isArray(t[0])?{type:"function",input:new Ao({type:"tuple",items:t[0],rest:t[1]}),output:e._def.output}:{type:"function",input:t[0],output:e._def.output})},e.output=t=>new e.constructor({type:"function",input:e._def.input,output:t}),e)),AZ=SI("$ZodPromise",(e,t)=>{Np.init(e,t),e._zod.parse=(e,r)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},r))}),AF=SI("$ZodLazy",(e,t)=>{Np.init(e,t),SD(e._zod,"innerType",()=>(t._cachedInner||(t._cachedInner=t.getter()),t._cachedInner)),SD(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),SD(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),SD(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),SD(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,r)=>e._zod.innerType._zod.run(t,r)}),AB=SI("$ZodCustom",(e,t)=>{CG.init(e,t),Np.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(t=>AV(t,r,n,e));AV(i,r,n,e)}});function AV(e,t,r,n){if(!e){let e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push($t(e))}}e.s(["$ZodAny",0,NY,"$ZodArray",0,N4,"$ZodBase64",0,NM,"$ZodBase64URL",0,ND,"$ZodBigInt",0,NW,"$ZodBigIntFormat",0,NJ,"$ZodBoolean",0,Nq,"$ZodCIDRv4",0,NR,"$ZodCIDRv6",0,NP,"$ZodCUID",0,Nw,"$ZodCUID2",0,N_,"$ZodCatch",0,AT,"$ZodCodec",0,AR,"$ZodCustom",0,AB,"$ZodCustomStringFormat",0,NF,"$ZodDate",0,N1,"$ZodDefault",0,Ak,"$ZodDiscriminatedUnion",0,An,"$ZodE164",0,NU,"$ZodEmail",0,Nv,"$ZodEmoji",0,Nb,"$ZodEnum",0,Ah,"$ZodExactOptional",0,Aw,"$ZodFile",0,Av,"$ZodFunction",0,AL,"$ZodGUID",0,Nh,"$ZodIPv4",0,NC,"$ZodIPv6",0,NN,"$ZodISODate",0,Nj,"$ZodISODateTime",0,N$,"$ZodISODuration",0,NT,"$ZodISOTime",0,NE,"$ZodIntersection",0,Ai,"$ZodJWT",0,NZ,"$ZodKSUID",0,NS,"$ZodLazy",0,AF,"$ZodLiteral",0,Ag,"$ZodMAC",0,NA,"$ZodMap",0,Ac,"$ZodNaN",0,AC,"$ZodNanoID",0,Nx,"$ZodNever",0,NQ,"$ZodNonOptional",0,A$,"$ZodNull",0,NG,"$ZodNullable",0,A_,"$ZodNumber",0,NB,"$ZodNumberFormat",0,NV,"$ZodObject",0,N9,"$ZodObjectJIT",0,N8,"$ZodOptional",0,Ax,"$ZodPipe",0,AN,"$ZodPrefault",0,AS,"$ZodPreprocess",0,AM,"$ZodPromise",0,AZ,"$ZodReadonly",0,Az,"$ZodRecord",0,Ad,"$ZodSet",0,Am,"$ZodString",0,Nm,"$ZodStringFormat",0,Nf,"$ZodSuccess",0,AE,"$ZodSymbol",0,NH,"$ZodTemplateLiteral",0,AU,"$ZodTransform",0,Ay,"$ZodTuple",0,Ao,"$ZodType",0,Np,"$ZodULID",0,Nk,"$ZodURL",0,Ny,"$ZodUUID",0,Ng,"$ZodUndefined",0,NK,"$ZodUnion",0,Ae,"$ZodUnknown",0,NX,"$ZodVoid",0,N0,"$ZodXID",0,NI,"$ZodXor",0,Ar,"isValidBase64",0,NO,"isValidBase64URL",0,Nz,"isValidJWT",0,NL],76094),e.i(76094),e.s(["$ZodAny",0,NY,"$ZodArray",0,N4,"$ZodBase64",0,NM,"$ZodBase64URL",0,ND,"$ZodBigInt",0,NW,"$ZodBigIntFormat",0,NJ,"$ZodBoolean",0,Nq,"$ZodCIDRv4",0,NR,"$ZodCIDRv6",0,NP,"$ZodCUID",0,Nw,"$ZodCUID2",0,N_,"$ZodCatch",0,AT,"$ZodCodec",0,AR,"$ZodCustom",0,AB,"$ZodCustomStringFormat",0,NF,"$ZodDate",0,N1,"$ZodDefault",0,Ak,"$ZodDiscriminatedUnion",0,An,"$ZodE164",0,NU,"$ZodEmail",0,Nv,"$ZodEmoji",0,Nb,"$ZodEnum",0,Ah,"$ZodExactOptional",0,Aw,"$ZodFile",0,Av,"$ZodFunction",0,AL,"$ZodGUID",0,Nh,"$ZodIPv4",0,NC,"$ZodIPv6",0,NN,"$ZodISODate",0,Nj,"$ZodISODateTime",0,N$,"$ZodISODuration",0,NT,"$ZodISOTime",0,NE,"$ZodIntersection",0,Ai,"$ZodJWT",0,NZ,"$ZodKSUID",0,NS,"$ZodLazy",0,AF,"$ZodLiteral",0,Ag,"$ZodMAC",0,NA,"$ZodMap",0,Ac,"$ZodNaN",0,AC,"$ZodNanoID",0,Nx,"$ZodNever",0,NQ,"$ZodNonOptional",0,A$,"$ZodNull",0,NG,"$ZodNullable",0,A_,"$ZodNumber",0,NB,"$ZodNumberFormat",0,NV,"$ZodObject",0,N9,"$ZodObjectJIT",0,N8,"$ZodOptional",0,Ax,"$ZodPipe",0,AN,"$ZodPrefault",0,AS,"$ZodPreprocess",0,AM,"$ZodPromise",0,AZ,"$ZodReadonly",0,Az,"$ZodRecord",0,Ad,"$ZodSet",0,Am,"$ZodString",0,Nm,"$ZodStringFormat",0,Nf,"$ZodSuccess",0,AE,"$ZodSymbol",0,NH,"$ZodTemplateLiteral",0,AU,"$ZodTransform",0,Ay,"$ZodTuple",0,Ao,"$ZodType",0,Np,"$ZodULID",0,Nk,"$ZodURL",0,Ny,"$ZodUUID",0,Ng,"$ZodUndefined",0,NK,"$ZodUnion",0,Ae,"$ZodUnknown",0,NX,"$ZodVoid",0,N0,"$ZodXID",0,NI,"$ZodXor",0,Ar,"clone",0,SY,"isValidBase64",0,NO,"isValidBase64URL",0,Nz,"isValidJWT",0,NL],32952),e.i(32952),e.i(55605),e.i(98477);var Aq=e.i(22143),AW=e.i(82358);function AJ(e,t,r,n){let i=Math.abs(e),a=i%10,o=i%100;return o>=11&&o<=19?n:1===a?t:a>=2&&a<=4?r:n}function AH(e,t,r){return 1===Math.abs(e)?t:r}function AK(e){if(!e)return"";let t=e[e.length-1];return e+(["ա","ե","ը","ի","ո","ու","օ"].includes(t)?"ն":"ը")}function AG(){let e,t,r;return{localeError:(e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}},t={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"},r={nan:"NaN",number:"លេខ",array:"អារេ (Array)",null:"គ្មានតម្លៃ (null)"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${n.expected} ប៉ុន្តែទទួលបាន ${i}`;return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${e} ប៉ុន្តែទទួលបាន ${i}`}case"invalid_value":if(1===n.values.length)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${SQ(n.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${t} ${n.maximum.toString()} ${r.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${t} ${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`តូចពេក៖ ត្រូវការ ${n.origin} ${t} ${n.minimum.toString()} ${r.unit}`;return`តូចពេក៖ ត្រូវការ ${n.origin} ${t} ${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${n.prefix}"`;if("ends_with"===n.format)return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${n.suffix}"`;if("includes"===n.format)return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${n.includes}"`;if("regex"===n.format)return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${n.pattern}`;return`មិនត្រឹមត្រូវ៖ ${t[n.format]??n.format}`;case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${n.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${SN(n.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;case"invalid_union":default:return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`}})}}e.s([],43365),e.i(43365);let AY=e=>e.charAt(0).toUpperCase()+e.slice(1);function AX(e){let t=Math.abs(e),r=t%10,n=t%100;return n>=11&&n<=19||0===r?"many":1===r?"one":"few"}function AQ(e,t,r,n){let i=Math.abs(e),a=i%10,o=i%100;return o>=11&&o<=19?n:1===a?t:a>=2&&a<=4?r:n}function A0(){let e,t,r;return{localeError:(e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}},t={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"},r={nan:"NaN",number:"число",array:"масив"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Неправильні вхідні дані: очікується instanceof ${n.expected}, отримано ${i}`;return`Неправильні вхідні дані: очікується ${e}, отримано ${i}`}case"invalid_value":if(1===n.values.length)return`Неправильні вхідні дані: очікується ${SQ(n.values[0])}`;return`Неправильна опція: очікується одне з ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Занадто велике: очікується, що ${n.origin??"значення"} ${r.verb} ${t}${n.maximum.toString()} ${r.unit??"елементів"}`;return`Занадто велике: очікується, що ${n.origin??"значення"} буде ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Занадто мале: очікується, що ${n.origin} ${r.verb} ${t}${n.minimum.toString()} ${r.unit}`;return`Занадто мале: очікується, що ${n.origin} буде ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Неправильний рядок: повинен починатися з "${n.prefix}"`;if("ends_with"===n.format)return`Неправильний рядок: повинен закінчуватися на "${n.suffix}"`;if("includes"===n.format)return`Неправильний рядок: повинен містити "${n.includes}"`;if("regex"===n.format)return`Неправильний рядок: повинен відповідати шаблону ${n.pattern}`;return`Неправильний ${t[n.format]??n.format}`;case"not_multiple_of":return`Неправильне число: повинно бути кратним ${n.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${n.keys.length>1?"і":""}: ${SN(n.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${n.origin}`;case"invalid_union":default:return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${n.origin}`}})}}e.s(["ar",0,function(){let e,t,r;return{localeError:(e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}},t={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`مدخلات غير مقبولة: يفترض إدخال instanceof ${n.expected}، ولكن تم إدخال ${i}`;return`مدخلات غير مقبولة: يفترض إدخال ${e}، ولكن تم إدخال ${i}`}case"invalid_value":if(1===n.values.length)return`مدخلات غير مقبولة: يفترض إدخال ${SQ(n.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return` أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${t} ${n.maximum.toString()} ${r.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${t} ${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${t} ${n.minimum.toString()} ${r.unit}`;return`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${t} ${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`نَص غير مقبول: يجب أن يبدأ بـ "${n.prefix}"`;if("ends_with"===n.format)return`نَص غير مقبول: يجب أن ينتهي بـ "${n.suffix}"`;if("includes"===n.format)return`نَص غير مقبول: يجب أن يتضمَّن "${n.includes}"`;if("regex"===n.format)return`نَص غير مقبول: يجب أن يطابق النمط ${n.pattern}`;return`${t[n.format]??n.format} غير مقبول`;case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${n.divisor}`;case"unrecognized_keys":return`معرف${n.keys.length>1?"ات":""} غريب${n.keys.length>1?"ة":""}: ${SN(n.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${n.origin}`;case"invalid_union":default:return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${n.origin}`}})}},"az",0,function(){let e,t,r;return{localeError:(e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}},t={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Yanlış dəyər: g\xf6zlənilən instanceof ${n.expected}, daxil olan ${i}`;return`Yanlış dəyər: g\xf6zlənilən ${e}, daxil olan ${i}`}case"invalid_value":if(1===n.values.length)return`Yanlış dəyər: g\xf6zlənilən ${SQ(n.values[0])}`;return`Yanlış se\xe7im: aşağıdakılardan biri olmalıdır: ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`\xc7ox b\xf6y\xfck: g\xf6zlənilən ${n.origin??"dəyər"} ${t}${n.maximum.toString()} ${r.unit??"element"}`;return`\xc7ox b\xf6y\xfck: g\xf6zlənilən ${n.origin??"dəyər"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`\xc7ox ki\xe7ik: g\xf6zlənilən ${n.origin} ${t}${n.minimum.toString()} ${r.unit}`;return`\xc7ox ki\xe7ik: g\xf6zlənilən ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Yanlış mətn: "${n.prefix}" ilə başlamalıdır`;if("ends_with"===n.format)return`Yanlış mətn: "${n.suffix}" ilə bitməlidir`;if("includes"===n.format)return`Yanlış mətn: "${n.includes}" daxil olmalıdır`;if("regex"===n.format)return`Yanlış mətn: ${n.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${t[n.format]??n.format}`;case"not_multiple_of":return`Yanlış ədəd: ${n.divisor} ilə b\xf6l\xfcnə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan a\xe7ar${n.keys.length>1?"lar":""}: ${SN(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilində yanlış a\xe7ar`;case"invalid_union":default:return"Yanlış dəyər";case"invalid_element":return`${n.origin} daxilində yanlış dəyər`}})}},"be",0,function(){let e,t,r;return{localeError:(e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}},t={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"},r={nan:"NaN",number:"лік",array:"масіў"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Няправільны ўвод: чакаўся instanceof ${n.expected}, атрымана ${i}`;return`Няправільны ўвод: чакаўся ${e}, атрымана ${i}`}case"invalid_value":if(1===n.values.length)return`Няправільны ўвод: чакалася ${SQ(n.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r){let e=AJ(Number(n.maximum),r.unit.one,r.unit.few,r.unit.many);return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна ${r.verb} ${t}${n.maximum.toString()} ${e}`}return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна быць ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r){let e=AJ(Number(n.minimum),r.unit.one,r.unit.few,r.unit.many);return`Занадта малы: чакалася, што ${n.origin} павінна ${r.verb} ${t}${n.minimum.toString()} ${e}`}return`Занадта малы: чакалася, што ${n.origin} павінна быць ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Няправільны радок: павінен пачынацца з "${n.prefix}"`;if("ends_with"===n.format)return`Няправільны радок: павінен заканчвацца на "${n.suffix}"`;if("includes"===n.format)return`Няправільны радок: павінен змяшчаць "${n.includes}"`;if("regex"===n.format)return`Няправільны радок: павінен адпавядаць шаблону ${n.pattern}`;return`Няправільны ${t[n.format]??n.format}`;case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${n.keys.length>1?"ключы":"ключ"}: ${SN(n.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${n.origin}`;case"invalid_union":default:return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${n.origin}`}})}},"bg",0,function(){let e,t,r;return{localeError:(e={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}},t={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"},r={nan:"NaN",number:"число",array:"масив"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Невалиден вход: очакван instanceof ${n.expected}, получен ${i}`;return`Невалиден вход: очакван ${e}, получен ${i}`}case"invalid_value":if(1===n.values.length)return`Невалиден вход: очакван ${SQ(n.values[0])}`;return`Невалидна опция: очаквано едно от ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Твърде голямо: очаква се ${n.origin??"стойност"} да съдържа ${t}${n.maximum.toString()} ${r.unit??"елемента"}`;return`Твърде голямо: очаква се ${n.origin??"стойност"} да бъде ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Твърде малко: очаква се ${n.origin} да съдържа ${t}${n.minimum.toString()} ${r.unit}`;return`Твърде малко: очаква се ${n.origin} да бъде ${t}${n.minimum.toString()}`}case"invalid_format":{if("starts_with"===n.format)return`Невалиден низ: трябва да започва с "${n.prefix}"`;if("ends_with"===n.format)return`Невалиден низ: трябва да завършва с "${n.suffix}"`;if("includes"===n.format)return`Невалиден низ: трябва да включва "${n.includes}"`;if("regex"===n.format)return`Невалиден низ: трябва да съвпада с ${n.pattern}`;let e="Невалиден";return"emoji"===n.format&&(e="Невалидно"),"datetime"===n.format&&(e="Невалидно"),"date"===n.format&&(e="Невалидна"),"time"===n.format&&(e="Невалидно"),"duration"===n.format&&(e="Невалидна"),`${e} ${t[n.format]??n.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${n.divisor}`;case"unrecognized_keys":return`Неразпознат${n.keys.length>1?"и":""} ключ${n.keys.length>1?"ове":""}: ${SN(n.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${n.origin}`;case"invalid_union":default:return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${n.origin}`}})}},"ca",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}},t={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Tipus inv\xe0lid: s'esperava instanceof ${n.expected}, s'ha rebut ${i}`;return`Tipus inv\xe0lid: s'esperava ${e}, s'ha rebut ${i}`}case"invalid_value":if(1===n.values.length)return`Valor inv\xe0lid: s'esperava ${SQ(n.values[0])}`;return`Opci\xf3 inv\xe0lida: s'esperava una de ${SN(n.values," o ")}`;case"too_big":{let t=n.inclusive?"com a màxim":"menys de",r=e[n.origin]??null;if(r)return`Massa gran: s'esperava que ${n.origin??"el valor"} contingu\xe9s ${t} ${n.maximum.toString()} ${r.unit??"elements"}`;return`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${t} ${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?"com a mínim":"més de",r=e[n.origin]??null;if(r)return`Massa petit: s'esperava que ${n.origin} contingu\xe9s ${t} ${n.minimum.toString()} ${r.unit}`;return`Massa petit: s'esperava que ${n.origin} fos ${t} ${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Format inv\xe0lid: ha de comen\xe7ar amb "${n.prefix}"`;if("ends_with"===n.format)return`Format inv\xe0lid: ha d'acabar amb "${n.suffix}"`;if("includes"===n.format)return`Format inv\xe0lid: ha d'incloure "${n.includes}"`;if("regex"===n.format)return`Format inv\xe0lid: ha de coincidir amb el patr\xf3 ${n.pattern}`;return`Format inv\xe0lid per a ${t[n.format]??n.format}`;case"not_multiple_of":return`N\xfamero inv\xe0lid: ha de ser m\xfaltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${SN(n.keys,", ")}`;case"invalid_key":return`Clau inv\xe0lida a ${n.origin}`;case"invalid_union":default:return"Entrada invàlida";case"invalid_element":return`Element inv\xe0lid a ${n.origin}`}})}},"cs",0,function(){let e,t,r;return{localeError:(e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}},t={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"},r={nan:"NaN",number:"číslo",string:"řetězec",function:"funkce",array:"pole"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Neplatn\xfd vstup: oček\xe1v\xe1no instanceof ${n.expected}, obdrženo ${i}`;return`Neplatn\xfd vstup: oček\xe1v\xe1no ${e}, obdrženo ${i}`}case"invalid_value":if(1===n.values.length)return`Neplatn\xfd vstup: oček\xe1v\xe1no ${SQ(n.values[0])}`;return`Neplatn\xe1 možnost: oček\xe1v\xe1na jedna z hodnot ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Hodnota je př\xedliš velk\xe1: ${n.origin??"hodnota"} mus\xed m\xedt ${t}${n.maximum.toString()} ${r.unit??"prvků"}`;return`Hodnota je př\xedliš velk\xe1: ${n.origin??"hodnota"} mus\xed b\xfdt ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Hodnota je př\xedliš mal\xe1: ${n.origin??"hodnota"} mus\xed m\xedt ${t}${n.minimum.toString()} ${r.unit??"prvků"}`;return`Hodnota je př\xedliš mal\xe1: ${n.origin??"hodnota"} mus\xed b\xfdt ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Neplatn\xfd řetězec: mus\xed zač\xednat na "${n.prefix}"`;if("ends_with"===n.format)return`Neplatn\xfd řetězec: mus\xed končit na "${n.suffix}"`;if("includes"===n.format)return`Neplatn\xfd řetězec: mus\xed obsahovat "${n.includes}"`;if("regex"===n.format)return`Neplatn\xfd řetězec: mus\xed odpov\xeddat vzoru ${n.pattern}`;return`Neplatn\xfd form\xe1t ${t[n.format]??n.format}`;case"not_multiple_of":return`Neplatn\xe9 č\xedslo: mus\xed b\xfdt n\xe1sobkem ${n.divisor}`;case"unrecognized_keys":return`Nezn\xe1m\xe9 kl\xedče: ${SN(n.keys,", ")}`;case"invalid_key":return`Neplatn\xfd kl\xedč v ${n.origin}`;case"invalid_union":default:return"Neplatný vstup";case"invalid_element":return`Neplatn\xe1 hodnota v ${n.origin}`}})}},"da",0,function(){let e,t,r;return{localeError:(e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},t={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},r={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ugyldigt input: forventede instanceof ${n.expected}, fik ${i}`;return`Ugyldigt input: forventede ${e}, fik ${i}`}case"invalid_value":if(1===n.values.length)return`Ugyldig v\xe6rdi: forventede ${SQ(n.values[0])}`;return`Ugyldigt valg: forventede en af f\xf8lgende ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",i=e[n.origin]??null,a=r[n.origin]??n.origin;if(i)return`For stor: forventede ${a??"value"} ${i.verb} ${t} ${n.maximum.toString()} ${i.unit??"elementer"}`;return`For stor: forventede ${a??"value"} havde ${t} ${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",i=e[n.origin]??null,a=r[n.origin]??n.origin;if(i)return`For lille: forventede ${a} ${i.verb} ${t} ${n.minimum.toString()} ${i.unit}`;return`For lille: forventede ${a} havde ${t} ${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Ugyldig streng: skal starte med "${n.prefix}"`;if("ends_with"===n.format)return`Ugyldig streng: skal ende med "${n.suffix}"`;if("includes"===n.format)return`Ugyldig streng: skal indeholde "${n.includes}"`;if("regex"===n.format)return`Ugyldig streng: skal matche m\xf8nsteret ${n.pattern}`;return`Ugyldig ${t[n.format]??n.format}`;case"not_multiple_of":return`Ugyldigt tal: skal v\xe6re deleligt med ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${SN(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xf8gle i ${n.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xe6rdi i ${n.origin}`;default:return"Ugyldigt input"}})}},"de",0,function(){let e,t,r;return{localeError:(e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}},t={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},r={nan:"NaN",number:"Zahl",array:"Array"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ung\xfcltige Eingabe: erwartet instanceof ${n.expected}, erhalten ${i}`;return`Ung\xfcltige Eingabe: erwartet ${e}, erhalten ${i}`}case"invalid_value":if(1===n.values.length)return`Ung\xfcltige Eingabe: erwartet ${SQ(n.values[0])}`;return`Ung\xfcltige Option: erwartet eine von ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Zu gro\xdf: erwartet, dass ${n.origin??"Wert"} ${t}${n.maximum.toString()} ${r.unit??"Elemente"} hat`;return`Zu gro\xdf: erwartet, dass ${n.origin??"Wert"} ${t}${n.maximum.toString()} ist`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Zu klein: erwartet, dass ${n.origin} ${t}${n.minimum.toString()} ${r.unit} hat`;return`Zu klein: erwartet, dass ${n.origin} ${t}${n.minimum.toString()} ist`}case"invalid_format":if("starts_with"===n.format)return`Ung\xfcltiger String: muss mit "${n.prefix}" beginnen`;if("ends_with"===n.format)return`Ung\xfcltiger String: muss mit "${n.suffix}" enden`;if("includes"===n.format)return`Ung\xfcltiger String: muss "${n.includes}" enthalten`;if("regex"===n.format)return`Ung\xfcltiger String: muss dem Muster ${n.pattern} entsprechen`;return`Ung\xfcltig: ${t[n.format]??n.format}`;case"not_multiple_of":return`Ung\xfcltige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${SN(n.keys,", ")}`;case"invalid_key":return`Ung\xfcltiger Schl\xfcssel in ${n.origin}`;case"invalid_union":default:return"Ungültige Eingabe";case"invalid_element":return`Ung\xfcltiger Wert in ${n.origin}`}})}},"el",0,function(){let e,t,r;return{localeError:(e={string:{unit:"χαρακτήρες",verb:"να έχει"},file:{unit:"bytes",verb:"να έχει"},array:{unit:"στοιχεία",verb:"να έχει"},set:{unit:"στοιχεία",verb:"να έχει"},map:{unit:"καταχωρήσεις",verb:"να έχει"}},t={regex:"είσοδος",email:"διεύθυνση email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ημερομηνία και ώρα",date:"ISO ημερομηνία",time:"ISO ώρα",duration:"ISO διάρκεια",ipv4:"διεύθυνση IPv4",ipv6:"διεύθυνση IPv6",mac:"διεύθυνση MAC",cidrv4:"εύρος IPv4",cidrv6:"εύρος IPv6",base64:"συμβολοσειρά κωδικοποιημένη σε base64",base64url:"συμβολοσειρά κωδικοποιημένη σε base64url",json_string:"συμβολοσειρά JSON",e164:"αριθμός E.164",jwt:"JWT",template_literal:"είσοδος"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if("string"==typeof n.expected&&/^[A-Z]/.test(n.expected))return`Μη έγκυρη είσοδος: αναμενόταν instanceof ${n.expected}, λήφθηκε ${i}`;return`Μη έγκυρη είσοδος: αναμενόταν ${e}, λήφθηκε ${i}`}case"invalid_value":if(1===n.values.length)return`Μη έγκυρη είσοδος: αναμενόταν ${SQ(n.values[0])}`;return`Μη έγκυρη επιλογή: αναμενόταν ένα από ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Πολύ μεγάλο: αναμενόταν ${n.origin??"τιμή"} να έχει ${t}${n.maximum.toString()} ${r.unit??"στοιχεία"}`;return`Πολύ μεγάλο: αναμενόταν ${n.origin??"τιμή"} να είναι ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Πολύ μικρό: αναμενόταν ${n.origin} να έχει ${t}${n.minimum.toString()} ${r.unit}`;return`Πολύ μικρό: αναμενόταν ${n.origin} να είναι ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Μη έγκυρη συμβολοσειρά: πρέπει να ξεκινά με "${n.prefix}"`;if("ends_with"===n.format)return`Μη έγκυρη συμβολοσειρά: πρέπει να τελειώνει με "${n.suffix}"`;if("includes"===n.format)return`Μη έγκυρη συμβολοσειρά: πρέπει να περιέχει "${n.includes}"`;if("regex"===n.format)return`Μη έγκυρη συμβολοσειρά: πρέπει να ταιριάζει με το μοτίβο ${n.pattern}`;return`Μη έγκυρο: ${t[n.format]??n.format}`;case"not_multiple_of":return`Μη έγκυρος αριθμός: πρέπει να είναι πολλαπλάσιο του ${n.divisor}`;case"unrecognized_keys":return`Άγνωστ${n.keys.length>1?"α":"ο"} κλειδ${n.keys.length>1?"ιά":"ί"}: ${SN(n.keys,", ")}`;case"invalid_key":return`Μη έγκυρο κλειδί στο ${n.origin}`;case"invalid_union":default:return"Μη έγκυρη είσοδος";case"invalid_element":return`Μη έγκυρη τιμή στο ${n.origin}`}})}},"en",0,T7,"eo",0,function(){let e,t,r;return{localeError:(e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}},t={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},r={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Nevalida enigo: atendiĝis instanceof ${n.expected}, riceviĝis ${i}`;return`Nevalida enigo: atendiĝis ${e}, riceviĝis ${i}`}case"invalid_value":if(1===n.values.length)return`Nevalida enigo: atendiĝis ${SQ(n.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Tro granda: atendiĝis ke ${n.origin??"valoro"} havu ${t}${n.maximum.toString()} ${r.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${n.origin??"valoro"} havu ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Tro malgranda: atendiĝis ke ${n.origin} havu ${t}${n.minimum.toString()} ${r.unit}`;return`Tro malgranda: atendiĝis ke ${n.origin} estu ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Nevalida karaktraro: devas komenciĝi per "${n.prefix}"`;if("ends_with"===n.format)return`Nevalida karaktraro: devas finiĝi per "${n.suffix}"`;if("includes"===n.format)return`Nevalida karaktraro: devas inkluzivi "${n.includes}"`;if("regex"===n.format)return`Nevalida karaktraro: devas kongrui kun la modelo ${n.pattern}`;return`Nevalida ${t[n.format]??n.format}`;case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} ŝlosilo${n.keys.length>1?"j":""}: ${SN(n.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${n.origin}`;case"invalid_union":default:return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`}})}},"es",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},t={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},r={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Entrada inv\xe1lida: se esperaba instanceof ${n.expected}, recibido ${i}`;return`Entrada inv\xe1lida: se esperaba ${e}, recibido ${i}`}case"invalid_value":if(1===n.values.length)return`Entrada inv\xe1lida: se esperaba ${SQ(n.values[0])}`;return`Opci\xf3n inv\xe1lida: se esperaba una de ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",i=e[n.origin]??null,a=r[n.origin]??n.origin;if(i)return`Demasiado grande: se esperaba que ${a??"valor"} tuviera ${t}${n.maximum.toString()} ${i.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${a??"valor"} fuera ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",i=e[n.origin]??null,a=r[n.origin]??n.origin;if(i)return`Demasiado peque\xf1o: se esperaba que ${a} tuviera ${t}${n.minimum.toString()} ${i.unit}`;return`Demasiado peque\xf1o: se esperaba que ${a} fuera ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Cadena inv\xe1lida: debe comenzar con "${n.prefix}"`;if("ends_with"===n.format)return`Cadena inv\xe1lida: debe terminar en "${n.suffix}"`;if("includes"===n.format)return`Cadena inv\xe1lida: debe incluir "${n.includes}"`;if("regex"===n.format)return`Cadena inv\xe1lida: debe coincidir con el patr\xf3n ${n.pattern}`;return`Inv\xe1lido ${t[n.format]??n.format}`;case"not_multiple_of":return`N\xfamero inv\xe1lido: debe ser m\xfaltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${SN(n.keys,", ")}`;case"invalid_key":return`Llave inv\xe1lida en ${r[n.origin]??n.origin}`;case"invalid_union":default:return"Entrada inválida";case"invalid_element":return`Valor inv\xe1lido en ${r[n.origin]??n.origin}`}})}},"fa",0,function(){let e,t,r;return{localeError:(e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}},t={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"},r={nan:"NaN",number:"عدد",array:"آرایه"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ورودی نامعتبر: میبایست instanceof ${n.expected} میبود، ${i} دریافت شد`;return`ورودی نامعتبر: میبایست ${e} میبود، ${i} دریافت شد`}case"invalid_value":if(1===n.values.length)return`ورودی نامعتبر: میبایست ${SQ(n.values[0])} میبود`;return`گزینه نامعتبر: میبایست یکی از ${SN(n.values,"|")} میبود`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`خیلی بزرگ: ${n.origin??"مقدار"} باید ${t}${n.maximum.toString()} ${r.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${n.origin??"مقدار"} باید ${t}${n.maximum.toString()} باشد`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`خیلی کوچک: ${n.origin} باید ${t}${n.minimum.toString()} ${r.unit} باشد`;return`خیلی کوچک: ${n.origin} باید ${t}${n.minimum.toString()} باشد`}case"invalid_format":if("starts_with"===n.format)return`رشته نامعتبر: باید با "${n.prefix}" شروع شود`;if("ends_with"===n.format)return`رشته نامعتبر: باید با "${n.suffix}" تمام شود`;if("includes"===n.format)return`رشته نامعتبر: باید شامل "${n.includes}" باشد`;if("regex"===n.format)return`رشته نامعتبر: باید با الگوی ${n.pattern} مطابقت داشته باشد`;return`${t[n.format]??n.format} نامعتبر`;case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${n.divisor} باشد`;case"unrecognized_keys":return`کلید${n.keys.length>1?"های":""} ناشناس: ${SN(n.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${n.origin}`;case"invalid_union":default:return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${n.origin}`}})}},"fi",0,function(){let e,t,r;return{localeError:(e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}},t={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Virheellinen tyyppi: odotettiin instanceof ${n.expected}, oli ${i}`;return`Virheellinen tyyppi: odotettiin ${e}, oli ${i}`}case"invalid_value":if(1===n.values.length)return`Virheellinen sy\xf6te: t\xe4ytyy olla ${SQ(n.values[0])}`;return`Virheellinen valinta: t\xe4ytyy olla yksi seuraavista: ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Liian suuri: ${r.subject} t\xe4ytyy olla ${t}${n.maximum.toString()} ${r.unit}`.trim();return`Liian suuri: arvon t\xe4ytyy olla ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Liian pieni: ${r.subject} t\xe4ytyy olla ${t}${n.minimum.toString()} ${r.unit}`.trim();return`Liian pieni: arvon t\xe4ytyy olla ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Virheellinen sy\xf6te: t\xe4ytyy alkaa "${n.prefix}"`;if("ends_with"===n.format)return`Virheellinen sy\xf6te: t\xe4ytyy loppua "${n.suffix}"`;if("includes"===n.format)return`Virheellinen sy\xf6te: t\xe4ytyy sis\xe4lt\xe4\xe4 "${n.includes}"`;if("regex"===n.format)return`Virheellinen sy\xf6te: t\xe4ytyy vastata s\xe4\xe4nn\xf6llist\xe4 lauseketta ${n.pattern}`;return`Virheellinen ${t[n.format]??n.format}`;case"not_multiple_of":return`Virheellinen luku: t\xe4ytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${SN(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}})}},"fr",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}},t={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},r={string:"chaîne",number:"nombre",int:"entier",boolean:"booléen",bigint:"grand entier",symbol:"symbole",undefined:"indéfini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Entr\xe9e invalide : instanceof ${n.expected} attendu, ${i} re\xe7u`;return`Entr\xe9e invalide : ${e} attendu, ${i} re\xe7u`}case"invalid_value":if(1===n.values.length)return`Entr\xe9e invalide : ${SQ(n.values[0])} attendu`;return`Option invalide : une valeur parmi ${SN(n.values,"|")} attendue`;case"too_big":{let t=n.inclusive?"<=":"<",i=e[n.origin]??null;if(i)return`Trop grand : ${r[n.origin]??"valeur"} doit ${i.verb} ${t}${n.maximum.toString()} ${i.unit??"élément(s)"}`;return`Trop grand : ${r[n.origin]??"valeur"} doit \xeatre ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",i=e[n.origin]??null;if(i)return`Trop petit : ${r[n.origin]??"valeur"} doit ${i.verb} ${t}${n.minimum.toString()} ${i.unit}`;return`Trop petit : ${r[n.origin]??"valeur"} doit \xeatre ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Cha\xeene invalide : doit commencer par "${n.prefix}"`;if("ends_with"===n.format)return`Cha\xeene invalide : doit se terminer par "${n.suffix}"`;if("includes"===n.format)return`Cha\xeene invalide : doit inclure "${n.includes}"`;if("regex"===n.format)return`Cha\xeene invalide : doit correspondre au mod\xe8le ${n.pattern}`;return`${t[n.format]??n.format} invalide`;case"not_multiple_of":return`Nombre invalide : doit \xeatre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xe9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${SN(n.keys,", ")}`;case"invalid_key":return`Cl\xe9 invalide dans ${n.origin}`;case"invalid_union":default:return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`}})}},"frCA",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}},t={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Entr\xe9e invalide : attendu instanceof ${n.expected}, re\xe7u ${i}`;return`Entr\xe9e invalide : attendu ${e}, re\xe7u ${i}`}case"invalid_value":if(1===n.values.length)return`Entr\xe9e invalide : attendu ${SQ(n.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"≤":"<",r=e[n.origin]??null;if(r)return`Trop grand : attendu que ${n.origin??"la valeur"} ait ${t}${n.maximum.toString()} ${r.unit}`;return`Trop grand : attendu que ${n.origin??"la valeur"} soit ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?"≥":">",r=e[n.origin]??null;if(r)return`Trop petit : attendu que ${n.origin} ait ${t}${n.minimum.toString()} ${r.unit}`;return`Trop petit : attendu que ${n.origin} soit ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Cha\xeene invalide : doit commencer par "${n.prefix}"`;if("ends_with"===n.format)return`Cha\xeene invalide : doit se terminer par "${n.suffix}"`;if("includes"===n.format)return`Cha\xeene invalide : doit inclure "${n.includes}"`;if("regex"===n.format)return`Cha\xeene invalide : doit correspondre au motif ${n.pattern}`;return`${t[n.format]??n.format} invalide`;case"not_multiple_of":return`Nombre invalide : doit \xeatre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xe9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${SN(n.keys,", ")}`;case"invalid_key":return`Cl\xe9 invalide dans ${n.origin}`;case"invalid_union":default:return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`}})}},"he",0,function(){let e,t,r,n,i,a,o,s,l;return{localeError:(e={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},t={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},r=t=>t?e[t]:void 0,n=t=>{let n=r(t);return n?n.label:t??e.unknown.label},i=e=>`ה${n(e)}`,a=e=>{let t=r(e);return"f"===(t?.gender??"m")?"צריכה להיות":"צריך להיות"},o=e=>e?t[e]??null:null,s={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}},l={nan:"NaN"},t=>{switch(t.code){case"invalid_type":{let r=t.expected,i=l[r??""]??n(r),a=$e(t.input),o=l[a]??e[a]?.label??a;if(/^[A-Z]/.test(t.expected))return`קלט לא תקין: צריך להיות instanceof ${t.expected}, התקבל ${o}`;return`קלט לא תקין: צריך להיות ${i}, התקבל ${o}`}case"invalid_value":{if(1===t.values.length)return`ערך לא תקין: הערך חייב להיות ${SQ(t.values[0])}`;let e=t.values.map(e=>SQ(e));if(2===t.values.length)return`ערך לא תקין: האפשרויות המתאימות הן ${e[0]} או ${e[1]}`;let r=e[e.length-1],n=e.slice(0,-1).join(", ");return`ערך לא תקין: האפשרויות המתאימות הן ${n} או ${r}`}case"too_big":{let e=o(t.origin),r=i(t.origin??"value");if("string"===t.origin)return`${e?.longLabel??"ארוך"} מדי: ${r} צריכה להכיל ${t.maximum.toString()} ${e?.unit??""} ${t.inclusive?"או פחות":"לכל היותר"}`.trim();if("number"===t.origin){let e=t.inclusive?`קטן או שווה ל-${t.maximum}`:`קטן מ-${t.maximum}`;return`גדול מדי: ${r} צריך להיות ${e}`}if("array"===t.origin||"set"===t.origin){let n="set"===t.origin?"צריכה":"צריך",i=t.inclusive?`${t.maximum} ${e?.unit??""} או פחות`:`פחות מ-${t.maximum} ${e?.unit??""}`;return`גדול מדי: ${r} ${n} להכיל ${i}`.trim()}let n=t.inclusive?"<=":"<",s=a(t.origin??"value");if(e?.unit)return`${e.longLabel} מדי: ${r} ${s} ${n}${t.maximum.toString()} ${e.unit}`;return`${e?.longLabel??"גדול"} מדי: ${r} ${s} ${n}${t.maximum.toString()}`}case"too_small":{let e=o(t.origin),r=i(t.origin??"value");if("string"===t.origin)return`${e?.shortLabel??"קצר"} מדי: ${r} צריכה להכיל ${t.minimum.toString()} ${e?.unit??""} ${t.inclusive?"או יותר":"לפחות"}`.trim();if("number"===t.origin){let e=t.inclusive?`גדול או שווה ל-${t.minimum}`:`גדול מ-${t.minimum}`;return`קטן מדי: ${r} צריך להיות ${e}`}if("array"===t.origin||"set"===t.origin){let n="set"===t.origin?"צריכה":"צריך";if(1===t.minimum&&t.inclusive){let e=(t.origin,"לפחות פריט אחד");return`קטן מדי: ${r} ${n} להכיל ${e}`}let i=t.inclusive?`${t.minimum} ${e?.unit??""} או יותר`:`יותר מ-${t.minimum} ${e?.unit??""}`;return`קטן מדי: ${r} ${n} להכיל ${i}`.trim()}let n=t.inclusive?">=":">",s=a(t.origin??"value");if(e?.unit)return`${e.shortLabel} מדי: ${r} ${s} ${n}${t.minimum.toString()} ${e.unit}`;return`${e?.shortLabel??"קטן"} מדי: ${r} ${s} ${n}${t.minimum.toString()}`}case"invalid_format":{if("starts_with"===t.format)return`המחרוזת חייבת להתחיל ב "${t.prefix}"`;if("ends_with"===t.format)return`המחרוזת חייבת להסתיים ב "${t.suffix}"`;if("includes"===t.format)return`המחרוזת חייבת לכלול "${t.includes}"`;if("regex"===t.format)return`המחרוזת חייבת להתאים לתבנית ${t.pattern}`;let e=s[t.format],r=e?.label??t.format,n=e?.gender??"m";return`${r} לא ${"f"===n?"תקינה":"תקין"}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${t.divisor}`;case"unrecognized_keys":return`מפתח${t.keys.length>1?"ות":""} לא מזוה${t.keys.length>1?"ים":"ה"}: ${SN(t.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":default:return"קלט לא תקין";case"invalid_element":{let e=i(t.origin??"array");return`ערך לא תקין ב${e}`}}})}},"hr",0,function(){let e,t,r;return{localeError:(e={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}},t={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},r={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Neispravan unos: očekuje se instanceof ${n.expected}, a primljeno je ${i}`;return`Neispravan unos: očekuje se ${e}, a primljeno je ${i}`}case"invalid_value":if(1===n.values.length)return`Neispravna vrijednost: očekivano ${SQ(n.values[0])}`;return`Neispravna opcija: očekivano jedno od ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",i=e[n.origin]??null,a=r[n.origin]??n.origin;if(i)return`Preveliko: očekivano da ${a??"vrijednost"} ima ${t}${n.maximum.toString()} ${i.unit??"elemenata"}`;return`Preveliko: očekivano da ${a??"vrijednost"} bude ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",i=e[n.origin]??null,a=r[n.origin]??n.origin;if(i)return`Premalo: očekivano da ${a} ima ${t}${n.minimum.toString()} ${i.unit}`;return`Premalo: očekivano da ${a} bude ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Neispravan tekst: mora započinjati s "${n.prefix}"`;if("ends_with"===n.format)return`Neispravan tekst: mora završavati s "${n.suffix}"`;if("includes"===n.format)return`Neispravan tekst: mora sadržavati "${n.includes}"`;if("regex"===n.format)return`Neispravan tekst: mora odgovarati uzorku ${n.pattern}`;return`Neispravna ${t[n.format]??n.format}`;case"not_multiple_of":return`Neispravan broj: mora biti višekratnik od ${n.divisor}`;case"unrecognized_keys":return`Neprepoznat${n.keys.length>1?"i ključevi":" ključ"}: ${SN(n.keys,", ")}`;case"invalid_key":return`Neispravan ključ u ${r[n.origin]??n.origin}`;case"invalid_union":default:return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${r[n.origin]??n.origin}`}})}},"hu",0,function(){let e,t,r;return{localeError:(e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}},t={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"},r={nan:"NaN",number:"szám",array:"tömb"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`\xc9rv\xe9nytelen bemenet: a v\xe1rt \xe9rt\xe9k instanceof ${n.expected}, a kapott \xe9rt\xe9k ${i}`;return`\xc9rv\xe9nytelen bemenet: a v\xe1rt \xe9rt\xe9k ${e}, a kapott \xe9rt\xe9k ${i}`}case"invalid_value":if(1===n.values.length)return`\xc9rv\xe9nytelen bemenet: a v\xe1rt \xe9rt\xe9k ${SQ(n.values[0])}`;return`\xc9rv\xe9nytelen opci\xf3: valamelyik \xe9rt\xe9k v\xe1rt ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`T\xfal nagy: ${n.origin??"érték"} m\xe9rete t\xfal nagy ${t}${n.maximum.toString()} ${r.unit??"elem"}`;return`T\xfal nagy: a bemeneti \xe9rt\xe9k ${n.origin??"érték"} t\xfal nagy: ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`T\xfal kicsi: a bemeneti \xe9rt\xe9k ${n.origin} m\xe9rete t\xfal kicsi ${t}${n.minimum.toString()} ${r.unit}`;return`T\xfal kicsi: a bemeneti \xe9rt\xe9k ${n.origin} t\xfal kicsi ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`\xc9rv\xe9nytelen string: "${n.prefix}" \xe9rt\xe9kkel kell kezdődnie`;if("ends_with"===n.format)return`\xc9rv\xe9nytelen string: "${n.suffix}" \xe9rt\xe9kkel kell v\xe9gződnie`;if("includes"===n.format)return`\xc9rv\xe9nytelen string: "${n.includes}" \xe9rt\xe9ket kell tartalmaznia`;if("regex"===n.format)return`\xc9rv\xe9nytelen string: ${n.pattern} mint\xe1nak kell megfelelnie`;return`\xc9rv\xe9nytelen ${t[n.format]??n.format}`;case"not_multiple_of":return`\xc9rv\xe9nytelen sz\xe1m: ${n.divisor} t\xf6bbsz\xf6r\xf6s\xe9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${SN(n.keys,", ")}`;case"invalid_key":return`\xc9rv\xe9nytelen kulcs ${n.origin}`;case"invalid_union":default:return"Érvénytelen bemenet";case"invalid_element":return`\xc9rv\xe9nytelen \xe9rt\xe9k: ${n.origin}`}})}},"hy",0,function(){let e,t,r;return{localeError:(e={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}},t={regex:"մուտք",email:"էլ. հասցե",url:"URL",emoji:"էմոջի",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ամսաթիվ և ժամ",date:"ISO ամսաթիվ",time:"ISO ժամ",duration:"ISO տևողություն",ipv4:"IPv4 հասցե",ipv6:"IPv6 հասցե",cidrv4:"IPv4 միջակայք",cidrv6:"IPv6 միջակայք",base64:"base64 ձևաչափով տող",base64url:"base64url ձևաչափով տող",json_string:"JSON տող",e164:"E.164 համար",jwt:"JWT",template_literal:"մուտք"},r={nan:"NaN",number:"թիվ",array:"զանգված"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Սխալ մուտքագրում․ սպասվում էր instanceof ${n.expected}, ստացվել է ${i}`;return`Սխալ մուտքագրում․ սպասվում էր ${e}, ստացվել է ${i}`}case"invalid_value":if(1===n.values.length)return`Սխալ մուտքագրում․ սպասվում էր ${SQ(n.values[1])}`;return`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r){let e=AH(Number(n.maximum),r.unit.one,r.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${AK(n.origin??"արժեք")} կունենա ${t}${n.maximum.toString()} ${e}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${AK(n.origin??"արժեք")} լինի ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r){let e=AH(Number(n.minimum),r.unit.one,r.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${AK(n.origin)} կունենա ${t}${n.minimum.toString()} ${e}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${AK(n.origin)} լինի ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Սխալ տող․ պետք է սկսվի "${n.prefix}"-ով`;if("ends_with"===n.format)return`Սխալ տող․ պետք է ավարտվի "${n.suffix}"-ով`;if("includes"===n.format)return`Սխալ տող․ պետք է պարունակի "${n.includes}"`;if("regex"===n.format)return`Սխալ տող․ պետք է համապատասխանի ${n.pattern} ձևաչափին`;return`Սխալ ${t[n.format]??n.format}`;case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${n.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${n.keys.length>1?"ներ":""}. ${SN(n.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${AK(n.origin)}-ում`;case"invalid_union":default:return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${AK(n.origin)}-ում`}})}},"id",0,function(){let e,t,r;return{localeError:(e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}},t={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Input tidak valid: diharapkan instanceof ${n.expected}, diterima ${i}`;return`Input tidak valid: diharapkan ${e}, diterima ${i}`}case"invalid_value":if(1===n.values.length)return`Input tidak valid: diharapkan ${SQ(n.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${t}${n.maximum.toString()} ${r.unit??"elemen"}`;return`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Terlalu kecil: diharapkan ${n.origin} memiliki ${t}${n.minimum.toString()} ${r.unit}`;return`Terlalu kecil: diharapkan ${n.origin} menjadi ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`String tidak valid: harus dimulai dengan "${n.prefix}"`;if("ends_with"===n.format)return`String tidak valid: harus berakhir dengan "${n.suffix}"`;if("includes"===n.format)return`String tidak valid: harus menyertakan "${n.includes}"`;if("regex"===n.format)return`String tidak valid: harus sesuai pola ${n.pattern}`;return`${t[n.format]??n.format} tidak valid`;case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${SN(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":default:return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`}})}},"is",0,function(){let e,t,r;return{localeError:(e={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}},t={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"},r={nan:"NaN",number:"númer",array:"fylki"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Rangt gildi: \xde\xfa sl\xf3st inn ${i} \xfear sem \xe1 a\xf0 vera instanceof ${n.expected}`;return`Rangt gildi: \xde\xfa sl\xf3st inn ${i} \xfear sem \xe1 a\xf0 vera ${e}`}case"invalid_value":if(1===n.values.length)return`Rangt gildi: gert r\xe1\xf0 fyrir ${SQ(n.values[0])}`;return`\xd3gilt val: m\xe1 vera eitt af eftirfarandi ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Of st\xf3rt: gert er r\xe1\xf0 fyrir a\xf0 ${n.origin??"gildi"} hafi ${t}${n.maximum.toString()} ${r.unit??"hluti"}`;return`Of st\xf3rt: gert er r\xe1\xf0 fyrir a\xf0 ${n.origin??"gildi"} s\xe9 ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Of l\xedti\xf0: gert er r\xe1\xf0 fyrir a\xf0 ${n.origin} hafi ${t}${n.minimum.toString()} ${r.unit}`;return`Of l\xedti\xf0: gert er r\xe1\xf0 fyrir a\xf0 ${n.origin} s\xe9 ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`\xd3gildur strengur: ver\xf0ur a\xf0 byrja \xe1 "${n.prefix}"`;if("ends_with"===n.format)return`\xd3gildur strengur: ver\xf0ur a\xf0 enda \xe1 "${n.suffix}"`;if("includes"===n.format)return`\xd3gildur strengur: ver\xf0ur a\xf0 innihalda "${n.includes}"`;if("regex"===n.format)return`\xd3gildur strengur: ver\xf0ur a\xf0 fylgja mynstri ${n.pattern}`;return`Rangt ${t[n.format]??n.format}`;case"not_multiple_of":return`R\xf6ng tala: ver\xf0ur a\xf0 vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`\xd3\xfeekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${SN(n.keys,", ")}`;case"invalid_key":return`Rangur lykill \xed ${n.origin}`;case"invalid_union":default:return"Rangt gildi";case"invalid_element":return`Rangt gildi \xed ${n.origin}`}})}},"it",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}},t={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"numero",array:"vettore"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Input non valido: atteso instanceof ${n.expected}, ricevuto ${i}`;return`Input non valido: atteso ${e}, ricevuto ${i}`}case"invalid_value":if(1===n.values.length)return`Input non valido: atteso ${SQ(n.values[0])}`;return`Opzione non valida: atteso uno tra ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Troppo grande: ${n.origin??"valore"} deve avere ${t}${n.maximum.toString()} ${r.unit??"elementi"}`;return`Troppo grande: ${n.origin??"valore"} deve essere ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Troppo piccolo: ${n.origin} deve avere ${t}${n.minimum.toString()} ${r.unit}`;return`Troppo piccolo: ${n.origin} deve essere ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Stringa non valida: deve iniziare con "${n.prefix}"`;if("ends_with"===n.format)return`Stringa non valida: deve terminare con "${n.suffix}"`;if("includes"===n.format)return`Stringa non valida: deve includere "${n.includes}"`;if("regex"===n.format)return`Stringa non valida: deve corrispondere al pattern ${n.pattern}`;return`Input non valido: ${t[n.format]??n.format}`;case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${SN(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":default:return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`}})}},"ja",0,function(){let e,t,r;return{localeError:(e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}},t={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"},r={nan:"NaN",number:"数値",array:"配列"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`無効な入力: instanceof ${n.expected}が期待されましたが、${i}が入力されました`;return`無効な入力: ${e}が期待されましたが、${i}が入力されました`}case"invalid_value":if(1===n.values.length)return`無効な入力: ${SQ(n.values[0])}が期待されました`;return`無効な選択: ${SN(n.values,"、")}のいずれかである必要があります`;case"too_big":{let t=n.inclusive?"以下である":"より小さい",r=e[n.origin]??null;if(r)return`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${r.unit??"要素"}${t}必要があります`;return`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${t}必要があります`}case"too_small":{let t=n.inclusive?"以上である":"より大きい",r=e[n.origin]??null;if(r)return`小さすぎる値: ${n.origin}は${n.minimum.toString()}${r.unit}${t}必要があります`;return`小さすぎる値: ${n.origin}は${n.minimum.toString()}${t}必要があります`}case"invalid_format":if("starts_with"===n.format)return`無効な文字列: "${n.prefix}"で始まる必要があります`;if("ends_with"===n.format)return`無効な文字列: "${n.suffix}"で終わる必要があります`;if("includes"===n.format)return`無効な文字列: "${n.includes}"を含む必要があります`;if("regex"===n.format)return`無効な文字列: パターン${n.pattern}に一致する必要があります`;return`無効な${t[n.format]??n.format}`;case"not_multiple_of":return`無効な数値: ${n.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${n.keys.length>1?"群":""}: ${SN(n.keys,"、")}`;case"invalid_key":return`${n.origin}内の無効なキー`;case"invalid_union":default:return"無効な入力";case"invalid_element":return`${n.origin}内の無効な値`}})}},"ka",0,function(){let e,t,r;return{localeError:(e={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}},t={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული ველი",base64url:"base64url-კოდირებული ველი",json_string:"JSON ველი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"},r={nan:"NaN",number:"რიცხვი",string:"ველი",boolean:"ბულეანი",function:"ფუნქცია",array:"მასივი"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`არასწორი შეყვანა: მოსალოდნელი instanceof ${n.expected}, მიღებული ${i}`;return`არასწორი შეყვანა: მოსალოდნელი ${e}, მიღებული ${i}`}case"invalid_value":if(1===n.values.length)return`არასწორი შეყვანა: მოსალოდნელი ${SQ(n.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${SN(n.values,"|")}-დან`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`ზედმეტად დიდი: მოსალოდნელი ${n.origin??"მნიშვნელობა"} ${r.verb} ${t}${n.maximum.toString()} ${r.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${n.origin??"მნიშვნელობა"} იყოს ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`ზედმეტად პატარა: მოსალოდნელი ${n.origin} ${r.verb} ${t}${n.minimum.toString()} ${r.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${n.origin} იყოს ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`არასწორი ველი: უნდა იწყებოდეს "${n.prefix}"-ით`;if("ends_with"===n.format)return`არასწორი ველი: უნდა მთავრდებოდეს "${n.suffix}"-ით`;if("includes"===n.format)return`არასწორი ველი: უნდა შეიცავდეს "${n.includes}"-ს`;if("regex"===n.format)return`არასწორი ველი: უნდა შეესაბამებოდეს შაბლონს ${n.pattern}`;return`არასწორი ${t[n.format]??n.format}`;case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${n.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${n.keys.length>1?"ები":"ი"}: ${SN(n.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${n.origin}-ში`;case"invalid_union":default:return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${n.origin}-ში`}})}},"kh",0,function(){return AG()},"km",0,AG,"ko",0,function(){let e,t,r;return{localeError:(e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}},t={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`잘못된 입력: 예상 타입은 instanceof ${n.expected}, 받은 타입은 ${i}입니다`;return`잘못된 입력: 예상 타입은 ${e}, 받은 타입은 ${i}입니다`}case"invalid_value":if(1===n.values.length)return`잘못된 입력: 값은 ${SQ(n.values[0])} 이어야 합니다`;return`잘못된 옵션: ${SN(n.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let t=n.inclusive?"이하":"미만",r="미만"===t?"이어야 합니다":"여야 합니다",i=e[n.origin]??null,a=i?.unit??"요소";if(i)return`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()}${a} ${t}${r}`;return`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()} ${t}${r}`}case"too_small":{let t=n.inclusive?"이상":"초과",r="이상"===t?"이어야 합니다":"여야 합니다",i=e[n.origin]??null,a=i?.unit??"요소";if(i)return`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()}${a} ${t}${r}`;return`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()} ${t}${r}`}case"invalid_format":if("starts_with"===n.format)return`잘못된 문자열: "${n.prefix}"(으)로 시작해야 합니다`;if("ends_with"===n.format)return`잘못된 문자열: "${n.suffix}"(으)로 끝나야 합니다`;if("includes"===n.format)return`잘못된 문자열: "${n.includes}"을(를) 포함해야 합니다`;if("regex"===n.format)return`잘못된 문자열: 정규식 ${n.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${t[n.format]??n.format}`;case"not_multiple_of":return`잘못된 숫자: ${n.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${SN(n.keys,", ")}`;case"invalid_key":return`잘못된 키: ${n.origin}`;case"invalid_union":default:return"잘못된 입력";case"invalid_element":return`잘못된 값: ${n.origin}`}})}},"lt",0,function(){return{localeError:(()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function t(t,r,n,i){let a=e[t]??null;return null===a?a:{unit:a.unit[r],verb:a.verb[i][n?"inclusive":"notInclusive"]}}let r={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"},n={nan:"NaN",number:"skaičius",bigint:"sveikasis skaičius",string:"eilutė",boolean:"loginė reikšmė",undefined:"neapibrėžta reikšmė",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinė reikšmė"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=$e(e.input),i=n[r]??r;if(/^[A-Z]/.test(e.expected))return`Gautas tipas ${i}, o tikėtasi - instanceof ${e.expected}`;return`Gautas tipas ${i}, o tikėtasi - ${t}`}case"invalid_value":if(1===e.values.length)return`Privalo būti ${SQ(e.values[0])}`;return`Privalo būti vienas iš ${SN(e.values,"|")} pasirinkimų`;case"too_big":{let r=n[e.origin]??e.origin,i=t(e.origin,AX(Number(e.maximum)),e.inclusive??!1,"smaller");if(i?.verb)return`${AY(r??e.origin??"reikšmė")} ${i.verb} ${e.maximum.toString()} ${i.unit??"elementų"}`;let a=e.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${AY(r??e.origin??"reikšmė")} turi būti ${a} ${e.maximum.toString()} ${i?.unit}`}case"too_small":{let r=n[e.origin]??e.origin,i=t(e.origin,AX(Number(e.minimum)),e.inclusive??!1,"bigger");if(i?.verb)return`${AY(r??e.origin??"reikšmė")} ${i.verb} ${e.minimum.toString()} ${i.unit??"elementų"}`;let a=e.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${AY(r??e.origin??"reikšmė")} turi būti ${a} ${e.minimum.toString()} ${i?.unit}`}case"invalid_format":if("starts_with"===e.format)return`Eilutė privalo prasidėti "${e.prefix}"`;if("ends_with"===e.format)return`Eilutė privalo pasibaigti "${e.suffix}"`;if("includes"===e.format)return`Eilutė privalo įtraukti "${e.includes}"`;if("regex"===e.format)return`Eilutė privalo atitikti ${e.pattern}`;return`Neteisingas ${r[e.format]??e.format}`;case"not_multiple_of":return`Skaičius privalo būti ${e.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${e.keys.length>1?"i":"as"} rakt${e.keys.length>1?"ai":"as"}: ${SN(e.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":default:return"Klaidinga įvestis";case"invalid_element":{let t=n[e.origin]??e.origin;return`${AY(t??e.origin??"reikšmė")} turi klaidingą įvestį`}}}})()}},"mk",0,function(){let e,t,r;return{localeError:(e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}},t={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"},r={nan:"NaN",number:"број",array:"низа"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Грешен внес: се очекува instanceof ${n.expected}, примено ${i}`;return`Грешен внес: се очекува ${e}, примено ${i}`}case"invalid_value":if(1===n.values.length)return`Invalid input: expected ${SQ(n.values[0])}`;return`Грешана опција: се очекува една ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Премногу голем: се очекува ${n.origin??"вредноста"} да има ${t}${n.maximum.toString()} ${r.unit??"елементи"}`;return`Премногу голем: се очекува ${n.origin??"вредноста"} да биде ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Премногу мал: се очекува ${n.origin} да има ${t}${n.minimum.toString()} ${r.unit}`;return`Премногу мал: се очекува ${n.origin} да биде ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Неважечка низа: мора да започнува со "${n.prefix}"`;if("ends_with"===n.format)return`Неважечка низа: мора да завршува со "${n.suffix}"`;if("includes"===n.format)return`Неважечка низа: мора да вклучува "${n.includes}"`;if("regex"===n.format)return`Неважечка низа: мора да одгоара на патернот ${n.pattern}`;return`Invalid ${t[n.format]??n.format}`;case"not_multiple_of":return`Грешен број: мора да биде делив со ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${SN(n.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${n.origin}`;case"invalid_union":default:return"Грешен внес";case"invalid_element":return`Грешна вредност во ${n.origin}`}})}},"ms",0,function(){let e,t,r;return{localeError:(e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}},t={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"nombor"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Input tidak sah: dijangka instanceof ${n.expected}, diterima ${i}`;return`Input tidak sah: dijangka ${e}, diterima ${i}`}case"invalid_value":if(1===n.values.length)return`Input tidak sah: dijangka ${SQ(n.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Terlalu besar: dijangka ${n.origin??"nilai"} ${r.verb} ${t}${n.maximum.toString()} ${r.unit??"elemen"}`;return`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Terlalu kecil: dijangka ${n.origin} ${r.verb} ${t}${n.minimum.toString()} ${r.unit}`;return`Terlalu kecil: dijangka ${n.origin} adalah ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`String tidak sah: mesti bermula dengan "${n.prefix}"`;if("ends_with"===n.format)return`String tidak sah: mesti berakhir dengan "${n.suffix}"`;if("includes"===n.format)return`String tidak sah: mesti mengandungi "${n.includes}"`;if("regex"===n.format)return`String tidak sah: mesti sepadan dengan corak ${n.pattern}`;return`${t[n.format]??n.format} tidak sah`;case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${SN(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":default:return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`}})}},"nl",0,function(){let e,t,r;return{localeError:(e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}},t={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},r={nan:"NaN",number:"getal"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ongeldige invoer: verwacht instanceof ${n.expected}, ontving ${i}`;return`Ongeldige invoer: verwacht ${e}, ontving ${i}`}case"invalid_value":if(1===n.values.length)return`Ongeldige invoer: verwacht ${SQ(n.values[0])}`;return`Ongeldige optie: verwacht \xe9\xe9n van ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null,i="date"===n.origin?"laat":"string"===n.origin?"lang":"groot";if(r)return`Te ${i}: verwacht dat ${n.origin??"waarde"} ${t}${n.maximum.toString()} ${r.unit??"elementen"} ${r.verb}`;return`Te ${i}: verwacht dat ${n.origin??"waarde"} ${t}${n.maximum.toString()} is`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null,i="date"===n.origin?"vroeg":"string"===n.origin?"kort":"klein";if(r)return`Te ${i}: verwacht dat ${n.origin} ${t}${n.minimum.toString()} ${r.unit} ${r.verb}`;return`Te ${i}: verwacht dat ${n.origin} ${t}${n.minimum.toString()} is`}case"invalid_format":if("starts_with"===n.format)return`Ongeldige tekst: moet met "${n.prefix}" beginnen`;if("ends_with"===n.format)return`Ongeldige tekst: moet op "${n.suffix}" eindigen`;if("includes"===n.format)return`Ongeldige tekst: moet "${n.includes}" bevatten`;if("regex"===n.format)return`Ongeldige tekst: moet overeenkomen met patroon ${n.pattern}`;return`Ongeldig: ${t[n.format]??n.format}`;case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${SN(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":default:return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`}})}},"no",0,function(){let e,t,r;return{localeError:(e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}},t={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"tall",array:"liste"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ugyldig input: forventet instanceof ${n.expected}, fikk ${i}`;return`Ugyldig input: forventet ${e}, fikk ${i}`}case"invalid_value":if(1===n.values.length)return`Ugyldig verdi: forventet ${SQ(n.values[0])}`;return`Ugyldig valg: forventet en av ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`For stor(t): forventet ${n.origin??"value"} til \xe5 ha ${t}${n.maximum.toString()} ${r.unit??"elementer"}`;return`For stor(t): forventet ${n.origin??"value"} til \xe5 ha ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`For lite(n): forventet ${n.origin} til \xe5 ha ${t}${n.minimum.toString()} ${r.unit}`;return`For lite(n): forventet ${n.origin} til \xe5 ha ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Ugyldig streng: m\xe5 starte med "${n.prefix}"`;if("ends_with"===n.format)return`Ugyldig streng: m\xe5 ende med "${n.suffix}"`;if("includes"===n.format)return`Ugyldig streng: m\xe5 inneholde "${n.includes}"`;if("regex"===n.format)return`Ugyldig streng: m\xe5 matche m\xf8nsteret ${n.pattern}`;return`Ugyldig ${t[n.format]??n.format}`;case"not_multiple_of":return`Ugyldig tall: m\xe5 v\xe6re et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${SN(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xf8kkel i ${n.origin}`;case"invalid_union":default:return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`}})}},"ota",0,function(){let e,t,r;return{localeError:(e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}},t={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"},r={nan:"NaN",number:"numara",array:"saf",null:"gayb"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`F\xe2sit giren: umulan instanceof ${n.expected}, alınan ${i}`;return`F\xe2sit giren: umulan ${e}, alınan ${i}`}case"invalid_value":if(1===n.values.length)return`F\xe2sit giren: umulan ${SQ(n.values[0])}`;return`F\xe2sit tercih: m\xfbteberler ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Fazla b\xfcy\xfck: ${n.origin??"value"}, ${t}${n.maximum.toString()} ${r.unit??"elements"} sahip olmalıydı.`;return`Fazla b\xfcy\xfck: ${n.origin??"value"}, ${t}${n.maximum.toString()} olmalıydı.`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Fazla k\xfc\xe7\xfck: ${n.origin}, ${t}${n.minimum.toString()} ${r.unit} sahip olmalıydı.`;return`Fazla k\xfc\xe7\xfck: ${n.origin}, ${t}${n.minimum.toString()} olmalıydı.`}case"invalid_format":if("starts_with"===n.format)return`F\xe2sit metin: "${n.prefix}" ile başlamalı.`;if("ends_with"===n.format)return`F\xe2sit metin: "${n.suffix}" ile bitmeli.`;if("includes"===n.format)return`F\xe2sit metin: "${n.includes}" ihtiv\xe2 etmeli.`;if("regex"===n.format)return`F\xe2sit metin: ${n.pattern} nakşına uymalı.`;return`F\xe2sit ${t[n.format]??n.format}`;case"not_multiple_of":return`F\xe2sit sayı: ${n.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${n.keys.length>1?"s":""}: ${SN(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xe7in tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${n.origin} i\xe7in tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}})}},"pl",0,function(){let e,t,r;return{localeError:(e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}},t={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"},r={nan:"NaN",number:"liczba",array:"tablica"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${n.expected}, otrzymano ${i}`;return`Nieprawidłowe dane wejściowe: oczekiwano ${e}, otrzymano ${i}`}case"invalid_value":if(1===n.values.length)return`Nieprawidłowe dane wejściowe: oczekiwano ${SQ(n.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Za duża wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${t}${n.maximum.toString()} ${r.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Za mała wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${t}${n.minimum.toString()} ${r.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Nieprawidłowy ciąg znak\xf3w: musi zaczynać się od "${n.prefix}"`;if("ends_with"===n.format)return`Nieprawidłowy ciąg znak\xf3w: musi kończyć się na "${n.suffix}"`;if("includes"===n.format)return`Nieprawidłowy ciąg znak\xf3w: musi zawierać "${n.includes}"`;if("regex"===n.format)return`Nieprawidłowy ciąg znak\xf3w: musi odpowiadać wzorcowi ${n.pattern}`;return`Nieprawidłow(y/a/e) ${t[n.format]??n.format}`;case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${SN(n.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${n.origin}`;case"invalid_union":default:return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${n.origin}`}})}},"ps",0,function(){let e,t,r;return{localeError:(e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}},t={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"},r={nan:"NaN",number:"عدد",array:"ارې"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ناسم ورودي: باید instanceof ${n.expected} وای, مګر ${i} ترلاسه شو`;return`ناسم ورودي: باید ${e} وای, مګر ${i} ترلاسه شو`}case"invalid_value":if(1===n.values.length)return`ناسم ورودي: باید ${SQ(n.values[0])} وای`;return`ناسم انتخاب: باید یو له ${SN(n.values,"|")} څخه وای`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`ډیر لوی: ${n.origin??"ارزښت"} باید ${t}${n.maximum.toString()} ${r.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${n.origin??"ارزښت"} باید ${t}${n.maximum.toString()} وي`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`ډیر کوچنی: ${n.origin} باید ${t}${n.minimum.toString()} ${r.unit} ولري`;return`ډیر کوچنی: ${n.origin} باید ${t}${n.minimum.toString()} وي`}case"invalid_format":if("starts_with"===n.format)return`ناسم متن: باید د "${n.prefix}" سره پیل شي`;if("ends_with"===n.format)return`ناسم متن: باید د "${n.suffix}" سره پای ته ورسيږي`;if("includes"===n.format)return`ناسم متن: باید "${n.includes}" ولري`;if("regex"===n.format)return`ناسم متن: باید د ${n.pattern} سره مطابقت ولري`;return`${t[n.format]??n.format} ناسم دی`;case"not_multiple_of":return`ناسم عدد: باید د ${n.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${n.keys.length>1?"کلیډونه":"کلیډ"}: ${SN(n.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${n.origin} کې`;case"invalid_union":default:return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${n.origin} کې`}})}},"pt",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}},t={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},r={nan:"NaN",number:"número",null:"nulo"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Tipo inv\xe1lido: esperado instanceof ${n.expected}, recebido ${i}`;return`Tipo inv\xe1lido: esperado ${e}, recebido ${i}`}case"invalid_value":if(1===n.values.length)return`Entrada inv\xe1lida: esperado ${SQ(n.values[0])}`;return`Op\xe7\xe3o inv\xe1lida: esperada uma das ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Muito grande: esperado que ${n.origin??"valor"} tivesse ${t}${n.maximum.toString()} ${r.unit??"elementos"}`;return`Muito grande: esperado que ${n.origin??"valor"} fosse ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Muito pequeno: esperado que ${n.origin} tivesse ${t}${n.minimum.toString()} ${r.unit}`;return`Muito pequeno: esperado que ${n.origin} fosse ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Texto inv\xe1lido: deve come\xe7ar com "${n.prefix}"`;if("ends_with"===n.format)return`Texto inv\xe1lido: deve terminar com "${n.suffix}"`;if("includes"===n.format)return`Texto inv\xe1lido: deve incluir "${n.includes}"`;if("regex"===n.format)return`Texto inv\xe1lido: deve corresponder ao padr\xe3o ${n.pattern}`;return`${t[n.format]??n.format} inv\xe1lido`;case"not_multiple_of":return`N\xfamero inv\xe1lido: deve ser m\xfaltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${SN(n.keys,", ")}`;case"invalid_key":return`Chave inv\xe1lida em ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inv\xe1lido em ${n.origin}`;default:return"Campo inválido"}})}},"ro",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caractere",verb:"să aibă"},file:{unit:"octeți",verb:"să aibă"},array:{unit:"elemente",verb:"să aibă"},set:{unit:"elemente",verb:"să aibă"},map:{unit:"intrări",verb:"să aibă"}},t={regex:"intrare",email:"adresă de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dată și oră ISO",date:"dată ISO",time:"oră ISO",duration:"durată ISO",ipv4:"adresă IPv4",ipv6:"adresă IPv6",mac:"adresă MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"șir codat base64",base64url:"șir codat base64url",json_string:"șir JSON",e164:"număr E.164",jwt:"JWT",template_literal:"intrare"},r={nan:"NaN",string:"șir",number:"număr",boolean:"boolean",function:"funcție",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"număr mare",void:"void",never:"never",map:"hartă",set:"set"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;return`Intrare invalidă: așteptat ${e}, primit ${i}`}case"invalid_value":if(1===n.values.length)return`Intrare invalidă: așteptat ${SQ(n.values[0])}`;return`Opțiune invalidă: așteptat una dintre ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Prea mare: așteptat ca ${n.origin??"valoarea"} ${r.verb} ${t}${n.maximum.toString()} ${r.unit??"elemente"}`;return`Prea mare: așteptat ca ${n.origin??"valoarea"} să fie ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Prea mic: așteptat ca ${n.origin} ${r.verb} ${t}${n.minimum.toString()} ${r.unit}`;return`Prea mic: așteptat ca ${n.origin} să fie ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Șir invalid: trebuie să \xeenceapă cu "${n.prefix}"`;if("ends_with"===n.format)return`Șir invalid: trebuie să se termine cu "${n.suffix}"`;if("includes"===n.format)return`Șir invalid: trebuie să includă "${n.includes}"`;if("regex"===n.format)return`Șir invalid: trebuie să se potrivească cu modelul ${n.pattern}`;return`Format invalid: ${t[n.format]??n.format}`;case"not_multiple_of":return`Număr invalid: trebuie să fie multiplu de ${n.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${SN(n.keys,", ")}`;case"invalid_key":return`Cheie invalidă \xeen ${n.origin}`;case"invalid_union":default:return"Intrare invalidă";case"invalid_element":return`Valoare invalidă \xeen ${n.origin}`}})}},"ru",0,function(){let e,t,r;return{localeError:(e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}},t={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"},r={nan:"NaN",number:"число",array:"массив"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Неверный ввод: ожидалось instanceof ${n.expected}, получено ${i}`;return`Неверный ввод: ожидалось ${e}, получено ${i}`}case"invalid_value":if(1===n.values.length)return`Неверный ввод: ожидалось ${SQ(n.values[0])}`;return`Неверный вариант: ожидалось одно из ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r){let e=AQ(Number(n.maximum),r.unit.one,r.unit.few,r.unit.many);return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет иметь ${t}${n.maximum.toString()} ${e}`}return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r){let e=AQ(Number(n.minimum),r.unit.one,r.unit.few,r.unit.many);return`Слишком маленькое значение: ожидалось, что ${n.origin} будет иметь ${t}${n.minimum.toString()} ${e}`}return`Слишком маленькое значение: ожидалось, что ${n.origin} будет ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Неверная строка: должна начинаться с "${n.prefix}"`;if("ends_with"===n.format)return`Неверная строка: должна заканчиваться на "${n.suffix}"`;if("includes"===n.format)return`Неверная строка: должна содержать "${n.includes}"`;if("regex"===n.format)return`Неверная строка: должна соответствовать шаблону ${n.pattern}`;return`Неверный ${t[n.format]??n.format}`;case"not_multiple_of":return`Неверное число: должно быть кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспознанн${n.keys.length>1?"ые":"ый"} ключ${n.keys.length>1?"и":""}: ${SN(n.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${n.origin}`;case"invalid_union":default:return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${n.origin}`}})}},"sl",0,function(){let e,t,r;return{localeError:(e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}},t={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"},r={nan:"NaN",number:"število",array:"tabela"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Neveljaven vnos: pričakovano instanceof ${n.expected}, prejeto ${i}`;return`Neveljaven vnos: pričakovano ${e}, prejeto ${i}`}case"invalid_value":if(1===n.values.length)return`Neveljaven vnos: pričakovano ${SQ(n.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} imelo ${t}${n.maximum.toString()} ${r.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Premajhno: pričakovano, da bo ${n.origin} imelo ${t}${n.minimum.toString()} ${r.unit}`;return`Premajhno: pričakovano, da bo ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Neveljaven niz: mora se začeti z "${n.prefix}"`;if("ends_with"===n.format)return`Neveljaven niz: mora se končati z "${n.suffix}"`;if("includes"===n.format)return`Neveljaven niz: mora vsebovati "${n.includes}"`;if("regex"===n.format)return`Neveljaven niz: mora ustrezati vzorcu ${n.pattern}`;return`Neveljaven ${t[n.format]??n.format}`;case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i ključi":" ključ"}: ${SN(n.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${n.origin}`;case"invalid_union":default:return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`}})}},"sv",0,function(){let e,t,r;return{localeError:(e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}},t={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},r={nan:"NaN",number:"antal",array:"lista"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ogiltig inmatning: f\xf6rv\xe4ntat instanceof ${n.expected}, fick ${i}`;return`Ogiltig inmatning: f\xf6rv\xe4ntat ${e}, fick ${i}`}case"invalid_value":if(1===n.values.length)return`Ogiltig inmatning: f\xf6rv\xe4ntat ${SQ(n.values[0])}`;return`Ogiltigt val: f\xf6rv\xe4ntade en av ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`F\xf6r stor(t): f\xf6rv\xe4ntade ${n.origin??"värdet"} att ha ${t}${n.maximum.toString()} ${r.unit??"element"}`;return`F\xf6r stor(t): f\xf6rv\xe4ntat ${n.origin??"värdet"} att ha ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`F\xf6r lite(t): f\xf6rv\xe4ntade ${n.origin??"värdet"} att ha ${t}${n.minimum.toString()} ${r.unit}`;return`F\xf6r lite(t): f\xf6rv\xe4ntade ${n.origin??"värdet"} att ha ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Ogiltig str\xe4ng: m\xe5ste b\xf6rja med "${n.prefix}"`;if("ends_with"===n.format)return`Ogiltig str\xe4ng: m\xe5ste sluta med "${n.suffix}"`;if("includes"===n.format)return`Ogiltig str\xe4ng: m\xe5ste inneh\xe5lla "${n.includes}"`;if("regex"===n.format)return`Ogiltig str\xe4ng: m\xe5ste matcha m\xf6nstret "${n.pattern}"`;return`Ogiltig(t) ${t[n.format]??n.format}`;case"not_multiple_of":return`Ogiltigt tal: m\xe5ste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${SN(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"värdet"}`;case"invalid_union":default:return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xe4rde i ${n.origin??"värdet"}`}})}},"ta",0,function(){let e,t,r;return{localeError:(e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}},t={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"எண்",array:"அணி",null:"வெறுமை"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${n.expected}, பெறப்பட்டது ${i}`;return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${e}, பெறப்பட்டது ${i}`}case"invalid_value":if(1===n.values.length)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${SQ(n.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${SN(n.values,"|")} இல் ஒன்று`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${t}${n.maximum.toString()} ${r.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${t}${n.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${t}${n.minimum.toString()} ${r.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${t}${n.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":if("starts_with"===n.format)return`தவறான சரம்: "${n.prefix}" இல் தொடங்க வேண்டும்`;if("ends_with"===n.format)return`தவறான சரம்: "${n.suffix}" இல் முடிவடைய வேண்டும்`;if("includes"===n.format)return`தவறான சரம்: "${n.includes}" ஐ உள்ளடக்க வேண்டும்`;if("regex"===n.format)return`தவறான சரம்: ${n.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${t[n.format]??n.format}`;case"not_multiple_of":return`தவறான எண்: ${n.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${n.keys.length>1?"கள்":""}: ${SN(n.keys,", ")}`;case"invalid_key":return`${n.origin} இல் தவறான விசை`;case"invalid_union":default:return"தவறான உள்ளீடு";case"invalid_element":return`${n.origin} இல் தவறான மதிப்பு`}})}},"th",0,function(){let e,t,r;return{localeError:(e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}},t={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"},r={nan:"NaN",number:"ตัวเลข",array:"อาร์เรย์ (Array)",null:"ไม่มีค่า (null)"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${n.expected} แต่ได้รับ ${i}`;return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${e} แต่ได้รับ ${i}`}case"invalid_value":if(1===n.values.length)return`ค่าไม่ถูกต้อง: ควรเป็น ${SQ(n.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"ไม่เกิน":"น้อยกว่า",r=e[n.origin]??null;if(r)return`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${t} ${n.maximum.toString()} ${r.unit??"รายการ"}`;return`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${t} ${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?"อย่างน้อย":"มากกว่า",r=e[n.origin]??null;if(r)return`น้อยกว่ากำหนด: ${n.origin} ควรมี${t} ${n.minimum.toString()} ${r.unit}`;return`น้อยกว่ากำหนด: ${n.origin} ควรมี${t} ${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${n.prefix}"`;if("ends_with"===n.format)return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${n.suffix}"`;if("includes"===n.format)return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${n.includes}" อยู่ในข้อความ`;if("regex"===n.format)return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${n.pattern}`;return`รูปแบบไม่ถูกต้อง: ${t[n.format]??n.format}`;case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${n.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${SN(n.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${n.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${n.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}})}},"tr",0,function(){let e,t,r;return{localeError:(e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}},t={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ge\xe7ersiz değer: beklenen instanceof ${n.expected}, alınan ${i}`;return`Ge\xe7ersiz değer: beklenen ${e}, alınan ${i}`}case"invalid_value":if(1===n.values.length)return`Ge\xe7ersiz değer: beklenen ${SQ(n.values[0])}`;return`Ge\xe7ersiz se\xe7enek: aşağıdakilerden biri olmalı: ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`\xc7ok b\xfcy\xfck: beklenen ${n.origin??"değer"} ${t}${n.maximum.toString()} ${r.unit??"öğe"}`;return`\xc7ok b\xfcy\xfck: beklenen ${n.origin??"değer"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`\xc7ok k\xfc\xe7\xfck: beklenen ${n.origin} ${t}${n.minimum.toString()} ${r.unit}`;return`\xc7ok k\xfc\xe7\xfck: beklenen ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Ge\xe7ersiz metin: "${n.prefix}" ile başlamalı`;if("ends_with"===n.format)return`Ge\xe7ersiz metin: "${n.suffix}" ile bitmeli`;if("includes"===n.format)return`Ge\xe7ersiz metin: "${n.includes}" i\xe7ermeli`;if("regex"===n.format)return`Ge\xe7ersiz metin: ${n.pattern} desenine uymalı`;return`Ge\xe7ersiz ${t[n.format]??n.format}`;case"not_multiple_of":return`Ge\xe7ersiz sayı: ${n.divisor} ile tam b\xf6l\xfcnebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${n.keys.length>1?"lar":""}: ${SN(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xe7inde ge\xe7ersiz anahtar`;case"invalid_union":default:return"Geçersiz değer";case"invalid_element":return`${n.origin} i\xe7inde ge\xe7ersiz değer`}})}},"ua",0,function(){return A0()},"uk",0,A0,"ur",0,function(){let e,t,r;return{localeError:(e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}},t={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"},r={nan:"NaN",number:"نمبر",array:"آرے",null:"نل"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`غلط ان پٹ: instanceof ${n.expected} متوقع تھا، ${i} موصول ہوا`;return`غلط ان پٹ: ${e} متوقع تھا، ${i} موصول ہوا`}case"invalid_value":if(1===n.values.length)return`غلط ان پٹ: ${SQ(n.values[0])} متوقع تھا`;return`غلط آپشن: ${SN(n.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`بہت بڑا: ${n.origin??"ویلیو"} کے ${t}${n.maximum.toString()} ${r.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${n.origin??"ویلیو"} کا ${t}${n.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`بہت چھوٹا: ${n.origin} کے ${t}${n.minimum.toString()} ${r.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${n.origin} کا ${t}${n.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":if("starts_with"===n.format)return`غلط سٹرنگ: "${n.prefix}" سے شروع ہونا چاہیے`;if("ends_with"===n.format)return`غلط سٹرنگ: "${n.suffix}" پر ختم ہونا چاہیے`;if("includes"===n.format)return`غلط سٹرنگ: "${n.includes}" شامل ہونا چاہیے`;if("regex"===n.format)return`غلط سٹرنگ: پیٹرن ${n.pattern} سے میچ ہونا چاہیے`;return`غلط ${t[n.format]??n.format}`;case"not_multiple_of":return`غلط نمبر: ${n.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${n.keys.length>1?"ز":""}: ${SN(n.keys,"، ")}`;case"invalid_key":return`${n.origin} میں غلط کی`;case"invalid_union":default:return"غلط ان پٹ";case"invalid_element":return`${n.origin} میں غلط ویلیو`}})}},"uz",0,function(){let e,t,r;return{localeError:(e={string:{unit:"belgi",verb:"bo‘lishi kerak"},file:{unit:"bayt",verb:"bo‘lishi kerak"},array:{unit:"element",verb:"bo‘lishi kerak"},set:{unit:"element",verb:"bo‘lishi kerak"},map:{unit:"yozuv",verb:"bo‘lishi kerak"}},t={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},r={nan:"NaN",number:"raqam",array:"massiv"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Noto‘g‘ri kirish: kutilgan instanceof ${n.expected}, qabul qilingan ${i}`;return`Noto‘g‘ri kirish: kutilgan ${e}, qabul qilingan ${i}`}case"invalid_value":if(1===n.values.length)return`Noto‘g‘ri kirish: kutilgan ${SQ(n.values[0])}`;return`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Juda katta: kutilgan ${n.origin??"qiymat"} ${t}${n.maximum.toString()} ${r.unit} ${r.verb}`;return`Juda katta: kutilgan ${n.origin??"qiymat"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Juda kichik: kutilgan ${n.origin} ${t}${n.minimum.toString()} ${r.unit} ${r.verb}`;return`Juda kichik: kutilgan ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Noto‘g‘ri satr: "${n.prefix}" bilan boshlanishi kerak`;if("ends_with"===n.format)return`Noto‘g‘ri satr: "${n.suffix}" bilan tugashi kerak`;if("includes"===n.format)return`Noto‘g‘ri satr: "${n.includes}" ni o‘z ichiga olishi kerak`;if("regex"===n.format)return`Noto‘g‘ri satr: ${n.pattern} shabloniga mos kelishi kerak`;return`Noto‘g‘ri ${t[n.format]??n.format}`;case"not_multiple_of":return`Noto‘g‘ri raqam: ${n.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${n.keys.length>1?"lar":""}: ${SN(n.keys,", ")}`;case"invalid_key":return`${n.origin} dagi kalit noto‘g‘ri`;case"invalid_union":default:return"Noto‘g‘ri kirish";case"invalid_element":return`${n.origin} da noto‘g‘ri qiymat`}})}},"vi",0,function(){let e,t,r;return{localeError:(e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}},t={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"},r={nan:"NaN",number:"số",array:"mảng"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Đầu v\xe0o kh\xf4ng hợp lệ: mong đợi instanceof ${n.expected}, nhận được ${i}`;return`Đầu v\xe0o kh\xf4ng hợp lệ: mong đợi ${e}, nhận được ${i}`}case"invalid_value":if(1===n.values.length)return`Đầu v\xe0o kh\xf4ng hợp lệ: mong đợi ${SQ(n.values[0])}`;return`T\xf9y chọn kh\xf4ng hợp lệ: mong đợi một trong c\xe1c gi\xe1 trị ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Qu\xe1 lớn: mong đợi ${n.origin??"giá trị"} ${r.verb} ${t}${n.maximum.toString()} ${r.unit??"phần tử"}`;return`Qu\xe1 lớn: mong đợi ${n.origin??"giá trị"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Qu\xe1 nhỏ: mong đợi ${n.origin} ${r.verb} ${t}${n.minimum.toString()} ${r.unit}`;return`Qu\xe1 nhỏ: mong đợi ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Chuỗi kh\xf4ng hợp lệ: phải bắt đầu bằng "${n.prefix}"`;if("ends_with"===n.format)return`Chuỗi kh\xf4ng hợp lệ: phải kết th\xfac bằng "${n.suffix}"`;if("includes"===n.format)return`Chuỗi kh\xf4ng hợp lệ: phải bao gồm "${n.includes}"`;if("regex"===n.format)return`Chuỗi kh\xf4ng hợp lệ: phải khớp với mẫu ${n.pattern}`;return`${t[n.format]??n.format} kh\xf4ng hợp lệ`;case"not_multiple_of":return`Số kh\xf4ng hợp lệ: phải l\xe0 bội số của ${n.divisor}`;case"unrecognized_keys":return`Kh\xf3a kh\xf4ng được nhận dạng: ${SN(n.keys,", ")}`;case"invalid_key":return`Kh\xf3a kh\xf4ng hợp lệ trong ${n.origin}`;case"invalid_union":default:return"Đầu vào không hợp lệ";case"invalid_element":return`Gi\xe1 trị kh\xf4ng hợp lệ trong ${n.origin}`}})}},"yo",0,function(){let e,t,r;return{localeError:(e={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}},t={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"},r={nan:"NaN",number:"nọ́mbà",array:"akopọ"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`\xccb\xe1wọl\xe9 aṣ\xecṣe: a n\xed l\xe1ti fi instanceof ${n.expected}, \xe0mọ̀ a r\xed ${i}`;return`\xccb\xe1wọl\xe9 aṣ\xecṣe: a n\xed l\xe1ti fi ${e}, \xe0mọ̀ a r\xed ${i}`}case"invalid_value":if(1===n.values.length)return`\xccb\xe1wọl\xe9 aṣ\xecṣe: a n\xed l\xe1ti fi ${SQ(n.values[0])}`;return`\xc0ṣ\xe0y\xe0n aṣ\xecṣe: yan ọ̀kan l\xe1ra ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`T\xf3 pọ̀ j\xf9: a n\xed l\xe1ti jẹ́ p\xe9 ${n.origin??"iye"} ${r.verb} ${t}${n.maximum} ${r.unit}`;return`T\xf3 pọ̀ j\xf9: a n\xed l\xe1ti jẹ́ ${t}${n.maximum}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`K\xe9r\xe9 ju: a n\xed l\xe1ti jẹ́ p\xe9 ${n.origin} ${r.verb} ${t}${n.minimum} ${r.unit}`;return`K\xe9r\xe9 ju: a n\xed l\xe1ti jẹ́ ${t}${n.minimum}`}case"invalid_format":if("starts_with"===n.format)return`Ọ̀rọ̀ aṣ\xecṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀l\xfa "${n.prefix}"`;if("ends_with"===n.format)return`Ọ̀rọ̀ aṣ\xecṣe: gbọ́dọ̀ par\xed pẹ̀l\xfa "${n.suffix}"`;if("includes"===n.format)return`Ọ̀rọ̀ aṣ\xecṣe: gbọ́dọ̀ n\xed "${n.includes}"`;if("regex"===n.format)return`Ọ̀rọ̀ aṣ\xecṣe: gbọ́dọ̀ b\xe1 \xe0pẹẹrẹ mu ${n.pattern}`;return`Aṣ\xecṣe: ${t[n.format]??n.format}`;case"not_multiple_of":return`Nọ́mb\xe0 aṣ\xecṣe: gbọ́dọ̀ jẹ́ \xe8y\xe0 p\xedp\xedn ti ${n.divisor}`;case"unrecognized_keys":return`Bọt\xecn\xec \xe0\xecmọ̀: ${SN(n.keys,", ")}`;case"invalid_key":return`Bọt\xecn\xec aṣ\xecṣe n\xedn\xfa ${n.origin}`;case"invalid_union":default:return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣ\xecṣe n\xedn\xfa ${n.origin}`}})}},"zhCN",0,function(){let e,t,r;return{localeError:(e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}},t={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"},r={nan:"NaN",number:"数字",array:"数组",null:"空值(null)"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`无效输入:期望 instanceof ${n.expected},实际接收 ${i}`;return`无效输入:期望 ${e},实际接收 ${i}`}case"invalid_value":if(1===n.values.length)return`无效输入:期望 ${SQ(n.values[0])}`;return`无效选项:期望以下之一 ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`数值过大:期望 ${n.origin??"值"} ${t}${n.maximum.toString()} ${r.unit??"个元素"}`;return`数值过大:期望 ${n.origin??"值"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`数值过小:期望 ${n.origin} ${t}${n.minimum.toString()} ${r.unit}`;return`数值过小:期望 ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`无效字符串:必须以 "${n.prefix}" 开头`;if("ends_with"===n.format)return`无效字符串:必须以 "${n.suffix}" 结尾`;if("includes"===n.format)return`无效字符串:必须包含 "${n.includes}"`;if("regex"===n.format)return`无效字符串:必须满足正则表达式 ${n.pattern}`;return`无效${t[n.format]??n.format}`;case"not_multiple_of":return`无效数字:必须是 ${n.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${SN(n.keys,", ")}`;case"invalid_key":return`${n.origin} 中的键(key)无效`;case"invalid_union":default:return"无效输入";case"invalid_element":return`${n.origin} 中包含无效值(value)`}})}},"zhTW",0,function(){let e,t,r;return{localeError:(e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}},t={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=$e(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`無效的輸入值:預期為 instanceof ${n.expected},但收到 ${i}`;return`無效的輸入值:預期為 ${e},但收到 ${i}`}case"invalid_value":if(1===n.values.length)return`無效的輸入值:預期為 ${SQ(n.values[0])}`;return`無效的選項:預期為以下其中之一 ${SN(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`數值過大:預期 ${n.origin??"值"} 應為 ${t}${n.maximum.toString()} ${r.unit??"個元素"}`;return`數值過大:預期 ${n.origin??"值"} 應為 ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`數值過小:預期 ${n.origin} 應為 ${t}${n.minimum.toString()} ${r.unit}`;return`數值過小:預期 ${n.origin} 應為 ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`無效的字串:必須以 "${n.prefix}" 開頭`;if("ends_with"===n.format)return`無效的字串:必須以 "${n.suffix}" 結尾`;if("includes"===n.format)return`無效的字串:必須包含 "${n.includes}"`;if("regex"===n.format)return`無效的字串:必須符合格式 ${n.pattern}`;return`無效的 ${t[n.format]??n.format}`;case"not_multiple_of":return`無效的數字:必須為 ${n.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${n.keys.length>1?"們":""}:${SN(n.keys,"、")}`;case"invalid_key":return`${n.origin} 中有無效的鍵值`;case"invalid_union":default:return"無效的輸入值";case"invalid_element":return`${n.origin} 中有無效的值`}})}}],54580);var A1=e.i(54580);function A2(e,t){return new e({type:"string",...SX(t)})}function A4(e,t){return new e({type:"string",coerce:!0,...SX(t)})}function A6(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...SX(t)})}function A5(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...SX(t)})}function A3(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...SX(t)})}function A9(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...SX(t)})}function A8(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...SX(t)})}function A7(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...SX(t)})}function Re(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...SX(t)})}function Rt(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...SX(t)})}function Rr(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...SX(t)})}function Rn(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...SX(t)})}function Ri(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...SX(t)})}function Ra(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...SX(t)})}function Ro(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...SX(t)})}function Rs(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...SX(t)})}function Rl(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...SX(t)})}function Ru(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...SX(t)})}function Rd(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...SX(t)})}function Rc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...SX(t)})}function Rp(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...SX(t)})}function Rm(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...SX(t)})}function Rf(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...SX(t)})}function Rh(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...SX(t)})}function Rg(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...SX(t)})}e.i(25527),e.i(98530);let Rv={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Ry(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...SX(t)})}function Rb(e,t){return new e({type:"string",format:"date",check:"string_format",...SX(t)})}function Rx(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...SX(t)})}function Rw(e,t){return new e({type:"string",format:"duration",check:"string_format",...SX(t)})}function R_(e,t){return new e({type:"number",checks:[],...SX(t)})}function Rk(e,t){return new e({type:"number",coerce:!0,checks:[],...SX(t)})}function RI(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...SX(t)})}function RS(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...SX(t)})}function R$(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...SX(t)})}function Rj(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...SX(t)})}function RE(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...SX(t)})}function RT(e,t){return new e({type:"boolean",...SX(t)})}function RC(e,t){return new e({type:"boolean",coerce:!0,...SX(t)})}function RN(e,t){return new e({type:"bigint",...SX(t)})}function RA(e,t){return new e({type:"bigint",coerce:!0,...SX(t)})}function RR(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...SX(t)})}function RP(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...SX(t)})}function RO(e,t){return new e({type:"symbol",...SX(t)})}function RM(e,t){return new e({type:"undefined",...SX(t)})}function Rz(e,t){return new e({type:"null",...SX(t)})}function RD(e){return new e({type:"any"})}function RU(e){return new e({type:"unknown"})}function RL(e,t){return new e({type:"never",...SX(t)})}function RZ(e,t){return new e({type:"void",...SX(t)})}function RF(e,t){return new e({type:"date",...SX(t)})}function RB(e,t){return new e({type:"date",coerce:!0,...SX(t)})}function RV(e,t){return new e({type:"nan",...SX(t)})}function Rq(e,t){return new CX({check:"less_than",...SX(t),value:e,inclusive:!1})}function RW(e,t){return new CX({check:"less_than",...SX(t),value:e,inclusive:!0})}function RJ(e,t){return new CQ({check:"greater_than",...SX(t),value:e,inclusive:!1})}function RH(e,t){return new CQ({check:"greater_than",...SX(t),value:e,inclusive:!0})}function RK(e){return RJ(0,e)}function RG(e){return Rq(0,e)}function RY(e){return RW(0,e)}function RX(e){return RH(0,e)}function RQ(e,t){return new C0({check:"multiple_of",...SX(t),value:e})}function R0(e,t){return new C4({check:"max_size",...SX(t),maximum:e})}function R1(e,t){return new C6({check:"min_size",...SX(t),minimum:e})}function R2(e,t){return new C5({check:"size_equals",...SX(t),size:e})}function R4(e,t){return new C3({check:"max_length",...SX(t),maximum:e})}function R6(e,t){return new C9({check:"min_length",...SX(t),minimum:e})}function R5(e,t){return new C8({check:"length_equals",...SX(t),length:e})}function R3(e,t){return new Ne({check:"string_format",format:"regex",...SX(t),pattern:e})}function R9(e){return new Nt({check:"string_format",format:"lowercase",...SX(e)})}function R8(e){return new Nr({check:"string_format",format:"uppercase",...SX(e)})}function R7(e,t){return new Nn({check:"string_format",format:"includes",...SX(t),includes:e})}function Pe(e,t){return new Ni({check:"string_format",format:"starts_with",...SX(t),prefix:e})}function Pt(e,t){return new Na({check:"string_format",format:"ends_with",...SX(t),suffix:e})}function Pr(e,t,r){return new Ns({check:"property",property:e,schema:t,...SX(r)})}function Pn(e,t){return new Nl({check:"mime_type",mime:e,...SX(t)})}function Pi(e){return new Nu({check:"overwrite",tx:e})}function Pa(e){return Pi(t=>t.normalize(e))}function Po(){return Pi(e=>e.trim())}function Ps(){return Pi(e=>e.toLowerCase())}function Pl(){return Pi(e=>e.toUpperCase())}function Pu(){return Pi(e=>SF(e))}function Pd(e,t,r){return new e({type:"array",element:t,...SX(r)})}function Pc(e,t,r){return new e({type:"union",options:t,...SX(r)})}function Pp(e,t,r){return new e({type:"union",options:t,inclusive:!1,...SX(r)})}function Pm(e,t,r,n){return new e({type:"union",options:r,discriminator:t,...SX(n)})}function Pf(e,t,r){return new e({type:"intersection",left:t,right:r})}function Ph(e,t,r,n){let i=r instanceof Np,a=i?n:r;return new e({type:"tuple",items:t,rest:i?r:null,...SX(a)})}function Pg(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,...SX(n)})}function Pv(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,...SX(n)})}function Py(e,t,r){return new e({type:"set",valueType:t,...SX(r)})}function Pb(e,t,r){return new e({type:"enum",entries:Array.isArray(t)?Object.fromEntries(t.map(e=>[e,e])):t,...SX(r)})}function Px(e,t,r){return new e({type:"enum",entries:t,...SX(r)})}function Pw(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...SX(r)})}function P_(e,t){return new e({type:"file",...SX(t)})}function Pk(e,t){return new e({type:"transform",transform:t})}function PI(e,t){return new e({type:"optional",innerType:t})}function PS(e,t){return new e({type:"nullable",innerType:t})}function P$(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return"function"==typeof r?r():SJ(r)}})}function Pj(e,t,r){return new e({type:"nonoptional",innerType:t,...SX(r)})}function PE(e,t){return new e({type:"success",innerType:t})}function PT(e,t,r){return new e({type:"catch",innerType:t,catchValue:"function"==typeof r?r:()=>r})}function PC(e,t,r){return new e({type:"pipe",in:t,out:r})}function PN(e,t){return new e({type:"readonly",innerType:t})}function PA(e,t,r){return new e({type:"template_literal",parts:t,...SX(r)})}function PR(e,t){return new e({type:"lazy",getter:t})}function PP(e,t){return new e({type:"promise",innerType:t})}function PO(e,t,r){let n=SX(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function PM(e,t,r){return new e({type:"custom",check:"custom",fn:t,...SX(r)})}function Pz(e,t){let r=PD(t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push($t(e,t.value,r._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=r),e.continue??(e.continue=!r._zod.def.abort),t.issues.push($t(e)))},e(t.value,t)),t);return r}function PD(e,t){let r=new CG({check:"custom",...SX(t)});return r._zod.check=e,r}function PU(e){let t=new CG({check:"describe"});return t._zod.onattach=[t=>{let r=$1.get(t)??{};$1.add(t,{...r,description:e})}],t._zod.check=()=>{},t}function PL(e){let t=new CG({check:"meta"});return t._zod.onattach=[t=>{let r=$1.get(t)??{};$1.add(t,{...r,...e})}],t._zod.check=()=>{},t}function PZ(e,t){let r=SX(t),n=r.truthy??["true","1","yes","on","y","enabled"],i=r.falsy??["false","0","no","off","n","disabled"];"sensitive"!==r.case&&(n=n.map(e=>"string"==typeof e?e.toLowerCase():e),i=i.map(e=>"string"==typeof e?e.toLowerCase():e));let a=new Set(n),o=new Set(i),s=e.Codec??AR,l=e.Boolean??Nq,u=new s({type:"pipe",in:new(e.String??Nm)({type:"string",error:r.error}),out:new l({type:"boolean",error:r.error}),transform:(e,t)=>{let n=e;return"sensitive"!==r.case&&(n=n.toLowerCase()),!!a.has(n)||!o.has(n)&&(t.issues.push({code:"invalid_value",expected:"stringbool",values:[...a,...o],input:t.value,inst:u,continue:!1}),{})},reverseTransform:(e,t)=>!0===e?n[0]||"true":i[0]||"false",error:r.error});return u}function PF(e,t,r,n={}){let i=SX(n),a={...SX(n),check:"string_format",type:"string",format:t,fn:"function"==typeof r?r:e=>r.test(e),...i};return r instanceof RegExp&&(a.pattern=r),new e(a)}e.s(["TimePrecision",0,Rv,"_any",0,RD,"_array",0,Pd,"_base64",0,Rm,"_base64url",0,Rf,"_bigint",0,RN,"_boolean",0,RT,"_catch",0,PT,"_check",0,PD,"_cidrv4",0,Rc,"_cidrv6",0,Rp,"_coercedBigint",0,RA,"_coercedBoolean",0,RC,"_coercedDate",0,RB,"_coercedNumber",0,Rk,"_coercedString",0,A4,"_cuid",0,Rn,"_cuid2",0,Ri,"_custom",0,PO,"_date",0,RF,"_default",0,P$,"_discriminatedUnion",0,Pm,"_e164",0,Rh,"_email",0,A6,"_emoji",0,Rt,"_endsWith",0,Pt,"_enum",0,Pb,"_file",0,P_,"_float32",0,RS,"_float64",0,R$,"_gt",0,RJ,"_gte",0,RH,"_guid",0,A5,"_includes",0,R7,"_int",0,RI,"_int32",0,Rj,"_int64",0,RR,"_intersection",0,Pf,"_ipv4",0,Rl,"_ipv6",0,Ru,"_isoDate",0,Rb,"_isoDateTime",0,Ry,"_isoDuration",0,Rw,"_isoTime",0,Rx,"_jwt",0,Rg,"_ksuid",0,Rs,"_lazy",0,PR,"_length",0,R5,"_literal",0,Pw,"_lowercase",0,R9,"_lt",0,Rq,"_lte",0,RW,"_mac",0,Rd,"_map",0,Pv,"_max",0,RW,"_maxLength",0,R4,"_maxSize",0,R0,"_mime",0,Pn,"_min",0,RH,"_minLength",0,R6,"_minSize",0,R1,"_multipleOf",0,RQ,"_nan",0,RV,"_nanoid",0,Rr,"_nativeEnum",0,Px,"_negative",0,RG,"_never",0,RL,"_nonnegative",0,RX,"_nonoptional",0,Pj,"_nonpositive",0,RY,"_normalize",0,Pa,"_null",0,Rz,"_nullable",0,PS,"_number",0,R_,"_optional",0,PI,"_overwrite",0,Pi,"_pipe",0,PC,"_positive",0,RK,"_promise",0,PP,"_property",0,Pr,"_readonly",0,PN,"_record",0,Pg,"_refine",0,PM,"_regex",0,R3,"_set",0,Py,"_size",0,R2,"_slugify",0,Pu,"_startsWith",0,Pe,"_string",0,A2,"_stringFormat",0,PF,"_stringbool",0,PZ,"_success",0,PE,"_superRefine",0,Pz,"_symbol",0,RO,"_templateLiteral",0,PA,"_toLowerCase",0,Ps,"_toUpperCase",0,Pl,"_transform",0,Pk,"_trim",0,Po,"_tuple",0,Ph,"_uint32",0,RE,"_uint64",0,RP,"_ulid",0,Ra,"_undefined",0,RM,"_union",0,Pc,"_unknown",0,RU,"_uppercase",0,R8,"_url",0,Re,"_uuid",0,A3,"_uuidv4",0,A9,"_uuidv6",0,A8,"_uuidv7",0,A7,"_void",0,RZ,"_xid",0,Ro,"_xor",0,Pp,"describe",0,PU,"meta",0,PL],50215),e.i(50215),e.i(34966),e.s([],18249);var PB=e.i(18249);e.s(["$ZodAny",0,NY,"$ZodArray",0,N4,"$ZodAsyncError",0,S$,"$ZodBase64",0,NM,"$ZodBase64URL",0,ND,"$ZodBigInt",0,NW,"$ZodBigIntFormat",0,NJ,"$ZodBoolean",0,Nq,"$ZodCIDRv4",0,NR,"$ZodCIDRv6",0,NP,"$ZodCUID",0,Nw,"$ZodCUID2",0,N_,"$ZodCatch",0,AT,"$ZodCheck",0,CG,"$ZodCheckBigIntFormat",0,C2,"$ZodCheckEndsWith",0,Na,"$ZodCheckGreaterThan",0,CQ,"$ZodCheckIncludes",0,Nn,"$ZodCheckLengthEquals",0,C8,"$ZodCheckLessThan",0,CX,"$ZodCheckLowerCase",0,Nt,"$ZodCheckMaxLength",0,C3,"$ZodCheckMaxSize",0,C4,"$ZodCheckMimeType",0,Nl,"$ZodCheckMinLength",0,C9,"$ZodCheckMinSize",0,C6,"$ZodCheckMultipleOf",0,C0,"$ZodCheckNumberFormat",0,C1,"$ZodCheckOverwrite",0,Nu,"$ZodCheckProperty",0,Ns,"$ZodCheckRegex",0,Ne,"$ZodCheckSizeEquals",0,C5,"$ZodCheckStartsWith",0,Ni,"$ZodCheckStringFormat",0,C7,"$ZodCheckUpperCase",0,Nr,"$ZodCodec",0,AR,"$ZodCustom",0,AB,"$ZodCustomStringFormat",0,NF,"$ZodDate",0,N1,"$ZodDefault",0,Ak,"$ZodDiscriminatedUnion",0,An,"$ZodE164",0,NU,"$ZodEmail",0,Nv,"$ZodEmoji",0,Nb,"$ZodEncodeError",0,Sj,"$ZodEnum",0,Ah,"$ZodError",0,$a,"$ZodExactOptional",0,Aw,"$ZodFile",0,Av,"$ZodFunction",0,AL,"$ZodGUID",0,Nh,"$ZodIPv4",0,NC,"$ZodIPv6",0,NN,"$ZodISODate",0,Nj,"$ZodISODateTime",0,N$,"$ZodISODuration",0,NT,"$ZodISOTime",0,NE,"$ZodIntersection",0,Ai,"$ZodJWT",0,NZ,"$ZodKSUID",0,NS,"$ZodLazy",0,AF,"$ZodLiteral",0,Ag,"$ZodMAC",0,NA,"$ZodMap",0,Ac,"$ZodNaN",0,AC,"$ZodNanoID",0,Nx,"$ZodNever",0,NQ,"$ZodNonOptional",0,A$,"$ZodNull",0,NG,"$ZodNullable",0,A_,"$ZodNumber",0,NB,"$ZodNumberFormat",0,NV,"$ZodObject",0,N9,"$ZodObjectJIT",0,N8,"$ZodOptional",0,Ax,"$ZodPipe",0,AN,"$ZodPrefault",0,AS,"$ZodPreprocess",0,AM,"$ZodPromise",0,AZ,"$ZodReadonly",0,Az,"$ZodRealError",0,$o,"$ZodRecord",0,Ad,"$ZodRegistry",0,$Q,"$ZodSet",0,Am,"$ZodString",0,Nm,"$ZodStringFormat",0,Nf,"$ZodSuccess",0,AE,"$ZodSymbol",0,NH,"$ZodTemplateLiteral",0,AU,"$ZodTransform",0,Ay,"$ZodTuple",0,Ao,"$ZodType",0,Np,"$ZodULID",0,Nk,"$ZodURL",0,Ny,"$ZodUUID",0,Ng,"$ZodUndefined",0,NK,"$ZodUnion",0,Ae,"$ZodUnknown",0,NX,"$ZodVoid",0,N0,"$ZodXID",0,NI,"$ZodXor",0,Ar,"$brand",0,SS,"$constructor",0,SI,"$input",0,$X,"$output",0,$Y,"Doc",0,Nd,"JSONSchema",0,PB,"JSONSchemaGenerator",0,class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??"draft-2020-12";"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),this.ctx=$2({processors:jD,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return $4(e,this.ctx,t)}emit(e,t){t&&(t.cycles&&(this.ctx.cycles=t.cycles),t.reused&&(this.ctx.reused=t.reused),t.external&&(this.ctx.external=t.external)),$6(this.ctx,e);let{"~standard":r,...n}=$5(this.ctx,e);return n}},"NEVER",0,Sk,"TimePrecision",0,Rv,"_any",0,RD,"_array",0,Pd,"_base64",0,Rm,"_base64url",0,Rf,"_bigint",0,RN,"_boolean",0,RT,"_catch",0,PT,"_check",0,PD,"_cidrv4",0,Rc,"_cidrv6",0,Rp,"_coercedBigint",0,RA,"_coercedBoolean",0,RC,"_coercedDate",0,RB,"_coercedNumber",0,Rk,"_coercedString",0,A4,"_cuid",0,Rn,"_cuid2",0,Ri,"_custom",0,PO,"_date",0,RF,"_decode",0,$_,"_decodeAsync",0,$$,"_default",0,P$,"_discriminatedUnion",0,Pm,"_e164",0,Rh,"_email",0,A6,"_emoji",0,Rt,"_encode",0,$x,"_encodeAsync",0,$I,"_endsWith",0,Pt,"_enum",0,Pb,"_file",0,P_,"_float32",0,RS,"_float64",0,R$,"_gt",0,RJ,"_gte",0,RH,"_guid",0,A5,"_includes",0,R7,"_int",0,RI,"_int32",0,Rj,"_int64",0,RR,"_intersection",0,Pf,"_ipv4",0,Rl,"_ipv6",0,Ru,"_isoDate",0,Rb,"_isoDateTime",0,Ry,"_isoDuration",0,Rw,"_isoTime",0,Rx,"_jwt",0,Rg,"_ksuid",0,Rs,"_lazy",0,PR,"_length",0,R5,"_literal",0,Pw,"_lowercase",0,R9,"_lt",0,Rq,"_lte",0,RW,"_mac",0,Rd,"_map",0,Pv,"_max",0,RW,"_maxLength",0,R4,"_maxSize",0,R0,"_mime",0,Pn,"_min",0,RH,"_minLength",0,R6,"_minSize",0,R1,"_multipleOf",0,RQ,"_nan",0,RV,"_nanoid",0,Rr,"_nativeEnum",0,Px,"_negative",0,RG,"_never",0,RL,"_nonnegative",0,RX,"_nonoptional",0,Pj,"_nonpositive",0,RY,"_normalize",0,Pa,"_null",0,Rz,"_nullable",0,PS,"_number",0,R_,"_optional",0,PI,"_overwrite",0,Pi,"_parse",0,$p,"_parseAsync",0,$f,"_pipe",0,PC,"_positive",0,RK,"_promise",0,PP,"_property",0,Pr,"_readonly",0,PN,"_record",0,Pg,"_refine",0,PM,"_regex",0,R3,"_safeDecode",0,$C,"_safeDecodeAsync",0,$P,"_safeEncode",0,$E,"_safeEncodeAsync",0,$A,"_safeParse",0,$g,"_safeParseAsync",0,$y,"_set",0,Py,"_size",0,R2,"_slugify",0,Pu,"_startsWith",0,Pe,"_string",0,A2,"_stringFormat",0,PF,"_stringbool",0,PZ,"_success",0,PE,"_superRefine",0,Pz,"_symbol",0,RO,"_templateLiteral",0,PA,"_toLowerCase",0,Ps,"_toUpperCase",0,Pl,"_transform",0,Pk,"_trim",0,Po,"_tuple",0,Ph,"_uint32",0,RE,"_uint64",0,RP,"_ulid",0,Ra,"_undefined",0,RM,"_union",0,Pc,"_unknown",0,RU,"_uppercase",0,R8,"_url",0,Re,"_uuid",0,A3,"_uuidv4",0,A9,"_uuidv6",0,A8,"_uuidv7",0,A7,"_void",0,RZ,"_xid",0,Ro,"_xor",0,Pp,"clone",0,SY,"config",0,ST,"createStandardJSONSchemaMethod",0,$9,"createToJSONSchemaMethod",0,$3,"decode",0,$k,"decodeAsync",0,$j,"describe",0,PU,"encode",0,$w,"encodeAsync",0,$S,"extractDefs",0,$6,"finalize",0,$5,"flattenError",0,$s,"formatError",0,$l,"globalConfig",0,SE,"globalRegistry",0,$1,"initializeContext",0,$2,"isValidBase64",0,NO,"isValidBase64URL",0,Nz,"isValidJWT",0,NL,"locales",0,A1,"meta",0,PL,"parse",0,$m,"parseAsync",0,$h,"prettifyError",0,$c,"process",0,$4,"regexes",0,AW,"registry",0,$0,"safeDecode",0,$N,"safeDecodeAsync",0,$O,"safeEncode",0,$T,"safeEncodeAsync",0,$R,"safeParse",0,$v,"safeParseAsync",0,$b,"toDotPath",0,$d,"toJSONSchema",0,jU,"treeifyError",0,$u,"util",0,Aq,"version",0,Nc],12717);var PV=e.i(12717);e.s(["ZodAny",()=>Mi,"ZodArray",()=>Mf,"ZodBase64",()=>OP,"ZodBase64URL",()=>OM,"ZodBigInt",()=>O4,"ZodBigIntFormat",()=>O5,"ZodBoolean",()=>O1,"ZodCIDRv4",()=>OC,"ZodCIDRv6",()=>OA,"ZodCUID",()=>Of,"ZodCUID2",()=>Og,"ZodCatch",()=>M7,"ZodCodec",()=>za,"ZodCustom",()=>zb,"ZodCustomStringFormat",()=>OF,"ZodDate",()=>Mp,"ZodDefault",()=>M1,"ZodDiscriminatedUnion",()=>MS,"ZodE164",()=>OD,"ZodEmail",()=>P8,"ZodEmoji",()=>Od,"ZodEnum",()=>MU,"ZodExactOptional",()=>MG,"ZodFile",()=>MV,"ZodFunction",()=>zv,"ZodGUID",()=>Oe,"ZodIPv4",()=>OI,"ZodIPv6",()=>OE,"ZodIntersection",()=>Mj,"ZodJWT",()=>OL,"ZodKSUID",()=>O_,"ZodLazy",()=>zm,"ZodLiteral",()=>MF,"ZodMAC",()=>O$,"ZodMap",()=>MO,"ZodNaN",()=>zt,"ZodNanoID",()=>Op,"ZodNever",()=>Ml,"ZodNonOptional",()=>M5,"ZodNull",()=>Mr,"ZodNullable",()=>MX,"ZodNumber",()=>OJ,"ZodNumberFormat",()=>OK,"ZodObject",()=>Mv,"ZodOptional",()=>MH,"ZodPipe",()=>zn,"ZodPrefault",()=>M4,"ZodPreprocess",()=>zl,"ZodPromise",()=>zh,"ZodReadonly",()=>zu,"ZodRecord",()=>MN,"ZodSet",()=>Mz,"ZodString",()=>P5,"ZodStringFormat",()=>P9,"ZodSuccess",()=>M9,"ZodSymbol",()=>O8,"ZodTemplateLiteral",()=>zc,"ZodTransform",()=>MW,"ZodTuple",()=>MT,"ZodType",()=>P4,"ZodULID",()=>Oy,"ZodURL",()=>Os,"ZodUUID",()=>Or,"ZodUndefined",()=>Me,"ZodUnion",()=>Mw,"ZodUnknown",()=>Mo,"ZodVoid",()=>Md,"ZodXID",()=>Ox,"ZodXor",()=>Mk,"_ZodString",()=>P6,"_default",()=>M2,"_function",()=>zy,"any",()=>Ma,"array",()=>Mh,"base64",()=>OO,"base64url",()=>Oz,"bigint",()=>O6,"boolean",()=>O2,"catch",()=>ze,"check",()=>zx,"cidrv4",()=>ON,"cidrv6",()=>OR,"codec",()=>zo,"cuid",()=>Oh,"cuid2",()=>Ov,"custom",()=>zw,"date",()=>Mm,"describe",()=>zI,"discriminatedUnion",()=>M$,"e164",()=>OU,"email",()=>P7,"emoji",()=>Oc,"enum",()=>ML,"exactOptional",()=>MY,"file",()=>Mq,"float32",()=>OY,"float64",()=>OX,"function",()=>zy,"guid",()=>Ot,"hash",()=>OW,"hex",()=>Oq,"hostname",()=>OV,"httpUrl",()=>Ou,"instanceof",()=>z$,"int",()=>OG,"int32",()=>OQ,"int64",()=>O3,"intersection",()=>ME,"invertCodec",()=>zs,"ipv4",()=>OS,"ipv6",()=>OT,"json",()=>zE,"jwt",()=>OZ,"keyof",()=>Mg,"ksuid",()=>Ok,"lazy",()=>zf,"literal",()=>MB,"looseObject",()=>Mx,"looseRecord",()=>MP,"mac",()=>Oj,"map",()=>MM,"meta",()=>zS,"nan",()=>zr,"nanoid",()=>Om,"nativeEnum",()=>MZ,"never",()=>Mu,"nonoptional",()=>M3,"null",()=>Mn,"nullable",()=>MQ,"nullish",()=>M0,"number",()=>OH,"object",()=>My,"optional",()=>MK,"partialRecord",()=>MR,"pipe",()=>zi,"prefault",()=>M6,"preprocess",()=>zT,"promise",()=>zg,"readonly",()=>zd,"record",()=>MA,"refine",()=>z_,"set",()=>MD,"strictObject",()=>Mb,"string",()=>P3,"stringFormat",()=>OB,"stringbool",()=>zj,"success",()=>M8,"superRefine",()=>zk,"symbol",()=>O7,"templateLiteral",()=>zp,"transform",()=>MJ,"tuple",()=>MC,"uint32",()=>O0,"uint64",()=>O9,"ulid",()=>Ob,"undefined",()=>Mt,"union",()=>M_,"unknown",()=>Ms,"url",()=>Ol,"uuid",()=>On,"uuidv4",()=>Oi,"uuidv6",()=>Oa,"uuidv7",()=>Oo,"void",()=>Mc,"xid",()=>Ow,"xor",()=>MI],62201);var Pq=AW,PW=Aq;e.s(["ZodISODate",()=>PK,"ZodISODateTime",()=>PJ,"ZodISODuration",()=>PQ,"ZodISOTime",()=>PY,"date",()=>PG,"datetime",()=>PH,"duration",()=>P0,"time",()=>PX],49732);let PJ=SI("ZodISODateTime",(e,t)=>{N$.init(e,t),P9.init(e,t)});function PH(e){return Ry(PJ,e)}let PK=SI("ZodISODate",(e,t)=>{Nj.init(e,t),P9.init(e,t)});function PG(e){return Rb(PK,e)}let PY=SI("ZodISOTime",(e,t)=>{NE.init(e,t),P9.init(e,t)});function PX(e){return Rx(PY,e)}let PQ=SI("ZodISODuration",(e,t)=>{NT.init(e,t),P9.init(e,t)});function P0(e){return Rw(PQ,e)}let P1=new WeakMap;function P2(e,t,r){let n=Object.getPrototypeOf(e),i=P1.get(n);if(i||(i=new Set,P1.set(n,i)),!i.has(t))for(let e in i.add(t),r){let t=r[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,get(){let r=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:r}),r},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}let P4=SI("ZodType",(e,t)=>(Np.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:$9(e,"input"),output:$9(e,"output")}}),e.toJSONSchema=$3(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>$U(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>$Z(e,t,r),e.parseAsync=async(t,r)=>$L(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>$F(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>$B(e,t,r),e.decode=(t,r)=>$V(e,t,r),e.encodeAsync=async(t,r)=>$q(e,t,r),e.decodeAsync=async(t,r)=>$W(e,t,r),e.safeEncode=(t,r)=>$J(e,t,r),e.safeDecode=(t,r)=>$H(e,t,r),e.safeEncodeAsync=async(t,r)=>$K(e,t,r),e.safeDecodeAsync=async(t,r)=>$G(e,t,r),P2(e,"ZodType",{check(...e){let t=this.def;return this.clone(PW.mergeDefs(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return SY(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(z_(e,t))},superRefine(e,t){return this.check(zk(e,t))},overwrite(e){return this.check(Pi(e))},optional(){return MK(this)},exactOptional(){return MY(this)},nullable(){return MQ(this)},nullish(){return MK(MQ(this))},nonoptional(e){return M3(this,e)},array(){return Mh(this)},or(e){return M_([this,e])},and(e){return ME(this,e)},transform(e){return zi(this,MJ(e))},default(e){return M2(this,e)},prefault(e){return M6(this,e)},catch(e){return ze(this,e)},pipe(e){return zi(this,e)},readonly(){return zd(this)},describe(e){let t=this.clone();return $1.add(t,{description:e}),t},meta(...e){if(0===e.length)return $1.get(this);let t=this.clone();return $1.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>$1.get(e)?.description,configurable:!0}),e)),P6=SI("_ZodString",(e,t)=>{Nm.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>$7(e,t,r,n);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,P2(e,"_ZodString",{regex(...e){return this.check(R3(...e))},includes(...e){return this.check(R7(...e))},startsWith(...e){return this.check(Pe(...e))},endsWith(...e){return this.check(Pt(...e))},min(...e){return this.check(R6(...e))},max(...e){return this.check(R4(...e))},length(...e){return this.check(R5(...e))},nonempty(...e){return this.check(R6(1,...e))},lowercase(e){return this.check(R9(e))},uppercase(e){return this.check(R8(e))},trim(){return this.check(Po())},normalize(...e){return this.check(Pa(...e))},toLowerCase(){return this.check(Ps())},toUpperCase(){return this.check(Pl())},slugify(){return this.check(Pu())}})}),P5=SI("ZodString",(e,t)=>{Nm.init(e,t),P6.init(e,t),e.email=t=>e.check(A6(P8,t)),e.url=t=>e.check(Re(Os,t)),e.jwt=t=>e.check(Rg(OL,t)),e.emoji=t=>e.check(Rt(Od,t)),e.guid=t=>e.check(A5(Oe,t)),e.uuid=t=>e.check(A3(Or,t)),e.uuidv4=t=>e.check(A9(Or,t)),e.uuidv6=t=>e.check(A8(Or,t)),e.uuidv7=t=>e.check(A7(Or,t)),e.nanoid=t=>e.check(Rr(Op,t)),e.guid=t=>e.check(A5(Oe,t)),e.cuid=t=>e.check(Rn(Of,t)),e.cuid2=t=>e.check(Ri(Og,t)),e.ulid=t=>e.check(Ra(Oy,t)),e.base64=t=>e.check(Rm(OP,t)),e.base64url=t=>e.check(Rf(OM,t)),e.xid=t=>e.check(Ro(Ox,t)),e.ksuid=t=>e.check(Rs(O_,t)),e.ipv4=t=>e.check(Rl(OI,t)),e.ipv6=t=>e.check(Ru(OE,t)),e.cidrv4=t=>e.check(Rc(OC,t)),e.cidrv6=t=>e.check(Rp(OA,t)),e.e164=t=>e.check(Rh(OD,t)),e.datetime=t=>e.check(PH(t)),e.date=t=>e.check(PG(t)),e.time=t=>e.check(PX(t)),e.duration=t=>e.check(P0(t))});function P3(e){return A2(P5,e)}let P9=SI("ZodStringFormat",(e,t)=>{Nf.init(e,t),P6.init(e,t)}),P8=SI("ZodEmail",(e,t)=>{Nv.init(e,t),P9.init(e,t)});function P7(e){return A6(P8,e)}let Oe=SI("ZodGUID",(e,t)=>{Nh.init(e,t),P9.init(e,t)});function Ot(e){return A5(Oe,e)}let Or=SI("ZodUUID",(e,t)=>{Ng.init(e,t),P9.init(e,t)});function On(e){return A3(Or,e)}function Oi(e){return A9(Or,e)}function Oa(e){return A8(Or,e)}function Oo(e){return A7(Or,e)}let Os=SI("ZodURL",(e,t)=>{Ny.init(e,t),P9.init(e,t)});function Ol(e){return Re(Os,e)}function Ou(e){return Re(Os,{protocol:Pq.httpProtocol,hostname:Pq.domain,...PW.normalizeParams(e)})}let Od=SI("ZodEmoji",(e,t)=>{Nb.init(e,t),P9.init(e,t)});function Oc(e){return Rt(Od,e)}let Op=SI("ZodNanoID",(e,t)=>{Nx.init(e,t),P9.init(e,t)});function Om(e){return Rr(Op,e)}let Of=SI("ZodCUID",(e,t)=>{Nw.init(e,t),P9.init(e,t)});function Oh(e){return Rn(Of,e)}let Og=SI("ZodCUID2",(e,t)=>{N_.init(e,t),P9.init(e,t)});function Ov(e){return Ri(Og,e)}let Oy=SI("ZodULID",(e,t)=>{Nk.init(e,t),P9.init(e,t)});function Ob(e){return Ra(Oy,e)}let Ox=SI("ZodXID",(e,t)=>{NI.init(e,t),P9.init(e,t)});function Ow(e){return Ro(Ox,e)}let O_=SI("ZodKSUID",(e,t)=>{NS.init(e,t),P9.init(e,t)});function Ok(e){return Rs(O_,e)}let OI=SI("ZodIPv4",(e,t)=>{NC.init(e,t),P9.init(e,t)});function OS(e){return Rl(OI,e)}let O$=SI("ZodMAC",(e,t)=>{NA.init(e,t),P9.init(e,t)});function Oj(e){return Rd(O$,e)}let OE=SI("ZodIPv6",(e,t)=>{NN.init(e,t),P9.init(e,t)});function OT(e){return Ru(OE,e)}let OC=SI("ZodCIDRv4",(e,t)=>{NR.init(e,t),P9.init(e,t)});function ON(e){return Rc(OC,e)}let OA=SI("ZodCIDRv6",(e,t)=>{NP.init(e,t),P9.init(e,t)});function OR(e){return Rp(OA,e)}let OP=SI("ZodBase64",(e,t)=>{NM.init(e,t),P9.init(e,t)});function OO(e){return Rm(OP,e)}let OM=SI("ZodBase64URL",(e,t)=>{ND.init(e,t),P9.init(e,t)});function Oz(e){return Rf(OM,e)}let OD=SI("ZodE164",(e,t)=>{NU.init(e,t),P9.init(e,t)});function OU(e){return Rh(OD,e)}let OL=SI("ZodJWT",(e,t)=>{NZ.init(e,t),P9.init(e,t)});function OZ(e){return Rg(OL,e)}let OF=SI("ZodCustomStringFormat",(e,t)=>{NF.init(e,t),P9.init(e,t)});function OB(e,t,r={}){return PF(OF,e,t,r)}function OV(e){return PF(OF,"hostname",Pq.hostname,e)}function Oq(e){return PF(OF,"hex",Pq.hex,e)}function OW(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,i=Pq[n];if(!i)throw Error(`Unrecognized hash format: ${n}`);return PF(OF,n,i,t)}let OJ=SI("ZodNumber",(e,t)=>{NB.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>je(e,t,r,n),P2(e,"ZodNumber",{gt(e,t){return this.check(RJ(e,t))},gte(e,t){return this.check(RH(e,t))},min(e,t){return this.check(RH(e,t))},lt(e,t){return this.check(Rq(e,t))},lte(e,t){return this.check(RW(e,t))},max(e,t){return this.check(RW(e,t))},int(e){return this.check(OG(e))},safe(e){return this.check(OG(e))},positive(e){return this.check(RJ(0,e))},nonnegative(e){return this.check(RH(0,e))},negative(e){return this.check(Rq(0,e))},nonpositive(e){return this.check(RW(0,e))},multipleOf(e,t){return this.check(RQ(e,t))},step(e,t){return this.check(RQ(e,t))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??-1/0,r.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(r.maximum??1/0,r.exclusiveMaximum??1/0)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function OH(e){return R_(OJ,e)}let OK=SI("ZodNumberFormat",(e,t)=>{NV.init(e,t),OJ.init(e,t)});function OG(e){return RI(OK,e)}function OY(e){return RS(OK,e)}function OX(e){return R$(OK,e)}function OQ(e){return Rj(OK,e)}function O0(e){return RE(OK,e)}let O1=SI("ZodBoolean",(e,t)=>{Nq.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jt(e,t,r,n)});function O2(e){return RT(O1,e)}let O4=SI("ZodBigInt",(e,t)=>{NW.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jr(e,t,r,n),e.gte=(t,r)=>e.check(RH(t,r)),e.min=(t,r)=>e.check(RH(t,r)),e.gt=(t,r)=>e.check(RJ(t,r)),e.gte=(t,r)=>e.check(RH(t,r)),e.min=(t,r)=>e.check(RH(t,r)),e.lt=(t,r)=>e.check(Rq(t,r)),e.lte=(t,r)=>e.check(RW(t,r)),e.max=(t,r)=>e.check(RW(t,r)),e.positive=t=>e.check(RJ(BigInt(0),t)),e.negative=t=>e.check(Rq(BigInt(0),t)),e.nonpositive=t=>e.check(RW(BigInt(0),t)),e.nonnegative=t=>e.check(RH(BigInt(0),t)),e.multipleOf=(t,r)=>e.check(RQ(t,r));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function O6(e){return RN(O4,e)}let O5=SI("ZodBigIntFormat",(e,t)=>{NJ.init(e,t),O4.init(e,t)});function O3(e){return RR(O5,e)}function O9(e){return RP(O5,e)}let O8=SI("ZodSymbol",(e,t)=>{NH.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jn(e,t,r,n)});function O7(e){return RO(O8,e)}let Me=SI("ZodUndefined",(e,t)=>{NK.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>ja(e,t,r,n)});function Mt(e){return RM(Me,e)}let Mr=SI("ZodNull",(e,t)=>{NG.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>ji(e,t,r,n)});function Mn(e){return Rz(Mr,e)}let Mi=SI("ZodAny",(e,t)=>{NY.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jl(e,t,r,n)});function Ma(){return RD(Mi)}let Mo=SI("ZodUnknown",(e,t)=>{NX.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>ju(e,t,r,n)});function Ms(){return RU(Mo)}let Ml=SI("ZodNever",(e,t)=>{NQ.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>js(e,t,r,n)});function Mu(e){return RL(Ml,e)}let Md=SI("ZodVoid",(e,t)=>{N0.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jo(e,t,r,n)});function Mc(e){return RZ(Md,e)}let Mp=SI("ZodDate",(e,t)=>{N1.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jd(e,t,r,n),e.min=(t,r)=>e.check(RH(t,r)),e.max=(t,r)=>e.check(RW(t,r));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function Mm(e){return RF(Mp,e)}let Mf=SI("ZodArray",(e,t)=>{N4.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>j_(e,t,r,n),e.element=t.element,P2(e,"ZodArray",{min(e,t){return this.check(R6(e,t))},nonempty(e){return this.check(R6(1,e))},max(e,t){return this.check(R4(e,t))},length(e,t){return this.check(R5(e,t))},unwrap(){return this.element}})});function Mh(e,t){return Pd(Mf,e,t)}function Mg(e){return ML(Object.keys(e._zod.def.shape))}let Mv=SI("ZodObject",(e,t)=>{N8.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jk(e,t,r,n),PW.defineLazy(e,"shape",()=>t.shape),P2(e,"ZodObject",{keyof(){return ML(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Ms()})},loose(){return this.clone({...this._zod.def,catchall:Ms()})},strict(){return this.clone({...this._zod.def,catchall:Mu()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return PW.extend(this,e)},safeExtend(e){return PW.safeExtend(this,e)},merge(e){return PW.merge(this,e)},pick(e){return PW.pick(this,e)},omit(e){return PW.omit(this,e)},partial(...e){return PW.partial(MH,this,e[0])},required(...e){return PW.required(M5,this,e[0])}})});function My(e,t){return new Mv({type:"object",shape:e??{},...PW.normalizeParams(t)})}function Mb(e,t){return new Mv({type:"object",shape:e,catchall:Mu(),...PW.normalizeParams(t)})}function Mx(e,t){return new Mv({type:"object",shape:e,catchall:Ms(),...PW.normalizeParams(t)})}let Mw=SI("ZodUnion",(e,t)=>{Ae.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jI(e,t,r,n),e.options=t.options});function M_(e,t){return new Mw({type:"union",options:e,...PW.normalizeParams(t)})}let Mk=SI("ZodXor",(e,t)=>{Mw.init(e,t),Ar.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jI(e,t,r,n),e.options=t.options});function MI(e,t){return new Mk({type:"union",options:e,inclusive:!1,...PW.normalizeParams(t)})}let MS=SI("ZodDiscriminatedUnion",(e,t)=>{Mw.init(e,t),An.init(e,t)});function M$(e,t,r){return new MS({type:"union",options:t,discriminator:e,...PW.normalizeParams(r)})}let Mj=SI("ZodIntersection",(e,t)=>{Ai.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jS(e,t,r,n)});function ME(e,t){return new Mj({type:"intersection",left:e,right:t})}let MT=SI("ZodTuple",(e,t)=>{Ao.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>j$(e,t,r,n),e.rest=t=>e.clone({...e._zod.def,rest:t})});function MC(e,t,r){let n=t instanceof Np,i=n?r:t;return new MT({type:"tuple",items:e,rest:n?t:null,...PW.normalizeParams(i)})}let MN=SI("ZodRecord",(e,t)=>{Ad.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jj(e,t,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function MA(e,t,r){return new MN(t&&t._zod?{type:"record",keyType:e,valueType:t,...PW.normalizeParams(r)}:{type:"record",keyType:P3(),valueType:e,...PW.normalizeParams(t)})}function MR(e,t,r){let n=SY(e);return n._zod.values=void 0,new MN({type:"record",keyType:n,valueType:t,...PW.normalizeParams(r)})}function MP(e,t,r){return new MN({type:"record",keyType:e,valueType:t,mode:"loose",...PW.normalizeParams(r)})}let MO=SI("ZodMap",(e,t)=>{Ac.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jx(e,t,r,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...t)=>e.check(R1(...t)),e.nonempty=t=>e.check(R1(1,t)),e.max=(...t)=>e.check(R0(...t)),e.size=(...t)=>e.check(R2(...t))});function MM(e,t,r){return new MO({type:"map",keyType:e,valueType:t,...PW.normalizeParams(r)})}let Mz=SI("ZodSet",(e,t)=>{Am.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jw(e,t,r,n),e.min=(...t)=>e.check(R1(...t)),e.nonempty=t=>e.check(R1(1,t)),e.max=(...t)=>e.check(R0(...t)),e.size=(...t)=>e.check(R2(...t))});function MD(e,t){return new Mz({type:"set",valueType:e,...PW.normalizeParams(t)})}let MU=SI("ZodEnum",(e,t)=>{Ah.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jc(e,t,r,n),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{let i={};for(let n of e)if(r.has(n))i[n]=t.entries[n];else throw Error(`Key ${n} not found in enum`);return new MU({...t,checks:[],...PW.normalizeParams(n),entries:i})},e.exclude=(e,n)=>{let i={...t.entries};for(let t of e)if(r.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new MU({...t,checks:[],...PW.normalizeParams(n),entries:i})}});function ML(e,t){return new MU({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...PW.normalizeParams(t)})}function MZ(e,t){return new MU({type:"enum",entries:e,...PW.normalizeParams(t)})}let MF=SI("ZodLiteral",(e,t)=>{Ag.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jp(e,t,r,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function MB(e,t){return new MF({type:"literal",values:Array.isArray(e)?e:[e],...PW.normalizeParams(t)})}let MV=SI("ZodFile",(e,t)=>{Av.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jh(e,t,r,n),e.min=(t,r)=>e.check(R1(t,r)),e.max=(t,r)=>e.check(R0(t,r)),e.mime=(t,r)=>e.check(Pn(Array.isArray(t)?t:[t],r))});function Mq(e){return P_(MV,e)}let MW=SI("ZodTransform",(e,t)=>{Ay.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jb(e,t,r,n),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new Sj(e.constructor.name);r.addIssue=n=>{"string"==typeof n?r.issues.push(PW.issue(n,r.value,t)):(n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=e),r.issues.push(PW.issue(n)))};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}});function MJ(e){return new MW({type:"transform",transform:e})}let MH=SI("ZodOptional",(e,t)=>{Ax.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jM(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function MK(e){return new MH({type:"optional",innerType:e})}let MG=SI("ZodExactOptional",(e,t)=>{Aw.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jM(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function MY(e){return new MG({type:"optional",innerType:e})}let MX=SI("ZodNullable",(e,t)=>{A_.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jE(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function MQ(e){return new MX({type:"nullable",innerType:e})}function M0(e){return MK(MQ(e))}let M1=SI("ZodDefault",(e,t)=>{Ak.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jC(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function M2(e,t){return new M1({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():PW.shallowClone(t)}})}let M4=SI("ZodPrefault",(e,t)=>{AS.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jN(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function M6(e,t){return new M4({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():PW.shallowClone(t)}})}let M5=SI("ZodNonOptional",(e,t)=>{A$.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jT(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function M3(e,t){return new M5({type:"nonoptional",innerType:e,...PW.normalizeParams(t)})}let M9=SI("ZodSuccess",(e,t)=>{AE.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jg(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function M8(e){return new M9({type:"success",innerType:e})}let M7=SI("ZodCatch",(e,t)=>{AT.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jA(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ze(e,t){return new M7({type:"catch",innerType:e,catchValue:"function"==typeof t?t:()=>t})}let zt=SI("ZodNaN",(e,t)=>{AC.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jm(e,t,r,n)});function zr(e){return RV(zt,e)}let zn=SI("ZodPipe",(e,t)=>{AN.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jR(e,t,r,n),e.in=t.in,e.out=t.out});function zi(e,t){return new zn({type:"pipe",in:e,out:t})}let za=SI("ZodCodec",(e,t)=>{zn.init(e,t),AR.init(e,t)});function zo(e,t,r){return new za({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function zs(e){let t=e._zod.def;return new za({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}let zl=SI("ZodPreprocess",(e,t)=>{zn.init(e,t),AM.init(e,t)}),zu=SI("ZodReadonly",(e,t)=>{Az.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jP(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function zd(e){return new zu({type:"readonly",innerType:e})}let zc=SI("ZodTemplateLiteral",(e,t)=>{AU.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jf(e,t,r,n)});function zp(e,t){return new zc({type:"template_literal",parts:e,...PW.normalizeParams(t)})}let zm=SI("ZodLazy",(e,t)=>{AF.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jz(e,t,r,n),e.unwrap=()=>e._zod.def.getter()});function zf(e){return new zm({type:"lazy",getter:e})}let zh=SI("ZodPromise",(e,t)=>{AZ.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jO(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function zg(e){return new zh({type:"promise",innerType:e})}let zv=SI("ZodFunction",(e,t)=>{AL.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jy(e,t,r,n)});function zy(e){return new zv({type:"function",input:Array.isArray(e?.input)?MC(e?.input):e?.input??Mh(Ms()),output:e?.output??Ms()})}let zb=SI("ZodCustom",(e,t)=>{AB.init(e,t),P4.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jv(e,t,r,n)});function zx(e){let t=new CG({check:"custom"});return t._zod.check=e,t}function zw(e,t){return PO(zb,e??(()=>!0),t)}function z_(e,t={}){return PM(zb,e,t)}function zk(e,t){return Pz(e,t)}let zI=PU,zS=PL;function z$(e,t={}){let r=new zb({type:"custom",check:"custom",fn:t=>t instanceof e,abort:!0,...PW.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=t=>{t.value instanceof e||t.issues.push({code:"invalid_type",expected:e.name,input:t.value,inst:r,path:[...r._zod.def.path??[]]})},r}let zj=(...e)=>PZ({Codec:za,Boolean:O1,String:P5},...e);function zE(e){let t=zf(()=>M_([P3(e),OH(),O2(),Mn(),Mh(t),MA(P3(),t)]));return t}function zT(e,t){return new zl({type:"pipe",in:MJ(e),out:t})}var zC=e.i(62201);e.s([],42332),e.i(42332),e.s(["endsWith",0,Pt,"gt",0,RJ,"gte",0,RH,"includes",0,R7,"length",0,R5,"lowercase",0,R9,"lt",0,Rq,"lte",0,RW,"maxLength",0,R4,"maxSize",0,R0,"mime",0,Pn,"minLength",0,R6,"minSize",0,R1,"multipleOf",0,RQ,"negative",0,RG,"nonnegative",0,RX,"nonpositive",0,RY,"normalize",0,Pa,"overwrite",0,Pi,"positive",0,RK,"property",0,Pr,"regex",0,R3,"size",0,R2,"slugify",0,Pu,"startsWith",0,Pe,"toLowerCase",0,Ps,"toUpperCase",0,Pl,"trim",0,Po,"uppercase",0,R8],30421);var zN=e.i(30421);e.i(89282),e.i(364);let zA={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function zR(e){ST({customError:e})}function zP(){return ST().customError}B||(B={}),e.s(["ZodFirstPartyTypeKind",0,B,"ZodIssueCode",0,zA,"getErrorMap",0,zP,"setErrorMap",0,zR],6034),e.i(6034),e.s(["$brand",0,SS,"ZodFirstPartyTypeKind",0,B,"ZodIssueCode",0,zA,"config",0,ST,"getErrorMap",0,zP,"setErrorMap",0,zR],58829),e.i(58829);var Pq=AW,PW=Aq,zO=e.i(49732);let zM={...zC,...zN,iso:zO},zz=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);e.s(["bigint",0,function(e){return RA(O4,e)},"boolean",0,function(e){return RC(O1,e)},"date",0,function(e){return RB(Mp,e)},"number",0,function(e){return Rk(OJ,e)},"string",0,function(e){return A4(P5,e)}],13657);var zD=e.i(13657);e.s(["$brand",0,SS,"$input",0,$X,"$output",0,$Y,"NEVER",0,Sk,"TimePrecision",0,Rv,"ZodAny",0,Mi,"ZodArray",0,Mf,"ZodBase64",0,OP,"ZodBase64URL",0,OM,"ZodBigInt",0,O4,"ZodBigIntFormat",0,O5,"ZodBoolean",0,O1,"ZodCIDRv4",0,OC,"ZodCIDRv6",0,OA,"ZodCUID",0,Of,"ZodCUID2",0,Og,"ZodCatch",0,M7,"ZodCodec",0,za,"ZodCustom",0,zb,"ZodCustomStringFormat",0,OF,"ZodDate",0,Mp,"ZodDefault",0,M1,"ZodDiscriminatedUnion",0,MS,"ZodE164",0,OD,"ZodEmail",0,P8,"ZodEmoji",0,Od,"ZodEnum",0,MU,"ZodError",0,$z,"ZodExactOptional",0,MG,"ZodFile",0,MV,"ZodFirstPartyTypeKind",0,B,"ZodFunction",0,zv,"ZodGUID",0,Oe,"ZodIPv4",0,OI,"ZodIPv6",0,OE,"ZodISODate",0,PK,"ZodISODateTime",0,PJ,"ZodISODuration",0,PQ,"ZodISOTime",0,PY,"ZodIntersection",0,Mj,"ZodIssueCode",0,zA,"ZodJWT",0,OL,"ZodKSUID",0,O_,"ZodLazy",0,zm,"ZodLiteral",0,MF,"ZodMAC",0,O$,"ZodMap",0,MO,"ZodNaN",0,zt,"ZodNanoID",0,Op,"ZodNever",0,Ml,"ZodNonOptional",0,M5,"ZodNull",0,Mr,"ZodNullable",0,MX,"ZodNumber",0,OJ,"ZodNumberFormat",0,OK,"ZodObject",0,Mv,"ZodOptional",0,MH,"ZodPipe",0,zn,"ZodPrefault",0,M4,"ZodPreprocess",0,zl,"ZodPromise",0,zh,"ZodReadonly",0,zu,"ZodRealError",0,$D,"ZodRecord",0,MN,"ZodSet",0,Mz,"ZodString",0,P5,"ZodStringFormat",0,P9,"ZodSuccess",0,M9,"ZodSymbol",0,O8,"ZodTemplateLiteral",0,zc,"ZodTransform",0,MW,"ZodTuple",0,MT,"ZodType",0,P4,"ZodULID",0,Oy,"ZodURL",0,Os,"ZodUUID",0,Or,"ZodUndefined",0,Me,"ZodUnion",0,Mw,"ZodUnknown",0,Mo,"ZodVoid",0,Md,"ZodXID",0,Ox,"ZodXor",0,Mk,"_ZodString",0,P6,"_default",0,M2,"_function",0,zy,"any",0,Ma,"array",0,Mh,"base64",0,OO,"base64url",0,Oz,"bigint",0,O6,"boolean",0,O2,"catch",0,ze,"check",0,zx,"cidrv4",0,ON,"cidrv6",0,OR,"clone",0,SY,"codec",0,zo,"coerce",0,zD,"config",0,ST,"core",0,PV,"cuid",0,Oh,"cuid2",0,Ov,"custom",0,zw,"date",0,Mm,"decode",0,$V,"decodeAsync",0,$W,"describe",0,zI,"discriminatedUnion",0,M$,"e164",0,OU,"email",0,P7,"emoji",0,Oc,"encode",0,$B,"encodeAsync",0,$q,"endsWith",0,Pt,"enum",0,ML,"exactOptional",0,MY,"file",0,Mq,"flattenError",0,$s,"float32",0,OY,"float64",0,OX,"formatError",0,$l,"fromJSONSchema",0,function(e,t){var r,n;let i,a;if("boolean"==typeof e)return e?zM.any():zM.never();try{i=JSON.parse(JSON.stringify(e))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o={version:(r=i,n=t?.defaultTarget,"https://json-schema.org/draft/2020-12/schema"===(a=r.$schema)?"draft-2020-12":"http://json-schema.org/draft-07/schema#"===a?"draft-7":"http://json-schema.org/draft-04/schema#"===a?"draft-4":n??"draft-2020-12"),defs:i.$defs||i.definitions||{},refs:new Map,processing:new Set,rootSchema:i,registry:t?.registry??$1};return function e(t,r){if("boolean"==typeof t)return t?zM.any():zM.never();let n=function t(r,n){let i;if(void 0!==r.not){if("object"==typeof r.not&&0===Object.keys(r.not).length)return zM.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(void 0!==r.unevaluatedItems)throw Error("unevaluatedItems is not supported");if(void 0!==r.unevaluatedProperties)throw Error("unevaluatedProperties is not supported");if(void 0!==r.if||void 0!==r.then||void 0!==r.else)throw Error("Conditional schemas (if/then/else) are not supported");if(void 0!==r.dependentSchemas||void 0!==r.dependentRequired)throw Error("dependentSchemas and dependentRequired are not supported");if(r.$ref){let t=r.$ref;if(n.refs.has(t))return n.refs.get(t);if(n.processing.has(t))return zM.lazy(()=>{if(!n.refs.has(t))throw Error(`Circular reference not resolved: ${t}`);return n.refs.get(t)});n.processing.add(t);let i=e(function(e,t){if(!e.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(0===r.length)return t.rootSchema;let n="draft-2020-12"===t.version?"$defs":"definitions";if(r[0]===n){let n=r[1];if(!n||!t.defs[n])throw Error(`Reference not found: ${e}`);return t.defs[n]}throw Error(`Reference not found: ${e}`)}(t,n),n);return n.refs.set(t,i),n.processing.delete(t),i}if(void 0!==r.enum){let e=r.enum;if("openapi-3.0"===n.version&&!0===r.nullable&&1===e.length&&null===e[0])return zM.null();if(0===e.length)return zM.never();if(1===e.length)return zM.literal(e[0]);if(e.every(e=>"string"==typeof e))return zM.enum(e);let t=e.map(e=>zM.literal(e));return t.length<2?t[0]:zM.union([t[0],t[1],...t.slice(2)])}if(void 0!==r.const)return zM.literal(r.const);let a=r.type;if(Array.isArray(a)){let e=a.map(e=>t({...r,type:e},n));return 0===e.length?zM.never():1===e.length?e[0]:zM.union(e)}if(!a)return zM.any();switch(a){case"string":{let e=zM.string();if(r.format){let t=r.format;"email"===t?e=e.check(zM.email()):"uri"===t||"uri-reference"===t?e=e.check(zM.url()):"uuid"===t||"guid"===t?e=e.check(zM.uuid()):"date-time"===t?e=e.check(zM.iso.datetime()):"date"===t?e=e.check(zM.iso.date()):"time"===t?e=e.check(zM.iso.time()):"duration"===t?e=e.check(zM.iso.duration()):"ipv4"===t?e=e.check(zM.ipv4()):"ipv6"===t?e=e.check(zM.ipv6()):"mac"===t?e=e.check(zM.mac()):"cidr"===t?e=e.check(zM.cidrv4()):"cidr-v6"===t?e=e.check(zM.cidrv6()):"base64"===t?e=e.check(zM.base64()):"base64url"===t?e=e.check(zM.base64url()):"e164"===t?e=e.check(zM.e164()):"jwt"===t?e=e.check(zM.jwt()):"emoji"===t?e=e.check(zM.emoji()):"nanoid"===t?e=e.check(zM.nanoid()):"cuid"===t?e=e.check(zM.cuid()):"cuid2"===t?e=e.check(zM.cuid2()):"ulid"===t?e=e.check(zM.ulid()):"xid"===t?e=e.check(zM.xid()):"ksuid"===t&&(e=e.check(zM.ksuid()))}"number"==typeof r.minLength&&(e=e.min(r.minLength)),"number"==typeof r.maxLength&&(e=e.max(r.maxLength)),r.pattern&&(e=e.regex(new RegExp(r.pattern))),i=e;break}case"number":case"integer":{let e="integer"===a?zM.number().int():zM.number();"number"==typeof r.minimum&&(e=e.min(r.minimum)),"number"==typeof r.maximum&&(e=e.max(r.maximum)),"number"==typeof r.exclusiveMinimum?e=e.gt(r.exclusiveMinimum):!0===r.exclusiveMinimum&&"number"==typeof r.minimum&&(e=e.gt(r.minimum)),"number"==typeof r.exclusiveMaximum?e=e.lt(r.exclusiveMaximum):!0===r.exclusiveMaximum&&"number"==typeof r.maximum&&(e=e.lt(r.maximum)),"number"==typeof r.multipleOf&&(e=e.multipleOf(r.multipleOf)),i=e;break}case"boolean":i=zM.boolean();break;case"null":i=zM.null();break;case"object":{let t={},a=r.properties||{},o=new Set(r.required||[]);for(let[r,i]of Object.entries(a)){let a=e(i,n);t[r]=o.has(r)?a:a.optional()}if(r.propertyNames){let a=e(r.propertyNames,n),o=r.additionalProperties&&"object"==typeof r.additionalProperties?e(r.additionalProperties,n):zM.any();if(0===Object.keys(t).length){i=zM.record(a,o);break}let s=zM.object(t).passthrough(),l=zM.looseRecord(a,o);i=zM.intersection(s,l);break}if(r.patternProperties){let a=r.patternProperties,o=Object.keys(a),s=[];for(let t of o){let r=e(a[t],n),i=zM.string().regex(new RegExp(t));s.push(zM.looseRecord(i,r))}let l=[];if(Object.keys(t).length>0&&l.push(zM.object(t).passthrough()),l.push(...s),0===l.length)i=zM.object({}).passthrough();else if(1===l.length)i=l[0];else{let e=zM.intersection(l[0],l[1]);for(let t=2;t<l.length;t++)e=zM.intersection(e,l[t]);i=e}break}let s=zM.object(t);i=!1===r.additionalProperties?s.strict():"object"==typeof r.additionalProperties?s.catchall(e(r.additionalProperties,n)):s.passthrough();break}case"array":{let t=r.prefixItems,a=r.items;if(t&&Array.isArray(t)){let o=t.map(t=>e(t,n)),s=a&&"object"==typeof a&&!Array.isArray(a)?e(a,n):void 0;i=s?zM.tuple(o).rest(s):zM.tuple(o),"number"==typeof r.minItems&&(i=i.check(zM.minLength(r.minItems))),"number"==typeof r.maxItems&&(i=i.check(zM.maxLength(r.maxItems)))}else if(Array.isArray(a)){let t=a.map(t=>e(t,n)),o=r.additionalItems&&"object"==typeof r.additionalItems?e(r.additionalItems,n):void 0;i=o?zM.tuple(t).rest(o):zM.tuple(t),"number"==typeof r.minItems&&(i=i.check(zM.minLength(r.minItems))),"number"==typeof r.maxItems&&(i=i.check(zM.maxLength(r.maxItems)))}else if(void 0!==a){let t=e(a,n),o=zM.array(t);"number"==typeof r.minItems&&(o=o.min(r.minItems)),"number"==typeof r.maxItems&&(o=o.max(r.maxItems)),i=o}else i=zM.array(zM.any());break}default:throw Error(`Unsupported type: ${a}`)}return i}(t,r),i=t.type||void 0!==t.enum||void 0!==t.const;if(t.anyOf&&Array.isArray(t.anyOf)){let a=t.anyOf.map(t=>e(t,r)),o=zM.union(a);n=i?zM.intersection(n,o):o}if(t.oneOf&&Array.isArray(t.oneOf)){let a=t.oneOf.map(t=>e(t,r)),o=zM.xor(a);n=i?zM.intersection(n,o):o}if(t.allOf&&Array.isArray(t.allOf))if(0===t.allOf.length)n=i?n:zM.any();else{let a=i?n:e(t.allOf[0],r),o=+!i;for(let n=o;n<t.allOf.length;n++)a=zM.intersection(a,e(t.allOf[n],r));n=a}!0===t.nullable&&"openapi-3.0"===r.version&&(n=zM.nullable(n)),!0===t.readOnly&&(n=zM.readonly(n)),void 0!==t.default&&(n=n.default(t.default));let a={};for(let e of["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"])e in t&&(a[e]=t[e]);for(let e of["contentEncoding","contentMediaType","contentSchema"])e in t&&(a[e]=t[e]);for(let e of Object.keys(t))zz.has(e)||(a[e]=t[e]);return Object.keys(a).length>0&&r.registry.add(n,a),t.description&&(n=n.describe(t.description)),n}(i,o)},"function",0,zy,"getErrorMap",0,zP,"globalRegistry",0,$1,"gt",0,RJ,"gte",0,RH,"guid",0,Ot,"hash",0,OW,"hex",0,Oq,"hostname",0,OV,"httpUrl",0,Ou,"includes",0,R7,"instanceof",0,z$,"int",0,OG,"int32",0,OQ,"int64",0,O3,"intersection",0,ME,"invertCodec",0,zs,"ipv4",0,OS,"ipv6",0,OT,"iso",0,zO,"json",0,zE,"jwt",0,OZ,"keyof",0,Mg,"ksuid",0,Ok,"lazy",0,zf,"length",0,R5,"literal",0,MB,"locales",0,A1,"looseObject",0,Mx,"looseRecord",0,MP,"lowercase",0,R9,"lt",0,Rq,"lte",0,RW,"mac",0,Oj,"map",0,MM,"maxLength",0,R4,"maxSize",0,R0,"meta",0,zS,"mime",0,Pn,"minLength",0,R6,"minSize",0,R1,"multipleOf",0,RQ,"nan",0,zr,"nanoid",0,Om,"nativeEnum",0,MZ,"negative",0,RG,"never",0,Mu,"nonnegative",0,RX,"nonoptional",0,M3,"nonpositive",0,RY,"normalize",0,Pa,"null",0,Mn,"nullable",0,MQ,"nullish",0,M0,"number",0,OH,"object",0,My,"optional",0,MK,"overwrite",0,Pi,"parse",0,$U,"parseAsync",0,$L,"partialRecord",0,MR,"pipe",0,zi,"positive",0,RK,"prefault",0,M6,"preprocess",0,zT,"prettifyError",0,$c,"promise",0,zg,"property",0,Pr,"readonly",0,zd,"record",0,MA,"refine",0,z_,"regex",0,R3,"regexes",()=>Pq,"registry",0,$0,"safeDecode",0,$H,"safeDecodeAsync",0,$G,"safeEncode",0,$J,"safeEncodeAsync",0,$K,"safeParse",0,$Z,"safeParseAsync",0,$F,"set",0,MD,"setErrorMap",0,zR,"size",0,R2,"slugify",0,Pu,"startsWith",0,Pe,"strictObject",0,Mb,"string",0,P3,"stringFormat",0,OB,"stringbool",0,zj,"success",0,M8,"superRefine",0,zk,"symbol",0,O7,"templateLiteral",0,zp,"toJSONSchema",0,jU,"toLowerCase",0,Ps,"toUpperCase",0,Pl,"transform",0,MJ,"treeifyError",0,$u,"trim",0,Po,"tuple",0,MC,"uint32",0,O0,"uint64",0,O9,"ulid",0,Ob,"undefined",0,Mt,"union",0,M_,"unknown",0,Ms,"uppercase",0,R8,"url",0,Ol,"util",()=>PW,"uuid",0,On,"uuidv4",0,Oi,"uuidv6",0,Oa,"uuidv7",0,Oo,"void",0,Mc,"xid",0,Ow,"xor",0,MI],22219);var zU=e.i(22219),zU=zU,zL=e.i(25150),zZ=Symbol.for("vercel.ai.gateway.error"),zF=class e extends(q=Error,V=zZ,q){constructor({message:e,statusCode:t=500,cause:r,generationId:n,isRetryable:i=null!=t&&(408===t||409===t||429===t||t>=500)}){super(n?`${e} [${n}]`:e),this[V]=!0,this.statusCode=t,this.cause=r,this.generationId=n,this.isRetryable=i}static isInstance(t){return e.hasMarker(t)}static hasMarker(e){return"object"==typeof e&&null!==e&&zZ in e&&!0===e[zZ]}},zB="GatewayAuthenticationError",zV=Symbol.for(`vercel.ai.gateway.error.${zB}`),zq=class e extends(J=zF,W=zV,J){constructor({message:e="Authentication failed",statusCode:t=401,cause:r,generationId:n}={}){super({message:e,statusCode:t,cause:r,generationId:n}),this[W]=!0,this.name=zB,this.type="authentication_error"}static isInstance(e){return zF.hasMarker(e)&&zV in e}static createContextualError({apiKeyProvided:t,oidcTokenProvided:r,message:n="Authentication failed",statusCode:i=401,cause:a,generationId:o}){return new e({message:t?`AI Gateway authentication failed: Invalid API key.
|
|
84
|
+
|
|
85
|
+
Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
|
|
86
|
+
|
|
87
|
+
Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.`:r?`AI Gateway authentication failed: Invalid OIDC token.
|
|
88
|
+
|
|
89
|
+
Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.
|
|
90
|
+
|
|
91
|
+
Alternatively, use an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys`:`AI Gateway authentication failed: No authentication provided.
|
|
92
|
+
|
|
93
|
+
Option 1 - API key:
|
|
94
|
+
Create an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
|
|
95
|
+
Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.
|
|
96
|
+
|
|
97
|
+
Option 2 - OIDC token:
|
|
98
|
+
Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.`,statusCode:i,cause:a,generationId:o})}},zW="GatewayInvalidRequestError",zJ=Symbol.for(`vercel.ai.gateway.error.${zW}`),zH=class extends(K=zF,H=zJ,K){constructor({message:e="Invalid request",statusCode:t=400,cause:r,generationId:n}={}){super({message:e,statusCode:t,cause:r,generationId:n}),this[H]=!0,this.name=zW,this.type="invalid_request_error"}static isInstance(e){return zF.hasMarker(e)&&zJ in e}},zK="GatewayRateLimitError",zG=Symbol.for(`vercel.ai.gateway.error.${zK}`),zY=class extends(Y=zF,G=zG,Y){constructor({message:e="Rate limit exceeded",statusCode:t=429,cause:r,generationId:n}={}){super({message:e,statusCode:t,cause:r,generationId:n}),this[G]=!0,this.name=zK,this.type="rate_limit_exceeded"}static isInstance(e){return zF.hasMarker(e)&&zG in e}},zX="GatewayModelNotFoundError",zQ=Symbol.for(`vercel.ai.gateway.error.${zX}`),z0=TJ(()=>TG(zU.object({modelId:zU.string()}))),z1=class extends(Q=zF,X=zQ,Q){constructor({message:e="Model not found",statusCode:t=404,modelId:r,cause:n,generationId:i}={}){super({message:e,statusCode:t,cause:n,generationId:i}),this[X]=!0,this.name=zX,this.type="model_not_found",this.modelId=r}static isInstance(e){return zF.hasMarker(e)&&zQ in e}},z2="GatewayInternalServerError",z4=Symbol.for(`vercel.ai.gateway.error.${z2}`),z6=class extends(et=zF,ee=z4,et){constructor({message:e="Internal server error",statusCode:t=500,cause:r,generationId:n}={}){super({message:e,statusCode:t,cause:r,generationId:n}),this[ee]=!0,this.name=z2,this.type="internal_server_error"}static isInstance(e){return zF.hasMarker(e)&&z4 in e}},z5="GatewayResponseError",z3=Symbol.for(`vercel.ai.gateway.error.${z5}`),z9=class extends(en=zF,er=z3,en){constructor({message:e="Invalid response from Gateway",statusCode:t=502,response:r,validationError:n,cause:i,generationId:a}={}){super({message:e,statusCode:t,cause:i,generationId:a}),this[er]=!0,this.name=z5,this.type="response_error",this.response=r,this.validationError=n}static isInstance(e){return zF.hasMarker(e)&&z3 in e}};async function z8({response:e,statusCode:t,defaultMessage:r="Gateway request failed",cause:n,authMethod:i}){var a;let o=await TX({value:e,schema:z7});if(!o.success){let i="object"==typeof e&&null!==e&&"generationId"in e?e.generationId:void 0;return new z9({message:`Invalid error response format: ${r}`,statusCode:t,response:e,validationError:o.error,cause:n,generationId:i})}let s=o.value,l=s.error.type,u=s.error.message,d=null!=(a=s.generationId)?a:void 0;switch(l){case"authentication_error":return zq.createContextualError({apiKeyProvided:"api-key"===i,oidcTokenProvided:"oidc"===i,statusCode:t,cause:n,generationId:d});case"invalid_request_error":return new zH({message:u,statusCode:t,cause:n,generationId:d});case"rate_limit_exceeded":return new zY({message:u,statusCode:t,cause:n,generationId:d});case"model_not_found":{let e=await TX({value:s.error.param,schema:z0});return new z1({message:u,statusCode:t,modelId:e.success?e.value.modelId:void 0,cause:n,generationId:d})}default:return new z6({message:u,statusCode:t,cause:n,generationId:d})}}var z7=TJ(()=>TG(zU.object({error:zU.object({message:zU.string(),type:zU.string().nullish(),param:zU.unknown().nullish(),code:zU.union([zU.string(),zU.number()]).nullish()}),generationId:zU.string().nullish()}))),De="GatewayTimeoutError",Dt=Symbol.for(`vercel.ai.gateway.error.${De}`),Dr=class e extends(ea=zF,ei=Dt,ea){constructor({message:e="Request timed out",statusCode:t=408,cause:r,generationId:n}={}){super({message:e,statusCode:t,cause:r,generationId:n}),this[ei]=!0,this.name=De,this.type="timeout_error"}static isInstance(e){return zF.hasMarker(e)&&Dt in e}static createTimeoutError({originalMessage:t,statusCode:r=408,cause:n,generationId:i}){return new e({message:`Gateway request timed out: ${t}
|
|
99
|
+
|
|
100
|
+
This is a client-side timeout. To resolve this, increase your timeout configuration: https://vercel.com/docs/ai-gateway/capabilities/video-generation#extending-timeouts-for-node.js`,statusCode:r,cause:n,generationId:i})}};function Dn(e){if(!(e instanceof Error))return!1;let t=e.code;return"string"==typeof t&&["UND_ERR_HEADERS_TIMEOUT","UND_ERR_BODY_TIMEOUT","UND_ERR_CONNECT_TIMEOUT"].includes(t)}async function Di(e,t){var r;return zF.isInstance(e)?e:Dn(e)?Dr.createTimeoutError({originalMessage:e instanceof Error?e.message:"Unknown error",cause:e}):Sr.isInstance(e)?e.cause&&Dn(e.cause)?Dr.createTimeoutError({originalMessage:e.message,cause:e}):await z8({response:function(e){if(void 0!==e.data)return e.data;if(null!=e.responseBody)try{return JSON.parse(e.responseBody)}catch(t){return e.responseBody}return{}}(e),statusCode:null!=(r=e.statusCode)?r:500,defaultMessage:"Gateway request failed",cause:e,authMethod:t}):await z8({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:"Unknown Gateway error",cause:e,authMethod:t})}var Da="ai-gateway-auth-method";async function Do(e){let t=await TX({value:e[Da],schema:Ds});return t.success?t.value:void 0}var Ds=TJ(()=>TG(zU.union([zU.literal("api-key"),zU.literal("oidc")]))),Dl=["embedding","image","language","reranking","video"],Du=class{constructor(e){this.config=e}async getAvailableModels(){try{let{value:e}=await Tp({url:`${this.config.baseURL}/config`,headers:await T3(this.config.headers()),successfulResponseHandler:T8(Dd),failedResponseHandler:T9({errorSchema:zU.any(),errorToMessage:e=>e}),fetch:this.config.fetch});return e}catch(e){throw await Di(e)}}async getCredits(){try{let e=new URL(this.config.baseURL),{value:t}=await Tp({url:`${e.origin}/v1/credits`,headers:await T3(this.config.headers()),successfulResponseHandler:T8(Dc),failedResponseHandler:T9({errorSchema:zU.any(),errorToMessage:e=>e}),fetch:this.config.fetch});return t}catch(e){throw await Di(e)}}},Dd=TJ(()=>TG(zU.object({models:zU.array(zU.object({id:zU.string(),name:zU.string(),description:zU.string().nullish(),pricing:zU.object({input:zU.string(),output:zU.string(),input_cache_read:zU.string().nullish(),input_cache_write:zU.string().nullish()}).transform(({input:e,output:t,input_cache_read:r,input_cache_write:n})=>({input:e,output:t,...r?{cachedInputTokens:r}:{},...n?{cacheCreationInputTokens:n}:{}})).nullish(),specification:zU.object({specificationVersion:zU.literal("v3"),provider:zU.string(),modelId:zU.string()}),modelType:zU.string().nullish()})).transform(e=>e.filter(e=>null==e.modelType||Dl.includes(e.modelType)))}))),Dc=TJ(()=>TG(zU.object({balance:zU.string(),total_used:zU.string()}).transform(({balance:e,total_used:t})=>({balance:e,totalUsed:t})))),Dp=class{constructor(e){this.config=e}async getSpendReport(e){try{let t=new URL(this.config.baseURL),r=new URLSearchParams;r.set("start_date",e.startDate),r.set("end_date",e.endDate),e.groupBy&&r.set("group_by",e.groupBy),e.datePart&&r.set("date_part",e.datePart),e.userId&&r.set("user_id",e.userId),e.model&&r.set("model",e.model),e.provider&&r.set("provider",e.provider),e.credentialType&&r.set("credential_type",e.credentialType),e.tags&&e.tags.length>0&&r.set("tags",e.tags.join(","));let{value:n}=await Tp({url:`${t.origin}/v1/report?${r.toString()}`,headers:await T3(this.config.headers()),successfulResponseHandler:T8(Dm),failedResponseHandler:T9({errorSchema:zU.any(),errorToMessage:e=>e}),fetch:this.config.fetch});return n}catch(e){throw await Di(e)}}},Dm=TJ(()=>TG(zU.object({results:zU.array(zU.object({day:zU.string().optional(),hour:zU.string().optional(),user:zU.string().optional(),model:zU.string().optional(),tag:zU.string().optional(),provider:zU.string().optional(),credential_type:zU.enum(["byok","system"]).optional(),total_cost:zU.number(),market_cost:zU.number().optional(),input_tokens:zU.number().optional(),output_tokens:zU.number().optional(),cached_input_tokens:zU.number().optional(),cache_creation_input_tokens:zU.number().optional(),reasoning_tokens:zU.number().optional(),request_count:zU.number().optional()}).transform(({credential_type:e,total_cost:t,market_cost:r,input_tokens:n,output_tokens:i,cached_input_tokens:a,cache_creation_input_tokens:o,reasoning_tokens:s,request_count:l,...u})=>({...u,...void 0!==e?{credentialType:e}:{},totalCost:t,...void 0!==r?{marketCost:r}:{},...void 0!==n?{inputTokens:n}:{},...void 0!==i?{outputTokens:i}:{},...void 0!==a?{cachedInputTokens:a}:{},...void 0!==o?{cacheCreationInputTokens:o}:{},...void 0!==s?{reasoningTokens:s}:{},...void 0!==l?{requestCount:l}:{}})))}))),Df=class{constructor(e){this.config=e}async getGenerationInfo(e){try{let t=new URL(this.config.baseURL),{value:r}=await Tp({url:`${t.origin}/v1/generation?id=${encodeURIComponent(e.id)}`,headers:await T3(this.config.headers()),successfulResponseHandler:T8(Dh),failedResponseHandler:T9({errorSchema:zU.any(),errorToMessage:e=>e}),fetch:this.config.fetch});return r}catch(e){throw await Di(e)}}},Dh=TJ(()=>TG(zU.object({data:zU.object({id:zU.string(),total_cost:zU.number(),upstream_inference_cost:zU.number(),usage:zU.number(),created_at:zU.string(),model:zU.string(),is_byok:zU.boolean(),provider_name:zU.string(),streamed:zU.boolean(),finish_reason:zU.string(),latency:zU.number(),generation_time:zU.number(),native_tokens_prompt:zU.number(),native_tokens_completion:zU.number(),native_tokens_reasoning:zU.number(),native_tokens_cached:zU.number(),native_tokens_cache_creation:zU.number(),billable_web_search_calls:zU.number()}).transform(({total_cost:e,upstream_inference_cost:t,created_at:r,is_byok:n,provider_name:i,finish_reason:a,generation_time:o,native_tokens_prompt:s,native_tokens_completion:l,native_tokens_reasoning:u,native_tokens_cached:d,native_tokens_cache_creation:c,billable_web_search_calls:p,...m})=>({...m,totalCost:e,upstreamInferenceCost:t,createdAt:r,isByok:n,providerName:i,finishReason:a,generationTime:o,promptTokens:s,completionTokens:l,reasoningTokens:u,cachedTokens:d,cacheCreationTokens:c,billableWebSearchCalls:p}))}).transform(({data:e})=>e))),Dg=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3",this.supportedUrls={"*/*":[/.*/]}}get provider(){return this.config.provider}async getArgs(e){let{abortSignal:t,...r}=e;return{args:this.maybeEncodeFileParts(r),warnings:[]}}async doGenerate(e){let{args:t,warnings:r}=await this.getArgs(e),{abortSignal:n}=e,i=await T3(this.config.headers());try{let{responseHeaders:a,value:o,rawValue:s}=await T4({url:this.getUrl(),headers:EX(i,e.headers,this.getModelConfigHeaders(this.modelId,!1),await T3(this.config.o11yHeaders)),body:t,successfulResponseHandler:T8(zU.any()),failedResponseHandler:T9({errorSchema:zU.any(),errorToMessage:e=>e}),...n&&{abortSignal:n},fetch:this.config.fetch});return{...o,request:{body:t},response:{headers:a,body:s},warnings:r}}catch(e){throw await Di(e,await Do(i))}}async doStream(e){let{args:t,warnings:r}=await this.getArgs(e),{abortSignal:n}=e,i=await T3(this.config.headers());try{let a,{value:o,responseHeaders:s}=await T4({url:this.getUrl(),headers:EX(i,e.headers,this.getModelConfigHeaders(this.modelId,!0),await T3(this.config.o11yHeaders)),body:t,successfulResponseHandler:(a=zU.any(),async({response:e})=>{let t=EQ(e);if(null==e.body)throw new So({});return{responseHeaders:t,value:T1({stream:e.body,schema:a})}}),failedResponseHandler:T9({errorSchema:zU.any(),errorToMessage:e=>e}),...n&&{abortSignal:n},fetch:this.config.fetch});return{stream:o.pipeThrough(new TransformStream({start(e){r.length>0&&e.enqueue({type:"stream-start",warnings:r})},transform(t,r){if(t.success){let n=t.value;("raw"!==n.type||e.includeRawChunks)&&("response-metadata"===n.type&&n.timestamp&&"string"==typeof n.timestamp&&(n.timestamp=new Date(n.timestamp)),r.enqueue(n))}else r.error(t.error)}})),request:{body:t},response:{headers:s}}}catch(e){throw await Di(e,await Do(i))}}isFilePart(e){return e&&"object"==typeof e&&"type"in e&&"file"===e.type}maybeEncodeFileParts(e){for(let t of e.prompt)for(let e of t.content)if(this.isFilePart(e)&&e.data instanceof Uint8Array){let t=Uint8Array.from(e.data),r=I5.Buffer.from(t).toString("base64");e.data=new URL(`data:${e.mediaType||"application/octet-stream"};base64,${r}`)}return e}getUrl(){return`${this.config.baseURL}/language-model`}getModelConfigHeaders(e,t){return{"ai-language-model-specification-version":"3","ai-language-model-id":e,"ai-language-model-streaming":String(t)}}},Dv=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0}get provider(){return this.config.provider}async doEmbed({values:e,headers:t,abortSignal:r,providerOptions:n}){var i;let a=await T3(this.config.headers());try{let{responseHeaders:o,value:s,rawValue:l}=await T4({url:this.getUrl(),headers:EX(a,null!=t?t:{},this.getModelConfigHeaders(),await T3(this.config.o11yHeaders)),body:{values:e,...n?{providerOptions:n}:{}},successfulResponseHandler:T8(Dy),failedResponseHandler:T9({errorSchema:zU.any(),errorToMessage:e=>e}),...r&&{abortSignal:r},fetch:this.config.fetch});return{embeddings:s.embeddings,usage:null!=(i=s.usage)?i:void 0,providerMetadata:s.providerMetadata,response:{headers:o,body:l},warnings:[]}}catch(e){throw await Di(e,await Do(a))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":"3","ai-model-id":this.modelId}}},Dy=TJ(()=>TG(zU.object({embeddings:zU.array(zU.array(zU.number())),usage:zU.object({tokens:zU.number()}).nullish(),providerMetadata:zU.record(zU.string(),zU.record(zU.string(),zU.unknown())).optional()}))),Db=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3",this.maxImagesPerCall=Number.MAX_SAFE_INTEGER}get provider(){return this.config.provider}async doGenerate({prompt:e,n:t,size:r,aspectRatio:n,seed:i,files:a,mask:o,providerOptions:s,headers:l,abortSignal:u}){var d,c,p,m;let f=await T3(this.config.headers());try{let{responseHeaders:h,value:g,rawValue:v}=await T4({url:this.getUrl(),headers:EX(f,null!=l?l:{},this.getModelConfigHeaders(),await T3(this.config.o11yHeaders)),body:{prompt:e,n:t,...r&&{size:r},...n&&{aspectRatio:n},...i&&{seed:i},...s&&{providerOptions:s},...a&&{files:a.map(e=>Dx(e))},...o&&{mask:Dx(o)}},successfulResponseHandler:T8(DI),failedResponseHandler:T9({errorSchema:zU.any(),errorToMessage:e=>e}),...u&&{abortSignal:u},fetch:this.config.fetch});return{images:g.images,warnings:null!=(d=g.warnings)?d:[],providerMetadata:g.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:h},...null!=g.usage&&{usage:{inputTokens:null!=(c=g.usage.inputTokens)?c:void 0,outputTokens:null!=(p=g.usage.outputTokens)?p:void 0,totalTokens:null!=(m=g.usage.totalTokens)?m:void 0}}}}catch(e){throw await Di(e,await Do(f))}}getUrl(){return`${this.config.baseURL}/image-model`}getModelConfigHeaders(){return{"ai-image-model-specification-version":"3","ai-model-id":this.modelId}}};function Dx(e){return"file"===e.type&&e.data instanceof Uint8Array?{...e,data:E2(e.data)}:e}var Dw=zU.object({images:zU.array(zU.unknown()).optional()}).catchall(zU.unknown()),D_=zU.discriminatedUnion("type",[zU.object({type:zU.literal("unsupported"),feature:zU.string(),details:zU.string().optional()}),zU.object({type:zU.literal("compatibility"),feature:zU.string(),details:zU.string().optional()}),zU.object({type:zU.literal("other"),message:zU.string()})]),Dk=zU.object({inputTokens:zU.number().nullish(),outputTokens:zU.number().nullish(),totalTokens:zU.number().nullish()}),DI=zU.object({images:zU.array(zU.string()),warnings:zU.array(D_).optional(),providerMetadata:zU.record(zU.string(),Dw).optional(),usage:Dk.optional()}),DS=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3",this.maxVideosPerCall=Number.MAX_SAFE_INTEGER}get provider(){return this.config.provider}async doGenerate({prompt:e,n:t,aspectRatio:r,resolution:n,duration:i,fps:a,seed:o,image:s,providerOptions:l,headers:u,abortSignal:d}){var c,p;let m=await T3(this.config.headers());try{let{responseHeaders:f,value:h}=await T4({url:this.getUrl(),headers:EX(m,null!=u?u:{},this.getModelConfigHeaders(),await T3(this.config.o11yHeaders),{accept:"text/event-stream"}),body:{prompt:e,n:t,...r&&{aspectRatio:r},...n&&{resolution:n},...i&&{duration:i},...a&&{fps:a},...o&&{seed:o},...l&&{providerOptions:l},...s&&{image:(p=s,"file"===p.type&&p.data instanceof Uint8Array?{...p,data:E2(p.data)}:p)}},successfulResponseHandler:async({response:e,url:t,requestBodyValues:r})=>{if(null==e.body)throw new Sr({message:"SSE response body is empty",url:t,requestBodyValues:r,statusCode:e.status});let n=T1({stream:e.body,schema:DT}).getReader(),{done:i,value:a}=await n.read();if(n.releaseLock(),i||!a)throw new Sr({message:"SSE stream ended without a data event",url:t,requestBodyValues:r,statusCode:e.status});if(!a.success)throw new Sr({message:"Failed to parse video SSE event",cause:a.error,url:t,requestBodyValues:r,statusCode:e.status});let o=a.value;if("error"===o.type)throw new Sr({message:o.message,statusCode:o.statusCode,url:t,requestBodyValues:r,responseHeaders:Object.fromEntries([...e.headers]),responseBody:JSON.stringify(o),data:{error:{message:o.message,type:o.errorType,param:o.param}}});return{value:{videos:o.videos,warnings:o.warnings,providerMetadata:o.providerMetadata},responseHeaders:Object.fromEntries([...e.headers])}},failedResponseHandler:T9({errorSchema:zU.any(),errorToMessage:e=>e}),...d&&{abortSignal:d},fetch:this.config.fetch});return{videos:h.videos,warnings:null!=(c=h.warnings)?c:[],providerMetadata:h.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:f}}}catch(e){throw await Di(e,await Do(m))}}getUrl(){return`${this.config.baseURL}/video-model`}getModelConfigHeaders(){return{"ai-video-model-specification-version":"3","ai-model-id":this.modelId}}},D$=zU.object({videos:zU.array(zU.unknown()).optional()}).catchall(zU.unknown()),Dj=zU.union([zU.object({type:zU.literal("url"),url:zU.string(),mediaType:zU.string()}),zU.object({type:zU.literal("base64"),data:zU.string(),mediaType:zU.string()})]),DE=zU.discriminatedUnion("type",[zU.object({type:zU.literal("unsupported"),feature:zU.string(),details:zU.string().optional()}),zU.object({type:zU.literal("compatibility"),feature:zU.string(),details:zU.string().optional()}),zU.object({type:zU.literal("other"),message:zU.string()})]),DT=zU.discriminatedUnion("type",[zU.object({type:zU.literal("result"),videos:zU.array(Dj),warnings:zU.array(DE).optional(),providerMetadata:zU.record(zU.string(),D$).optional()}),zU.object({type:zU.literal("error"),message:zU.string(),errorType:zU.string(),statusCode:zU.number(),param:zU.unknown().nullable()})]),DC=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3"}get provider(){return this.config.provider}async doRerank({documents:e,query:t,topN:r,headers:n,abortSignal:i,providerOptions:a}){let o=await T3(this.config.headers());try{let{responseHeaders:s,value:l,rawValue:u}=await T4({url:this.getUrl(),headers:EX(o,null!=n?n:{},this.getModelConfigHeaders(),await T3(this.config.o11yHeaders)),body:{documents:e,query:t,...null!=r?{topN:r}:{},...a?{providerOptions:a}:{}},successfulResponseHandler:T8(DN),failedResponseHandler:T9({errorSchema:zU.any(),errorToMessage:e=>e}),...i&&{abortSignal:i},fetch:this.config.fetch});return{ranking:l.ranking,providerMetadata:l.providerMetadata,response:{headers:s,body:u},warnings:[]}}catch(e){throw await Di(e,await Do(o))}}getUrl(){return`${this.config.baseURL}/reranking-model`}getModelConfigHeaders(){return{"ai-reranking-model-specification-version":"3","ai-model-id":this.modelId}}},DN=TJ(()=>TG(zU.object({ranking:zU.array(zU.object({index:zU.number(),relevanceScore:zU.number()})),providerMetadata:zU.record(zU.string(),zU.record(zU.string(),zU.unknown())).optional()}))),DA=T5({id:"gateway.parallel_search",inputSchema:TJ(()=>TG(zU.object({objective:zU.string().describe("Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."),search_queries:zU.array(zU.string()).optional().describe("Optional search queries to supplement the objective. Maximum 200 characters per query."),mode:zU.enum(["one-shot","agentic"]).optional().describe('Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.'),max_results:zU.number().optional().describe("Maximum number of results to return (1-20). Defaults to 10 if not specified."),source_policy:zU.object({include_domains:zU.array(zU.string()).optional().describe("List of domains to include in search results."),exclude_domains:zU.array(zU.string()).optional().describe("List of domains to exclude from search results."),after_date:zU.string().optional().describe("Only include results published after this date (ISO 8601 format).")}).optional().describe("Source policy for controlling which domains to include/exclude and freshness."),excerpts:zU.object({max_chars_per_result:zU.number().optional().describe("Maximum characters per result."),max_chars_total:zU.number().optional().describe("Maximum total characters across all results.")}).optional().describe("Excerpt configuration for controlling result length."),fetch_policy:zU.object({max_age_seconds:zU.number().optional().describe("Maximum age in seconds for cached content. Set to 0 to always fetch fresh content.")}).optional().describe("Fetch policy for controlling content freshness.")}))),outputSchema:TJ(()=>TG(zU.union([zU.object({searchId:zU.string(),results:zU.array(zU.object({url:zU.string(),title:zU.string(),excerpt:zU.string(),publishDate:zU.string().nullable().optional(),relevanceScore:zU.number().optional()}))}),zU.object({error:zU.enum(["api_error","rate_limit","timeout","invalid_input","configuration_error","unknown"]),statusCode:zU.number().optional(),message:zU.string()})])))}),DR=T5({id:"gateway.perplexity_search",inputSchema:TJ(()=>TG(zU.object({query:zU.union([zU.string(),zU.array(zU.string())]).describe("Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."),max_results:zU.number().optional().describe("Maximum number of search results to return (1-20, default: 10)"),max_tokens_per_page:zU.number().optional().describe("Maximum number of tokens to extract per search result page (256-2048, default: 2048)"),max_tokens:zU.number().optional().describe("Maximum total tokens across all search results (default: 25000, max: 1000000)"),country:zU.string().optional().describe("Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"),search_domain_filter:zU.array(zU.string()).optional().describe("List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"),search_language_filter:zU.array(zU.string()).optional().describe("List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"),search_after_date:zU.string().optional().describe("Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),search_before_date:zU.string().optional().describe("Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),last_updated_after_filter:zU.string().optional().describe("Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),last_updated_before_filter:zU.string().optional().describe("Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),search_recency_filter:zU.enum(["day","week","month","year"]).optional().describe("Filter results by relative time period. Cannot be used with search_after_date or search_before_date.")}))),outputSchema:TJ(()=>TG(zU.union([zU.object({results:zU.array(zU.object({title:zU.string(),url:zU.string(),snippet:zU.string(),date:zU.string().optional(),lastUpdated:zU.string().optional()})),id:zU.string()}),zU.object({error:zU.enum(["api_error","rate_limit","timeout","invalid_input","unknown"]),statusCode:zU.number().optional(),message:zU.string()})])))}),DP={parallelSearch:(e={})=>DA(e),perplexitySearch:(e={})=>DR(e)};async function DO(){var e;return null==(e=(0,zL.getContext)().headers)?void 0:e["x-vercel-id"]}async function DM(e){let t=Tm({settingValue:e.apiKey,environmentVariableName:"AI_GATEWAY_API_KEY"});return t?{token:t,authMethod:"api-key"}:{token:await (0,zL.getVercelOidcToken)(),authMethod:"oidc"}}!function(e={}){var t,r,n;let i=null,a=null,o=null!=(t=e.metadataCacheRefreshMillis)?t:3e5,s=0,l=null!=(r=null==(n=e.baseURL)?void 0:n.replace(/\/$/,""))?r:"https://ai-gateway.vercel.sh/v3/ai",u=async()=>{try{let t=await DM(e);return Tu({Authorization:`Bearer ${t.token}`,"ai-gateway-protocol-version":"0.0.1",[Da]:t.authMethod,...e.headers},"ai-sdk/gateway/3.0.120")}catch(e){throw zq.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},d=()=>{let e=Tm({settingValue:void 0,environmentVariableName:"VERCEL_DEPLOYMENT_ID"}),t=Tm({settingValue:void 0,environmentVariableName:"VERCEL_ENV"}),r=Tm({settingValue:void 0,environmentVariableName:"VERCEL_REGION"}),n=Tm({settingValue:void 0,environmentVariableName:"VERCEL_PROJECT_ID"});return async()=>{let i=await DO();return{...e&&{"ai-o11y-deployment-id":e},...t&&{"ai-o11y-environment":t},...r&&{"ai-o11y-region":r},...i&&{"ai-o11y-request-id":i},...n&&{"ai-o11y-project-id":n}}}},c=t=>new Dg(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:d()}),p=async()=>{var t,r,n;let d=null!=(n=null==(r=null==(t=e._internal)?void 0:t.currentDate)?void 0:r.call(t).getTime())?n:Date.now();return(!i||d-s>o)&&(s=d,i=new Du({baseURL:l,headers:u,fetch:e.fetch}).getAvailableModels().then(e=>(a=e,e)).catch(async e=>{throw await Di(e,await Do(await u()))})),a?Promise.resolve(a):i},m=async()=>new Du({baseURL:l,headers:u,fetch:e.fetch}).getCredits().catch(async e=>{throw await Di(e,await Do(await u()))}),f=async t=>new Dp({baseURL:l,headers:u,fetch:e.fetch}).getSpendReport(t).catch(async e=>{throw await Di(e,await Do(await u()))}),h=async t=>new Df({baseURL:l,headers:u,fetch:e.fetch}).getGenerationInfo(t).catch(async e=>{throw await Di(e,await Do(await u()))}),g=function(e){if(new.target)throw Error("The Gateway Provider model function cannot be called with the new keyword.");return c(e)};g.specificationVersion="v3",g.getAvailableModels=p,g.getCredits=m,g.getSpendReport=f,g.getGenerationInfo=h,g.imageModel=t=>new Db(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:d()}),g.languageModel=c;let v=t=>new Dv(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:d()});g.embeddingModel=v,g.textEmbeddingModel=v,g.videoModel=t=>new DS(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:d()});let y=t=>new DC(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:d()});g.rerankingModel=y,g.reranking=y,g.chat=g.languageModel,g.embedding=g.embeddingModel,g.image=g.imageModel,g.video=g.videoModel,g.tools=DP}();var zU=zU;let Dz="1.9.1",DD=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,DU=function(e){let t=new Set([e]),r=new Set,n=e.match(DD);if(!n)return()=>!1;let i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(null!=i.prerelease)return function(t){return t===e};function a(e){return r.add(e),!1}return function(e){if(t.has(e))return!0;if(r.has(e))return!1;let n=e.match(DD);if(!n)return a(e);let o={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(null!=o.prerelease||i.major!==o.major)return a(e);if(0===i.major)return i.minor===o.minor&&i.patch<=o.patch?(t.add(e),!0):a(e);return i.minor<=o.minor?(t.add(e),!0):a(e)}}(Dz),DL=Dz.split(".")[0],DZ=Symbol.for(`opentelemetry.js.api.${DL}`),DF="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:e.g;function DB(e,t,r,n=!1){var i;let a=DF[DZ]=null!=(i=DF[DZ])?i:{version:Dz};if(!n&&a[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(t.stack||t.message),!1}if(a.version!==Dz){let t=Error(`@opentelemetry/api: Registration of version v${a.version} for ${e} does not match previously registered API v${Dz}`);return r.error(t.stack||t.message),!1}return a[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${Dz}.`),!0}function DV(e){var t,r;let n=null==(t=DF[DZ])?void 0:t.version;if(n&&DU(n))return null==(r=DF[DZ])?void 0:r[e]}function Dq(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Dz}.`);let r=DF[DZ];r&&delete r[e]}class DW{constructor(e){const t=this;t._currentContext=e?new Map(e):new Map,t.getValue=e=>t._currentContext.get(e),t.setValue=(e,r)=>{let n=new DW(t._currentContext);return n._currentContext.set(e,r),n},t.deleteValue=e=>{let r=new DW(t._currentContext);return r._currentContext.delete(e),r}}}let DJ=new DW;class DH{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return DK("debug",this._namespace,e)}error(...e){return DK("error",this._namespace,e)}info(...e){return DK("info",this._namespace,e)}warn(...e){return DK("warn",this._namespace,e)}verbose(...e){return DK("verbose",this._namespace,e)}}function DK(e,t,r){let n=DV("diag");if(n)return n[e](t,...r)}(v=eo||(eo={}))[v.NONE=0]="NONE",v[v.ERROR=30]="ERROR",v[v.WARN=50]="WARN",v[v.INFO=60]="INFO",v[v.DEBUG=70]="DEBUG",v[v.VERBOSE=80]="VERBOSE",v[v.ALL=9999]="ALL";class DG{static instance(){return this._instance||(this._instance=new DG),this._instance}constructor(){function e(e){return function(...t){let r=DV("diag");if(r)return r[e](...t)}}const t=this,r=(e,r={logLevel:eo.INFO})=>{var n,i,a;if(e===t){let e=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error(null!=(n=e.stack)?n:e.message),!1}"number"==typeof r&&(r={logLevel:r});let o=DV("diag"),s=function(e,t){function r(r,n){let i=t[r];return"function"==typeof i&&e>=n?i.bind(t):function(){}}return e<eo.NONE?e=eo.NONE:e>eo.ALL&&(e=eo.ALL),t=t||{},{error:r("error",eo.ERROR),warn:r("warn",eo.WARN),info:r("info",eo.INFO),debug:r("debug",eo.DEBUG),verbose:r("verbose",eo.VERBOSE)}}(null!=(i=r.logLevel)?i:eo.INFO,e);if(o&&!r.suppressOverrideMessage){let e=null!=(a=Error().stack)?a:"<failed to generate stacktrace>";o.warn(`Current logger will be overwritten from ${e}`),s.warn(`Current logger will overwrite one already registered from ${e}`)}return DB("diag",s,t,!0)};t.setLogger=r,t.disable=()=>{Dq("diag",t)},t.createComponentLogger=e=>new DH(e),t.verbose=e("verbose"),t.debug=e("debug"),t.info=e("info"),t.warn=e("warn"),t.error=e("error")}}let DY="context",DX=new class{active(){return DJ}with(e,t,r,...n){return t.call(r,...n)}bind(e,t){return t}enable(){return this}disable(){return this}};class DQ{static getInstance(){return this._instance||(this._instance=new DQ),this._instance}setGlobalContextManager(e){return DB(DY,e,DG.instance())}active(){return this._getContextManager().active()}with(e,t,r,...n){return this._getContextManager().with(e,t,r,...n)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return DV(DY)||DX}disable(){this._getContextManager().disable(),Dq(DY,DG.instance())}}(y=es||(es={}))[y.NONE=0]="NONE",y[y.SAMPLED=1]="SAMPLED";let D0="0000000000000000",D1="00000000000000000000000000000000",D2={traceId:D1,spanId:D0,traceFlags:es.NONE};class D4{constructor(e=D2){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}let D6=Symbol.for("OpenTelemetry Context Key SPAN");function D5(e){return e.getValue(D6)||void 0}function D3(){return D5(DQ.getInstance().active())}function D9(e,t){return e.setValue(D6,t)}function D8(e){return e.deleteValue(D6)}function D7(e,t){return D9(e,new D4(t))}function Ue(e){var t;return null==(t=D5(e))?void 0:t.spanContext()}let Ut=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function Ur(e,t){if("string"!=typeof e||e.length!==t)return!1;let r=0;for(let t=0;t<e.length;t+=4)r+=(0|Ut[e.charCodeAt(t)])+(0|Ut[e.charCodeAt(t+1)])+(0|Ut[e.charCodeAt(t+2)])+(0|Ut[e.charCodeAt(t+3)]);return r===t}function Un(e){var t,r;return Ur(t=e.traceId,32)&&t!==D1&&Ur(r=e.spanId,16)&&r!==D0}function Ui(e){return new D4(e)}let Ua=DQ.getInstance();class Uo{startSpan(e,t,r=Ua.active()){var n;if(null==t?void 0:t.root)return new D4;let i=r&&Ue(r);return null!==(n=i)&&"object"==typeof n&&"spanId"in n&&"string"==typeof n.spanId&&"traceId"in n&&"string"==typeof n.traceId&&"traceFlags"in n&&"number"==typeof n.traceFlags&&Un(i)?new D4(i):new D4}startActiveSpan(e,t,r,n){let i,a,o;if(arguments.length<2)return;2==arguments.length?o=t:3==arguments.length?(i=t,o=r):(i=t,a=r,o=n);let s=null!=a?a:Ua.active(),l=this.startSpan(e,i,s),u=D9(s,l);return Ua.with(u,o,void 0,l)}}let Us=new Uo;class Ul{constructor(e,t,r,n){this._provider=e,this.name=t,this.version=r,this.options=n}startSpan(e,t,r){return this._getTracer().startSpan(e,t,r)}startActiveSpan(e,t,r,n){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Us}}let Uu=new class{getTracer(e,t,r){return new Uo}};class Ud{getTracer(e,t,r){var n;return null!=(n=this.getDelegateTracer(e,t,r))?n:new Ul(this,e,t,r)}getDelegate(){var e;return null!=(e=this._delegate)?e:Uu}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,r){var n;return null==(n=this._delegate)?void 0:n.getTracer(e,t,r)}}let Uc="trace";class Up{constructor(){this._proxyTracerProvider=new Ud,this.wrapSpanContext=Ui,this.isSpanContextValid=Un,this.deleteSpan=D8,this.getSpan=D5,this.getActiveSpan=D3,this.getSpanContext=Ue,this.setSpan=D9,this.setSpanContext=D7}static getInstance(){return this._instance||(this._instance=new Up),this._instance}setGlobalTracerProvider(e){let t=DB(Uc,this._proxyTracerProvider,DG.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return DV(Uc)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){Dq(Uc,DG.instance()),this._proxyTracerProvider=new Ud}}Up.getInstance(),(b=el||(el={}))[b.UNSET=0]="UNSET",b[b.OK=1]="OK",b[b.ERROR=2]="ERROR",DQ.getInstance();var Um=Object.defineProperty,Uf=(Symbol.for("vercel.ai.error.AI_InvalidArgumentError"),Symbol.for("vercel.ai.error.AI_InvalidStreamPartError"),Symbol.for("vercel.ai.error.AI_InvalidToolApprovalError"),Symbol.for("vercel.ai.error.AI_InvalidToolInputError"),Symbol.for("vercel.ai.error.AI_ToolCallNotFoundForApprovalError"),Symbol.for("vercel.ai.error.AI_MissingToolResultsError"),Symbol.for("vercel.ai.error.AI_NoImageGeneratedError"),"AI_NoObjectGeneratedError"),Uh=`vercel.ai.error.${Uf}`,Ug=Symbol.for(Uh),Uv=class extends I8{constructor({message:e="No object generated.",cause:t,text:r,response:n,usage:i,finishReason:a}){super({name:Uf,message:e,cause:t}),this[eu]=!0,this.text=r,this.response=n,this.usage=i,this.finishReason=a}static isInstance(e){return I8.hasMarker(e,Uh)}};eu=Ug,Symbol.for("vercel.ai.error.AI_NoOutputGeneratedError"),Symbol.for("vercel.ai.error.AI_NoSpeechGeneratedError"),Symbol.for("vercel.ai.error.AI_NoTranscriptGeneratedError"),Symbol.for("vercel.ai.error.AI_NoVideoGeneratedError"),Symbol.for("vercel.ai.error.AI_NoSuchToolError"),Symbol.for("vercel.ai.error.AI_ToolCallRepairError");var Uy="AI_UIMessageStreamError",Ub=`vercel.ai.error.${Uy}`,Ux=Symbol.for(Ub),Uw=class extends I8{constructor({chunkType:e,chunkId:t,message:r}){super({name:Uy,message:r}),this[ed]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return I8.hasMarker(e,Ub)}};ed=Ux,Symbol.for("vercel.ai.error.AI_InvalidDataContentError"),Symbol.for("vercel.ai.error.AI_InvalidMessageRoleError"),Symbol.for("vercel.ai.error.AI_MessageConversionError"),Symbol.for("vercel.ai.error.AI_RetryError");var U_=async({url:e,maxBytes:t,abortSignal:r})=>{var n;let i=e.toString();E8(i);try{let e=await fetch(i,{headers:Tu({},"ai-sdk/6.0.191",Ts()),signal:r});if(e.redirected&&E8(e.url),!e.ok)throw new E3({url:i,statusCode:e.status,statusText:e.statusText});return{data:await E9({response:e,url:i,maxBytes:null!=t?t:0x80000000}),mediaType:null!=(n=e.headers.get("content-type"))?n:void 0}}catch(e){if(E3.isInstance(e))throw e;throw new E3({url:i,cause:e})}},Uk=zU.union([zU.string(),zU.instanceof(Uint8Array),zU.instanceof(ArrayBuffer),zU.custom(e=>{var t,r;return null!=(r=null==(t=globalThis.Buffer)?void 0:t.isBuffer(e))&&r},{message:"Must be a Buffer"})]),UI=zU.lazy(()=>zU.union([zU.null(),zU.string(),zU.number(),zU.boolean(),zU.record(zU.string(),UI.optional()),zU.array(UI)])),US=zU.record(zU.string(),zU.record(zU.string(),UI.optional())),U$=zU.object({type:zU.literal("text"),text:zU.string(),providerOptions:US.optional()}),Uj=zU.object({type:zU.literal("image"),image:zU.union([Uk,zU.instanceof(URL)]),mediaType:zU.string().optional(),providerOptions:US.optional()}),UE=zU.object({type:zU.literal("file"),data:zU.union([Uk,zU.instanceof(URL)]),filename:zU.string().optional(),mediaType:zU.string(),providerOptions:US.optional()}),UT=zU.object({type:zU.literal("reasoning"),text:zU.string(),providerOptions:US.optional()}),UC=zU.object({type:zU.literal("tool-call"),toolCallId:zU.string(),toolName:zU.string(),input:zU.unknown(),providerOptions:US.optional(),providerExecuted:zU.boolean().optional()}),UN=zU.discriminatedUnion("type",[zU.object({type:zU.literal("text"),value:zU.string(),providerOptions:US.optional()}),zU.object({type:zU.literal("json"),value:UI,providerOptions:US.optional()}),zU.object({type:zU.literal("execution-denied"),reason:zU.string().optional(),providerOptions:US.optional()}),zU.object({type:zU.literal("error-text"),value:zU.string(),providerOptions:US.optional()}),zU.object({type:zU.literal("error-json"),value:UI,providerOptions:US.optional()}),zU.object({type:zU.literal("content"),value:zU.array(zU.union([zU.object({type:zU.literal("text"),text:zU.string(),providerOptions:US.optional()}),zU.object({type:zU.literal("media"),data:zU.string(),mediaType:zU.string()}),zU.object({type:zU.literal("file-data"),data:zU.string(),mediaType:zU.string(),filename:zU.string().optional(),providerOptions:US.optional()}),zU.object({type:zU.literal("file-url"),url:zU.string(),providerOptions:US.optional()}),zU.object({type:zU.literal("file-id"),fileId:zU.union([zU.string(),zU.record(zU.string(),zU.string())]),providerOptions:US.optional()}),zU.object({type:zU.literal("image-data"),data:zU.string(),mediaType:zU.string(),providerOptions:US.optional()}),zU.object({type:zU.literal("image-url"),url:zU.string(),providerOptions:US.optional()}),zU.object({type:zU.literal("image-file-id"),fileId:zU.union([zU.string(),zU.record(zU.string(),zU.string())]),providerOptions:US.optional()}),zU.object({type:zU.literal("custom"),providerOptions:US.optional()})]))})]),UA=zU.object({type:zU.literal("tool-result"),toolCallId:zU.string(),toolName:zU.string(),output:UN,providerOptions:US.optional()}),UR=zU.object({type:zU.literal("tool-approval-request"),approvalId:zU.string(),toolCallId:zU.string()}),UP=zU.object({type:zU.literal("tool-approval-response"),approvalId:zU.string(),approved:zU.boolean(),reason:zU.string().optional()}),UO=zU.object({role:zU.literal("system"),content:zU.string(),providerOptions:US.optional()}),UM=zU.object({role:zU.literal("user"),content:zU.union([zU.string(),zU.array(zU.union([U$,Uj,UE]))]),providerOptions:US.optional()}),Uz=zU.object({role:zU.literal("assistant"),content:zU.union([zU.string(),zU.array(zU.union([U$,UE,UT,UC,UA,UR]))]),providerOptions:US.optional()}),UD=zU.object({role:zU.literal("tool"),content:zU.array(zU.union([UA,UP])),providerOptions:US.optional()});zU.union([UO,UM,Uz,UD]);var UU={},UL={array:()=>Uq,choice:()=>UW,json:()=>UJ,object:()=>UV,text:()=>UB};for(var UZ in UL)Um(UU,UZ,{get:UL[UZ],enumerable:!0});async function UF(e){if(void 0===e)return{value:void 0,state:"undefined-input"};let t=await T0({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await T0({text:function(e){let t=["ROOT"],r=-1,n=null;function i(e,i,a){switch(e){case'"':r=i,t.pop(),t.push(a),t.push("INSIDE_STRING");break;case"f":case"t":case"n":r=i,n=i,t.pop(),t.push(a),t.push("INSIDE_LITERAL");break;case"-":t.pop(),t.push(a),t.push("INSIDE_NUMBER");break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r=i,t.pop(),t.push(a),t.push("INSIDE_NUMBER");break;case"{":r=i,t.pop(),t.push(a),t.push("INSIDE_OBJECT_START");break;case"[":r=i,t.pop(),t.push(a),t.push("INSIDE_ARRAY_START")}}function a(e,n){switch(e){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":r=n,t.pop()}}function o(e,n){switch(e){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":r=n,t.pop()}}for(let s=0;s<e.length;s++){let l=e[s];switch(t[t.length-1]){case"ROOT":i(l,s,"FINISH");break;case"INSIDE_OBJECT_START":switch(l){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY");break;case"}":r=s,t.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":'"'===l&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break;case"INSIDE_OBJECT_KEY":'"'===l&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break;case"INSIDE_OBJECT_AFTER_KEY":":"===l&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":i(l,s,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":a(l,s);break;case"INSIDE_STRING":switch(l){case'"':t.pop(),r=s;break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:r=s}break;case"INSIDE_ARRAY_START":"]"===l?(r=s,t.pop()):(r=s,i(l,s,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(l){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":r=s,t.pop();break;default:r=s}break;case"INSIDE_ARRAY_AFTER_COMMA":i(l,s,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),r=s;break;case"INSIDE_NUMBER":switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r=s;break;case"e":case"E":case"-":case".":break;case",":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&o(l,s),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&a(l,s);break;case"}":t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&a(l,s);break;case"]":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&o(l,s);break;default:t.pop()}break;case"INSIDE_LITERAL":{let i=e.substring(n,s+1);"false".startsWith(i)||"true".startsWith(i)||"null".startsWith(i)?r=s:(t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]?a(l,s):"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&o(l,s))}}}let s=e.slice(0,r+1);for(let r=t.length-1;r>=0;r--)switch(t[r]){case"INSIDE_STRING":s+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":s+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":s+="]";break;case"INSIDE_LITERAL":{let t=e.substring(n,e.length);"true".startsWith(t)?s+="true".slice(t.length):"false".startsWith(t)?s+="false".slice(t.length):"null".startsWith(t)&&(s+="null".slice(t.length))}}return s}(e)})).success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"}}var UB=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),parseCompleteOutput:async({text:e})=>e,parsePartialOutput:async({text:e})=>({partial:e}),createElementStreamTransform(){}}),UV=({schema:e,name:t,description:r})=>{let n=TK(e);return{name:"object",responseFormat:T3(n.jsonSchema).then(e=>({type:"json",schema:e,...null!=t&&{name:t},...null!=r&&{description:r}})),async parseCompleteOutput({text:e},t){let r=await T0({text:e});if(!r.success)throw new Uv({message:"No object generated: could not parse the response.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=await TX({value:r.value,schema:n});if(!i.success)throw new Uv({message:"No object generated: response did not match schema.",cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return i.value},async parsePartialOutput({text:e}){let t=await UF(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:t.value}}},createElementStreamTransform(){}}},Uq=({element:e,name:t,description:r})=>{let n=TK(e);return{name:"array",responseFormat:T3(n.jsonSchema).then(e=>{let{$schema:n,...i}=e;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:i}},required:["elements"],additionalProperties:!1},...null!=t&&{name:t},...null!=r&&{description:r}}}),async parseCompleteOutput({text:e},t){let r=await T0({text:e});if(!r.success)throw new Uv({message:"No object generated: could not parse the response.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=r.value;if(null==i||"object"!=typeof i||!("elements"in i)||!Array.isArray(i.elements))throw new Uv({message:"No object generated: response did not match schema.",cause:new Sw({value:i,cause:"response must be an object with an elements array"}),text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});for(let r of i.elements){let i=await TX({value:r,schema:n});if(!i.success)throw new Uv({message:"No object generated: response did not match schema.",cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason})}return i.elements},async parsePartialOutput({text:e}){let t=await UF(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{let e=t.value;if(null==e||"object"!=typeof e||!("elements"in e)||!Array.isArray(e.elements))return;let r="repaired-parse"===t.state&&e.elements.length>0?e.elements.slice(0,-1):e.elements,i=[];for(let e of r){let t=await TX({value:e,schema:n});t.success&&i.push(t.value)}return{partial:i}}}},createElementStreamTransform(){let e=0;return new TransformStream({transform({partialOutput:t},r){if(null!=t)for(;e<t.length;e++)r.enqueue(t[e])}})}}},UW=({options:e,name:t,description:r})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...null!=t&&{name:t},...null!=r&&{description:r}}),async parseCompleteOutput({text:t},r){let n=await T0({text:t});if(!n.success)throw new Uv({message:"No object generated: could not parse the response.",cause:n.error,text:t,response:r.response,usage:r.usage,finishReason:r.finishReason});let i=n.value;if(null==i||"object"!=typeof i||!("result"in i)||"string"!=typeof i.result||!e.includes(i.result))throw new Uv({message:"No object generated: response did not match schema.",cause:new Sw({value:i,cause:"response must be an object that contains a choice value."}),text:t,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.result},async parsePartialOutput({text:t}){let r=await UF(t);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{let t=r.value;if(null==t||"object"!=typeof t||!("result"in t)||"string"!=typeof t.result)return;let n=e.filter(e=>e.startsWith(t.result));if("successful-parse"===r.state)return n.includes(t.result)?{partial:t.result}:void 0;return 1===n.length?{partial:n[0]}:void 0}}},createElementStreamTransform(){}}),UJ=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...null!=e&&{name:e},...null!=t&&{description:t}}),async parseCompleteOutput({text:e},t){let r=await T0({text:e});if(!r.success)throw new Uv({message:"No object generated: could not parse the response.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return r.value},async parsePartialOutput({text:e}){let t=await UF(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return void 0===t.value?void 0:{partial:t.value}}},createElementStreamTransform(){}});Tt({prefix:"aitxt",size:24}),TransformStream;var UH=zU.record(zU.string(),UI.optional()),UK=TJ(()=>TG(zU.union([zU.strictObject({type:zU.literal("text-start"),id:zU.string(),providerMetadata:US.optional()}),zU.strictObject({type:zU.literal("text-delta"),id:zU.string(),delta:zU.string(),providerMetadata:US.optional()}),zU.strictObject({type:zU.literal("text-end"),id:zU.string(),providerMetadata:US.optional()}),zU.strictObject({type:zU.literal("error"),errorText:zU.string()}),zU.strictObject({type:zU.literal("tool-input-start"),toolCallId:zU.string(),toolName:zU.string(),providerExecuted:zU.boolean().optional(),providerMetadata:US.optional(),toolMetadata:UH.optional(),dynamic:zU.boolean().optional(),title:zU.string().optional()}),zU.strictObject({type:zU.literal("tool-input-delta"),toolCallId:zU.string(),inputTextDelta:zU.string()}),zU.strictObject({type:zU.literal("tool-input-available"),toolCallId:zU.string(),toolName:zU.string(),input:zU.unknown(),providerExecuted:zU.boolean().optional(),providerMetadata:US.optional(),toolMetadata:UH.optional(),dynamic:zU.boolean().optional(),title:zU.string().optional()}),zU.strictObject({type:zU.literal("tool-input-error"),toolCallId:zU.string(),toolName:zU.string(),input:zU.unknown(),providerExecuted:zU.boolean().optional(),providerMetadata:US.optional(),toolMetadata:UH.optional(),dynamic:zU.boolean().optional(),errorText:zU.string(),title:zU.string().optional()}),zU.strictObject({type:zU.literal("tool-approval-request"),approvalId:zU.string(),toolCallId:zU.string()}),zU.strictObject({type:zU.literal("tool-output-available"),toolCallId:zU.string(),output:zU.unknown(),providerExecuted:zU.boolean().optional(),providerMetadata:US.optional(),toolMetadata:UH.optional(),dynamic:zU.boolean().optional(),preliminary:zU.boolean().optional()}),zU.strictObject({type:zU.literal("tool-output-error"),toolCallId:zU.string(),errorText:zU.string(),providerExecuted:zU.boolean().optional(),providerMetadata:US.optional(),toolMetadata:UH.optional(),dynamic:zU.boolean().optional()}),zU.strictObject({type:zU.literal("tool-output-denied"),toolCallId:zU.string()}),zU.strictObject({type:zU.literal("reasoning-start"),id:zU.string(),providerMetadata:US.optional()}),zU.strictObject({type:zU.literal("reasoning-delta"),id:zU.string(),delta:zU.string(),providerMetadata:US.optional()}),zU.strictObject({type:zU.literal("reasoning-end"),id:zU.string(),providerMetadata:US.optional()}),zU.strictObject({type:zU.literal("source-url"),sourceId:zU.string(),url:zU.string(),title:zU.string().optional(),providerMetadata:US.optional()}),zU.strictObject({type:zU.literal("source-document"),sourceId:zU.string(),mediaType:zU.string(),title:zU.string(),filename:zU.string().optional(),providerMetadata:US.optional()}),zU.strictObject({type:zU.literal("file"),url:zU.string(),mediaType:zU.string(),providerMetadata:US.optional()}),zU.strictObject({type:zU.custom(e=>"string"==typeof e&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:zU.string().optional(),data:zU.unknown(),transient:zU.boolean().optional()}),zU.strictObject({type:zU.literal("start-step")}),zU.strictObject({type:zU.literal("finish-step")}),zU.strictObject({type:zU.literal("start"),messageId:zU.string().optional(),messageMetadata:zU.unknown().optional()}),zU.strictObject({type:zU.literal("finish"),finishReason:zU.enum(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:zU.unknown().optional()}),zU.strictObject({type:zU.literal("abort"),reason:zU.string().optional()}),zU.strictObject({type:zU.literal("message-metadata"),messageMetadata:zU.unknown()})])));function UG(e){return e.type.startsWith("tool-")}function UY(e){return"dynamic-tool"===e.type}function UX(e){return UG(e)||UY(e)}function UQ(e){return e.type.split("-").slice(1).join("-")}async function U0({stream:e,onError:t}){let r=e.getReader();try{for(;;){let{done:e}=await r.read();if(e)break}}catch(e){null==t||t(e)}finally{r.releaseLock()}}Tt({prefix:"aitxt",size:24});var U1=zU.record(zU.string(),UI.optional());function U2(e){return({url:t,abortSignal:r})=>U_({url:t,maxBytes:null==e?void 0:e.maxBytes,abortSignal:r})}TJ(()=>TG(zU.array(zU.object({id:zU.string(),role:zU.enum(["system","user","assistant"]),metadata:zU.unknown().optional(),parts:zU.array(zU.union([zU.object({type:zU.literal("text"),text:zU.string(),state:zU.enum(["streaming","done"]).optional(),providerMetadata:US.optional()}),zU.object({type:zU.literal("reasoning"),text:zU.string(),state:zU.enum(["streaming","done"]).optional(),providerMetadata:US.optional()}),zU.object({type:zU.literal("source-url"),sourceId:zU.string(),url:zU.string(),title:zU.string().optional(),providerMetadata:US.optional()}),zU.object({type:zU.literal("source-document"),sourceId:zU.string(),mediaType:zU.string(),title:zU.string(),filename:zU.string().optional(),providerMetadata:US.optional()}),zU.object({type:zU.literal("file"),mediaType:zU.string(),filename:zU.string().optional(),url:zU.string(),providerMetadata:US.optional()}),zU.object({type:zU.literal("step-start")}),zU.object({type:zU.string().startsWith("data-"),id:zU.string().optional(),data:zU.unknown()}),zU.object({type:zU.literal("dynamic-tool"),toolName:zU.string(),toolCallId:zU.string(),toolMetadata:U1.optional(),state:zU.literal("input-streaming"),input:zU.unknown().optional(),providerExecuted:zU.boolean().optional(),callProviderMetadata:US.optional(),output:zU.never().optional(),errorText:zU.never().optional(),approval:zU.never().optional()}),zU.object({type:zU.literal("dynamic-tool"),toolName:zU.string(),toolCallId:zU.string(),toolMetadata:U1.optional(),state:zU.literal("input-available"),input:zU.unknown(),providerExecuted:zU.boolean().optional(),output:zU.never().optional(),errorText:zU.never().optional(),callProviderMetadata:US.optional(),approval:zU.never().optional()}),zU.object({type:zU.literal("dynamic-tool"),toolName:zU.string(),toolCallId:zU.string(),toolMetadata:U1.optional(),state:zU.literal("approval-requested"),input:zU.unknown(),providerExecuted:zU.boolean().optional(),output:zU.never().optional(),errorText:zU.never().optional(),callProviderMetadata:US.optional(),approval:zU.object({id:zU.string(),approved:zU.never().optional(),reason:zU.never().optional()})}),zU.object({type:zU.literal("dynamic-tool"),toolName:zU.string(),toolCallId:zU.string(),toolMetadata:U1.optional(),state:zU.literal("approval-responded"),input:zU.unknown(),providerExecuted:zU.boolean().optional(),output:zU.never().optional(),errorText:zU.never().optional(),callProviderMetadata:US.optional(),approval:zU.object({id:zU.string(),approved:zU.boolean(),reason:zU.string().optional()})}),zU.object({type:zU.literal("dynamic-tool"),toolName:zU.string(),toolCallId:zU.string(),toolMetadata:U1.optional(),state:zU.literal("output-available"),input:zU.unknown(),providerExecuted:zU.boolean().optional(),output:zU.unknown(),errorText:zU.never().optional(),callProviderMetadata:US.optional(),resultProviderMetadata:US.optional(),preliminary:zU.boolean().optional(),approval:zU.object({id:zU.string(),approved:zU.literal(!0),reason:zU.string().optional()}).optional()}),zU.object({type:zU.literal("dynamic-tool"),toolName:zU.string(),toolCallId:zU.string(),toolMetadata:U1.optional(),state:zU.literal("output-error"),input:zU.unknown().optional(),rawInput:zU.unknown().optional(),providerExecuted:zU.boolean().optional(),output:zU.never().optional(),errorText:zU.string(),callProviderMetadata:US.optional(),resultProviderMetadata:US.optional(),approval:zU.object({id:zU.string(),approved:zU.literal(!0),reason:zU.string().optional()}).optional()}),zU.object({type:zU.literal("dynamic-tool"),toolName:zU.string(),toolCallId:zU.string(),toolMetadata:U1.optional(),state:zU.literal("output-denied"),input:zU.unknown(),providerExecuted:zU.boolean().optional(),output:zU.never().optional(),errorText:zU.never().optional(),callProviderMetadata:US.optional(),approval:zU.object({id:zU.string(),approved:zU.literal(!1),reason:zU.string().optional()})}),zU.object({type:zU.string().startsWith("tool-"),toolCallId:zU.string(),toolMetadata:U1.optional(),state:zU.literal("input-streaming"),providerExecuted:zU.boolean().optional(),callProviderMetadata:US.optional(),input:zU.unknown().optional(),output:zU.never().optional(),errorText:zU.never().optional(),approval:zU.never().optional()}),zU.object({type:zU.string().startsWith("tool-"),toolCallId:zU.string(),toolMetadata:U1.optional(),state:zU.literal("input-available"),providerExecuted:zU.boolean().optional(),input:zU.unknown(),output:zU.never().optional(),errorText:zU.never().optional(),callProviderMetadata:US.optional(),approval:zU.never().optional()}),zU.object({type:zU.string().startsWith("tool-"),toolCallId:zU.string(),toolMetadata:U1.optional(),state:zU.literal("approval-requested"),input:zU.unknown(),providerExecuted:zU.boolean().optional(),output:zU.never().optional(),errorText:zU.never().optional(),callProviderMetadata:US.optional(),approval:zU.object({id:zU.string(),approved:zU.never().optional(),reason:zU.never().optional()})}),zU.object({type:zU.string().startsWith("tool-"),toolCallId:zU.string(),toolMetadata:U1.optional(),state:zU.literal("approval-responded"),input:zU.unknown(),providerExecuted:zU.boolean().optional(),output:zU.never().optional(),errorText:zU.never().optional(),callProviderMetadata:US.optional(),approval:zU.object({id:zU.string(),approved:zU.boolean(),reason:zU.string().optional()})}),zU.object({type:zU.string().startsWith("tool-"),toolCallId:zU.string(),toolMetadata:U1.optional(),state:zU.literal("output-available"),providerExecuted:zU.boolean().optional(),input:zU.unknown(),output:zU.unknown(),errorText:zU.never().optional(),callProviderMetadata:US.optional(),resultProviderMetadata:US.optional(),preliminary:zU.boolean().optional(),approval:zU.object({id:zU.string(),approved:zU.literal(!0),reason:zU.string().optional()}).optional()}),zU.object({type:zU.string().startsWith("tool-"),toolCallId:zU.string(),toolMetadata:U1.optional(),state:zU.literal("output-error"),providerExecuted:zU.boolean().optional(),input:zU.unknown().optional(),rawInput:zU.unknown().optional(),output:zU.never().optional(),errorText:zU.string(),callProviderMetadata:US.optional(),resultProviderMetadata:US.optional(),approval:zU.object({id:zU.string(),approved:zU.literal(!0),reason:zU.string().optional()}).optional()}),zU.object({type:zU.string().startsWith("tool-"),toolCallId:zU.string(),toolMetadata:U1.optional(),state:zU.literal("output-denied"),providerExecuted:zU.boolean().optional(),input:zU.unknown(),output:zU.never().optional(),errorText:zU.never().optional(),callProviderMetadata:US.optional(),approval:zU.object({id:zU.string(),approved:zU.literal(!1),reason:zU.string().optional()})})])).nonempty("Message must contain at least one part")})).nonempty("Messages array must not be empty"))),Tt({prefix:"aiobj",size:24});var U4=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,r)=>{this.queue.push(async()=>{try{await e(),t()}catch(e){r(e)}}),this.processQueue()})}};async function U6(e){if(null==e)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map(async e=>{let{name:t,type:r}=e;return{type:"file",mediaType:r,filename:t,url:await new Promise((t,r)=>{let n=new FileReader;n.onload=e=>{var r;t(null==(r=e.target)?void 0:r.result)},n.onerror=e=>r(e),n.readAsDataURL(e)})}}))}Tt({prefix:"aiobj",size:24}),U2(),Symbol.for("vercel.ai.error.AI_NoSuchProviderError"),U2();var U5=class{constructor({api:e="/api/chat",credentials:t,headers:r,body:n,fetch:i,prepareSendMessagesRequest:a,prepareReconnectToStreamRequest:o}){this.api=e,this.credentials=t,this.headers=r,this.body=n,this.fetch=i,this.prepareSendMessagesRequest=a,this.prepareReconnectToStreamRequest=o}async sendMessages({abortSignal:e,...t}){var r,n,i,a,o;let s=await T3(this.body),l=await T3(this.headers),u=await T3(this.credentials),d={...Tl(l),...Tl(t.headers)},c=await (null==(r=this.prepareSendMessagesRequest)?void 0:r.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...s,...t.body},headers:d,credentials:u,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),p=null!=(n=null==c?void 0:c.api)?n:this.api,m=(null==c?void 0:c.headers)!==void 0?Tl(c.headers):d,f=(null==c?void 0:c.body)!==void 0?c.body:{...s,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},h=null!=(i=null==c?void 0:c.credentials)?i:u,g=null!=(a=this.fetch)?a:globalThis.fetch,v=await g(p,{method:"POST",headers:{"Content-Type":"application/json",...m},body:JSON.stringify(f),credentials:h,signal:e});if(!v.ok)throw Error(null!=(o=await v.text())?o:"Failed to fetch the chat response.");if(!v.body)throw Error("The response body is empty.");return this.processResponseStream(v.body)}async reconnectToStream(e){var t,r,n,i,a;let o=await T3(this.body),s=await T3(this.headers),l=await T3(this.credentials),u={...Tl(s),...Tl(e.headers)},d=await (null==(t=this.prepareReconnectToStreamRequest)?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...o,...e.body},headers:u,credentials:l,requestMetadata:e.metadata})),c=null!=(r=null==d?void 0:d.api)?r:`${this.api}/${e.chatId}/stream`,p=(null==d?void 0:d.headers)!==void 0?Tl(d.headers):u,m=null!=(n=null==d?void 0:d.credentials)?n:l,f=null!=(i=this.fetch)?i:globalThis.fetch,h=await f(c,{method:"GET",headers:p,credentials:m});if(204===h.status)return null;if(!h.ok)throw Error(null!=(a=await h.text())?a:"Failed to fetch the chat response.");if(!h.body)throw Error("The response body is empty.");return this.processResponseStream(h.body)}},U3=class extends U5{constructor(e={}){super(e)}processResponseStream(e){return T1({stream:e,schema:UK}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},U9=class{constructor({generateId:e=Tr,id:t=e(),transport:r=new U3,messageMetadataSchema:n,dataPartSchemas:i,state:a,onError:o,onToolCall:s,onFinish:l,onData:u,sendAutomaticallyWhen:d}){this.activeResponse=void 0,this.jobExecutor=new U4,this.sendMessage=async(e,t)=>{var r,n,i,a;let o;if(null==e)return void await this.makeRequest({trigger:"submit-message",messageId:null==(r=this.lastMessage)?void 0:r.id,...t});if(o="text"in e||"files"in e?{parts:[...Array.isArray(e.files)?e.files:await U6(e.files),..."text"in e&&null!=e.text?[{type:"text",text:e.text}]:[]]}:e,null!=e.messageId){let t=this.state.messages.findIndex(t=>t.id===e.messageId);if(-1===t)throw Error(`message with id ${e.messageId} not found`);if("user"!==this.state.messages[t].role)throw Error(`message with id ${e.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,t+1),this.state.replaceMessage(t,{...o,id:e.messageId,role:null!=(n=o.role)?n:"user",metadata:e.metadata})}else this.state.pushMessage({...o,id:null!=(i=o.id)?i:this.generateId(),role:null!=(a=o.role)?a:"user",metadata:e.metadata});await this.makeRequest({trigger:"submit-message",messageId:e.messageId,...t})},this.regenerate=async({messageId:e,...t}={})=>{let r=null==e?this.state.messages.length-1:this.state.messages.findIndex(t=>t.id===e);if(-1===r)throw Error(`message ${e} not found`);this.state.messages=this.state.messages.slice(0,"assistant"===this.messages[r].role?r:r+1),await this.makeRequest({trigger:"regenerate-message",messageId:e,...t})},this.resumeStream=async(e={})=>{await this.makeRequest({trigger:"resume-stream",...e})},this.clearError=()=>{"error"===this.status&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:e,approved:t,reason:r,options:n})=>this.jobExecutor.run(async()=>{let i=this.state.messages,a=i[i.length-1],o=n=>UX(n)&&"approval-requested"===n.state&&n.approval.id===e?{...n,state:"approval-responded",approval:{id:e,approved:t,reason:r}}:n;this.state.replaceMessage(i.length-1,{...a,parts:a.parts.map(o)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(o)),"streaming"!==this.status&&"submitted"!==this.status&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(e=>{var t;e&&this.makeRequest({trigger:"submit-message",messageId:null==(t=this.lastMessage)?void 0:t.id,...n})})}),this.addToolOutput=async({state:e="output-available",toolCallId:t,output:r,errorText:n,options:i})=>this.jobExecutor.run(async()=>{let a=this.state.messages,o=a[a.length-1],s=i=>UX(i)&&i.toolCallId===t?{...i,state:e,output:r,errorText:n}:i;this.state.replaceMessage(a.length-1,{...o,parts:o.parts.map(s)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(s)),"streaming"!==this.status&&"submitted"!==this.status&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(e=>{var t;e&&this.makeRequest({trigger:"submit-message",messageId:null==(t=this.lastMessage)?void 0:t.id,...i})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var e;("streaming"===this.status||"submitted"===this.status)&&(null==(e=this.activeResponse)?void 0:e.abortController)&&this.activeResponse.abortController.abort()},this.id=t,this.transport=r,this.generateId=e,this.messageMetadataSchema=n,this.dataPartSchemas=i,this.state=a,this.onError=o,this.onToolCall=s,this.onFinish=l,this.onData=u,this.sendAutomaticallyWhen=d}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;let e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&"object"==typeof e&&"then"in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:r,body:n,messageId:i}){var a,o,s;let l;if("resume-stream"===e)try{let e=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:r,body:n});if(null==e)return;l=e}catch(e){this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:"error",error:e});return}this.setStatus({status:"submitted",error:void 0});let u=this.lastMessage,d=!1,c=!1,p=!1;try{let a,o={state:function({lastMessage:e,messageId:t}){return{message:(null==e?void 0:e.role)==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}({lastMessage:this.state.snapshot(u),messageId:this.generateId()}),abortController:new AbortController};o.abortController.signal.addEventListener("abort",()=>{d=!0}),this.activeResponse=o,a="resume-stream"===e?l:await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:o.abortController.signal,metadata:t,headers:r,body:n,trigger:e,messageId:i});let s=e=>this.jobExecutor.run(()=>e({state:o.state,write:()=>{var e;this.setStatus({status:"streaming"}),o.state.message.id===(null==(e=this.lastMessage)?void 0:e.id)?this.state.replaceMessage(this.state.messages.length-1,o.state.message):this.state.pushMessage(o.state.message)}}));await U0({stream:function({stream:e,messageMetadataSchema:t,dataPartSchemas:r,runUpdateMessageJob:n,onError:i,onToolCall:a,onData:o}){return e.pipeThrough(new TransformStream({async transform(e,s){await n(async({state:n,write:l})=>{var u,d,c,p;function m(e){let t=n.message.parts.filter(UX).find(t=>t.toolCallId===e);if(null==t)throw new Uw({chunkType:"tool-invocation",chunkId:e,message:`No tool invocation found for tool call ID "${e}".`});return t}function f(e){var t;let r=n.message.parts.find(t=>UG(t)&&t.toolCallId===e.toolCallId);if(null!=r){r.state=e.state,r.input=e.input,r.output=e.output,r.errorText=e.errorText,r.rawInput=e.rawInput,r.preliminary=e.preliminary,void 0!==e.title&&(r.title=e.title),void 0!==e.toolMetadata&&(r.toolMetadata=e.toolMetadata),r.providerExecuted=null!=(t=e.providerExecuted)?t:r.providerExecuted;let n=e.providerMetadata;null!=n&&("output-available"===e.state||"output-error"===e.state?r.resultProviderMetadata=n:r.callProviderMetadata=n)}else n.message.parts.push({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,title:e.title,...void 0!==e.toolMetadata?{toolMetadata:e.toolMetadata}:{},input:e.input,output:e.output,rawInput:e.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,preliminary:e.preliminary,...null!=e.providerMetadata&&("output-available"===e.state||"output-error"===e.state)?{resultProviderMetadata:e.providerMetadata}:{},...null!=e.providerMetadata&&"output-available"!==e.state&&"output-error"!==e.state?{callProviderMetadata:e.providerMetadata}:{}})}function h(e){var t,r;let i=n.message.parts.find(t=>"dynamic-tool"===t.type&&t.toolCallId===e.toolCallId);if(null!=i){i.state=e.state,i.toolName=e.toolName,i.input=e.input,i.output=e.output,i.errorText=e.errorText,i.rawInput=null!=(t=e.rawInput)?t:i.rawInput,i.preliminary=e.preliminary,void 0!==e.title&&(i.title=e.title),void 0!==e.toolMetadata&&(i.toolMetadata=e.toolMetadata),i.providerExecuted=null!=(r=e.providerExecuted)?r:i.providerExecuted;let n=e.providerMetadata;null!=n&&("output-available"===e.state||"output-error"===e.state?i.resultProviderMetadata=n:i.callProviderMetadata=n)}else n.message.parts.push({type:"dynamic-tool",toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:e.input,output:e.output,errorText:e.errorText,preliminary:e.preliminary,providerExecuted:e.providerExecuted,title:e.title,...void 0!==e.toolMetadata?{toolMetadata:e.toolMetadata}:{},...null!=e.providerMetadata&&("output-available"===e.state||"output-error"===e.state)?{resultProviderMetadata:e.providerMetadata}:{},...null!=e.providerMetadata&&"output-available"!==e.state&&"output-error"!==e.state?{callProviderMetadata:e.providerMetadata}:{}})}async function g(e){if(null!=e){let r=null!=n.message.metadata?function e(t,r){if(void 0===t&&void 0===r)return;if(void 0===t)return r;if(void 0===r)return t;let n={...t};for(let i in r)if("__proto__"!==i&&"constructor"!==i&&"prototype"!==i&&Object.prototype.hasOwnProperty.call(r,i)){let a=r[i];if(void 0===a)continue;let o=i in t?t[i]:void 0,s=null!==a&&"object"==typeof a&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp),l=null!=o&&"object"==typeof o&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp);s&&l?n[i]=e(o,a):n[i]=a}return n}(n.message.metadata,e):e;null!=t&&await TY({value:r,schema:t,context:{field:"message.metadata",entityId:n.message.id}}),n.message.metadata=r}}switch(e.type){case"text-start":{let t={type:"text",text:"",providerMetadata:e.providerMetadata,state:"streaming"};n.activeTextParts[e.id]=t,n.message.parts.push(t),l();break}case"text-delta":{let t=n.activeTextParts[e.id];if(null==t)throw new Uw({chunkType:"text-delta",chunkId:e.id,message:`Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});t.text+=e.delta,t.providerMetadata=null!=(u=e.providerMetadata)?u:t.providerMetadata,l();break}case"text-end":{let t=n.activeTextParts[e.id];if(null==t)throw new Uw({chunkType:"text-end",chunkId:e.id,message:`Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});t.state="done",t.providerMetadata=null!=(d=e.providerMetadata)?d:t.providerMetadata,delete n.activeTextParts[e.id],l();break}case"reasoning-start":{let t={type:"reasoning",text:"",providerMetadata:e.providerMetadata,state:"streaming"};n.activeReasoningParts[e.id]=t,n.message.parts.push(t),l();break}case"reasoning-delta":{let t=n.activeReasoningParts[e.id];if(null==t)throw new Uw({chunkType:"reasoning-delta",chunkId:e.id,message:`Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});t.text+=e.delta,t.providerMetadata=null!=(c=e.providerMetadata)?c:t.providerMetadata,l();break}case"reasoning-end":{let t=n.activeReasoningParts[e.id];if(null==t)throw new Uw({chunkType:"reasoning-end",chunkId:e.id,message:`Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});t.providerMetadata=null!=(p=e.providerMetadata)?p:t.providerMetadata,t.state="done",delete n.activeReasoningParts[e.id],l();break}case"file":n.message.parts.push({type:"file",mediaType:e.mediaType,url:e.url,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}}),l();break;case"source-url":n.message.parts.push({type:"source-url",sourceId:e.sourceId,url:e.url,title:e.title,providerMetadata:e.providerMetadata}),l();break;case"source-document":n.message.parts.push({type:"source-document",sourceId:e.sourceId,mediaType:e.mediaType,title:e.title,filename:e.filename,providerMetadata:e.providerMetadata}),l();break;case"tool-input-start":{let t=n.message.parts.filter(UG);n.partialToolCalls[e.toolCallId]={text:"",toolName:e.toolName,index:t.length,dynamic:e.dynamic,title:e.title,toolMetadata:e.toolMetadata},e.dynamic?h({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-streaming",input:void 0,providerExecuted:e.providerExecuted,title:e.title,toolMetadata:e.toolMetadata,providerMetadata:e.providerMetadata}):f({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-streaming",input:void 0,providerExecuted:e.providerExecuted,title:e.title,toolMetadata:e.toolMetadata,providerMetadata:e.providerMetadata}),l();break}case"tool-input-delta":{let t=n.partialToolCalls[e.toolCallId];if(null==t)throw new Uw({chunkType:"tool-input-delta",chunkId:e.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});t.text+=e.inputTextDelta;let{value:r}=await UF(t.text);t.dynamic?h({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",input:r,title:t.title,toolMetadata:t.toolMetadata}):f({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",input:r,title:t.title,toolMetadata:t.toolMetadata}),l();break}case"tool-input-available":e.dynamic?h({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-available",input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title,toolMetadata:e.toolMetadata}):f({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-available",input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title,toolMetadata:e.toolMetadata}),l(),a&&!e.providerExecuted&&await a({toolCall:e});break;case"tool-input-error":{let t=n.message.parts.filter(UX).find(t=>t.toolCallId===e.toolCallId);(null!=t?"dynamic-tool"===t.type:e.dynamic)?h({toolCallId:e.toolCallId,toolName:e.toolName,state:"output-error",input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,toolMetadata:e.toolMetadata}):f({toolCallId:e.toolCallId,toolName:e.toolName,state:"output-error",input:void 0,rawInput:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,toolMetadata:e.toolMetadata}),l();break}case"tool-approval-request":{let t=m(e.toolCallId);t.state="approval-requested",t.approval={id:e.approvalId},l();break}case"tool-output-denied":m(e.toolCallId).state="output-denied",l();break;case"tool-output-available":{let t=m(e.toolCallId);"dynamic-tool"===t.type?h({toolCallId:e.toolCallId,toolName:t.toolName,state:"output-available",input:t.input,output:e.output,preliminary:e.preliminary,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:t.toolMetadata}):f({toolCallId:e.toolCallId,toolName:UQ(t),state:"output-available",input:t.input,output:e.output,providerExecuted:e.providerExecuted,preliminary:e.preliminary,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:t.toolMetadata}),l();break}case"tool-output-error":{let t=m(e.toolCallId);"dynamic-tool"===t.type?h({toolCallId:e.toolCallId,toolName:t.toolName,state:"output-error",input:t.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:t.toolMetadata}):f({toolCallId:e.toolCallId,toolName:UQ(t),state:"output-error",input:t.input,rawInput:t.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:t.toolMetadata}),l();break}case"start-step":n.message.parts.push({type:"step-start"});break;case"finish-step":n.activeTextParts={},n.activeReasoningParts={};break;case"start":null!=e.messageId&&(n.message.id=e.messageId),await g(e.messageMetadata),(null!=e.messageId||null!=e.messageMetadata)&&l();break;case"finish":null!=e.finishReason&&(n.finishReason=e.finishReason),await g(e.messageMetadata),null!=e.messageMetadata&&l();break;case"message-metadata":await g(e.messageMetadata),null!=e.messageMetadata&&l();break;case"error":null==i||i(Error(e.errorText));break;default:if(e.type.startsWith("data-")){if((null==r?void 0:r[e.type])!=null){let t=n.message.parts.findIndex(t=>"id"in t&&"data"in t&&t.id===e.id&&t.type===e.type),i=t>=0?t:n.message.parts.length;await TY({value:e.data,schema:r[e.type],context:{field:`message.parts[${i}].data`,entityName:e.type,entityId:e.id}})}if(e.transient){null==o||o(e);break}let t=null!=e.id?n.message.parts.find(t=>e.type===t.type&&e.id===t.id):void 0;null!=t?t.data=e.data:n.message.parts.push(e),null==o||o(e),l()}}s.enqueue(e)})}}))}({stream:a,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:s,onError:e=>{throw e}}),onError:e=>{throw e}}),this.setStatus({status:"ready"})}catch(e){if(d||"AbortError"===e.name)return d=!0,this.setStatus({status:"ready"}),null;p=!0,e instanceof TypeError&&(e.message.toLowerCase().includes("fetch")||e.message.toLowerCase().includes("network"))&&(c=!0),this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:"error",error:e})}finally{try{null==(o=this.onFinish)||o.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:d,isDisconnect:c,isError:p,finishReason:null==(a=this.activeResponse)?void 0:a.state.finishReason})}catch(e){console.error(e)}this.activeResponse=void 0}!p&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:null==(s=this.lastMessage)?void 0:s.id,metadata:t,headers:r,body:n})}};function U8({messages:e}){let t=e[e.length-1];if(!t||"assistant"!==t.role)return!1;let r=t.parts.reduce((e,t,r)=>"step-start"===t.type?r:e,-1),n=t.parts.slice(r+1).filter(UX).filter(e=>!e.providerExecuted);return n.length>0&&n.every(e=>"output-available"===e.state||"output-error"===e.state)}function U7(e){return"object"==typeof e&&null!==e&&"~standard"in e&&"object"==typeof e["~standard"]}function Le(e,t){return!t.disabled&&"backend"!==t.type}class Lt extends U3{runtime;getThreadListItem;resumable;constructor(e){const{resumable:t,...r}=e??{},n=r.fetch,i=r.prepareReconnectToStreamRequest;super({...r,...t&&{fetch:function(e,t){let r=t?(e,r)=>t(e,r):globalThis.fetch.bind(globalThis);return async(t,n)=>{let i=await r(t,n),a=i.headers.get("x-resumable-stream-id");if(a&&e.storage.setStreamId(a),!i.body)return i;let o=e.isFinishEvent??Lr,s=new TextDecoder,l="",u=new TransformStream({transform(t,r){r.enqueue(t),l+=s.decode(t,{stream:!0}),o(t,l)?(e.storage.clear(),l=""):l.length>4096&&(l=l.slice(-1024))}});return new Response(i.body.pipeThrough(u),{status:i.status,statusText:i.statusText,headers:i.headers})}}(t,n),prepareReconnectToStreamRequest:function(e,t){return async r=>{let n=e.storage.getStreamId();if(!n)throw Error("AssistantChatTransport: no resumable stream id available; nothing to resume");let i="function"==typeof e.resumeApi?e.resumeApi(n):e.resumeApi,a=await t?.({...r,api:i});return{...a,api:a?.api??i}}}(t,i)},prepareSendMessagesRequest:async e=>{let t=this.runtime?.thread.getModelContext(),n=this.getThreadListItem?.()??this.runtime?.threads.mainItem,i=(await n?.initialize())?.remoteId??e.id,a={...e,body:{callSettings:t?.callSettings,system:t?.system,config:t?.config,tools:function(e,t={}){if(!e)return{};let r=t.filter??Le;return Object.fromEntries(Object.entries(e).filter(([e,t])=>r(e,t)&&t.parameters).map(([e,t])=>[e,{...t.description&&{description:t.description},parameters:function(e){if(U7(e)){let t=e["~standard"].toJSONSchema;if("function"==typeof t)return t();let r=e["~standard"].jsonSchema;if("object"==typeof r&&null!==r&&"function"==typeof r.input)return r.input()}if("object"==typeof e&&null!==e&&"toJSONSchema"in e&&"function"==typeof e.toJSONSchema)return e.toJSONSchema();if("object"==typeof e&&null!==e&&"toJSON"in e&&"function"==typeof e.toJSON)return e.toJSON();if(U7(e))throw Error("Could not convert schema to JSON Schema. The schema implements Standard Schema but does not support JSON Schema conversion. If you are using Zod, please upgrade to Zod v4 (npm install zod@latest). Alternatively, pass a plain JSON Schema object instead.");return e}(t.parameters)}]))}(t?.tools??{}),...e?.body}},o=await r.prepareSendMessagesRequest?.(a);return{...o,body:o?.body??{...a.body,id:i,messages:e.messages,trigger:e.trigger,messageId:e.messageId,metadata:e.requestMetadata}}}}),this.resumable=t}setRuntime(e){this.runtime=e}getResumableAdapter(){return this.resumable}__internal_setGetThreadListItem(e){this.getThreadListItem=e}}function Lr(e,t){return t.includes('"type":"finish"')}var Ln=e.i(61866);e.s(["ERROR_REVALIDATE_EVENT",0,3,"FOCUS_EVENT",0,0,"MUTATE_EVENT",0,2,"RECONNECT_EVENT",0,1],11671);var Li=Object.prototype.hasOwnProperty;let La=new WeakMap,Lo=()=>{},Ls=Lo(),Ll=Object,Lu=e=>e===Ls,Ld=(e,t)=>({...e,...t}),Lc={},Lp={},Lm="undefined",Lf=typeof window!=Lm,Lh=typeof document!=Lm,Lg=Lf&&"Deno"in window,Lv=(e,t)=>{let r=La.get(e);return[()=>!Lu(t)&&e.get(t)||Lc,n=>{if(!Lu(t)){let i=e.get(t);t in Lp||(Lp[t]=i),r[5](t,Ld(i,n),i||Lc)}},r[6],()=>!Lu(t)&&t in Lp?Lp[t]:!Lu(t)&&e.get(t)||Lc]},Ly=!0,[Lb,Lx]=Lf&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Lo,Lo],Lw={initFocus:e=>(Lh&&document.addEventListener("visibilitychange",e),Lb("focus",e),()=>{Lh&&document.removeEventListener("visibilitychange",e),Lx("focus",e)}),initReconnect:e=>{let t=()=>{Ly=!0,e()},r=()=>{Ly=!1};return Lb("online",t),Lb("offline",r),()=>{Lx("online",t),Lx("offline",r)}}},L_=!ek.default.useId,Lk=!Lf||Lg,LI=Lk?ek.useEffect:ek.useLayoutEffect,LS="u">typeof navigator&&navigator.connection,L$=!Lk&&LS&&(["slow-2g","2g"].includes(LS.effectiveType)||LS.saveData),Lj=new WeakMap,LE=(e,t)=>e===`[object ${t}]`,LT=0,LC=e=>{let t,r,n=typeof e,i=Ll.prototype.toString.call(e),a=LE(i,"Date"),o=LE(i,"RegExp"),s=LE(i,"Object");if(Ll(e)!==e||a||o)t=a?e.toJSON():"symbol"==n?e.toString():"string"==n?JSON.stringify(e):""+e;else{if(t=Lj.get(e))return t;if(t=++LT+"~",Lj.set(e,t),Array.isArray(e)){for(r=0,t="@";r<e.length;r++)t+=LC(e[r])+",";Lj.set(e,t)}if(s){t="#";let n=Ll.keys(e).sort();for(;!Lu(r=n.pop());)Lu(e[r])||(t+=r+":"+LC(e[r])+",");Lj.set(e,t)}}return t},LN=e=>{if("function"==typeof e)try{e=e()}catch(t){e=""}let t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?LC(e):"",t]},LA=0,LR=()=>++LA;async function LP(...e){let[t,r,n,i]=e,a=Ld({populateCache:!0,throwOnError:!0},"boolean"==typeof i?{revalidate:i}:i||{}),o=a.populateCache,s=a.rollbackOnError,l=a.optimisticData,u=a.throwOnError;if("function"==typeof r){let e=[];for(let n of t.keys())!/^\$(inf|sub)\$/.test(n)&&r(t.get(n)._k)&&e.push(n);return Promise.all(e.map(d))}return d(r);async function d(r){let i,[d]=LN(r);if(!d)return;let[c,p]=Lv(t,d),[m,f,h,g]=La.get(t),v=()=>{let e=m[d];return("function"==typeof a.revalidate?a.revalidate(c().data,r):!1!==a.revalidate)&&(delete h[d],delete g[d],e&&e[0])?e[0](2).then(()=>c().data):c().data};if(e.length<3)return v();let y=n,b=!1,x=LR();f[d]=[x,0];let w=!Lu(l),_=c(),k=_.data,I=_._c,S=Lu(I)?k:I;if(w&&p({data:l="function"==typeof l?l(S,k):l,_c:S}),"function"==typeof y)try{y=y(S)}catch(e){i=e,b=!0}if(y&&"function"==typeof y.then){let e;if(y=await y.catch(e=>{i=e,b=!0}),x!==f[d][0]){if(b)throw i;return y}b&&w&&(e=i,"function"==typeof s?s(e):!1!==s)&&(o=!0,p({data:S,_c:Ls}))}if(o&&!b&&("function"==typeof o?p({data:o(y,S),error:Ls,_c:Ls}):p({data:y,error:Ls,_c:Ls})),f[d][1]=LR(),Promise.resolve(v()).then(()=>{p({_c:Ls})}),b){if(u)throw i;return}return y}}let LO=(e,t)=>{for(let r in e)e[r][0]&&e[r][0](t)},LM=(e,t)=>{if(!La.has(e)){let r=Ld(Lw,t),n=Object.create(null),i=LP.bind(Ls,e),a=Lo,o=Object.create(null),s=(e,t)=>{let r=o[e]||[];return o[e]=r,r.push(t),()=>r.splice(r.indexOf(t),1)},l=(t,r,n)=>{e.set(t,r);let i=o[t];if(i)for(let e of i)e(r,n)},u=()=>{if(!La.has(e)&&(La.set(e,[n,Object.create(null),Object.create(null),Object.create(null),i,l,s]),!Lk)){let t=r.initFocus(setTimeout.bind(Ls,LO.bind(Ls,n,0))),i=r.initReconnect(setTimeout.bind(Ls,LO.bind(Ls,n,1)));a=()=>{t&&t(),i&&i(),La.delete(e)}}};return u(),[e,i,u,a]}return[e,La.get(e)[4]]},[Lz,LD]=LM(new Map),LU=Ld({onLoadingSlow:Lo,onSuccess:Lo,onError:Lo,onErrorRetry:(e,t,r,n,i)=>{let a=r.errorRetryCount,o=i.retryCount,s=~~((Math.random()+.5)*(1<<(o<8?o:8)))*r.errorRetryInterval;(Lu(a)||!(o>a))&&setTimeout(n,s,i)},onDiscarded:Lo,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:L$?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:L$?5e3:3e3,compare:function e(t,r){var n,i;if(t===r)return!0;if(t&&r&&(n=t.constructor)===r.constructor){if(n===Date)return t.getTime()===r.getTime();if(n===RegExp)return t.toString()===r.toString();if(n===Array){if((i=t.length)===r.length)for(;i--&&e(t[i],r[i]););return -1===i}if(!n||"object"==typeof t){for(n in i=0,t)if(Li.call(t,n)&&++i&&!Li.call(r,n)||!(n in r)||!e(t[n],r[n]))return!1;return Object.keys(r).length===i}}return t!=t&&r!=r},isPaused:()=>!1,cache:Lz,mutate:LD,fallback:{}},{isOnline:()=>Ly,isVisible:()=>{let e=Lh&&document.visibilityState;return Lu(e)||"hidden"!==e}}),LL=(0,ek.createContext)({});e.i(11671);let LZ=Lf&&window.__SWR_DEVTOOLS_USE__;(LZ?window.__SWR_DEVTOOLS_USE__:[]).concat(e=>(t,r,n)=>{let i=r&&((...e)=>{let[n]=LN(t),[,,,i]=La.get(Lz);if(n.startsWith("$inf$"))return r(...e);let a=i[n];return Lu(a)?r(...e):(delete i[n],a)});return e(t,i,n)}),LZ&&(window.__SWR_DEVTOOLS_REACT__=ek.default);let LF=()=>{},LB=LF(),LV=(new WeakMap,ek.default.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}})),Lq={dedupe:!0},LW=Promise.resolve(Ls);Ll.defineProperty(e=>{let{value:t}=e,r=(0,ek.useContext)(LL),n="function"==typeof t,i=(0,ek.useMemo)(()=>n?t(r):t,[n,r,t]),a=(0,ek.useMemo)(()=>n?i:((e,t)=>{let r=Ld(e,t);if(t){let{use:n,fallback:i}=e,{use:a,fallback:o}=t;n&&a&&(r.use=n.concat(a)),i&&o&&(r.fallback=Ld(i,o))}return r})(r,i),[n,r,i]),o=i&&i.provider,s=(0,ek.useRef)(Ls);o&&!s.current&&(s.current=LM(o(a.cache||Lz),i));let l=s.current;return l&&(a.cache=l[0],a.mutate=l[1]),LI(()=>{if(l)return l[2]&&l[2](),l[3]},[]),(0,ek.createElement)(LL.Provider,Ld(e,{value:a}))},"defaultValue",{value:LU});var LJ=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},LH=(e,t,r)=>(LJ(e,t,"read from private field"),r?r.call(e):t.get(e)),LK=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},LG=(e,t,r,n)=>(LJ(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),LY=class{constructor(e=[]){LK(this,ec,void 0),LK(this,ep,"ready"),LK(this,em,void 0),LK(this,ef,new Set),LK(this,eh,new Set),LK(this,eg,new Set),this.pushMessage=e=>{LG(this,ec,LH(this,ec).concat(e)),LH(this,ev).call(this)},this.popMessage=()=>{LG(this,ec,LH(this,ec).slice(0,-1)),LH(this,ev).call(this)},this.replaceMessage=(e,t)=>{LG(this,ec,[...LH(this,ec).slice(0,e),this.snapshot(t),...LH(this,ec).slice(e+1)]),LH(this,ev).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,t)=>{let r=t?null!=t?(0,Ln.default)(e,t):e:e;return LH(this,ef).add(r),()=>{LH(this,ef).delete(r)}},this["~registerStatusCallback"]=e=>(LH(this,eh).add(e),()=>{LH(this,eh).delete(e)}),this["~registerErrorCallback"]=e=>(LH(this,eg).add(e),()=>{LH(this,eg).delete(e)}),LK(this,ev,()=>{LH(this,ef).forEach(e=>e())}),LK(this,ey,()=>{LH(this,eh).forEach(e=>e())}),LK(this,eb,()=>{LH(this,eg).forEach(e=>e())}),LG(this,ec,e)}get status(){return LH(this,ep)}set status(e){LG(this,ep,e),LH(this,ey).call(this)}get error(){return LH(this,em)}set error(e){LG(this,em,e),LH(this,eb).call(this)}get messages(){return LH(this,ec)}set messages(e){LG(this,ec,[...e]),LH(this,ev).call(this)}};ec=new WeakMap,ep=new WeakMap,em=new WeakMap,ef=new WeakMap,eh=new WeakMap,eg=new WeakMap,ev=new WeakMap,ey=new WeakMap,eb=new WeakMap;var LX=class extends U9{constructor({messages:e,...t}){const r=new LY(e);super({...t,state:r}),LK(this,ex,void 0),this["~registerMessagesCallback"]=(e,t)=>LH(this,ex)["~registerMessagesCallback"](e,t),this["~registerStatusCallback"]=e=>LH(this,ex)["~registerStatusCallback"](e),this["~registerErrorCallback"]=e=>LH(this,ex)["~registerErrorCallback"](e),LG(this,ex,r)}};ex=new WeakMap;let LQ=Object.freeze([]),L0="DEFAULT_THREAD_ID",L1=Object.freeze([L0]),L2=Object.freeze({id:L0,remoteId:void 0,externalId:void 0,status:"regular"}),L4=Promise.resolve(),L6=Object.freeze({[L0]:L2});class L5{threadFactory;_mainThreadId=L0;_threads=L1;_archivedThreads=LQ;_threadData=L6;adapter={};get isLoading(){return this.adapter.isLoading??!1}get newThreadId(){}get threadIds(){return this._threads}get archivedThreadIds(){return this._archivedThreads}get threadItems(){return this._threadData}getLoadThreadsPromise(){return L4}_mainThread;get mainThreadId(){return this._mainThreadId}constructor(e={},t){this.threadFactory=t,this.__internal_setAdapter(e,!0)}getMainThreadRuntimeCore(){return this._mainThread}getThreadRuntimeCore(){throw Error("Method not implemented.")}getItemById(e){return this._threadData[e]}__internal_setAdapter(e,t=!1){let r=this.adapter;this.adapter=e;let n=e.threadId??L0,i=e.threads??LQ,a=e.archivedThreads??LQ,o=r.threadId??L0,s=r.threads??LQ,l=r.archivedThreads??LQ;(t||o!==n||s!==i||l!==a)&&((s!==i||l!==a||o!==n)&&(this._threadData={...L6,...Object.fromEntries(e.threads?.map(e=>[e.id,{...e,remoteId:e.remoteId,externalId:e.externalId,status:"regular"}])??[]),...Object.fromEntries(e.archivedThreads?.map(e=>[e.id,{...e,remoteId:e.remoteId,externalId:e.externalId,status:"archived"}])??[])}),s!==i&&(this._threads=this.adapter.threads?.map(e=>e.id)??LQ),l!==a&&(this._archivedThreads=this.adapter.archivedThreads?.map(e=>e.id)??LQ),(t||o!==n)&&(this._mainThreadId=n,this._mainThread=this.threadFactory()),this._threadData[this._mainThreadId]||(this._threadData={...this._threadData,[this._mainThreadId]:{id:this._mainThreadId,remoteId:void 0,externalId:void 0,status:"regular"}}),this._notifySubscribers())}async switchToThread(e){if(this._mainThreadId===e)return;let t=this.adapter.onSwitchToThread;if(!t)throw Error("External store adapter does not support switching to thread");await t(e)}async switchToNewThread(){let e=this.adapter.onSwitchToNewThread;if(!e)throw Error("External store adapter does not support switching to new thread");await e()}async rename(e,t){let r=this.adapter.onRename;if(!r)throw Error("External store adapter does not support renaming");await r(e,t)}async detach(){}async archive(e){let t=this.adapter.onArchive;if(!t)throw Error("External store adapter does not support archiving");await t(e)}async unarchive(e){let t=this.adapter.onUnarchive;if(!t)throw Error("External store adapter does not support unarchiving");await t(e)}async delete(e){let t=this.adapter.onDelete;if(!t)throw Error("External store adapter does not support deleting");await t(e)}initialize(e){return Promise.resolve({remoteId:e,externalId:void 0})}generateTitle(){throw Error("Method not implemented.")}_subscriptions=new Set;subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}_notifySubscribers(){for(let e of this._subscriptions)e()}}class L3{cache=new WeakMap;convertMessages(e,t){return e.map((e,r)=>{let n=t(this.cache.get(e),e,r);return this.cache.set(e,n),n})}}let L9=Object.freeze([]),L8=(e,t)=>{let r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let n of r)if(e[n]!==t[n])return!1;return!0};class L7 extends hq{_assistantOptimisticId=null;_lastSyncedMessageIds=new Set;_capabilities={switchToBranch:!1,switchBranchDuringRun:!1,edit:!1,reload:!1,cancel:!1,unstable_copy:!1,speech:!1,dictation:!1,voice:!1,attachments:!1,feedback:!1,queue:!1};get capabilities(){return this._capabilities}_messages;isDisabled;isSendDisabled;get isLoading(){return this._store.isLoading??!1}get isRunning(){return this._store.isRunning}_getBaseMessages(){return this._messages}get state(){return this._store.state??super.state}get adapters(){return this._store.adapters}suggestions=[];extras=void 0;_converter=new L3;_store;beginEdit(e){if(!this._store.onEdit)throw Error("Runtime does not support editing.");super.beginEdit(e)}constructor(e,t){super(e),this.__internal_setAdapter(t)}__internal_setAdapter(e){let t,r;if(this._store===e)return;let n=e.isRunning??!1;this.isDisabled=e.isDisabled??!1,this.isSendDisabled=e.isSendDisabled??!1;let i=this._store;this._store=e,this.extras!==e.extras&&(this.extras=e.extras);let a=e.suggestions??L9;L8(this.suggestions,a)||(this.suggestions=a);let o={switchToBranch:void 0!==this._store.setMessages,switchBranchDuringRun:!1,edit:void 0!==this._store.onEdit,reload:void 0!==this._store.onReload,cancel:void 0!==this._store.onCancel,speech:this._store.adapters?.speech!==void 0,dictation:this._store.adapters?.dictation!==void 0,voice:this._store.adapters?.voice!==void 0,unstable_copy:this._store.unstable_capabilities?.copy!==!1,attachments:!!this._store.adapters?.attachments,feedback:!!this._store.adapters?.feedback,queue:!1};if(L8(this._capabilities,o)||(this._capabilities=o),e.messageRepository){if(i&&i.isRunning===e.isRunning&&i.messageRepository===e.messageRepository)return void this._notifySubscribers();this.repository.clear(),this._assistantOptimisticId=null,this._lastSyncedMessageIds=new Set,this.repository.import(e.messageRepository),t=this.repository.getMessages()}else if(e.messages){if(i){if(i.convertMessage!==e.convertMessage)this._converter=new L3;else if(i.isRunning===e.isRunning&&i.messages===e.messages)return void this._notifySubscribers()}let r=new Set((t=e.convertMessage?this._converter.convertMessages(e.messages,(t,r,i)=>{if(!e.convertMessage)return r;let a=hn(i===(e.messages?.length??0)-1,n,!1,!1,void 0);if(t&&("assistant"!==t.role||!hr(t.status)||t.status===a))return t;let o=hd(e.convertMessage(r,i),i.toString(),a);return hx(o,r),o}):e.messages).map(e=>e.id));for(let e of this._lastSyncedMessageIds)r.has(e)||this.repository.deleteMessage(e);this._lastSyncedMessageIds=r;for(let e=0;e<t.length;e++){let r=t[e],n=t[e-1];this.repository.addOrUpdateMessage(n?.id??null,r)}}else throw Error("ExternalStoreAdapter must provide either 'messages' or 'messageRepository'");t.length>0&&this.ensureInitialized(),(i?.isRunning??!1)!==(e.isRunning??!1)&&(e.isRunning?this._notifyEventSubscribers("runStart",{}):this._notifyEventSubscribers("runEnd",{})),this._assistantOptimisticId&&(this.repository.deleteMessage(this._assistantOptimisticId),this._assistantOptimisticId=null),r=t,n&&r[r.length-1]?.role!=="assistant"&&(this._assistantOptimisticId=this.repository.appendOptimisticMessage(t.at(-1)?.id??null,{role:"assistant",content:[]})),this.repository.resetHead(this._assistantOptimisticId??t.at(-1)?.id??null),this._messages=this.repository.getMessages(),this._notifySubscribers()}switchToBranch(e){if(!this._store.setMessages)throw Error("Runtime does not support switching branches.");this._store.isRunning||(this.repository.switchToBranch(e),this.updateMessages(this.repository.getMessages()))}async append(e){if(e.parentId!==(this.messages.at(-1)?.id??null)){if(!this._store.onEdit)throw Error("Runtime does not support editing messages.");await this._store.onEdit(e)}else await this._store.onNew(e)}async startRun(e){if(!this._store.onReload)throw Error("Runtime does not support reloading messages.");await this._store.onReload(e.parentId,e)}async resumeRun(e){if(!this._store.onResume)throw Error("Runtime does not support resuming runs.");await this._store.onResume(e)}exportExternalState(){if(!this._store.onExportExternalState)throw Error("Runtime does not support exporting external states.");return this._store.onExportExternalState()}importExternalState(e){if(!this._store.onLoadExternalState)throw Error("Runtime does not support importing external states.");this._store.onLoadExternalState(e)}cancelRun(){if(!this._store.onCancel)throw Error("Runtime does not support cancelling runs.");this._store.onCancel(),this._assistantOptimisticId&&(this.repository.deleteMessage(this._assistantOptimisticId),this._assistantOptimisticId=null);let e=this.repository.getMessages(),t=e[e.length-1];t?.role==="user"&&t.id===e.at(-1)?.id?(this.repository.deleteMessage(t.id),this._lastSyncedMessageIds.delete(t.id),this.composer.text.trim()||this.composer.setText(h_(t)),e=this.repository.getMessages()):this._notifySubscribers(),setTimeout(()=>{this.updateMessages(e)},0)}addToolResult(e){if(!this._store.onAddToolResult&&!this._store.onAddToolResult)throw Error("Runtime does not support tool results.");this._store.onAddToolResult?.(e)}resumeToolCall(e){if(!this._store.onResumeToolCall)throw Error("Runtime does not support resuming tool calls.");this._store.onResumeToolCall(e)}reset(e){this._lastSyncedMessageIds=new Set;let t=new hf;t.import(hc(e??[])),this.updateMessages(t.getMessages())}import(e){this._assistantOptimisticId=null,this._lastSyncedMessageIds=new Set,super.import(e),this._store.onImport&&this._store.onImport(this.repository.getMessages())}updateMessages=e=>{void 0!==this._store.convertMessage?this._store.setMessages?.(e.flatMap(hw)):this._store.setMessages?.(e)}}let Ze=e=>e.adapters?.threadList??{};class Zt extends hh{threads;constructor(e){super(),this.threads=new L5(Ze(e),()=>new L7(this._contextProvider,e))}setAdapter(e){this.threads.__internal_setAdapter(Ze(e)),this.threads.getMainThreadRuntimeCore().__internal_setAdapter(e)}}let Zr=(e,t)=>{if(null==t)return[];let r=e.findIndex(e=>e.id===t);if(-1===r)throw Error("useVercelAIThreadState: Message not found. This is likely an internal bug in assistant-ui.");for(;e[r+1]?.role==="assistant";)r++;return e.slice(0,r+1)},Zn=e=>{let t=[...e.content.filter(e=>"file"!==e.type),...e.attachments?.flatMap(e=>e.content.map(t=>({...t,filename:e.name})))??[]].map(e=>{switch(e.type){case"text":return{type:"text",text:e.text};case"image":return{type:"file",url:e.image,...e.filename&&{filename:e.filename},mediaType:"image/png"};case"file":return{type:"file",url:e.data,mediaType:e.mimeType,...e.filename&&{filename:e.filename}};default:throw Error(`Unsupported part type: ${e.type}`)}});return{role:e.role,parts:t,metadata:e.metadata}},Zi={accept:"*",add:async({file:e})=>({id:Tr(),type:e.type.startsWith("image/")?"image":"file",name:e.name,file:e,contentType:e.type,content:[],status:{type:"requires-action",reason:"composer-send"}}),send:async e=>{let t;return{...e,status:{type:"complete"},content:[{type:"file",mimeType:e.contentType??"",filename:e.name,data:await (t=e.file,new Promise((e,r)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=e=>r(e),n.readAsDataURL(t)}))}]}},async remove(){}},Za=e=>hw(e),Zo=(e,t)=>({[hv]:[...e[hv]??[],...t[hv]??[]]}),Zs=e=>{let t={role:"assistant",content:[]};for(let r of e)if("tool"===r.role){let e=t.content.findIndex(e=>"tool-call"===e.type&&e.toolCallId===r.toolCallId);if(-1!==e){let n=t.content[e];if(void 0!==r.toolName&&n.toolName!==r.toolName)throw Error(`Tool call name ${r.toolCallId} ${r.toolName} does not match existing tool call ${n.toolName}`);t.content[e]={...n,...{[hv]:[...n[hv]??[],r]},result:r.result,artifact:r.artifact,isError:r.isError,messages:r.messages}}}else{let e=r.role,n=("string"==typeof r.content?[{type:"text",text:r.content}]:r.content).map(e=>({...e,...{[hv]:[r]}}));switch(e){case"system":case"user":return{...r,content:n};case"assistant":for(let e of(0===t.content.length&&(t.id=r.id,t.createdAt??=r.createdAt,t.status??=r.status,r.attachments&&(t.attachments=[...t.attachments??[],...r.attachments]),r.metadata&&(t.metadata??={},r.metadata.unstable_state&&(t.metadata.unstable_state=r.metadata.unstable_state),r.metadata.unstable_annotations&&(t.metadata.unstable_annotations=[...t.metadata.unstable_annotations??[],...r.metadata.unstable_annotations]),r.metadata.unstable_data&&(t.metadata.unstable_data=[...t.metadata.unstable_data??[],...r.metadata.unstable_data]),r.metadata.steps&&(t.metadata.steps=[...t.metadata.steps??[],...r.metadata.steps]),r.metadata.custom&&(t.metadata.custom={...t.metadata.custom??{},...r.metadata.custom}),r.metadata.timing&&(t.metadata.timing=r.metadata.timing),r.metadata.submittedFeedback&&(t.metadata.submittedFeedback=r.metadata.submittedFeedback))),n)){if("tool-call"===e.type){let r=t.content.findIndex(t=>"tool-call"===t.type&&t.toolCallId===e.toolCallId);if(-1!==r){let n=t.content[r];t.content[r]={...n,...e,...Zo(n,e)};continue}}if("reasoning"===e.type&&"parentId"in e&&e.parentId){let r=t.content.findIndex(t=>"reasoning"===t.type&&"parentId"in t&&t.parentId===e.parentId);if(-1!==r){let n=t.content[r];t.content[r]={...n,text:`${n.text}
|
|
101
|
+
|
|
102
|
+
${e.text}`,...Zo(n,e)};continue}}t.content.push(e)}break;default:throw Error(`Unknown message role: ${e}`)}}return t},Zl=(e,t)=>{let r=[],n=!1,i=!1,a=[],o=[],s=()=>{o.length&&r.push({inputs:a,outputs:o}),a=[],o=[],n=!1,i=!1};for(let r of e)for(let e of r.outputs)(i&&"tool"!==e.role||!n||"user"===e.role||"system"===e.role)&&s(),n="assistant"===e.role||"tool"===e.role,a.at(-1)!==r.input&&a.push(r.input),o.push(e),"assistant"===e.role&&(e.convertConfig?.joinStrategy==="none"||"none"===t)&&(i=!0);return s(),r};function Zu(e){let t={id:`__error__${f2()}`,role:"assistant",content:[],status:{type:"incomplete",reason:"error",error:e},createdAt:new Date,metadata:{unstable_state:null,unstable_annotations:[],unstable_data:[],custom:{},steps:[]}};return hx(t,[]),t}let Zd=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},Zc="__aui_modelContent",Zp=(e,t,r)=>{if(Array.isArray(e))return e.map((e,n)=>Zp(e,`${t}[${n}]`,r));if(e&&"object"==typeof e){let n=Object.keys(e),i=r.get(t)??[],a=new Set(i),o=[...i.filter(t=>Object.hasOwn(e,t)),...n.filter(e=>!a.has(e))];return r.set(t,o),Object.fromEntries(o.map(n=>[n,Zp(e[n],`${t}.${n}`,r)]))}return e},Zm=(x=(e,t)=>{let r=new Date,n=function(e,t){if(!e.parts||0===e.parts.length)return[];let r=e.parts.filter(t=>"step-start"!==t.type&&("user"!==e.role||"file"!==t.type)).map(r=>{if("text"===r.type)return{type:"text",text:r.text};if("reasoning"===r.type)return{type:"reasoning",text:r.text};if(UX(r)){var n,i,a,o;let s,l,u,d,c=UY(r)?r.toolName:UQ(r),p=r.toolCallId,m=`${e.id}:${p}`,f=r.input;null==f||"object"!=typeof f||Array.isArray(f)?s=t.toolLastInputCache?.get(m)??{}:(s=f,t.toolLastInputCache?.set(m,s));let h=!1;if("output-available"===r.state){let e=null!=(i=n=r.output)&&"object"==typeof i&&Zc in i&&Array.isArray(i[Zc])?{result:n.value,modelContent:n[Zc]}:{result:n};l=e.result,u=e.modelContent}else"output-error"===r.state?(h=!0,l={error:r.errorText}):"output-denied"===r.state&&(h=!0,l={error:r.approval.reason||"Tool approval denied"});let g=(a=t.toolArgsKeyOrderCache,o=s,d=a?.get(m)??new Map,a?.set(m,d),JSON.stringify(Zp(o,"$",d)));"input-streaming"===r.state?g=g.replace(/[}\]"]+$/,""):(t.toolArgsKeyOrderCache?.delete(m),("output-available"===r.state||"output-error"===r.state||"output-denied"===r.state)&&t.toolLastInputCache?.delete(m));let v=t.toolStatuses?.[p],y=function(e,t){let r;if(!e||"object"!=typeof e)return;let n=e.callProviderMetadata,i=n&&"object"==typeof n?n.mcp:void 0,a=i&&"object"==typeof i?i.app:void 0;if(a&&"object"==typeof a)r=a;else{let t=e.output,n=t&&"object"==typeof t?t._meta:void 0,i=n&&"object"==typeof n?n["ui/resourceUri"]:void 0;if("string"!=typeof i)return;r={resourceUri:i}}if("string"!=typeof r.resourceUri||!u4(r.resourceUri))return;let o=t?.get(r.resourceUri);if(o)return t.delete(r.resourceUri),t.set(r.resourceUri,o),o;let s={resourceUri:r.resourceUri};if("string"==typeof r.mimeType&&(s.mimeType=r.mimeType),Array.isArray(r.visibility)&&(s.visibility=r.visibility.filter(e=>"model"===e||"app"===e)),t){if(t.size>=100){let e=t.keys().next().value;void 0!==e&&t.delete(e)}t.set(r.resourceUri,s)}return s}(r,t.mcpAppMetadataCache);return{type:"tool-call",toolName:c,toolCallId:p,argsText:g,args:s,result:l,isError:h,...void 0!==u&&{modelContent:u},...y&&{mcp:{app:y}},..."approval-requested"===r.state&&"approval"in r?{interrupt:{type:"human",payload:r.approval},status:{type:"requires-action",reason:"interrupt"}}:v?.type==="interrupt"?{interrupt:v.payload,status:{type:"requires-action",reason:"interrupt"}}:{}}}return"source-url"===r.type?{type:"source",sourceType:"url",id:r.sourceId,url:r.url,...null!=r.title?{title:r.title}:void 0,...null!=r.providerMetadata?{providerMetadata:r.providerMetadata}:void 0}:"file"===r.type?{type:"file",data:r.url,mimeType:r.mediaType,...null!=r.filename&&{filename:r.filename}}:"source-document"===r.type?{type:"source",sourceType:"document",id:r.sourceId,title:r.title,mediaType:r.mediaType,...null!=r.filename?{filename:r.filename}:void 0,...null!=r.providerMetadata?{providerMetadata:r.providerMetadata}:void 0}:r.type.startsWith("data-")?{type:"data",name:r.type.substring(5),data:r.data}:(console.warn(`Unsupported message part type: ${r.type}`),null)}).filter(Boolean),n=new Set;return r.filter(e=>{if("tool-call"===e.type&&null!=e.toolCallId){if(n.has(e.toolCallId))return!1;n.add(e.toolCallId)}return!0})}(e,t);switch(e.role){case"user":return{role:"user",id:e.id,createdAt:r,content:n,attachments:e.parts?.filter(e=>"file"===e.type).map((e,t)=>({id:t.toString(),type:e.mediaType.startsWith("image/")?"image":"file",name:e.filename??"file",content:[e.mediaType.startsWith("image/")?{type:"image",image:e.url,filename:e.filename}:{type:"file",filename:e.filename,data:e.url,mimeType:e.mediaType}],contentType:e.mediaType??"unknown/unknown",status:{type:"complete"}})),metadata:e.metadata};case"system":case"assistant":{let i=t.messageTiming?.[e.id];return{role:e.role,id:e.id,createdAt:r,content:n,metadata:{...e.metadata,...i&&{timing:i}}}}default:return console.warn(`Unsupported message role: ${e.role}`),[]}},i={useThreadMessages:({messages:e,isRunning:t,joinStrategy:r,metadata:n})=>(({callback:e,messages:t,isRunning:r,joinStrategy:n,metadata:i})=>{let a=(0,ek.useMemo)(()=>({metadata:i??{},callback:e,callbackCache:new WeakMap,chunkCache:new WeakMap,converterCache:new L3}),[e,i]);return(0,ek.useMemo)(()=>{let e=[];for(let r of t){let t=a.callbackCache.get(r);if(!t){let e=a.callback(r,a.metadata);t={input:r,outputs:Array.isArray(e)?e:[e]},a.callbackCache.set(r,t)}e.push(t)}let i=Zl(e,n).map(e=>{let t=e.outputs[0];if(!t)return e;let r=a.chunkCache.get(t);return r&&Zd(r.outputs,e.outputs)?r:(a.chunkCache.set(t,e),e)}),o=a.converterCache.convertMessages(i,(e,t,n)=>{let o=n===i.length-1,s=Zs(t.outputs),l=hn(o,r,"object"==typeof s.content&&s.content.some(e=>"tool-call"===e.type&&void 0===e.result),"object"==typeof s.content&&s.content.some(e=>"tool-call"===e.type&&void 0===e.result),o?a.metadata.error:void 0);if(e&&("assistant"!==e.role||!hr(e.status)||e.status===l)&&Zd(hw(e),t.inputs))return e;let u=hd(s,n.toString(),l);return hx(u,t.inputs),u});if(hx(o,t),a.metadata.error){let e=o.at(-1);e&&"assistant"===e.role||o.push(Zu(a.metadata.error))}return o},[a,t,r,n])})({callback:x,messages:e,isRunning:t,joinStrategy:r,metadata:n}),toThreadMessages:(e,t=!1,r={})=>((e,t,r,n)=>{let i=[];for(let r of e){let e=t(r,n),a={input:r,outputs:Array.isArray(e)?e:[e]};i.push(a)}let a=Zl(i),o=a.map((e,t)=>{let i=t===a.length-1,o=Zs(e.outputs),s="object"==typeof o.content&&o.content.some(e=>"tool-call"===e.type&&void 0===e.result),l=hn(i,r,s,s,i?n.error:void 0),u=hd(o,t.toString(),l);return hx(u,e.inputs),u});if(n.error){let e=o.at(-1);e&&"assistant"===e.role||o.push(Zu(n.error))}return o})(e,x,t,r),toOriginalMessages:e=>{let t=hw(e);if(0===t.length)throw Error("No original messages found");return t},toOriginalMessage:e=>i.toOriginalMessages(e)[0],useOriginalMessage:()=>i.useOriginalMessages()[0],useOriginalMessages:()=>{let e=tU(),t=rS(t=>{if(e.part.source)return hw(t.part)}),r=rS(e=>hw(e.message)),n=t??r;if(0===n.length)throw Error("No original messages found");return n}}),Zf={format:"ai-sdk/v6",encode:({message:{id:e,parts:t,...r}})=>({...r,parts:t}),decode:e=>({parentId:e.parent_id,message:{id:e.id,...e.content}}),getId:e=>e.id},Zh=(e,t)=>({headId:t.headId,messages:t.messages.map(t=>{let r=e([t.message])[0];return{...t,message:r}})}),Zg=(e,t)=>({...e,id:e.id??Tr(),role:e.role??t}),Zv=new Set([204,205,304]),Zy=new Set(["app-context","collaboration_mode","developer","dynamic_context","environment_context","permissions instructions","plugins_instructions","skills_instructions","system"]);function Zb(e){let t=e.trim().toLowerCase();return!!Zy.has(t)||t.includes("_")||t.includes("-")||t.includes(" ")}function Zx(e){var t;let r,n,i,a,o,s=e.trim();if(!s)return"";let l=(t="user_message",o=RegExp(`<${t}(?:\\s[^>]*)?>([\\s\\S]*?)<\\/${t}>`,"iu"),o.exec(s)?.[1]?.trim()??"");if(l)return l;let u=function(e){let t=e.trim();for(let e=0;e<10;e+=1){let e=t.match(/^<([A-Za-z][\w:-]*)(?:\s[^>]*)?>/u),r=e?.[1]?.trim();if(!e||!r||!Zb(r))break;let n=RegExp(`</${r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}>`,"iu"),i=e[0].length,a=n.exec(t.slice(i));if(!a)return"";t=t.slice(i+a.index+a[0].length).trim()}return t}(s);return(n=(r=u.trim().match(/^<([A-Za-z][\w:-]*)(?:\s[^>]*)?>[\s\S]*<\/\1>$/u),r?.[1]?.trim()??null))&&Zb(n)||(a=(i=u.trim().match(/^<([A-Za-z][\w:-]*)(?:\s[^>]*)?>/u),i?.[1]?.trim()??null))&&Zb(a)?"":u}let Zw="codex";function Z_(e){return encodeURIComponent(e||"default")}function Zk({workspacePath:e,provider:t,threadId:r}){return["acp-ui:resumable",Z_(e),Z_(t??Zw),Z_(r)].join(":")}function ZI(e){return{remoteId:e.threadId,status:"archived"===e.status?"archived":"regular",title:e.title??void 0,custom:{provider:e.provider,model:e.model,modeId:e.modeId,thoughtLevel:e.thoughtLevel,workspacePath:e.workspacePath,updatedAt:e.updatedAt,lastActiveAt:e.lastActiveAt??null,providerSessionId:e.providerSessionId??null}}}function ZS(e){return Zx(e.content.filter(e=>"text"===e.type).map(e=>e.text).join(" ").trim())}function Z$(e){return!!(e&&"object"==typeof e&&!Array.isArray(e))}function Zj(e,t){let r="string"==typeof e?Zx(e).replace(/\s+/g," ").trim():"";return(t?r.slice(0,t):r).trim()}function ZE(e){for(let t of[...e].reverse()){let e=function(e){let t=Z$(e.metadata?.custom)?e.metadata.custom:void 0,r=Z$(t?.acpSessionUpdate)?t.acpSessionUpdate:void 0,n=Z$(r?.session_info_update)?r.session_info_update:void 0;return Zj(n?.title)}(t);if(e)return e}return""}let ZT=()=>{let e=tU(),t=rS(e=>e.threadListItem.remoteId),r=rS(e=>e.threadListItem.title),n=rS(e=>ZE(e.thread.messages)),i=(0,ek.useRef)(null);return(0,ek.useEffect)(()=>{if(!t||!n||n===r)return;let a=`${t}:${n}`;i.current===a||e.threadListItem().getState().remoteId===t&&(i.current=a,Promise.resolve().then(()=>e.threadListItem().rename(n)).catch(()=>{i.current=null}))},[n,e,r,t]),null};class ZC{aui;workspacePath;fallbackThreadId;provider;constructor(e,t,r,n){this.aui=e,this.workspacePath=t,this.fallbackThreadId=r,this.provider=n}async load(){return{messages:[]}}async append(){}withFormat(e){let t=this.aui,r=this.workspacePath,n=this.fallbackThreadId,i=this.provider,a=async()=>{let e=t.threadListItem().getState().remoteId;return e||(await t.threadListItem().initialize().catch(()=>null),t.threadListItem().getState().remoteId??n)};return{async load(){let n=await a();if(!n)return{messages:[]};let o=await a1.loadConversationMessages(n,r,e.format,void 0,{hideResumable:function({workspacePath:e,provider:t,threadId:r}){return!!window.sessionStorage.getItem(Zk({workspacePath:e,provider:t??Zw,threadId:r}))}({workspacePath:r,provider:i,threadId:n})}),s=o.messages.map(t=>e.decode({id:t.id,parent_id:t.parent_id,format:t.format,content:t.content})),l={headId:o.headId,messages:s};return 0===s.length&&t.thread().import({messages:[]}),l},async append(e){await t.threadListItem().initialize()},async update(e,t){}}}}let ZN=["cwd","project","workdir"];function ZA(e){let t=String(e??"").trim();if(!t)return"";let r=t.replace(/\\/g,"/");return"/"===r?"/":/^[A-Za-z]:\/?$/.test(r)?`${r[0].toUpperCase()}:/`:r.replace(/\/+$/g,"")}function ZR(e,t){let r,n,i=ZA(e);if(!i||(r=ZA(i),n=ZA(t),r&&r===n))return"";let a=new URLSearchParams;a.set("cwd",i);let o=a.toString();return o?`?${o}`:""}function ZP({threadId:e,workspacePath:t,defaultWorkspacePath:r}){return`/thread/${encodeURIComponent(e)}${ZR(t,r)}`}function ZO({workspacePath:e,defaultWorkspacePath:t}){return`/${ZR(e,t)}`}function ZM(e){return!!(e&&"function"==typeof e.postMessage)}function Zz(e){return e.trim()||"*"}function ZD(e){return String(e||"").trim()}function ZU(e,t,r){return JSON.stringify({messages:e,artifacts:t,imageGenerationRecords:r})}let ZL="acp.host-context.received";function ZZ(e){return e.flatMap(e=>{let t=function e(t,r=new WeakSet){if(null===t)return null;let n=typeof t;if("string"===n||"number"===n||"boolean"===n)return t;if("bigint"===n)return String(t);if("undefined"===n||"function"===n||"symbol"===n)return;if(Array.isArray(t))return t.map(t=>{let n=e(t,r);return void 0===n?null:n});if("object"!==n||r.has(t))return;r.add(t);let i={};for(let[n,a]of Object.entries(t)){if("toolUI"===n)continue;let t=e(a,r);void 0!==t&&(i[n]=t)}return r.delete(t),i}(e);return t&&"object"==typeof t&&!Array.isArray(t)?[t]:[]})}function ZF(...e){let t=new Map;for(let r of e.flat()){let e=`${r.kind}:${r.path||r.title}`,n=t.get(e);(!n||!n.newText&&r.newText||r.updatedAt>=n.updatedAt)&&t.set(e,r)}return[...t.values()]}function ZB(e){window.dispatchEvent(new CustomEvent(ZL,{detail:e}))}let ZV=()=>{let e,t,r,n,i,a,o=(0,ek.useRef)((e=null,t=null,r=null,n=new Map,i=new Map,a=new Map,{hasHost:()=>ZM(e?.source??null),rememberHost(t){ZM(t.source)&&(e={source:t.source,origin:t.origin,filter:t.filter})},activateForThread(n,i={}){let o=ZD(n);e&&o&&(t=o,r=ZD(i.localThreadId)||null,"snapshot"===e.filter&&a.set(o,{baselineSignature:ZU(i.messages??[],i.artifacts??[],i.imageGenerationRecords??[]),lastSentSignature:a.get(o)?.lastSentSignature??null,sawRunning:!1}))},flush(o){let s=ZD(o.threadId),l=ZD(o.localThreadId)||null;return e&&s&&((e,o)=>{if(!t)return!1;if(e===t)return!0;if(r&&o===r){let r=n.get(t),o=n.get(e);if(r&&r!==o)if(o)for(let[e,t]of r)o.has(e)||o.set(e,t);else n.set(e,r);let s=a.get(t);s&&!a.has(e)&&a.set(e,s);let l=i.get(t);return l&&!i.has(e)&&i.set(e,l),t=e,!0}return!1})(s,l)&&ZM(e.source)?"artifacts"===e.filter?((t,r)=>{if(!e||!ZM(e.source))return[];let a=n.get(r)??new Map,o=[],s=[...t.imageGenerationRecords??[]],l=JSON.stringify(s),u=i.get(r)??"";for(let e of t.artifacts){let t=JSON.stringify({id:e.id,kind:e.kind,title:e.title,path:e.path||"",status:e.status||"",toolCallId:e.toolCallId,updatedAt:e.updatedAt||0});a.get(e.id)!==t&&(a.set(e.id,t),o.push(e))}if(!o.length&&(0===s.length||l===u))return[];n.set(r,a),i.set(r,l);let d={type:"acp.messages.changed",payload:{version:1,threadId:r,workspacePath:t.workspacePath||null,filter:"artifacts",artifacts:o,...s.length>0?{imageGenerationRecords:s}:{}}};return e.source.postMessage(d,{targetOrigin:Zz(e.origin)}),o})(o,s):((t,r)=>{if(!e||!ZM(e.source))return[];let n=a.get(r)??{baselineSignature:null,lastSentSignature:null,sawRunning:!1};if(t.isRunning)return n.sawRunning=!0,a.set(r,n),[];let i=ZU(t.messages,t.artifacts,t.imageGenerationRecords??[]);if(!n.sawRunning)return n.baselineSignature=i,a.set(r,n),[];if(n.lastSentSignature===i)return[];n.baselineSignature=i,n.lastSentSignature=i,n.sawRunning=!1,a.set(r,n);let o=[...t.messages],s=[...t.imageGenerationRecords??[]],l={type:"acp.messages.changed",payload:{version:1,threadId:r,workspacePath:t.workspacePath||null,filter:"snapshot",messages:o,artifacts:[...t.artifacts],...s.length>0?{imageGenerationRecords:s}:{}}};return e.source.postMessage(l,{targetOrigin:Zz(e.origin)}),o})(o,s):[]}})),s=rS(e=>e.threads.mainThreadId),l=rS(e=>e.threadListItem.remoteId),u=rS(e=>e.thread.messages),d=rS(e=>e.thread.isRunning),c=o2(),[p,m]=(0,ek.useState)([]),f=(0,ek.useMemo)(()=>ZZ([...u]),[u]),h=(0,ek.useMemo)(()=>ZF(c,p),[c,p]),g=(0,ek.useRef)({artifacts:h,messages:f}),v=(0,ek.useRef)(0),y=(0,ek.useRef)(null),b=(0,ek.useRef)(null),{workspacePath:x}=aq(),w=String(l||s||"").trim();return(0,ek.useEffect)(()=>{g.current={artifacts:h,messages:f}},[h,f]),(0,ek.useEffect)(()=>{if(d){null===y.current&&(y.current=Date.now(),m([]));return}let e=y.current;if(y.current=null,b.current=e,!e||!w||!x)return;let t=!1;return a1.listWorkspaceOutputArtifacts(x,w,e-500).then(({artifacts:e})=>{t||m(e)}).catch(e=>{console.warn("[ACP UI] Failed to scan workspace output artifacts",e)}),()=>{t=!0}},[d,w,x]),(0,ek.useEffect)(()=>{let e=e=>{let t=e.detail;o.current.rememberHost({source:t?.source??null,origin:t?.origin??"",itemCount:Number(t?.itemCount||0),filter:t?.filter==="artifacts"?"artifacts":"snapshot"})},t=e=>{let t=e.detail;if(t?.change?.operation==="consume"){let e=g.current;o.current.activateForThread(w,{localThreadId:s,artifacts:e.artifacts,messages:e.messages})}};return window.addEventListener(ZL,e),window.addEventListener("acp.context.local-change",t),()=>{window.removeEventListener(ZL,e),window.removeEventListener("acp.context.local-change",t)}},[s,w]),(0,ek.useEffect)(()=>{let e=v.current+1;v.current=e;let t={artifacts:h,imageGenerationRecords:[],messages:f},r=t=>{e===v.current&&o.current.flush({threadId:w,localThreadId:s,workspacePath:x,artifacts:t.artifacts,imageGenerationRecords:t.imageGenerationRecords,messages:t.messages,isRunning:d})};!d&&w&&o.current.hasHost()?a1.collectThreadOutputArtifacts({workspacePath:x,threadId:w,format:"ai-sdk/v6",source:"auto",sinceMs:b.current}).then(e=>{r({artifacts:ZF(h,e.artifacts),imageGenerationRecords:e.imageGenerationRecords,messages:ZZ(e.messages.map(e=>e.content))})}).catch(()=>{r(t)}):o.current.flush({threadId:w,localThreadId:s,workspacePath:x,artifacts:h,messages:f,isRunning:d})},[h,d,s,f,w,x]),null};function Zq(e){return"string"==typeof e&&e.startsWith("__LOCALID_")}function ZW(e){`${window.location.pathname}${window.location.search}`!==e&&(window.history.replaceState(window.history.state,"",e),window.dispatchEvent(new CustomEvent("acp-ui:route-sync")),function(e){let t;try{t=new URL(e,window.location.href)}catch{return}let{href:r,pathname:n,search:i}=t,a={type:"acp.navigation.changed",payload:{href:r,pathname:n,search:i,threadId:function(e){let t=e.pathname.match(/^\/thread\/([^/]+)\/?$/u);if(!t)return null;try{return decodeURIComponent(t[1]).trim()||null}catch{return t[1]?.trim()||null}}(t)}};try{window.parent!==window&&window.parent.postMessage(a,"*")}catch{}try{window.opener&&window.opener!==window&&window.opener.postMessage(a,"*")}catch{}}(e))}let ZJ=new Map,ZH=({defaultWorkspacePath:e,initialThreadId:t})=>{let{workspacePath:r}=aq(),n=rS(e=>e.threads.mainThreadId),i=rS(e=>e.threadListItem.remoteId),a=(0,ek.useRef)(null);return(0,ek.useEffect)(()=>{let o=i??n;if(t&&Zq(o)||t&&!o)return;i&&!Zq(i)&&(Zq(n)&&ZJ.set(n,i),a.current={localThreadId:Zq(n)?n:null,remoteThreadId:i});let s=a.current,l=Zq(n)?ZJ.get(n)??(s?.localThreadId===n?s.remoteThreadId:void 0):void 0;!i&&Zq(n)&&l?ZW(ZP({threadId:l,workspacePath:r,defaultWorkspacePath:e})):ZW(o&&!Zq(o)?ZP({threadId:o,workspacePath:r,defaultWorkspacePath:e}):ZO({workspacePath:r,defaultWorkspacePath:e}))},[e,t,n,i,r]),null};function ZK(e,t){if(!e||!(t in e))return;let r=e?.[t];return"string"==typeof r&&r.trim()?r.trim():null}let ZG=()=>{let{setModel:e,setModeId:t,setProvider:r,setThoughtLevel:n}=aq(),i=rS(e=>e.threadListItem.custom),a=ZK(i,"provider"),o=ZK(i,"model"),s=ZK(i,"modeId"),l=ZK(i,"thoughtLevel");return(0,ek.useEffect)(()=>{a&&r(a)},[a,r]),(0,ek.useEffect)(()=>{void 0!==o&&e(o)},[o,e]),(0,ek.useEffect)(()=>{void 0!==s&&t(s)},[s,t]),(0,ek.useEffect)(()=>{void 0!==l&&n(l)},[l,n]),null},ZY=new Set(["acp.attachment.add"]);function ZX(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function ZQ(e,t,r){e&&"function"==typeof e.postMessage&&e.postMessage({type:"acp.attachment.result",requestId:t,payload:{ok:!0,name:r.name,mimeType:r.mimeType}},{targetOrigin:"*"})}function Z0(e,t,r){e&&"function"==typeof e.postMessage&&e.postMessage({type:"acp.attachment.error",requestId:t,payload:r},{targetOrigin:"*"})}let Z1=()=>{let e=tU(),t=(0,ek.useRef)(new Map),r=(0,ek.useRef)(new Map);return(0,ek.useEffect)(()=>{let n=async n=>{if(n.source!==window&&n.source!==window.parent&&n.source!==window.opener)return;let i=n.data;if(!ZX(i)||"string"!=typeof i.type||!ZY.has(i.type))return;let a="string"==typeof i.requestId?i.requestId:void 0;if(a&&t.current.has(a)){let e=t.current.get(a);e?.type==="result"?ZQ(n.source,a,e.payload):e?.type==="error"&&Z0(n.source,a,e.error);return}let o=a?r.current.get(a):null;if(o){let e=await o;"result"===e.type?ZQ(n.source,a,e.payload):Z0(n.source,a,e.error);return}let s=(async()=>{let{name:t,mimeType:r,dataUrl:n}=function(e){if(!ZX(e))throw{code:"invalid_payload",message:"payload must be an object"};let t="string"==typeof e.name?e.name.trim():"",r="string"==typeof e.mimeType?e.mimeType.trim():"",n="string"==typeof e.dataUrl?e.dataUrl.trim():"";if(!t)throw{code:"invalid_payload",message:"payload.name must be a non-empty string"};if(!r.startsWith("image/"))throw{code:"invalid_payload",message:"payload.mimeType must be an image MIME type"};if(!n.startsWith("data:image/"))throw{code:"invalid_payload",message:"payload.dataUrl must be a data:image/* URL"};return{name:t,mimeType:r,dataUrl:n}}(i.payload);return await e.thread().composer().addAttachment({name:t,type:"image",contentType:r,content:[{type:"image",image:n}]}),{type:"result",payload:{name:t,mimeType:r}}})().catch(e=>({type:"error",error:ZX(e)&&"string"==typeof e.code?{code:e.code,message:"string"==typeof e.message?e.message:"Attachment message failed"}:{code:"internal_error",message:e instanceof Error?e.message:String(e)}}));a&&r.current.set(a,s);try{let e=await s;a&&t.current.set(a,e),"result"===e.type?ZQ(n.source,a,e.payload):Z0(n.source,a,e.error)}finally{a&&r.current.delete(a)}};return window.addEventListener("message",n),()=>window.removeEventListener("message",n)},[e]),null},Z2=new Set(["acp.chat.submit"]);function Z4(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Z6(e){let t=e.thread().getState(),r=t.messages.filter(e=>"assistant"===e.role).length,n="",i="";try{let t=e.threadListItem().getState();n=String(t.remoteId||""),i=String(t.id||"")}catch{i=""}return{assistantMessageCount:r,isRunning:!!t.isRunning,messageCount:t.messages.length,remoteId:n,threadId:i}}function Z5(e,t,r){e&&"function"==typeof e.postMessage&&e.postMessage({type:"acp.chat.result",requestId:t,payload:{ok:!0,...r}},{targetOrigin:"*"})}function Z3(e,t,r){e&&"function"==typeof e.postMessage&&e.postMessage({type:"acp.chat.error",requestId:t,payload:r},{targetOrigin:"*"})}let Z9=()=>{let e=tU(),t=rS(e=>e.threads.mainThreadId),r=(0,ek.useRef)(new Map),n=(0,ek.useRef)(new Map);return(0,ek.useEffect)(()=>{let i=async i=>{if(i.source!==window&&i.source!==window.parent&&i.source!==window.opener)return;let a=i.data;if(!Z4(a)||"string"!=typeof a.type||!Z2.has(a.type))return;let o="string"==typeof a.requestId?a.requestId:void 0;if(o&&r.current.has(o)){let e=r.current.get(o);e?.type==="result"?Z5(i.source,o,e.payload):e?.type==="error"&&Z3(i.source,o,e.error);return}let s=o?n.current.get(o):null;if(s){let e=await s;"result"===e.type?Z5(i.source,o,e.payload):Z3(i.source,o,e.error);return}let l=(async()=>{var r,n;let i=function(e){if(!Z4(e)||"string"!=typeof e.text)throw{code:"invalid_payload",message:"payload.text must be a non-empty string"};let t=e.text.trim();if(!t)throw{code:"invalid_payload",message:"payload.text must be a non-empty string"};return t}(a.payload),o=Z4(r=a.payload)&&"started"===r.waitUntil?"started":"finished";Z4(n=a.payload)&&!0===n.newThread&&await e.threads().switchToNewThread(),await function(e,t=1e4){let r=Date.now()+t;return new Promise((t,n)=>{let i=()=>{try{let r=e.thread().composer(),n=r.getState();return r.setText(n.text),t(),!0}catch(e){if(Date.now()>=r)return n(e),!0;return!1}};if(i())return;let a=window.setInterval(()=>{i()&&window.clearInterval(a)},100)})}(e);let s=e.thread().composer(),l=Date.now()+1e4,u=s.getState();for(;Date.now()<l&&(s.setText(i),await new Promise(e=>window.setTimeout(e,50)),(u=s.getState()).text!==i||!u.canSend););if(!u.canSend)throw Error("Composer is not ready to send the chat prompt.");let d=Z6(e);s.send({startRun:!0});let c=await function(e,t,r=1e4){let n=Date.now()+r;return new Promise((r,i)=>{let a=null,o=null,s=!1,l=()=>{null!==a&&window.clearInterval(a),a=null,o?.(),o=null},u=()=>{if(s)return;let a=Z6(e);if(a.isRunning||a.assistantMessageCount>t.assistantMessageCount){s=!0,l(),r(a);return}Date.now()>=n&&(s=!0,l(),i(Error("Timed out waiting for the assistant run to start.")))};try{o=e.thread().subscribe?.(u)??null}catch{o=null}u(),s||(a=window.setInterval(u,100))})}(e,d),p="finished"===o?await function(e,t,r,n=6e5){let i=Date.now()+n;return new Promise((n,a)=>{let o=null,s=null,l=!1,u=()=>{null!==o&&window.clearInterval(o),o=null,s?.(),s=null},d=()=>{if(l)return;let o=Z6(e),s=o.assistantMessageCount>t.assistantMessageCount,d=o.messageCount>=r.messageCount;if(!o.isRunning&&d&&(r.isRunning||s)){l=!0,u(),n(o);return}Date.now()>=i&&(l=!0,u(),a(Error("Timed out waiting for the assistant run to finish.")))};try{s=e.thread().subscribe?.(d)??null}catch{s=null}d(),l||(o=window.setInterval(d,250))})}(e,d,c):c;return{type:"result",payload:{canSend:u.canSend,textLength:u.text.length,waitUntil:o,threadId:p.remoteId||p.threadId||t,remoteId:p.remoteId||void 0,messageCount:p.messageCount,isRunning:p.isRunning}}})().catch(e=>({type:"error",error:Z4(e)&&"string"==typeof e.code?{code:e.code,message:"string"==typeof e.message?e.message:"Chat message failed"}:{code:"internal_error",message:e instanceof Error?e.message:String(e)}}));o&&n.current.set(o,l);try{let e=await l;o&&r.current.set(o,e),"result"===e.type?Z5(i.source,o,e.payload):Z3(i.source,o,e.error)}finally{o&&n.current.delete(o)}};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[e,t]),null},Z8=new Set(["acp.composer.append"]);function Z7(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Fe(e,t,r){e&&"function"==typeof e.postMessage&&e.postMessage({type:"acp.composer.result",requestId:t,payload:{ok:!0,textLength:r.textLength}},{targetOrigin:"*"})}function Ft(e,t,r){e&&"function"==typeof e.postMessage&&e.postMessage({type:"acp.composer.error",requestId:t,payload:r},{targetOrigin:"*"})}let Fr=()=>{let e=tU(),t=(0,ek.useRef)(new Map),r=(0,ek.useRef)(new Map);return(0,ek.useEffect)(()=>{let n=async n=>{if(n.source!==window&&n.source!==window.parent&&n.source!==window.opener)return;let i=n.data;if(!Z7(i)||"string"!=typeof i.type||!Z8.has(i.type))return;let a="string"==typeof i.requestId?i.requestId:void 0;if(a&&t.current.has(a)){let e=t.current.get(a);e?.type==="result"?Fe(n.source,a,e.payload):e?.type==="error"&&Ft(n.source,a,e.error);return}let o=a?r.current.get(a):null;if(o){let e=await o;"result"===e.type?Fe(n.source,a,e.payload):Ft(n.source,a,e.error);return}let s=(async()=>{var t;let r,n,{text:a}=function(e){if(!Z7(e)||"string"!=typeof e.text)throw{code:"invalid_payload",message:"payload.text must be a non-empty string"};let t=e.text.trim();if(!t)throw{code:"invalid_payload",message:"payload.text must be a non-empty string"};return{text:t}}(i.payload);await function(e,t=1e4){let r=Date.now()+t;return new Promise((t,n)=>{let i=()=>{try{let r=e.thread().composer(),n=r.getState();return r.setText(n.text),t(),!0}catch(e){if(Date.now()>=r)return n(e),!0;return!1}};if(i())return;let a=window.setInterval(()=>{i()&&window.clearInterval(a)},100)})}(e);let o=e.thread().composer(),s=(t=o.getState().text,r=String(t||"").trimEnd(),n=String(a||"").trim(),r?`${r}
|
|
103
|
+
|
|
104
|
+
${n}`:n);return o.setText(s),{type:"result",payload:{textLength:s.length}}})().catch(e=>({type:"error",error:Z7(e)&&"string"==typeof e.code?{code:e.code,message:"string"==typeof e.message?e.message:"Composer message failed"}:{code:"internal_error",message:e instanceof Error?e.message:String(e)}}));a&&r.current.set(a,s);try{let e=await s;a&&t.current.set(a,e),"result"===e.type?Fe(n.source,a,e.payload):Ft(n.source,a,e.error)}finally{a&&r.current.delete(a)}};return window.addEventListener("message",n),()=>window.removeEventListener("message",n)},[e]),null},Fn=new Set(["acp.context.add","acp.context.remove","acp.context.replace","acp.context.clear","acp.context.get"]);function Fi(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Fa(e,t,r){if(void 0!==e){if("string"==typeof e)return e;r.push(`${t} must be a string`)}}function Fo(e,t,r){if(void 0!==e){if("number"==typeof e&&Number.isFinite(e))return e;r.push(`${t} must be a finite number`)}}function Fs(e,t,r){if(void 0!==e){if("boolean"==typeof e)return e;r.push(`${t} must be a boolean`)}}function Fl(e,t,r){if(void 0!==e){if(Fi(e))return e;r.push(`${t} must be an object`)}}function Fu(e,t,r){if(void 0===e)return;if(!Fi(e))return void r.push(`${t} must be an object`);let n={};for(let i of["x","y","width","height","top","right","bottom","left"]){let a=Fo(e[i],`${t}.${i}`,r);void 0!==a&&(n[i]=a)}return n}function Fd(e){if(!Fi(e)||!Array.isArray(e.items))throw{code:"invalid_payload",message:"payload.items must be an array"};let t=[],r=e.items.map((e,r)=>(function(e,t,r){if(!Fi(e))return r.push(`items[${t}] must be an object`),null;if("file"===e.kind)return"string"==typeof e.path&&e.path.trim()?{kind:"file",id:Fa(e.id,`items[${t}].id`,r),hidden:Fs(e.hidden,`items[${t}].hidden`,r),pinned:Fs(e.pinned,`items[${t}].pinned`,r),path:e.path,name:Fa(e.name,`items[${t}].name`,r),mimeType:Fa(e.mimeType,`items[${t}].mimeType`,r),range:function(e,t,r){if(void 0===e)return;if(!Fi(e))return void r.push(`${t} must be an object`);let n={};for(let i of["startLine","endLine","startColumn","endColumn"]){let a=Fo(e[i],`${t}.${i}`,r);void 0!==a&&(n[i]=a)}return n}(e.range,`items[${t}].range`,r),description:Fa(e.description,`items[${t}].description`,r),metadata:Fl(e.metadata,`items[${t}].metadata`,r)}:(r.push(`items[${t}].path must be a non-empty string`),null);if("annotation"===e.kind){var n,i;if("string"!=typeof e.body||!e.body.trim())return r.push(`items[${t}].body must be a non-empty string`),null;if(!Fi(e.target))return r.push(`items[${t}].target must be an object`),null;let a=(n=e.target,i=`items[${t}].target`,"web-element"===n.type?{type:"web-element",url:Fa(n.url,`${i}.url`,r),selector:Fa(n.selector,`${i}.selector`,r),elementId:Fa(n.elementId,`${i}.elementId`,r),label:Fa(n.label,`${i}.label`,r),rect:Fu(n.rect,`${i}.rect`,r)}:"canvas-element"===n.type?{type:"canvas-element",filePath:Fa(n.filePath,`${i}.filePath`,r),canvasId:Fa(n.canvasId,`${i}.canvasId`,r),elementId:Fa(n.elementId,`${i}.elementId`,r),elementType:Fa(n.elementType,`${i}.elementType`,r),label:Fa(n.label,`${i}.label`,r),rect:Fu(n.rect,`${i}.rect`,r),link:Fa(n.link,`${i}.link`,r)}:"text"===n.type?{type:"text",filePath:Fa(n.filePath,`${i}.filePath`,r),quote:Fa(n.quote,`${i}.quote`,r),range:function(e,t,r){if(void 0===e)return;if(!Fi(e))return void r.push(`${t} must be an object`);let n={};for(let i of["startLine","endLine","startColumn","endColumn","startOffset","endOffset"]){let a=Fo(e[i],`${t}.${i}`,r);void 0!==a&&(n[i]=a)}return n}(n.range,`${i}.range`,r),label:Fa(n.label,`${i}.label`,r)}:(r.push(`${i}.type must be "web-element", "canvas-element", or "text"`),null));if(!a)return null;let o=void 0===e.status||"open"===e.status||"resolved"===e.status?e.status:void 0;return void 0!==e.status&&void 0===o&&r.push(`items[${t}].status must be "open" or "resolved"`),{kind:"annotation",id:Fa(e.id,`items[${t}].id`,r),hidden:Fs(e.hidden,`items[${t}].hidden`,r),pinned:Fs(e.pinned,`items[${t}].pinned`,r),body:e.body,target:a,title:Fa(e.title,`items[${t}].title`,r),status:o,source:Fa(e.source,`items[${t}].source`,r),metadata:Fl(e.metadata,`items[${t}].metadata`,r)}}return r.push(`items[${t}].kind must be "file" or "annotation"`),null})(e,r,t)).filter(e=>!!e);if(t.length>0)throw{code:"invalid_payload",message:t.join("; ")};return r}function Fc(e){return Fi(e)&&"artifacts"===(e.messageFilter??e.syncFilter??e.outputFilter??e.filter)?"artifacts":"snapshot"}function Fp(e){if(void 0===e||!Fi(e)||void 0===e.kinds)return;if(!Array.isArray(e.kinds))throw{code:"invalid_payload",message:"payload.kinds must be an array"};let t=e.kinds.filter(i8);if(t.length!==e.kinds.length)throw{code:"invalid_payload",message:'payload.kinds may only contain "file" or "annotation"'};return t}let Fm=()=>{let{addContextItems:e,removeContextItems:t,replaceContextItems:r,clearContextItems:n,getContextBundle:i}=aq();return(0,ek.useEffect)(()=>{let a=(e,t,r,n)=>{e&&"function"==typeof e.postMessage&&e.postMessage({type:"acp.context.result",requestId:t,payload:{ok:!0,context:r,change:n}},{targetOrigin:"*"})},o=e=>{let t=e.detail;t?.context&&t.change&&((e,t)=>{for(let r of new Set([window.parent,window.opener,window]))r&&"function"==typeof r.postMessage&&r.postMessage({type:"acp.context.changed",payload:{context:e,change:t}},{targetOrigin:"*"})})(t.context,t.change)},s=o=>{var s,l;if(o.source!==window&&o.source!==window.parent&&o.source!==window.opener)return;let u=o.data;if(Fi(u)&&"string"==typeof u.type&&Fn.has(u.type))try{let s="string"==typeof u.requestId?u.requestId:void 0;if("acp.context.add"===u.type){let t=Fd(u.payload),{context:r,change:n}=e(t);ZB({source:o.source,origin:o.origin,itemCount:t.length,filter:Fc(u.payload)}),a(o.source,s,r,n);return}if("acp.context.remove"===u.type){let{context:e,change:r}=t(function(e){if(!Fi(e)||!Array.isArray(e.ids))throw{code:"invalid_payload",message:"payload.ids must be an array"};let t=e.ids.map(e=>"string"==typeof e?e.trim():"").filter(Boolean);if(t.length!==e.ids.length)throw{code:"invalid_payload",message:"payload.ids must contain only non-empty strings"};return t}(u.payload));a(o.source,s,e,r);return}if("acp.context.replace"===u.type){let e=Fd(u.payload),{context:t,change:n}=r(e);ZB({source:o.source,origin:o.origin,itemCount:e.length,filter:Fc(u.payload)}),a(o.source,s,t,n);return}if("acp.context.clear"===u.type){let{context:e,change:t}=n(Fp(u.payload));a(o.source,s,e,t);return}let l=Fp(u.payload);a(o.source,s,i7(i(),l))}catch(t){let e="string"==typeof u.requestId?u.requestId:void 0;s=o.source,l=Fi(t)&&"string"==typeof t.code?{code:t.code,message:"string"==typeof t.message?t.message:"Context message failed"}:{code:"internal_error",message:t instanceof Error?t.message:String(t)},s&&"function"==typeof s.postMessage&&s.postMessage({type:"acp.context.error",requestId:e,payload:l},{targetOrigin:"*"})}};return window.addEventListener("message",s),window.addEventListener("acp.context.local-change",o),()=>{window.removeEventListener("message",s),window.removeEventListener("acp.context.local-change",o)}},[e,n,i,t,r]),null},Ff=new Set(["acp.runtime.configure","acp.runtime.get","acp.runtime.clear"]),Fh=["builtinTools","builtinToolSettings","mcpServers","commands"];function Fg(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Fv(e,t,r){if(void 0===e)return;if("string"!=typeof e)return void r.push(`${t} must be a string`);let n=e.trim();return n||void r.push(`${t} must be a non-empty string when provided`)}function Fy(e,t,r){if(void 0!==e){if(Array.isArray(e))return e;r.push(`${t} must be an array`)}}function Fb(e){return Fh.filter(t=>void 0!==e[t])}function Fx(e){let t=function(e){if(!e)return null;let{apiKey:t,...r}=e;return{...r,...t?{hasApiKey:!0}:{}}}(e);return t?{builtinTools:[al],builtinToolSettings:{[al]:t}}:{}}function Fw(e,t,r,n){e&&"function"==typeof e.postMessage&&e.postMessage({type:"acp.runtime.result",requestId:r,payload:{ok:!0,...n}},{targetOrigin:t.trim()||"*"})}function F_(e,t,r,n){e&&"function"==typeof e.postMessage&&e.postMessage({type:"acp.runtime.error",requestId:r,payload:n},{targetOrigin:t.trim()||"*"})}let Fk=()=>{let{clearHostImageGenerationSettings:e,hostImageGenerationSettings:t,setHostImageGenerationSettings:r}=aq(),n=(0,ek.useRef)(t),i=(0,ek.useRef)(void 0),a=(0,ek.useRef)(new Map);return(0,ek.useEffect)(()=>{n.current=t},[t]),(0,ek.useEffect)(()=>{let t=t=>{if(t.source!==window&&t.source!==window.parent&&t.source!==window.opener)return;let o=t.data;if(!Fg(o)||"string"!=typeof o.type||!Ff.has(o.type))return;let s="string"==typeof o.requestId?o.requestId:void 0;if(s&&a.current.has(s)){let e=a.current.get(s);e?.type==="result"?Fw(t.source,t.origin,s,e.payload):e?.type==="error"&&F_(t.source,t.origin,s,e.error);return}let l=(()=>{try{return(()=>{if("acp.runtime.configure"===o.type){let e=function(e){if(!Fg(e))throw{code:"invalid_payload",message:"payload must be an object"};let t=[],r=void 0===e.merge||("boolean"==typeof e.merge?e.merge:void 0);void 0===r&&t.push("payload.merge must be a boolean");let n=function(e,t,r){if(void 0===e)return;if(!Array.isArray(e))return void r.push(`${t} must be an array`);let n=[];return e.forEach((e,i)=>{if("string"!=typeof e)return void r.push(`${t}[${i}] must be a string`);let a=e.trim();a?n.includes(a)||n.push(a):r.push(`${t}[${i}] must be a non-empty string`)}),n}(e.builtinTools,"payload.builtinTools",t),i=function(e,t,r){if(void 0!==e){if(Fg(e))return e;r.push(`${t} must be an object`)}}(e.builtinToolSettings,"payload.builtinToolSettings",t),a=Fy(e.mcpServers,"payload.mcpServers",t),o=Fy(e.commands,"payload.commands",t);if(t.length>0)throw{code:"invalid_payload",message:t.join("; ")};if(void 0===n&&void 0===i&&void 0===a&&void 0===o)throw{code:"invalid_payload",message:"payload must include at least one runtime config field"};return{merge:r??!0,...void 0!==n?{builtinTools:n}:{},...void 0!==i?{builtinToolSettings:i}:{},...void 0!==a?{mcpServers:a}:{},...void 0!==o?{commands:o}:{}}}(o.payload),t=e.builtinToolSettings?.[al];if(void 0===t)return{type:"result",payload:{config:Fx(n.current),change:{operation:"configure",fields:Fb(e)}}};let a=Fg(t)&&void 0!==t.enabled,s=function(e){if(!Fg(e))throw{code:"invalid_payload",message:`payload.builtinToolSettings["${al}"] must be an object`};let t=[],r={};void 0!==e.enabled&&("boolean"==typeof e.enabled?r.enabled=e.enabled:t.push(`payload.builtinToolSettings["${al}"].enabled must be a boolean`));let n=Fv(e.baseUrl,`payload.builtinToolSettings["${al}"].baseUrl`,t),i=Fv(e.apiKey,`payload.builtinToolSettings["${al}"].apiKey`,t),a=Fv(e.model,`payload.builtinToolSettings["${al}"].model`,t),o=Fv(e.savePathPattern,`payload.builtinToolSettings["${al}"].savePathPattern`,t);if(n&&(r.baseUrl=n.replace(/\/+$/u,"")),i&&(r.apiKey=i),a&&(r.model=a),o&&(r.savePathPattern=o),void 0!==e.preservePrompt&&("boolean"==typeof e.preservePrompt?r.preservePrompt=e.preservePrompt:t.push(`payload.builtinToolSettings["${al}"].preservePrompt must be a boolean`)),t.length>0)throw{code:"invalid_payload",message:t.join("; ")};let s=ah(r);if(!s)throw{code:"invalid_payload",message:`payload.builtinToolSettings["${al}"] must include at least one image generation setting field`};return s}(t);a&&(i.current=!0===s.enabled);let l=r(t=>e.merge?{...t??{},...s}:s),u=l;return!a&&l&&void 0===i.current&&ag(l)&&(u=r({...l,enabled:!0})),{type:"result",payload:{config:Fx(u),change:{operation:"configure",fields:Fb(e)}}}}if("acp.runtime.clear"===o.type){var t;let r=(t=function(e){if(void 0===e)return{};if(!Fg(e))throw{code:"invalid_payload",message:"payload must be an object"};if(void 0===e.fields)return{};if(!Array.isArray(e.fields))throw{code:"invalid_payload",message:"payload.fields must be an array"};let t=[],r=[];if(e.fields.forEach((e,n)=>{"builtinTools"!==e&&"builtinToolSettings"!==e&&"mcpServers"!==e&&"commands"!==e?r.push(`payload.fields[${n}] must be "builtinTools", "builtinToolSettings", "mcpServers", or "commands"`):t.includes(e)||t.push(e)}),r.length>0)throw{code:"invalid_payload",message:r.join("; ")};return{fields:t}}(o.payload)).fields&&t.fields.length>0?t.fields:Fh,a=r.includes("builtinToolSettings")?e():n.current;return r.includes("builtinToolSettings")&&(i.current=void 0),{type:"result",payload:{config:Fx(a),change:{operation:"clear",fields:r}}}}return{type:"result",payload:{config:Fx(n.current)}}})()}catch(e){return{type:"error",error:Fg(e)&&"string"==typeof e.code?{code:e.code,message:"string"==typeof e.message?e.message:"Runtime configuration message failed"}:{code:"internal_error",message:e instanceof Error?e.message:String(e)}}}})();s&&a.current.set(s,l),"result"===l.type?Fw(t.source,t.origin,s,l.payload):F_(t.source,t.origin,s,l.error)};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[e,r]),null},FI=["thread.runtime.changed","thread.messages.changed","thread.artifacts.changed","thread.idle"],FS=new Set(FI),F$=new Set(["acp.thread.get","acp.messages.get","acp.artifacts.get","acp.snapshot.get","acp.subscribe","acp.unsubscribe","acp.host.ready"]),Fj=new Set(["acp.chat.submit","acp.chat.result","acp.chat.error","acp.attachment.add","acp.attachment.result","acp.attachment.error","acp.composer.append","acp.composer.result","acp.composer.error","acp.context.add","acp.context.remove","acp.context.replace","acp.context.clear","acp.context.get","acp.context.result","acp.context.error","acp.context.changed","acp.runtime.configure","acp.runtime.get","acp.runtime.clear","acp.runtime.result","acp.runtime.error","acp.runtime.changed","acp.messages.changed","acp.query.result","acp.query.error","acp.ui.ready","acp.event"]);function FE(e){return!!(e&&"object"==typeof e&&!Array.isArray(e))}function FT(e){return"string"==typeof e?e.trim():""}function FC(e){return e.trim()||"*"}function FN(e){return!!(e&&"function"==typeof e.postMessage)}function FA(e){if(void 0===e)return{};if(FE(e))return e;throw{code:"invalid_payload",message:"payload must be an object"}}function FR(e){let t=e.source;if(void 0===t)return"auto";if("auto"===t||"provider"===t||"runtime"===t)return t;throw{code:"invalid_payload",message:'payload.source must be "auto", "provider", or "runtime"'}}function FP(e){let t=e.format;if(void 0===t||"ai-sdk/v6"===t)return"ai-sdk/v6";throw{code:"invalid_payload",message:'payload.format must be "ai-sdk/v6"'}}function FO(e,t){let r=e.workspacePath;if(null==r)return t.workspacePath;if("string"==typeof r)return r.trim()||null;throw{code:"invalid_payload",message:"payload.workspacePath must be a string"}}function FM(e,t){if(void 0!==e.threadId){let t=FT(e.threadId);if(t)return t;throw{code:"invalid_payload",message:"payload.threadId must be a non-empty string"}}if(t.threadId)return t.threadId;throw{code:"thread_unavailable",message:"No threadId was provided and the current thread is unavailable"}}function Fz(e){let t=FA(e);if(!Array.isArray(t.events))throw{code:"invalid_payload",message:"payload.events must be an array"};let r=t.events.map(e=>"string"==typeof e?e.trim():"");if(r.some(e=>!FS.has(e)))throw{code:"invalid_payload",message:`payload.events may only contain: ${FI.join(", ")}`};return[...new Set(r)]}function FD(e,t=new WeakSet){if(null===e)return null;if(e instanceof Date)return e.toISOString();let r=typeof e;if("string"===r||"number"===r||"boolean"===r)return e;if("bigint"===r)return String(e);if("undefined"===r||"function"===r||"symbol"===r)return;if(Array.isArray(e))return e.map(e=>{let r=FD(e,t);return void 0===r?null:r});if("object"!==r||t.has(e))return;t.add(e);let n={};for(let[r,i]of Object.entries(e)){if("toolUI"===r)continue;let e=FD(i,t);void 0!==e&&(n[r]=e)}return t.delete(e),n}function FU({aui:e,current:t,format:r,source:n,diagnosticError:i="Runtime store unavailable"}){if("provider"===n)return null;let a=function(e,t){try{let r=e.thread().__internal_getRuntime?.()?.exportExternalState?.();if(!FE(r)||!Array.isArray(r.messages))return null;let n=r.messages.flatMap((e,r)=>{if(!FE(e)||!FE(e.message))return[];let n=FD(e.message);if(!FE(n))return[];let i=FT(n.id)||`runtime-message-${r}`,a="string"==typeof e.parentId&&e.parentId.trim()?e.parentId.trim():null,o=new Date().toISOString();return[{id:i,parent_id:a,format:t,content:n,createdAt:o,updatedAt:o}]});return{headId:"string"==typeof r.headId?r.headId:null,messages:n}}catch{return null}}(e,r);return a?{threadId:t.threadId,workspacePath:t.workspacePath,source:n,format:r,headId:a.headId,messages:a.messages,diagnostic:{source:"runtime-store",error:i}}:null}let FL=()=>{let e=tU(),{provider:t,workspacePath:r}=aq(),n=rS(e=>e.threads.mainThreadId),i=rS(e=>e.threadListItem.id),a=rS(e=>e.threadListItem.remoteId),o=rS(e=>e.threadListItem.title),s=rS(e=>e.threadListItem.status),l=rS(e=>e.thread.messages),u=rS(e=>e.thread.isRunning),d=rS(e=>e.thread.isLoading),c=o2(),p=FT(a)||FT(n),m=u?"running":null,f=(0,ek.useMemo)(()=>({threadId:p,localThreadId:FT(i||n)||null,remoteId:FT(a)||null,title:o??null,status:s??null,workspacePath:r,provider:t,runState:m,isRunning:u,isLoading:d,syncing:!1,messageCount:l.length,artifactCount:c.length}),[m,p,d,u,c.length,i,n,t,l.length,a,s,o,r]),h=(0,ek.useRef)(f),g=(0,ek.useRef)([]),v=(0,ek.useRef)(0),y=(0,ek.useRef)(new Map),b=(0,ek.useRef)(new Map),x=(0,ek.useRef)(new Map),w=(0,ek.useRef)(null),_=(0,ek.useRef)(null),k=(0,ek.useRef)(null),I=(0,ek.useRef)(null),S=(0,ek.useRef)(new Map),$=(0,ek.useRef)(new Map),j=(0,ek.useRef)(null),E=(0,ek.useMemo)(()=>JSON.stringify({threadId:p,messages:[...l].flatMap(e=>{let t=FD(e);return t&&"object"==typeof t&&!Array.isArray(t)?[t]:[]})}),[p,l]),T=(0,ek.useMemo)(()=>JSON.stringify({threadId:p,artifacts:c}),[p,c]);(0,ek.useEffect)(()=>{h.current=f},[f]);let C=(0,ek.useCallback)((e,t,r=[])=>{if(!FN(e))return null;let n=g.current,i=n.find(r=>r.source===e&&r.origin===t);for(let a of(i||(i={source:e,origin:t,events:new Set},n.push(i)),r))i.events.add(a);return i},[]),N=(0,ek.useCallback)(e=>g.current.some(t=>t.events.has(e)),[]),A=(0,ek.useCallback)((e,t)=>{let r,n=g.current.filter(t=>t.events.has(e));if(0===n.length)return;let i=v.current+1;v.current=i;let a={type:"acp.event",eventId:(r=globalThis.crypto&&"randomUUID"in globalThis.crypto?globalThis.crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,`acp-event-${i}-${r}`),seq:i,payload:{kind:e,...t}};for(let e of n)e.source.postMessage(a,{targetOrigin:FC(e.origin)})},[]),R=(0,ek.useCallback)(e=>{let t=h.current,r=FT(e?.threadId)||t.threadId;if(!r)return;let n=e?.runState!==void 0?e.runState:t.runState,i=e?.isRunning!==void 0?e.isRunning:"running"===n||t.isRunning,a=e?.syncing!==void 0?e.syncing:t.syncing,o=JSON.stringify({threadId:r,activeThreadId:t.threadId,runState:n,isRunning:i,syncing:a});I.current!==o&&(I.current=o,A("thread.runtime.changed",{threadId:r,activeThreadId:t.threadId,workspacePath:t.workspacePath,provider:t.provider,runState:n,runtime:{runState:n,isRunning:i,isLoading:t.isLoading,syncing:a},changedAt:new Date().toISOString()}))},[A]),P=(0,ek.useCallback)(e=>{let t=h.current,r=FT(e)||t.threadId;if(!r)return;let n=`${r}:${E}`;S.current.get(r)!==n&&(S.current.set(r,n),A("thread.messages.changed",{threadId:r,workspacePath:t.workspacePath,provider:t.provider,messageCount:t.messageCount,changedAt:new Date().toISOString()}))},[E,A]),O=(0,ek.useCallback)(({threadId:e,artifacts:t,imageGenerationRecords:r=[],workspaceArtifacts:n=[]})=>{let i=h.current,a=FT(e)||i.threadId;if(!a)return;let o=JSON.stringify({artifacts:t,imageGenerationRecords:r,workspaceArtifacts:n});$.current.get(a)!==o&&($.current.set(a,o),A("thread.artifacts.changed",{threadId:a,workspacePath:i.workspacePath,provider:i.provider,artifactCount:t.length,artifacts:[...t],imageGenerationRecords:[...r],workspaceArtifacts:[...n],changedAt:new Date().toISOString()}))},[A]),M=(0,ek.useCallback)((e,t)=>{e&&(null==t||"completed"===t||"aborted"===t||"error"===t)&&x.current.get(e)&&(x.current.set(e,!1),A("thread.idle",{threadId:e,workspacePath:h.current.workspacePath,runState:t??"completed",finishedAt:new Date().toISOString()}))},[A]),z=(0,ek.useCallback)(async(e,t={})=>{var r;let n=h.current,i=FA(e),a=FM(i,n),o=FO(i,n);try{let e;return r=await a1.getConversationRuntime(a,o),e=r.threadId===n.threadId,{threadId:r.threadId,localThreadId:e?n.localThreadId:null,remoteId:e?n.remoteId:r.threadId,title:e?n.title:null,status:e?n.status:null,workspacePath:r.workspacePath,provider:r.provider,runtime:{runState:r.metadata?.runState??null,isRunning:r.metadata?.runState==="running",isLoading:e?n.isLoading:void 0,syncing:e?n.syncing:void 0,acpSessionId:r.acpSessionId,lastUsedAt:r.lastUsedAt}}}catch(e){if(t.allowCurrentFallback&&a===n.threadId)return{threadId:n.threadId,localThreadId:n.localThreadId,remoteId:n.remoteId,title:n.title,status:n.status,workspacePath:n.workspacePath,provider:n.provider,runtime:{runState:n.runState,isRunning:n.isRunning,isLoading:n.isLoading,syncing:n.syncing}};throw e}},[]),D=(0,ek.useCallback)(async t=>{let r,n=h.current,i=FA(t),a=FM(i,n),o=FO(i,n),s=FR(i),l=FP(i);try{r=await a1.loadConversationMessages(a,o,l,s)}catch(r){let t=a===n.threadId?FU({aui:e,current:n,format:l,source:s,diagnosticError:r instanceof Error?r.message:String(r)}):null;if(t)return t;throw r}let u=a===n.threadId&&0===r.messages.length?FU({aui:e,current:n,format:l,source:s,diagnosticError:r.diagnostic?.error}):null;return u?.messages.length?u:{threadId:a,workspacePath:o,source:s,format:l,headId:r.headId,messages:r.messages,diagnostic:r.diagnostic}},[e]),U=(0,ek.useCallback)(async e=>{let t,r=h.current,n=FA(e),i=FM(n,r),a=FO(n,r),o=FR(n),s=FP(n),l=function(e){if(void 0===e.sinceMs||null===e.sinceMs)return null;let t=Number(e.sinceMs);if(Number.isFinite(t))return Math.max(0,t);throw{code:"invalid_payload",message:"payload.sinceMs must be a finite number"}}(n);try{t=await a1.collectThreadOutputArtifacts({workspacePath:a,threadId:i,format:s,source:o,sinceMs:l})}catch(t){let e=i===r.threadId?function({current:e,format:t,source:r,sinceMs:n,localArtifacts:i,diagnosticError:a="Thread artifact collector unavailable"}){return"provider"===r?null:{threadId:e.threadId,workspacePath:e.workspacePath,source:r,format:t,sinceMs:n,artifacts:[...i],imageGenerationRecords:[],workspaceArtifacts:[],messageCount:e.messageCount,diagnostic:{source:"runtime-store",error:a}}}({current:r,format:s,source:o,sinceMs:l,localArtifacts:c,diagnosticError:t instanceof Error?t.message:String(t)}):null;if(e)return e;throw t}let u=i===r.threadId&&"provider"!==o?function(...e){let t=new Map;for(let r of e.flat()){let e=`${r.kind}:${r.path||r.title}`,n=t.get(e);(!n||!n.newText&&r.newText||r.updatedAt>=n.updatedAt)&&t.set(e,r)}return[...t.values()]}(t.artifacts,c):t.artifacts;return{threadId:i,workspacePath:a,source:o,format:s,sinceMs:l,artifacts:u,imageGenerationRecords:t.imageGenerationRecords,workspaceArtifacts:t.workspaceArtifacts,messageCount:i===r.threadId?Math.max(t.messages.length,r.messageCount):t.messages.length,diagnostic:t.diagnostic}},[c]),L=(0,ek.useCallback)(async(e,t={})=>{let[r,n,i]=await Promise.all([z(e,t),D(e),U(e)]);return{thread:r,runtime:r.runtime,messages:n.messages,headId:n.headId,artifacts:i.artifacts,imageGenerationRecords:i.imageGenerationRecords,workspaceArtifacts:i.workspaceArtifacts,diagnostic:n.diagnostic??i.diagnostic}},[U,D,z]);return(0,ek.useEffect)(()=>{let e=JSON.stringify({threadId:f.threadId,workspacePath:f.workspacePath,provider:f.provider,runState:f.runState,isRunning:f.isRunning,isLoading:f.isLoading,syncing:f.syncing}),t=w.current;if(w.current=e,!t){(f.isRunning||"running"===f.runState)&&x.current.set(f.threadId,!0);return}(f.isRunning||"running"===f.runState)&&x.current.set(f.threadId,!0),e!==t&&(R(),M(f.threadId,f.runState))},[f,M,R]),(0,ek.useEffect)(()=>{let e=_.current;_.current=E,!e||f.isRunning||e!==E&&P(f.threadId)},[E,f.isRunning,f.threadId,P]),(0,ek.useEffect)(()=>{let e=k.current;k.current=T,e&&e!==T&&O({threadId:f.threadId,artifacts:c})},[f.threadId,T,c,O]),(0,ek.useEffect)(()=>{if(f.isRunning){null===j.current&&(j.current=Date.now());return}let e=j.current;if(j.current=null,!e||!f.threadId||!N("thread.artifacts.changed"))return;let t=!1;return a1.collectThreadOutputArtifacts({workspacePath:f.workspacePath,threadId:f.threadId,format:"ai-sdk/v6",source:"auto",sinceMs:Math.max(0,e-500)}).then(e=>{t||O({threadId:f.threadId,artifacts:e.artifacts,imageGenerationRecords:e.imageGenerationRecords,workspaceArtifacts:e.workspaceArtifacts})}).catch(e=>{console.warn("[ACP UI] Failed to collect thread output artifacts",e)}),()=>{t=!0}},[f.isRunning,f.threadId,f.workspacePath,N,O]),(0,ek.useEffect)(()=>{let e=(e,t,r,n)=>{FN(e)&&e.postMessage({type:"acp.query.error",requestId:r,payload:n},{targetOrigin:FC(t)})},t=(t,r,n,i)=>{var a,o;"query"===i.type?(a=i.payload,FN(t)&&t.postMessage({type:"acp.query.result",requestId:n,payload:a},{targetOrigin:FC(r)})):"ready"===i.type?(o=i.payload,FN(t)&&t.postMessage({type:"acp.ui.ready",requestId:n,payload:o},{targetOrigin:FC(r)})):e(t,r,n,i.error)},r=async(e,t)=>{if("acp.host.ready"===e.type){let r=FE(e.payload)&&Array.isArray(e.payload.events)?Fz(e.payload):[];C(t.source,t.origin,r);let n=await L(e.payload,{allowCurrentFallback:!0}).catch(()=>null);return{type:"ready",payload:{ok:!0,version:1,supportedEvents:FI,snapshot:n?{kind:"snapshot",...n}:null}}}if("acp.subscribe"===e.type){let r=Fz(e.payload),n=C(t.source,t.origin,r);return{type:"query",payload:{ok:!0,kind:"subscription",supportedEvents:FI,subscribedEvents:n?[...n.events]:[]}}}if("acp.unsubscribe"===e.type){let r=Fz(e.payload),n=C(t.source,t.origin);if(n)for(let e of r)n.events.delete(e);return{type:"query",payload:{ok:!0,kind:"subscription",supportedEvents:FI,removedEvents:r,subscribedEvents:n?[...n.events]:[]}}}if("acp.thread.get"===e.type)return{type:"query",payload:{ok:!0,kind:"thread",...await z(e.payload,{allowCurrentFallback:!0})}};if("acp.messages.get"===e.type)return{type:"query",payload:{ok:!0,kind:"messages",...await D(e.payload)}};if("acp.artifacts.get"===e.type)return{type:"query",payload:{ok:!0,kind:"artifacts",...await U(e.payload)}};if("acp.snapshot.get"===e.type)return{type:"query",payload:{ok:!0,kind:"snapshot",...await L(e.payload,{allowCurrentFallback:!0})}};throw{code:"unknown_type",message:`Unsupported postMessage type: ${e.type}`}},n=async n=>{var i;if(n.source!==window&&n.source!==window.parent&&n.source!==window.opener)return;let a=n.data;if(!FE(a)||"string"!=typeof a.type)return;if(!F$.has(a.type)){if((i=a.type).startsWith("acp.")&&!Fj.has(i)){let t="string"==typeof a.requestId?a.requestId:void 0;e(n.source,n.origin,t,{code:"unknown_type",message:`Unsupported postMessage type: ${a.type}`})}return}let o="string"==typeof a.requestId?a.requestId:void 0,s=o?`${a.type}:${o}`:null;if(s&&y.current.has(s))return void t(n.source,n.origin,o,y.current.get(s));let l=s?b.current.get(s):null;if(l)return void t(n.source,n.origin,o,await l);let u=r(a,n).catch(e=>({type:"error",error:FE(e)&&"string"==typeof e.code?{code:e.code,message:"string"==typeof e.message?e.message:"Thread query failed"}:{code:"internal_error",message:e instanceof Error?e.message:String(e)}}));s&&b.current.set(s,u);let d=await u;s&&(b.current.delete(s),y.current.set(s,d)),t(n.source,n.origin,o,d)};return window.addEventListener("message",n),()=>window.removeEventListener("message",n)},[U,D,L,z,C]),null};function FZ(e){return"string"==typeof e&&e.startsWith("__LOCALID_")}let FF=({defaultWorkspacePath:e,workspaceName:t,initialThreadId:r})=>{let n=aq(),i=(0,rq.usePathname)(),a=(0,rq.useRouter)(),o=function(){let e=(0,rq.usePathname)(),t=(0,rq.useSearchParams)().toString(),[r,n]=(0,ek.useState)(null);return(0,ek.useEffect)(()=>{let r=new URL(window.location.href);r.pathname=e,r.search=t,n(FB(r.href));let i=()=>{n(FB(window.location.href))};return window.addEventListener("acp-ui:route-sync",i),()=>window.removeEventListener("acp-ui:route-sync",i)},[e,t]),r}(),s=function({context:e,threadId:t}={}){let r=e?.provider,n=e?.model,i=e?.modeId,a=e?.thoughtLevel,o=e?.explicitModel,s=e?.explicitModeId??ao[as(r)].defaultModeId??null,l=e?.explicitThoughtLevel,u=e?.permissionMode,d=e?.workspacePath,c=e?.runtimeBuiltinToolSettings??e?.builtinToolSettings,p=e?.consumeContextBundle,m=(0,ek.useRef)([]),f=(0,ek.useCallback)(e=>{let t;if(e.startRun??"user"===e.role){let e=p?.();e&&m.current.push(e)}return t=[...e.content.filter(e=>"file"!==e.type),...e.attachments?.flatMap(e=>e.content.map(t=>({...t,filename:e.name})))??[]].map(e=>{switch(e.type){case"text":return{type:"text",text:e.text};case"image":return{type:"file",url:e.image,...e.filename?{filename:e.filename}:{},mediaType:"image/png"};case"file":return{type:"file",url:e.data,mediaType:e.mimeType,...e.filename?{filename:e.filename}:{}};default:throw Error(`Unsupported part type: ${e.type}`)}}),{role:e.role,parts:t,metadata:e.metadata}},[p]),h=(0,ek.useRef)({});h.current={model:n,modeId:i,thoughtLevel:a};let g=(0,ek.useMemo)(()=>({provider:r,permissionMode:u,workspacePath:d,getConversationMetadata:()=>h.current}),[r,u,d]);return gs({adapter:(0,ek.useMemo)(()=>(function(e={},t){var r,n;let i=async(t,r={})=>{let n;await a1.upsertConversation({...(n=e.getConversationMetadata?.()??{},{threadId:t,provider:e.provider??Zw,model:n.model??null,modeId:n.modeId??null,thoughtLevel:n.thoughtLevel??null,permissionMode:e.permissionMode,workspacePath:e.workspacePath??void 0}),...r,threadId:t},e.workspacePath)};return{unstable_Provider:(r=e.workspacePath,n=e.provider,({children:e})=>{let i=tU(),a=(0,ek.useMemo)(()=>new ZC(i,r,t,n),[i]),o=(0,ek.useMemo)(()=>({history:a}),[a]);return(0,ew.jsxs)(gn,{adapters:o,children:[(0,ew.jsx)(ZT,{}),e]})}),async list(r){let{threads:n,nextCursor:i}=await a1.listConversations(e.workspacePath,{after:r?.after,limit:50,refreshProvider:!1}),a=t&&n.some(e=>e.threadId===t),o=t&&!a?await a1.getConversation(t,e.workspacePath).then(({thread:e})=>e).catch(()=>null):null;return{threads:(o?[o,...n]:n).map(ZI),nextCursor:i}},async initialize(t){let r,n=e.provider??Zw;return{remoteId:t.startsWith("__LOCALID_")?(r="u">typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,`${n}-${r}`):t,externalId:void 0}},async rename(t,r){await a1.renameConversation(t,r,e.workspacePath)},async archive(t){await a1.archiveConversation(t,!0,e.workspacePath)},async unarchive(t){await a1.archiveConversation(t,!1,e.workspacePath)},async delete(t){await a1.deleteConversation(t,e.workspacePath)},async fetch(t){let{thread:r}=await a1.getConversation(t,e.workspacePath);return ZI(r)},async generateTitle(t,r){let n,a=ZE(r),o=a?"":await a1.getConversation(t,e.workspacePath).then(({thread:e})=>{let t;return"新对话"===(t=Zj(e.title))?"":t}).catch(()=>""),s=a||o||Zj(((n=r.find(e=>"user"===e.role&&ZS(e)))?ZS(n):"")||ZS(r.find(e=>"system"!==e.role)??r[0]),48);return s?(await i(t,{title:s}),g$(e=>{e.appendText(s)})):g$(()=>{})}}})(g,t),[g,t]),allowNesting:!0,threadId:t,runtimeHook:function(){var e;let n,i=rS(e=>e.threadListItem.id),a=rS(e=>e.threadListItem.remoteId)??t??i,p=r??Zw;return(({cloud:e,...t}={})=>gs({runtimeHook:function(){return(e=>{var t;let r,{adapters:n,transport:i,toCreateMessage:a,onResume:o,suggestions:s,...l}=e??{},u=(t=i??new Lt,r=(0,ek.useRef)(t),(0,ek.useEffect)(()=>{r.current=t}),(0,ek.useMemo)(()=>new Proxy(r.current,{get(e,t){let n=r.current[t];return"function"==typeof n?n.bind(r.current):n}}),[])),d=rS(e=>e.threadListItem.id),c=tU(),p=function({experimental_throttle:e,resume:t=!1,...r}={}){let n=(0,ek.useRef)("chat"in r?{}:{onToolCall:r.onToolCall,onData:r.onData,onFinish:r.onFinish,onError:r.onError,sendAutomaticallyWhen:r.sendAutomaticallyWhen});"chat"in r||(n.current={onToolCall:r.onToolCall,onData:r.onData,onFinish:r.onFinish,onError:r.onError,sendAutomaticallyWhen:r.sendAutomaticallyWhen});let i={...r,onToolCall:e=>{var t,r;return null==(r=(t=n.current).onToolCall)?void 0:r.call(t,e)},onData:e=>{var t,r;return null==(r=(t=n.current).onData)?void 0:r.call(t,e)},onFinish:e=>{var t,r;return null==(r=(t=n.current).onFinish)?void 0:r.call(t,e)},onError:e=>{var t,r;return null==(r=(t=n.current).onError)?void 0:r.call(t,e)},sendAutomaticallyWhen:e=>{var t,r,i;return null!=(i=null==(r=(t=n.current).sendAutomaticallyWhen)?void 0:r.call(t,e))&&i}},a=(0,ek.useRef)("chat"in r?r.chat:new LX(i));("chat"in r&&r.chat!==a.current||"id"in r&&a.current.id!==r.id)&&(a.current="chat"in r?r.chat:new LX(i));let o=(0,ek.useCallback)(t=>a.current["~registerMessagesCallback"](t,e),[e,a.current.id]),s=(0,ek.useSyncExternalStore)(o,()=>a.current.messages,()=>a.current.messages),l=(0,ek.useSyncExternalStore)(a.current["~registerStatusCallback"],()=>a.current.status,()=>a.current.status),u=(0,ek.useSyncExternalStore)(a.current["~registerErrorCallback"],()=>a.current.error,()=>a.current.error),d=(0,ek.useCallback)(e=>{"function"==typeof e&&(e=e(a.current.messages)),a.current.messages=e},[a]);return(0,ek.useEffect)(()=>{t&&a.current.resumeStream()},[t,a]),{id:a.current.id,messages:s,setMessages:d,sendMessage:a.current.sendMessage,regenerate:a.current.regenerate,clearError:a.current.clearError,stop:a.current.stop,error:u,resumeStream:a.current.resumeStream,status:l,addToolResult:a.current.addToolOutput,addToolOutput:a.current.addToolOutput,addToolApprovalResponse:a.current.addToolApprovalResponse}}({...l,id:d,transport:u}),m=((e,{adapters:t,toCreateMessage:r,cancelPendingToolCallsOnSend:n=!0,onResume:i,suggestions:a}={})=>{let o=gi(),[s,l]=(0,ek.useState)({}),u=(0,ek.useRef)(new Map),d=(0,ek.useRef)(new Map),c=(0,ek.useRef)(new Map),p=(0,ek.useRef)(void 0),m=Object.values(s).some(e=>e?.type==="executing"),f="submitted"===e.status||"streaming"===e.status||m,h=((e,t)=>{let[r,n]=(0,ek.useState)({}),i=(0,ek.useRef)(null);return(0,ek.useEffect)(()=>{let r=e.findLast(e=>"assistant"===e.role);if(t&&r){i.current&&i.current.messageId===r.id||(i.current={messageId:r.id,startTime:Date.now(),lastContentLength:0,totalChunks:0});let e=i.current,t=function(e){if(!e?.parts)return 0;let t=0;for(let r of e.parts)"text"===r.type&&(t+=r.text.length);return t}(r);t>e.lastContentLength&&(void 0===e.firstTokenTime&&(e.firstTokenTime=Date.now()-e.startTime),e.totalChunks++,e.lastContentLength=t)}else if(!t&&i.current){let e=i.current,t=Date.now()-e.startTime,a=Math.ceil(e.lastContentLength/4),o=function(e){if(!e?.parts)return 0;let t=0;for(let r of e.parts)UX(r)&&t++;return t}(r),s={streamStartTime:e.startTime,totalStreamTime:t,totalChunks:e.totalChunks,toolCallCount:o,...void 0!==e.firstTokenTime&&{firstTokenTime:e.firstTokenTime},...a>0&&{tokenCount:a},...t>0&&a>0&&{tokensPerSecond:a/(t/1e3)}};n(t=>({...t,[e.messageId]:s})),i.current=null}},[e,t]),r})(e.messages,f),g=Zm.useThreadMessages({isRunning:f,messages:e.messages,metadata:(0,ek.useMemo)(()=>({toolStatuses:s,messageTiming:h,toolArgsKeyOrderCache:u.current,toolLastInputCache:d.current,mcpAppMetadataCache:c.current,...e.error&&{error:e.error.message}}),[s,h,e.error])}),[v]=(0,ek.useState)(()=>({get current(){return w}})),y=vs({state:{messages:g,isRunning:f},getTools:()=>v.current.thread.getModelContext().tools,onResult:t=>{if("add-tool-result"===t.type){var r;let n=void 0!==t.modelContent?(r=t.result,{[Zc]:t.modelContent,value:r}):t.result;e.addToolResult({tool:t.toolName,toolCallId:t.toolCallId,output:n,options:{metadata:p.current}})}},setToolStatuses:l}),b=((e,t,r,n,i)=>{let a=(0,ek.useRef)(!1),o=tU(),s=(0,ek.useCallback)(()=>o.threadListItem.source?o.threadListItem():null,[o]),[l,u]=(0,ek.useState)(!1),d=(0,ek.useRef)(new Set),c=(0,ek.useRef)(i);(0,ek.useEffect)(()=>{c.current=i});let p=(0,ek.useMemo)(()=>{if(t){if(!t.withFormat)throw Error("useAISDKRuntime: ThreadHistoryAdapter is missing the required `withFormat` method.");return t.withFormat(n)}},[t,n]);(0,ek.useEffect)(()=>{if(!p||a.current)return;let t=async()=>{u(!0);try{let t=await p.load();if(t&&t.messages.length>0){let n=Zh(r,t);e.current.thread.import(n);let i=new hf;i.import(n);let a=i.getMessages();c.current(a.flatMap(hw)),d.current=new Set(n.messages.map(e=>e.message.id))}}catch(e){console.error("Failed to load message history:",e)}finally{u(!1)}};(a.current=!0,s()?.getState().remoteId)?t():u(!1)},[p,r,e,s]);let m=(0,ek.useRef)(null),f=(0,ek.useRef)(null),h=(0,ek.useRef)([]),g=(0,ek.useRef)(!1),v=(0,ek.useRef)(0);return(0,ek.useEffect)(()=>{if(!p)return;let t=e.current.thread.subscribe(()=>{let{isRunning:t}=e.current.thread.getState(),r=g.current;if(g.current=t,null!=m.current){let t=e.current.thread.getState().messages.at(-1);if(t?.role==="assistant"){let e=t.content.filter(e=>"tool-call"===e.type).length;for(;v.current<e;)h.current.push(Date.now()-m.current),v.current++}}if(t){null==m.current&&(m.current=Date.now(),h.current=[],v.current=0),f.current&&(clearTimeout(f.current),f.current=null);return}r&&(null!=m.current&&h.current.push(Date.now()-m.current),f.current&&clearTimeout(f.current),f.current=setTimeout(async()=>{f.current=null;let t=e.current.thread.getState();if(t.isRunning)return;let r=h.current,i=r.length>0?r.at(-1):void 0;if(1===r.length&&null!=i){let e=t.messages.findLast(e=>"assistant"===e.role);if(e){let t=e.content.filter(e=>"tool-call"===e.type).length;if(t>0){let e=t+1,n=i/e;r.length=0;for(let t=0;t<e;t++)r.push(Math.round((t+1)*n))}}}let a=r.length>1?r.map((e,t)=>({start_ms:0===t?0:r[t-1],end_ms:e})):void 0;m.current=null,h.current=[];let o={...null!=i?{durationMs:i}:void 0,...null!=a?{stepTimestamps:a}:void 0},{messages:s}=t,l=null,u=e=>e.length>0?n.getId(e.at(-1)):null,c=e=>e.map((t,r)=>({parentId:0===r?l:n.getId(e[r-1]),message:t}));for(let e of s){let t=hw(e);if(void 0!==e.status&&"complete"!==e.status.type&&"incomplete"!==e.status.type){l=u(t)??l;continue}if(d.current.has(e.id)){if(void 0!==i){let e=l;for(let r of t){try{await p.update?.({parentId:e,message:r},n.getId(r))}catch{}e=n.getId(r)}}l=u(t)??l;continue}d.current.add(e.id);let r=c(t);for(let e of r)await p.append(e);l=u(t)??l,p.reportTelemetry?.(r,o)}},0))});return()=>{t(),f.current&&(clearTimeout(f.current),f.current=null)}},[p,n,e]),l})(v,t?.history??o?.history,Zm.toThreadMessages,Zf,t=>{e.setMessages(t)}),x=async()=>{n&&(await y.abort(),e.setMessages(e=>{let t=e.at(-1);if(t?.role!=="assistant")return e;let r=!1,n=t.parts?.map(e=>UX(e)&&"output-available"!==e.state&&"output-error"!==e.state?(r=!0,{...e,state:"output-error",errorText:"User cancelled tool call by sending a new message."}):e);return r?[...e.slice(0,-1),{...t,parts:n}]:e}))},w=(e=>{let[t]=(0,ek.useState)(()=>new Zt(e));(0,ek.useEffect)(()=>{t.setAdapter(e)});let{modelContext:r}=gi()??{};return(0,ek.useEffect)(()=>{if(r)return t.registerModelContextProvider(r)},[r,t]),(0,ek.useMemo)(()=>new hB(t),[t])})({isRunning:f,messages:g,setMessages:t=>e.setMessages(t.map(Za).filter(Boolean).flat()),onImport:t=>e.setMessages(t.map(Za).filter(Boolean).flat()),onExportExternalState:()=>{let e=v.current.thread.export(),t=[],r=new Map;for(let n of e.messages){let e=hw(n.message),i=null!=n.parentId?r.get(n.parentId)??n.parentId:null;for(let r of e)t.push({parentId:i,message:r}),i=Zf.getId(r);e.length>0&&r.set(n.message.id,Zf.getId(e[e.length-1]))}let n={messages:t};return null!=e.headId&&(n.headId=r.get(e.headId)??e.headId),n},onLoadExternalState:e=>{let t=Zh(Zm.toThreadMessages,e);v.current.thread.import(t)},onCancel:async()=>{e.stop(),await y.abort()},onNew:async t=>{let n=(r??Zn)(t);t.startRun??"user"===t.role?(p.current=t.runConfig,await x(),await e.sendMessage(n,{metadata:t.runConfig})):e.setMessages(e=>[...e,Zg(n,t.role)])},onEdit:async t=>{let n=(r??Zn)(t);t.startRun??"user"===t.role?(p.current=t.runConfig,e.setMessages(e=>Zr(e,t.parentId)),await e.sendMessage(n,{metadata:t.runConfig})):e.setMessages(e=>[...Zr(e,t.parentId),Zg(n,t.role)])},onReload:async(t,r)=>{p.current=r.runConfig;let n=Zr(e.messages,t);e.setMessages(n),await e.regenerate({metadata:r.runConfig})},onAddToolResult:({toolCallId:t,result:r,isError:n})=>{let i={metadata:p.current};n?e.addToolOutput({state:"output-error",tool:t,toolCallId:t,errorText:"string"==typeof r?r:JSON.stringify(r),options:i}):e.addToolOutput({state:"output-available",tool:t,toolCallId:t,output:r,options:i})},onResumeToolCall:e=>y.resume(e.toolCallId,e.payload),...i&&{onResume:i},...a&&{suggestions:a},adapters:{attachments:Zi,...o,...t},isLoading:b});return w})(p,{adapters:n,...a&&{toCreateMessage:a},...o&&{onResume:o},...s&&{suggestions:s}});u instanceof Lt&&(u.setRuntime(m),u.__internal_setGetThreadListItem(()=>c.threadListItem.source?c.threadListItem():void 0));let f=(0,ek.useRef)(!1);return(0,ek.useEffect)(()=>{if(f.current)return;let e=(e=>{if(e instanceof Lt)return e.getResumableAdapter();let t=e.getResumableAdapter;if("function"==typeof t)return t.call(e)})(u);!e||e.storage.getStreamId()&&(f.current=!0,p.resumeStream().catch(t=>{console.warn("[assistant-ui] resumable: resume failed; clearing stored stream id",t),e.storage.clear()}))},[u,p]),m})(t)},adapter:(e=>{let t=(0,ek.useRef)(e);(0,ek.useEffect)(()=>{t.current=e},[e]);let r=(0,ek.useCallback)(function({children:e}){let r=function(e){let t=tU(),[r]=(0,ek.useState)(()=>new gZ(e,t));return r}({get current(){return t.current.cloud??g0}}),n=t.current.cloud??g0,i=(0,ek.useMemo)(()=>new gX(n),[n]),a=(0,ek.useMemo)(()=>({history:r,attachments:i}),[r,i]);return(0,ew.jsx)(gn,{adapters:a,children:e})},[]),n=e.cloud??g0;if(!n){let e=new gO;return e.initialize=async e=>{let r=await t.current.create?.();return{remoteId:e,externalId:r?.externalId}},e}return{list:async()=>{let{threads:e}=await n.threads.list();return{threads:e.map(e=>({status:e.is_archived?"archived":"regular",remoteId:e.id,title:e.title,externalId:e.external_id??void 0}))}},initialize:async()=>{let t=e.create?.()??Promise.resolve(),r=await t,i=r?r.externalId:void 0,{thread_id:a}=await n.threads.create({last_message_at:new Date,external_id:i});return{externalId:i,remoteId:a}},rename:async(e,t)=>n.threads.update(e,{title:t}),archive:async e=>n.threads.update(e,{is_archived:!0}),unarchive:async e=>n.threads.update(e,{is_archived:!1}),delete:async t=>(await e.delete?.(t),n.threads.delete(t)),generateTitle:async(e,t)=>{let r=t.map(e=>({...e,content:e.content.filter(e=>"text"===e.type||"tool-call"===e.type)}));return n.runs.stream({thread_id:e,assistant_id:"system/thread_title",messages:r})},fetch:async e=>{let t=await n.threads.get(e);return{status:t.is_archived?"archived":"regular",remoteId:t.id,title:t.title,externalId:t.external_id??void 0}},unstable_Provider:r}})({cloud:e}),allowNesting:!0}))({sendAutomaticallyWhen:U8,toCreateMessage:f,transport:new Lt({api:a1.chatUrl(),resumable:{storage:(e={key:Zk({workspacePath:d,provider:p,threadId:a})},n=e?.key??"aui-resumable-stream-id",{getStreamId:()=>"u"<typeof window?null:window.sessionStorage.getItem(n),setStreamId(e){"u">typeof window&&window.sessionStorage.setItem(n,e)},clear(){"u">typeof window&&window.sessionStorage.removeItem(n)}}),resumeApi:e=>a1.chatResumeUrl(e,{threadId:a,provider:p,workspacePath:d??null})},fetch:async(e,t)=>{let n=function(e){var t;if(t=e.status,!Zv.has(t)||!e.body)return e;try{e.body.cancel().catch(()=>{})}catch{}let r=new Headers(e.headers);return r.delete("content-length"),r.delete("transfer-encoding"),new Response(null,{headers:r,status:e.status,statusText:e.statusText})}(await fetch(e,t)),i=n.headers.get("x-acp-provider")??r??Zw,a=n.headers.get("x-acp-thread-id"),o=a?decodeURIComponent(a):null;return o&&function({provider:e,threadId:t,workspacePath:r}){window.dispatchEvent(new CustomEvent(l3,{detail:{provider:e,threadId:t,workspacePath:r??null}}))}({provider:i,threadId:o,workspacePath:d}),n},body:()=>{let e;return{provider:r??Zw,model:o??null,modeId:s,thoughtLevel:l??null,permissionMode:u,workspacePath:d??null,builtinTools:(e=aM(c),aA.filter(t=>t.isEnabled?.(e[t.id])??!0).map(e=>e.id)),builtinToolSettings:c,context:m.current.shift()??null}}})})}})}({context:n,threadId:r}),l=i.startsWith("/thread/"),u=FZ(r),d=ZO({workspacePath:n.workspacePath,defaultWorkspacePath:e}),c=(0,ek.useCallback)(e=>{e.preventDefault(),a.replace(d)},[d,a]);return(0,ew.jsxs)(rm,{runtime:s,children:[(0,ew.jsx)(ZH,{defaultWorkspacePath:e,initialThreadId:r}),(0,ew.jsx)(Z1,{}),(0,ew.jsx)(Z9,{}),(0,ew.jsx)(Fr,{}),(0,ew.jsx)(FL,{}),(0,ew.jsx)(ZV,{}),(0,ew.jsx)(ZG,{}),(0,ew.jsx)(Fm,{}),(0,ew.jsx)(Fk,{}),(0,ew.jsx)(se,{children:(0,ew.jsx)(IJ,{children:(0,ew.jsxs)("div",{className:"flex h-dvh w-full pr-0.5",children:[(0,ew.jsx)(I6,{workspacePath:n.workspacePath,workspaceTitle:t,openInNewWindowHref:o,localNewThreadHref:u?d:null,onNewThreadClick:u?c:void 0}),(0,ew.jsxs)(IY,{className:"relative",children:[(0,ew.jsxs)("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-20 flex items-start justify-between px-3 pt-2 md:px-4 md:pt-3",children:[(0,ew.jsxs)("div",{className:"pointer-events-auto flex items-center gap-1.5",children:[(0,ew.jsx)(IK,{className:"size-8 rounded-lg bg-background/80 backdrop-blur-sm hover:bg-accent [&_svg]:size-4"}),(0,ew.jsx)(FV,{localNewThreadHref:u?d:null,onClick:u?c:void 0})]}),(0,ew.jsx)("div",{className:"pointer-events-auto",children:(0,ew.jsx)(st,{})})]}),(0,ew.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,ew.jsx)(sr,{children:(0,ew.jsx)(_G,{isHistoryRoute:l})})})]})]})})})]})};function FB(e){try{if(window.parent===window)return null}catch{}return e}let FV=({localNewThreadHref:e,onClick:t})=>{let r=(0,ew.jsx)(r9,{tooltip:"新建对话","aria-label":"新建对话",className:"size-8 rounded-lg bg-background/80 p-0 backdrop-blur-sm hover:bg-accent [&_svg]:size-4",onClick:t,children:(0,ew.jsx)(rV,{className:"size-4"})});return e?r:(0,ew.jsx)(rz.New,{asChild:!0,children:r})};e.s(["Assistant",0,({defaultWorkspacePath:e,workspaceName:t,defaultProvider:r,initialThreadId:n})=>{let i=(0,rq.useSearchParams)(),a=function(e){for(let t of ZN){let r=(function(e,t){if(!e)return null;if("get"in e&&"function"==typeof e.get)return e.get(t);let r=e[t];return Array.isArray(r)?r[0]??null:r??null})(e,t)?.trim();if(r)return r}return null}(i)??e,o=as(r??i.get("provider")),s=FZ(n)?n:"default";return(0,ew.jsx)(aV,{workspacePath:a,defaultProvider:o,children:(0,ew.jsx)(FF,{defaultWorkspacePath:e,workspaceName:t,initialThreadId:n},`${a}:${o}:${s}`)})}],63454)}]);
|