@tonyclaw/agent-inspector 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{CompareDrawer-D5A4bTfV.js → CompareDrawer-3nRwtk8J.js} +1 -1
  3. package/.output/public/assets/ProxyViewerContainer-CbW5VRER.js +101 -0
  4. package/.output/public/assets/ReplayDialog-Cl62N9PI.js +1 -0
  5. package/.output/public/assets/RequestAnatomy-DgQWGvjs.js +1 -0
  6. package/.output/public/assets/ResponseView-Cvc-ct4E.js +1 -0
  7. package/.output/public/assets/StreamingChunkSequence-BCQaCAIe.js +1 -0
  8. package/.output/public/assets/_sessionId-CcD_aLGq.js +1 -0
  9. package/.output/public/assets/index-B_dffD3u.js +1 -0
  10. package/.output/public/assets/index-CX796gvi.css +1 -0
  11. package/.output/public/assets/{json-viewer-BbU0n8eM.js → json-viewer-IXejqXB0.js} +1 -1
  12. package/.output/public/assets/{main-CZT_F-gu.js → main-2NlGzgOe.js} +2 -2
  13. package/.output/server/_libs/lucide-react.mjs +181 -114
  14. package/.output/server/{_sessionId-B-s9P7fJ.mjs → _sessionId-DWCTasJU.mjs} +3 -3
  15. package/.output/server/_ssr/{CompareDrawer-C08L3UOO.mjs → CompareDrawer-DhrN1uC2.mjs} +6 -6
  16. package/.output/server/_ssr/{ProxyViewerContainer-CMWl3Ijy.mjs → ProxyViewerContainer-DRl51s_n.mjs} +910 -186
  17. package/.output/server/_ssr/{ReplayDialog-CPDo9_G5.mjs → ReplayDialog-BQT_ygxC.mjs} +240 -14
  18. package/.output/server/_ssr/{RequestAnatomy-D9wt_K1E.mjs → RequestAnatomy-DS2tZOgq.mjs} +5 -5
  19. package/.output/server/_ssr/{ResponseView-DXaL7nY3.mjs → ResponseView-e0kL2C3x.mjs} +25 -21
  20. package/.output/server/_ssr/{StreamingChunkSequence-B_hudZyb.mjs → StreamingChunkSequence-BJG-m7xs.mjs} +3 -3
  21. package/.output/server/_ssr/{index-CuE_BN86.mjs → index-Dea3OeRw.mjs} +2 -2
  22. package/.output/server/_ssr/index.mjs +2 -2
  23. package/.output/server/_ssr/{json-viewer-Ci6kkjde.mjs → json-viewer-DDU55MLK.mjs} +3 -3
  24. package/.output/server/_ssr/{router-BemxgIg7.mjs → router-Dl7oh0zx.mjs} +164 -82
  25. package/.output/server/_tanstack-start-manifest_v-m-FJNBVf.mjs +4 -0
  26. package/.output/server/index.mjs +70 -70
  27. package/package.json +1 -1
  28. package/src/components/OnboardingBanner.tsx +11 -19
  29. package/src/components/ProxyViewer.tsx +26 -16
  30. package/src/components/ProxyViewerContainer.tsx +2 -1
  31. package/src/components/providers/ProviderCard.tsx +6 -20
  32. package/src/components/providers/SettingsDialog.tsx +140 -3
  33. package/src/components/proxy-viewer/AgentTraceSummary.tsx +731 -72
  34. package/src/components/proxy-viewer/AnswerMarkdown.tsx +16 -0
  35. package/src/components/proxy-viewer/CompareDrawer.tsx +4 -2
  36. package/src/components/proxy-viewer/ConversationGroup.tsx +12 -0
  37. package/src/components/proxy-viewer/ConversationHeader.tsx +6 -6
  38. package/src/components/proxy-viewer/LogEntry.tsx +5 -5
  39. package/src/components/proxy-viewer/LogEntryHeader.tsx +21 -36
  40. package/src/components/proxy-viewer/ReplayDialog.tsx +190 -8
  41. package/src/components/proxy-viewer/ResponseView.tsx +4 -8
  42. package/src/components/proxy-viewer/ToolTraceEvents.tsx +37 -17
  43. package/src/components/proxy-viewer/TurnGroup.tsx +18 -2
  44. package/src/components/proxy-viewer/anatomy/SegmentBar.tsx +2 -2
  45. package/src/components/proxy-viewer/formats/anthropic/ContentBlocks.tsx +6 -12
  46. package/src/components/proxy-viewer/formats/anthropic/ResponseView.tsx +2 -2
  47. package/src/components/proxy-viewer/formats/openai/ResponseView.tsx +10 -14
  48. package/src/components/proxy-viewer/replayComparison.ts +131 -0
  49. package/src/components/proxy-viewer/useKeyboardNavigation.ts +64 -22
  50. package/src/components/proxy-viewer/viewerState.ts +14 -2
  51. package/src/knowledge/candidateStore.ts +32 -1
  52. package/src/lib/runtimeConfig.ts +6 -0
  53. package/src/lib/timeDisplay.ts +22 -0
  54. package/src/lib/useOnboarding.ts +2 -0
  55. package/src/lib/useStripConfig.ts +16 -0
  56. package/src/proxy/config.ts +3 -0
  57. package/src/routes/api/config.ts +5 -1
  58. package/src/routes/api/knowledge.candidates.$candidateId.ts +50 -0
  59. package/src/routes/api/knowledge.sessions.$sessionId.candidates.ts +12 -2
  60. package/.output/public/assets/ProxyViewerContainer-Da0jpBkp.js +0 -101
  61. package/.output/public/assets/ReplayDialog-CxUk_TF0.js +0 -1
  62. package/.output/public/assets/RequestAnatomy-DIlzjgjJ.js +0 -1
  63. package/.output/public/assets/ResponseView-DQCuKJ1G.js +0 -1
  64. package/.output/public/assets/StreamingChunkSequence-DHk4SGGL.js +0 -1
  65. package/.output/public/assets/_sessionId-dY1TTl7N.js +0 -1
  66. package/.output/public/assets/index-D7wwbwly.css +0 -1
  67. package/.output/public/assets/index-FqQZbfl2.js +0 -1
  68. package/.output/server/_tanstack-start-manifest_v--L1_b4sd.mjs +0 -4
@@ -0,0 +1,101 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompareDrawer-3nRwtk8J.js","assets/main-2NlGzgOe.js","assets/json-viewer-IXejqXB0.js","assets/ReplayDialog-Cl62N9PI.js","assets/ResponseView-Cvc-ct4E.js","assets/RequestAnatomy-DgQWGvjs.js","assets/StreamingChunkSequence-BCQaCAIe.js"])))=>i.map(i=>d[i]);
2
+ import{u as to,a as ja,r as v,j as i,c as Yn,g as gd,b as Un,d as He,e as Na,f as xd,h as vd,_ as $t}from"./main-2NlGzgOe.js";function G(e,t,n){function r(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,c);const u=a.prototype,d=Object.keys(u);for(let p=0;p<d.length;p++){const g=d[p];g in l||(l[g]=u[g].bind(l))}}const s=n?.Parent??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function a(l){var c;const u=n?.Parent?new o:this;r(u,l),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>n?.Parent&&l instanceof n.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class nn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ea extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Ta={};function kt(e){return Ta}function Aa(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,s])=>t.indexOf(+r)===-1).map(([r,s])=>s)}function Ns(e,t){return typeof t=="bigint"?t.toString():t}function Pr(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function no(e){return e==null}function ro(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function yd(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let s=(r.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c?.[1]&&(s=Number.parseInt(c[1]))}const o=n>s?n:s,a=Number.parseInt(e.toFixed(o).replace(".","")),l=Number.parseInt(t.toFixed(o).replace(".",""));return a%l/10**o}const qo=Symbol("evaluating");function ke(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==qo)return r===void 0&&(r=qo,r=n()),r},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function Bt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Tt(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Ko(e){return JSON.stringify(e)}function bd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const za="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function In(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const wd=Pr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ln(e){if(In(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(In(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Oa(e){return ln(e)?{...e}:Array.isArray(e)?[...e]:e}const _d=new Set(["string","number","symbol"]);function cn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function At(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function de(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function kd(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Cd={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Sd(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const o=Tt(e._zod.def,{get shape(){const a={};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(a[l]=n.shape[l])}return Bt(this,"shape",a),a},checks:[]});return At(e,o)}function jd(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const o=Tt(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete a[l]}return Bt(this,"shape",a),a},checks:[]});return At(e,o)}function Nd(e,t){if(!ln(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const o=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=Tt(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return Bt(this,"shape",o),o}});return At(e,s)}function Ed(e,t){if(!ln(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Tt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Bt(this,"shape",r),r}});return At(e,n)}function Td(e,t){const n=Tt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Bt(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return At(e,n)}function Ad(e,t,n){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=Tt(t._zod.def,{get shape(){const l=t._zod.def.shape,c={...l};if(n)for(const u in n){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:l[u]}):l[u])}else for(const u in l)c[u]=e?new e({type:"optional",innerType:l[u]}):l[u];return Bt(this,"shape",c),c},checks:[]});return At(t,a)}function zd(e,t,n){const r=Tt(t._zod.def,{get shape(){const s=t._zod.def.shape,o={...s};if(n)for(const a in n){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(o[a]=new e({type:"nonoptional",innerType:s[a]}))}else for(const a in s)o[a]=new e({type:"nonoptional",innerType:s[a]});return Bt(this,"shape",o),o}});return At(t,r)}function en(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function tn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Xn(e){return typeof e=="string"?e:e?.message}function Ct(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const s=Xn(e.inst?._zod.def?.error?.(e))??Xn(t?.error?.(e))??Xn(n.customError?.(e))??Xn(n.localeError?.(e))??"Invalid input";r.message=s}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function so(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Rn(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Ia=(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,Ns,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ra=G("$ZodError",Ia),Pa=G("$ZodError",Ia,{Parent:Error});function Od(e,t=n=>n.message){const n={},r=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):r.push(t(s));return{formErrors:r,fieldErrors:n}}function Id(e,t=n=>n.message){const n={_errors:[]},r=s=>{for(const o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>r({issues:a}));else if(o.code==="invalid_key")r({issues:o.issues});else if(o.code==="invalid_element")r({issues:o.issues});else if(o.path.length===0)n._errors.push(t(o));else{let a=n,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return r(e),n}const oo=e=>(t,n,r,s)=>{const o=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new nn;if(a.issues.length){const l=new(s?.Err??e)(a.issues.map(c=>Ct(c,o,kt())));throw za(l,s?.callee),l}return a.value},io=e=>async(t,n,r,s)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const l=new(s?.Err??e)(a.issues.map(c=>Ct(c,o,kt())));throw za(l,s?.callee),l}return a.value},Mr=e=>(t,n,r)=>{const s=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new nn;return o.issues.length?{success:!1,error:new(e??Ra)(o.issues.map(a=>Ct(a,s,kt())))}:{success:!0,data:o.value}},Rd=Mr(Pa),Dr=e=>async(t,n,r)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>Ct(a,s,kt())))}:{success:!0,data:o.value}},Pd=Dr(Pa),Md=e=>(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return oo(e)(t,n,s)},Dd=e=>(t,n,r)=>oo(e)(t,n,r),Ld=e=>async(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return io(e)(t,n,s)},Fd=e=>async(t,n,r)=>io(e)(t,n,r),$d=e=>(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Mr(e)(t,n,s)},Bd=e=>(t,n,r)=>Mr(e)(t,n,r),Ud=e=>async(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Dr(e)(t,n,s)},Zd=e=>async(t,n,r)=>Dr(e)(t,n,r),Wd=/^[cC][^\s-]{8,}$/,Vd=/^[0-9a-z]+$/,Hd=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,qd=/^[0-9a-vA-V]{20}$/,Kd=/^[A-Za-z0-9]{27}$/,Jd=/^[a-zA-Z0-9_-]{21}$/,Gd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Yd=/^([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})$/,Jo=e=>e?new 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)$/,Xd=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Qd="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ef(){return new RegExp(Qd,"u")}const tf=/^(?:(?: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])$/,nf=/^(([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}|:))$/,rf=/^((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])$/,sf=/^(([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])$/,of=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ma=/^[A-Za-z0-9_-]*$/,af=/^\+[1-9]\d{6,14}$/,Da="(?:(?:\\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])))",lf=new RegExp(`^${Da}$`);function La(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function cf(e){return new RegExp(`^${La(e)}$`)}function uf(e){const t=La({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Da}T(?:${r})$`)}const df=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ff=/^-?\d+$/,Fa=/^-?\d+(?:\.\d+)?$/,hf=/^(?:true|false)$/i,pf=/^null$/i,mf=/^[^A-Z]*$/,gf=/^[^a-z]*$/,qe=G("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),$a={number:"number",bigint:"bigint",object:"date"},Ba=G("$ZodCheckLessThan",(e,t)=>{qe.init(e,t);const n=$a[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,o=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ua=G("$ZodCheckGreaterThan",(e,t)=>{qe.init(e,t);const n=$a[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,o=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),xf=G("$ZodCheckMultipleOf",(e,t)=>{qe.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):yd(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),vf=G("$ZodCheckNumberFormat",(e,t)=>{qe.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[s,o]=Cd[t.format];e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,l.minimum=s,l.maximum=o,n&&(l.pattern=ff)}),e._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}l<s&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),l>o&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),yf=G("$ZodCheckMaxLength",(e,t)=>{var n;qe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!no(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const s=r.value;if(s.length<=t.maximum)return;const a=so(s);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),bf=G("$ZodCheckMinLength",(e,t)=>{var n;qe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!no(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const s=r.value;if(s.length>=t.minimum)return;const a=so(s);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),wf=G("$ZodCheckLengthEquals",(e,t)=>{var n;qe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!no(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=r=>{const s=r.value,o=s.length;if(o===t.length)return;const a=so(s),l=o>t.length;r.issues.push({origin:a,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Lr=G("$ZodCheckStringFormat",(e,t)=>{var n,r;qe.init(e,t),e._zod.onattach.push(s=>{const o=s._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),_f=G("$ZodCheckRegex",(e,t)=>{Lr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),kf=G("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=mf),Lr.init(e,t)}),Cf=G("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=gf),Lr.init(e,t)}),Sf=G("$ZodCheckIncludes",(e,t)=>{qe.init(e,t);const n=cn(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),jf=G("$ZodCheckStartsWith",(e,t)=>{qe.init(e,t);const n=new RegExp(`^${cn(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),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})}}),Nf=G("$ZodCheckEndsWith",(e,t)=>{qe.init(e,t);const n=new RegExp(`.*${cn(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),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})}}),Ef=G("$ZodCheckOverwrite",(e,t)=>{qe.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Tf{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
3
+ `).filter(a=>a),s=Math.min(...r.map(a=>a.length-a.trimStart().length)),o=r.map(a=>a.slice(s)).map(a=>" ".repeat(this.indent*2)+a);for(const a of o)this.content.push(a)}compile(){const t=Function,n=this?.args,s=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...n,s.join(`
4
+ `))}}const Af={major:4,minor:3,patch:6},Te=G("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Af;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const s of r)for(const o of s._zod.onattach)o(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(a,l,c)=>{let u=en(a),d;for(const p of l){if(p._zod.def.when){if(!p._zod.def.when(a))continue}else if(u)continue;const g=a.issues.length,h=p._zod.check(a);if(h instanceof Promise&&c?.async===!1)throw new nn;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,a.issues.length!==g&&(u||(u=en(a,g)))});else{if(a.issues.length===g)continue;u||(u=en(a,g))}}return d?d.then(()=>a):a},o=(a,l,c)=>{if(en(a))return a.aborted=!0,a;const u=s(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new nn;return u.then(d=>e._zod.parse(d,c))}return e._zod.parse(u,c)};e._zod.run=(a,l)=>{if(l.skipChecks)return e._zod.parse(a,l);if(l.direction==="backward"){const u=e._zod.parse({value:a.value,issues:[]},{...l,skipChecks:!0});return u instanceof Promise?u.then(d=>o(d,a,l)):o(u,a,l)}const c=e._zod.parse(a,l);if(c instanceof Promise){if(l.async===!1)throw new nn;return c.then(u=>s(u,r,l))}return s(c,r,l)}}ke(e,"~standard",()=>({validate:s=>{try{const o=Rd(e,s);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return Pd(e,s).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),ao=G("$ZodString",(e,t)=>{Te.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??df(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Pe=G("$ZodStringFormat",(e,t)=>{Lr.init(e,t),ao.init(e,t)}),zf=G("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Yd),Pe.init(e,t)}),Of=G("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Jo(r))}else t.pattern??(t.pattern=Jo());Pe.init(e,t)}),If=G("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Xd),Pe.init(e,t)}),Rf=G("$ZodURL",(e,t)=>{Pe.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),s=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=s.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Pf=G("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ef()),Pe.init(e,t)}),Mf=G("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Jd),Pe.init(e,t)}),Df=G("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Wd),Pe.init(e,t)}),Lf=G("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Vd),Pe.init(e,t)}),Ff=G("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Hd),Pe.init(e,t)}),$f=G("$ZodXID",(e,t)=>{t.pattern??(t.pattern=qd),Pe.init(e,t)}),Bf=G("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Kd),Pe.init(e,t)}),Uf=G("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=uf(t)),Pe.init(e,t)}),Zf=G("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=lf),Pe.init(e,t)}),Wf=G("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=cf(t)),Pe.init(e,t)}),Vf=G("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Gd),Pe.init(e,t)}),Hf=G("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=tf),Pe.init(e,t),e._zod.bag.format="ipv4"}),qf=G("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=nf),Pe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Kf=G("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=rf),Pe.init(e,t)}),Jf=G("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=sf),Pe.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[s,o]=r;if(!o)throw new Error;const a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Za(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Gf=G("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=of),Pe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Za(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Yf(e){if(!Ma.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Za(n)}const Xf=G("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ma),Pe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Yf(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Qf=G("$ZodE164",(e,t)=>{t.pattern??(t.pattern=af),Pe.init(e,t)});function eh(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const s=JSON.parse(atob(r));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const th=G("$ZodJWT",(e,t)=>{Pe.init(e,t),e._zod.check=n=>{eh(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Wa=G("$ZodNumber",(e,t)=>{Te.init(e,t),e._zod.pattern=e._zod.bag.pattern??Fa,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const o=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...o?{received:o}:{}}),n}}),nh=G("$ZodNumberFormat",(e,t)=>{vf.init(e,t),Wa.init(e,t)}),rh=G("$ZodBoolean",(e,t)=>{Te.init(e,t),e._zod.pattern=hf,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),n}}),sh=G("$ZodNull",(e,t)=>{Te.init(e,t),e._zod.pattern=pf,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const s=n.value;return s===null||n.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),n}}),oh=G("$ZodUnknown",(e,t)=>{Te.init(e,t),e._zod.parse=n=>n}),ih=G("$ZodNever",(e,t)=>{Te.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Go(e,t,n){e.issues.length&&t.issues.push(...tn(n,e.issues)),t.value[n]=e.value}const ah=G("$ZodArray",(e,t)=>{Te.init(e,t),e._zod.parse=(n,r)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const o=[];for(let a=0;a<s.length;a++){const l=s[a],c=t.element._zod.run({value:l,issues:[]},r);c instanceof Promise?o.push(c.then(u=>Go(u,n,a))):Go(c,n,a)}return o.length?Promise.all(o).then(()=>n):n}});function xr(e,t,n,r,s){if(e.issues.length){if(s&&!(n in r))return;t.issues.push(...tn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Va(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=kd(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ha(e,t,n,r,s,o){const a=[],l=s.keySet,c=s.catchall._zod,u=c.def.type,d=c.optout==="optional";for(const p in t){if(l.has(p))continue;if(u==="never"){a.push(p);continue}const g=c.run({value:t[p],issues:[]},r);g instanceof Promise?e.push(g.then(h=>xr(h,n,p,t,d))):xr(g,n,p,t,d)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const lh=G("$ZodObject",(e,t)=>{if(Te.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const l=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...l};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=Pr(()=>Va(t));ke(e._zod,"propValues",()=>{const l=t.shape,c={};for(const u in l){const d=l[u]._zod;if(d.values){c[u]??(c[u]=new Set);for(const p of d.values)c[u].add(p)}}return c});const s=In,o=t.catchall;let a;e._zod.parse=(l,c)=>{a??(a=r.value);const u=l.value;if(!s(u))return l.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),l;l.value={};const d=[],p=a.shape;for(const g of a.keys){const h=p[g],x=h._zod.optout==="optional",f=h._zod.run({value:u[g],issues:[]},c);f instanceof Promise?d.push(f.then(m=>xr(m,l,g,u,x))):xr(f,l,g,u,x)}return o?Ha(d,u,l,c,r.value,e):d.length?Promise.all(d).then(()=>l):l}}),ch=G("$ZodObjectJIT",(e,t)=>{lh.init(e,t);const n=e._zod.parse,r=Pr(()=>Va(t)),s=g=>{const h=new Tf(["shape","payload","ctx"]),x=r.value,f=k=>{const C=Ko(k);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};h.write("const input = payload.value;");const m=Object.create(null);let y=0;for(const k of x.keys)m[k]=`key_${y++}`;h.write("const newResult = {};");for(const k of x.keys){const C=m[k],S=Ko(k),N=g[k]?._zod?.optout==="optional";h.write(`const ${C} = ${f(k)};`),N?h.write(`
5
+ if (${C}.issues.length) {
6
+ if (${S} in input) {
7
+ payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
8
+ ...iss,
9
+ path: iss.path ? [${S}, ...iss.path] : [${S}]
10
+ })));
11
+ }
12
+ }
13
+
14
+ if (${C}.value === undefined) {
15
+ if (${S} in input) {
16
+ newResult[${S}] = undefined;
17
+ }
18
+ } else {
19
+ newResult[${S}] = ${C}.value;
20
+ }
21
+
22
+ `):h.write(`
23
+ if (${C}.issues.length) {
24
+ payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
25
+ ...iss,
26
+ path: iss.path ? [${S}, ...iss.path] : [${S}]
27
+ })));
28
+ }
29
+
30
+ if (${C}.value === undefined) {
31
+ if (${S} in input) {
32
+ newResult[${S}] = undefined;
33
+ }
34
+ } else {
35
+ newResult[${S}] = ${C}.value;
36
+ }
37
+
38
+ `)}h.write("payload.value = newResult;"),h.write("return payload;");const w=h.compile();return(k,C)=>w(g,k,C)};let o;const a=In,l=!Ta.jitless,u=l&&wd.value,d=t.catchall;let p;e._zod.parse=(g,h)=>{p??(p=r.value);const x=g.value;return a(x)?l&&u&&h?.async===!1&&h.jitless!==!0?(o||(o=s(t.shape)),g=o(g,h),d?Ha([],x,g,h,p,e):g):n(g,h):(g.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),g)}});function Yo(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const s=e.filter(o=>!en(o));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(a=>Ct(a,r,kt())))}),t)}const qa=G("$ZodUnion",(e,t)=>{Te.init(e,t),ke(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),ke(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),ke(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),ke(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${s.map(o=>ro(o.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(s,o)=>{if(n)return r(s,o);let a=!1;const l=[];for(const c of t.options){const u=c._zod.run({value:s.value,issues:[]},o);if(u instanceof Promise)l.push(u),a=!0;else{if(u.issues.length===0)return u;l.push(u)}}return a?Promise.all(l).then(c=>Yo(c,s,e,o)):Yo(l,s,e,o)}}),uh=G("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,qa.init(e,t);const n=e._zod.parse;ke(e._zod,"propValues",()=>{const s={};for(const o of t.options){const a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const[l,c]of Object.entries(a)){s[l]||(s[l]=new Set);for(const u of c)s[l].add(u)}}return s});const r=Pr(()=>{const s=t.options,o=new Map;for(const a of s){const l=a._zod.propValues?.[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const c of l){if(o.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);o.set(c,a)}}return o});e._zod.parse=(s,o)=>{const a=s.value;if(!In(a))return s.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),s;const l=r.value.get(a?.[t.discriminator]);return l?l._zod.run(s,o):t.unionFallback?n(s,o):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),s)}}),dh=G("$ZodIntersection",(e,t)=>{Te.init(e,t),e._zod.parse=(n,r)=>{const s=n.value,o=t.left._zod.run({value:s,issues:[]},r),a=t.right._zod.run({value:s,issues:[]},r);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([c,u])=>Xo(n,c,u)):Xo(n,o,a)}});function Es(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ln(e)&&ln(t)){const n=Object.keys(t),r=Object.keys(e).filter(o=>n.indexOf(o)!==-1),s={...e,...t};for(const o of r){const a=Es(e[o],t[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};s[o]=a.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const s=e[r],o=t[r],a=Es(s,o);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Xo(e,t,n){const r=new Map;let s;for(const l of t.issues)if(l.code==="unrecognized_keys"){s??(s=l);for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(l);for(const l of n.issues)if(l.code==="unrecognized_keys")for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(l);const o=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(o.length&&s&&e.issues.push({...s,keys:o}),en(e))return e;const a=Es(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const fh=G("$ZodRecord",(e,t)=>{Te.init(e,t),e._zod.parse=(n,r)=>{const s=n.value;if(!ln(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;const o=[],a=t.keyType._zod.values;if(a){n.value={};const l=new Set;for(const u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){l.add(typeof u=="number"?u.toString():u);const d=t.valueType._zod.run({value:s[u],issues:[]},r);d instanceof Promise?o.push(d.then(p=>{p.issues.length&&n.issues.push(...tn(u,p.issues)),n.value[u]=p.value})):(d.issues.length&&n.issues.push(...tn(u,d.issues)),n.value[u]=d.value)}let c;for(const u in s)l.has(u)||(c=c??[],c.push(u));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c})}else{n.value={};for(const l of Reflect.ownKeys(s)){if(l==="__proto__")continue;let c=t.keyType._zod.run({value:l,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Fa.test(l)&&c.issues.length){const p=t.keyType._zod.run({value:Number(l),issues:[]},r);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(c=p)}if(c.issues.length){t.mode==="loose"?n.value[l]=s[l]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>Ct(p,r,kt())),input:l,path:[l],inst:e});continue}const d=t.valueType._zod.run({value:s[l],issues:[]},r);d instanceof Promise?o.push(d.then(p=>{p.issues.length&&n.issues.push(...tn(l,p.issues)),n.value[c.value]=p.value})):(d.issues.length&&n.issues.push(...tn(l,d.issues)),n.value[c.value]=d.value)}}return o.length?Promise.all(o).then(()=>n):n}}),hh=G("$ZodEnum",(e,t)=>{Te.init(e,t);const n=Aa(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(s=>_d.has(typeof s)).map(s=>typeof s=="string"?cn(s):s.toString()).join("|")})$`),e._zod.parse=(s,o)=>{const a=s.value;return r.has(a)||s.issues.push({code:"invalid_value",values:n,input:a,inst:e}),s}}),ph=G("$ZodLiteral",(e,t)=>{if(Te.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?cn(r):r?cn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,s)=>{const o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),mh=G("$ZodTransform",(e,t)=>{Te.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Ea(e.constructor.name);const s=t.transform(n.value,n);if(r.async)return(s instanceof Promise?s:Promise.resolve(s)).then(a=>(n.value=a,n));if(s instanceof Promise)throw new nn;return n.value=s,n}});function Qo(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Ka=G("$ZodOptional",(e,t)=>{Te.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ke(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ke(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ro(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(o=>Qo(o,n.value)):Qo(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),gh=G("$ZodExactOptional",(e,t)=>{Ka.init(e,t),ke(e._zod,"values",()=>t.innerType._zod.values),ke(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),xh=G("$ZodNullable",(e,t)=>{Te.init(e,t),ke(e._zod,"optin",()=>t.innerType._zod.optin),ke(e._zod,"optout",()=>t.innerType._zod.optout),ke(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ro(n.source)}|null)$`):void 0}),ke(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),vh=G("$ZodDefault",(e,t)=>{Te.init(e,t),e._zod.optin="optional",ke(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(o=>ei(o,t)):ei(s,t)}});function ei(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const yh=G("$ZodPrefault",(e,t)=>{Te.init(e,t),e._zod.optin="optional",ke(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),bh=G("$ZodNonOptional",(e,t)=>{Te.init(e,t),ke(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(o=>ti(o,e)):ti(s,e)}});function ti(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const wh=G("$ZodCatch",(e,t)=>{Te.init(e,t),ke(e._zod,"optin",()=>t.innerType._zod.optin),ke(e._zod,"optout",()=>t.innerType._zod.optout),ke(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(a=>Ct(a,r,kt()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(o=>Ct(o,r,kt()))},input:n.value}),n.issues=[]),n)}}),_h=G("$ZodPipe",(e,t)=>{Te.init(e,t),ke(e._zod,"values",()=>t.in._zod.values),ke(e._zod,"optin",()=>t.in._zod.optin),ke(e._zod,"optout",()=>t.out._zod.optout),ke(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const o=t.out._zod.run(n,r);return o instanceof Promise?o.then(a=>Qn(a,t.in,r)):Qn(o,t.in,r)}const s=t.in._zod.run(n,r);return s instanceof Promise?s.then(o=>Qn(o,t.out,r)):Qn(s,t.out,r)}});function Qn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const kh=G("$ZodReadonly",(e,t)=>{Te.init(e,t),ke(e._zod,"propValues",()=>t.innerType._zod.propValues),ke(e._zod,"values",()=>t.innerType._zod.values),ke(e._zod,"optin",()=>t.innerType?._zod?.optin),ke(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(ni):ni(s)}});function ni(e){return e.value=Object.freeze(e.value),e}const Ch=G("$ZodLazy",(e,t)=>{Te.init(e,t),ke(e._zod,"innerType",()=>t.getter()),ke(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),ke(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),ke(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),ke(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),Sh=G("$ZodCustom",(e,t)=>{qe.init(e,t),Te.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,s=t.fn(r);if(s instanceof Promise)return s.then(o=>ri(o,n,r,e));ri(s,n,r,e)}});function ri(e,t,n,r){if(!e){const s={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(s.params=r._zod.def.params),t.issues.push(Rn(s))}}var si;class jh{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const s={...r,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Nh(){return new jh}(si=globalThis).__zod_globalRegistry??(si.__zod_globalRegistry=Nh());const An=globalThis.__zod_globalRegistry;function Eh(e,t){return new e({type:"string",...de(t)})}function Th(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...de(t)})}function oi(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...de(t)})}function Ah(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...de(t)})}function zh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...de(t)})}function Oh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...de(t)})}function Ih(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...de(t)})}function Rh(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...de(t)})}function Ph(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...de(t)})}function Mh(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...de(t)})}function Dh(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...de(t)})}function Lh(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...de(t)})}function Fh(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...de(t)})}function $h(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...de(t)})}function Bh(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...de(t)})}function Uh(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...de(t)})}function Zh(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...de(t)})}function Wh(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...de(t)})}function Vh(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...de(t)})}function Hh(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...de(t)})}function qh(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...de(t)})}function Kh(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...de(t)})}function Jh(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...de(t)})}function Gh(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...de(t)})}function Yh(e,t){return new e({type:"string",format:"date",check:"string_format",...de(t)})}function Xh(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...de(t)})}function Qh(e,t){return new e({type:"string",format:"duration",check:"string_format",...de(t)})}function ep(e,t){return new e({type:"number",checks:[],...de(t)})}function tp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...de(t)})}function np(e,t){return new e({type:"boolean",...de(t)})}function rp(e,t){return new e({type:"null",...de(t)})}function sp(e){return new e({type:"unknown"})}function op(e,t){return new e({type:"never",...de(t)})}function ii(e,t){return new Ba({check:"less_than",...de(t),value:e,inclusive:!1})}function ss(e,t){return new Ba({check:"less_than",...de(t),value:e,inclusive:!0})}function ai(e,t){return new Ua({check:"greater_than",...de(t),value:e,inclusive:!1})}function os(e,t){return new Ua({check:"greater_than",...de(t),value:e,inclusive:!0})}function li(e,t){return new xf({check:"multiple_of",...de(t),value:e})}function Ja(e,t){return new yf({check:"max_length",...de(t),maximum:e})}function vr(e,t){return new bf({check:"min_length",...de(t),minimum:e})}function Ga(e,t){return new wf({check:"length_equals",...de(t),length:e})}function ip(e,t){return new _f({check:"string_format",format:"regex",...de(t),pattern:e})}function ap(e){return new kf({check:"string_format",format:"lowercase",...de(e)})}function lp(e){return new Cf({check:"string_format",format:"uppercase",...de(e)})}function cp(e,t){return new Sf({check:"string_format",format:"includes",...de(t),includes:e})}function up(e,t){return new jf({check:"string_format",format:"starts_with",...de(t),prefix:e})}function dp(e,t){return new Nf({check:"string_format",format:"ends_with",...de(t),suffix:e})}function mn(e){return new Ef({check:"overwrite",tx:e})}function fp(e){return mn(t=>t.normalize(e))}function hp(){return mn(e=>e.trim())}function pp(){return mn(e=>e.toLowerCase())}function mp(){return mn(e=>e.toUpperCase())}function gp(){return mn(e=>bd(e))}function xp(e,t,n){return new e({type:"array",element:t,...de(n)})}function vp(e,t,n){return new e({type:"custom",check:"custom",fn:t,...de(n)})}function yp(e){const t=bp(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Rn(r,n.value,t._zod.def));else{const s=r;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),n.issues.push(Rn(s))}},e(n.value,n)));return t}function bp(e,t){const n=new qe({check:"custom",...de(t)});return n._zod.check=e,n}function Ya(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??An,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 Le(e,t,n={path:[],schemaPath:[]}){var r;const s=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const l=e._zod.toJSONSchema?.();if(l)a.schema=l;else{const d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,d);else{const g=a.schema,h=t.processors[s.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);h(e,t,g,d)}const p=e._zod.parent;p&&(a.ref||(a.ref=p),Le(p,t,d),t.seen.get(p).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&Ve(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function Xa(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const a of e.seen.entries()){const l=e.metadataRegistry.get(a[0])?.id;if(l){const c=r.get(l);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${l}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(l,a[0])}}const s=a=>{const l=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const p=e.external.registry.get(a[0])?.id,g=e.external.uri??(x=>x);if(p)return{ref:g(p)};const h=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=h,{defId:h,ref:`${g("__shared")}#/${l}/${h}`}}if(a[1]===n)return{ref:"#"};const u=`#/${l}/`,d=a[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},o=a=>{if(a[1].schema.$ref)return;const l=a[1],{ref:c,defId:u}=s(a);l.def={...l.schema},u&&(l.defId=u);const d=l.schema;for(const p in d)delete d[p];d.$ref=c};if(e.cycles==="throw")for(const a of e.seen.entries()){const l=a[1];if(l.cycle)throw new Error(`Cycle detected: #/${l.cycle?.join("/")}/<root>
39
+
40
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of e.seen.entries()){const l=a[1];if(t===a[0]){o(a);continue}if(e.external){const u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){o(a);continue}}if(e.metadataRegistry.get(a[0])?.id){o(a);continue}if(l.cycle){o(a);continue}if(l.count>1&&e.reused==="ref"){o(a);continue}}}function Qa(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=a=>{const l=e.seen.get(a);if(l.ref===null)return;const c=l.def??l.schema,u={...c},d=l.ref;if(l.ref=null,d){r(d);const g=e.seen.get(d),h=g.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(h)):Object.assign(c,h),Object.assign(c,u),a._zod.parent===d)for(const f in c)f==="$ref"||f==="allOf"||f in u||delete c[f];if(h.$ref&&g.def)for(const f in c)f==="$ref"||f==="allOf"||f in g.def&&JSON.stringify(c[f])===JSON.stringify(g.def[f])&&delete c[f]}const p=a._zod.parent;if(p&&p!==d){r(p);const g=e.seen.get(p);if(g?.schema.$ref&&(c.$ref=g.schema.$ref,g.def))for(const h in c)h==="$ref"||h==="allOf"||h in g.def&&JSON.stringify(c[h])===JSON.stringify(g.def[h])&&delete c[h]}e.override({zodSchema:a,jsonSchema:c,path:l.path??[]})};for(const a of[...e.seen.entries()].reverse())r(a[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(a)}Object.assign(s,n.def??n.schema);const o=e.external?.defs??{};for(const a of e.seen.entries()){const l=a[1];l.def&&l.defId&&(o[l.defId]=l.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const a=JSON.parse(JSON.stringify(s));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:yr(t,"input",e.processors),output:yr(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ve(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ve(r.element,n);if(r.type==="set")return Ve(r.valueType,n);if(r.type==="lazy")return Ve(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Ve(r.innerType,n);if(r.type==="intersection")return Ve(r.left,n)||Ve(r.right,n);if(r.type==="record"||r.type==="map")return Ve(r.keyType,n)||Ve(r.valueType,n);if(r.type==="pipe")return Ve(r.in,n)||Ve(r.out,n);if(r.type==="object"){for(const s in r.shape)if(Ve(r.shape[s],n))return!0;return!1}if(r.type==="union"){for(const s of r.options)if(Ve(s,n))return!0;return!1}if(r.type==="tuple"){for(const s of r.items)if(Ve(s,n))return!0;return!!(r.rest&&Ve(r.rest,n))}return!1}const wp=(e,t={})=>n=>{const r=Ya({...n,processors:t});return Le(e,r),Xa(r,e),Qa(r,e)},yr=(e,t,n={})=>r=>{const{libraryOptions:s,target:o}=r??{},a=Ya({...s??{},target:o,io:t,processors:n});return Le(e,a),Xa(a,e),Qa(a,e)},_p={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},kp=(e,t,n,r)=>{const s=n;s.type="string";const{minimum:o,maximum:a,format:l,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof o=="number"&&(s.minLength=o),typeof a=="number"&&(s.maxLength=a),l&&(s.format=_p[l]??l,s.format===""&&delete s.format,l==="time"&&delete s.format),u&&(s.contentEncoding=u),c&&c.size>0){const d=[...c];d.length===1?s.pattern=d[0].source:d.length>1&&(s.allOf=[...d.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},Cp=(e,t,n,r)=>{const s=n,{minimum:o,maximum:a,format:l,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof l=="string"&&l.includes("int")?s.type="integer":s.type="number",typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=d,s.exclusiveMinimum=!0):s.exclusiveMinimum=d),typeof o=="number"&&(s.minimum=o,typeof d=="number"&&t.target!=="draft-04"&&(d>=o?delete s.minimum:delete s.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.maximum=u,s.exclusiveMaximum=!0):s.exclusiveMaximum=u),typeof a=="number"&&(s.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete s.maximum:delete s.exclusiveMaximum)),typeof c=="number"&&(s.multipleOf=c)},Sp=(e,t,n,r)=>{n.type="boolean"},jp=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Np=(e,t,n,r)=>{n.not={}},Ep=(e,t,n,r)=>{},Tp=(e,t,n,r)=>{const s=e._zod.def,o=Aa(s.entries);o.every(a=>typeof a=="number")&&(n.type="number"),o.every(a=>typeof a=="string")&&(n.type="string"),n.enum=o},Ap=(e,t,n,r)=>{const s=e._zod.def,o=[];for(const a of s.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(a))}else o.push(a);if(o.length!==0)if(o.length===1){const a=o[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else o.every(a=>typeof a=="number")&&(n.type="number"),o.every(a=>typeof a=="string")&&(n.type="string"),o.every(a=>typeof a=="boolean")&&(n.type="boolean"),o.every(a=>a===null)&&(n.type="null"),n.enum=o},zp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Op=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Ip=(e,t,n,r)=>{const s=n,o=e._zod.def,{minimum:a,maximum:l}=e._zod.bag;typeof a=="number"&&(s.minItems=a),typeof l=="number"&&(s.maxItems=l),s.type="array",s.items=Le(o.element,t,{...r,path:[...r.path,"items"]})},Rp=(e,t,n,r)=>{const s=n,o=e._zod.def;s.type="object",s.properties={};const a=o.shape;for(const u in a)s.properties[u]=Le(a[u],t,{...r,path:[...r.path,"properties",u]});const l=new Set(Object.keys(a)),c=new Set([...l].filter(u=>{const d=o.shape[u]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));c.size>0&&(s.required=Array.from(c)),o.catchall?._zod.def.type==="never"?s.additionalProperties=!1:o.catchall?o.catchall&&(s.additionalProperties=Le(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},Pp=(e,t,n,r)=>{const s=e._zod.def,o=s.inclusive===!1,a=s.options.map((l,c)=>Le(l,t,{...r,path:[...r.path,o?"oneOf":"anyOf",c]}));o?n.oneOf=a:n.anyOf=a},Mp=(e,t,n,r)=>{const s=e._zod.def,o=Le(s.left,t,{...r,path:[...r.path,"allOf",0]}),a=Le(s.right,t,{...r,path:[...r.path,"allOf",1]}),l=u=>"allOf"in u&&Object.keys(u).length===1,c=[...l(o)?o.allOf:[o],...l(a)?a.allOf:[a]];n.allOf=c},Dp=(e,t,n,r)=>{const s=n,o=e._zod.def;s.type="object";const a=o.keyType,c=a._zod.bag?.patterns;if(o.mode==="loose"&&c&&c.size>0){const d=Le(o.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});s.patternProperties={};for(const p of c)s.patternProperties[p.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(s.propertyNames=Le(o.keyType,t,{...r,path:[...r.path,"propertyNames"]})),s.additionalProperties=Le(o.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=a._zod.values;if(u){const d=[...u].filter(p=>typeof p=="string"||typeof p=="number");d.length>0&&(s.required=d)}},Lp=(e,t,n,r)=>{const s=e._zod.def,o=Le(s.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=s.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},Fp=(e,t,n,r)=>{const s=e._zod.def;Le(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType},$p=(e,t,n,r)=>{const s=e._zod.def;Le(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},Bp=(e,t,n,r)=>{const s=e._zod.def;Le(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},Up=(e,t,n,r)=>{const s=e._zod.def;Le(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType;let a;try{a=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},Zp=(e,t,n,r)=>{const s=e._zod.def,o=t.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;Le(o,t,r);const a=t.seen.get(e);a.ref=o},Wp=(e,t,n,r)=>{const s=e._zod.def;Le(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType,n.readOnly=!0},el=(e,t,n,r)=>{const s=e._zod.def;Le(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType},Vp=(e,t,n,r)=>{const s=e._zod.innerType;Le(s,t,r);const o=t.seen.get(e);o.ref=s},Hp=G("ZodISODateTime",(e,t)=>{Uf.init(e,t),Me.init(e,t)});function qp(e){return Gh(Hp,e)}const Kp=G("ZodISODate",(e,t)=>{Zf.init(e,t),Me.init(e,t)});function Jp(e){return Yh(Kp,e)}const Gp=G("ZodISOTime",(e,t)=>{Wf.init(e,t),Me.init(e,t)});function Yp(e){return Xh(Gp,e)}const Xp=G("ZodISODuration",(e,t)=>{Vf.init(e,t),Me.init(e,t)});function Qp(e){return Qh(Xp,e)}const em=(e,t)=>{Ra.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Id(e,n)},flatten:{value:n=>Od(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Ns,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Ns,2)}},isEmpty:{get(){return e.issues.length===0}}})},Xe=G("ZodError",em,{Parent:Error}),tm=oo(Xe),nm=io(Xe),rm=Mr(Xe),sm=Dr(Xe),om=Md(Xe),im=Dd(Xe),am=Ld(Xe),lm=Fd(Xe),cm=$d(Xe),um=Bd(Xe),dm=Ud(Xe),fm=Zd(Xe),Ae=G("ZodType",(e,t)=>(Te.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:yr(e,"input"),output:yr(e,"output")}}),e.toJSONSchema=wp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Tt(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>At(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>tm(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>rm(e,n,r),e.parseAsync=async(n,r)=>nm(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>sm(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>om(e,n,r),e.decode=(n,r)=>im(e,n,r),e.encodeAsync=async(n,r)=>am(e,n,r),e.decodeAsync=async(n,r)=>lm(e,n,r),e.safeEncode=(n,r)=>cm(e,n,r),e.safeDecode=(n,r)=>um(e,n,r),e.safeEncodeAsync=async(n,r)=>dm(e,n,r),e.safeDecodeAsync=async(n,r)=>fm(e,n,r),e.refine=(n,r)=>e.check(lg(n,r)),e.superRefine=n=>e.check(cg(n)),e.overwrite=n=>e.check(mn(n)),e.optional=()=>di(e),e.exactOptional=()=>qm(e),e.nullable=()=>fi(e),e.nullish=()=>di(fi(e)),e.nonoptional=n=>Qm(e,n),e.array=()=>_e(e),e.or=n=>yt([e,n]),e.and=n=>Bm(e,n),e.transform=n=>hi(e,Vm(n)),e.default=n=>Gm(e,n),e.prefault=n=>Xm(e,n),e.catch=n=>tg(e,n),e.pipe=n=>hi(e,n),e.readonly=()=>sg(e),e.describe=n=>{const r=e.clone();return An.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return An.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return An.get(e);const r=e.clone();return An.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),tl=G("_ZodString",(e,t)=>{ao.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(r,s,o)=>kp(e,r,s);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(ip(...r)),e.includes=(...r)=>e.check(cp(...r)),e.startsWith=(...r)=>e.check(up(...r)),e.endsWith=(...r)=>e.check(dp(...r)),e.min=(...r)=>e.check(vr(...r)),e.max=(...r)=>e.check(Ja(...r)),e.length=(...r)=>e.check(Ga(...r)),e.nonempty=(...r)=>e.check(vr(1,...r)),e.lowercase=r=>e.check(ap(r)),e.uppercase=r=>e.check(lp(r)),e.trim=()=>e.check(hp()),e.normalize=(...r)=>e.check(fp(...r)),e.toLowerCase=()=>e.check(pp()),e.toUpperCase=()=>e.check(mp()),e.slugify=()=>e.check(gp())}),hm=G("ZodString",(e,t)=>{ao.init(e,t),tl.init(e,t),e.email=n=>e.check(Th(pm,n)),e.url=n=>e.check(Rh(mm,n)),e.jwt=n=>e.check(Jh(Am,n)),e.emoji=n=>e.check(Ph(gm,n)),e.guid=n=>e.check(oi(ci,n)),e.uuid=n=>e.check(Ah(er,n)),e.uuidv4=n=>e.check(zh(er,n)),e.uuidv6=n=>e.check(Oh(er,n)),e.uuidv7=n=>e.check(Ih(er,n)),e.nanoid=n=>e.check(Mh(xm,n)),e.guid=n=>e.check(oi(ci,n)),e.cuid=n=>e.check(Dh(vm,n)),e.cuid2=n=>e.check(Lh(ym,n)),e.ulid=n=>e.check(Fh(bm,n)),e.base64=n=>e.check(Hh(Nm,n)),e.base64url=n=>e.check(qh(Em,n)),e.xid=n=>e.check($h(wm,n)),e.ksuid=n=>e.check(Bh(_m,n)),e.ipv4=n=>e.check(Uh(km,n)),e.ipv6=n=>e.check(Zh(Cm,n)),e.cidrv4=n=>e.check(Wh(Sm,n)),e.cidrv6=n=>e.check(Vh(jm,n)),e.e164=n=>e.check(Kh(Tm,n)),e.datetime=n=>e.check(qp(n)),e.date=n=>e.check(Jp(n)),e.time=n=>e.check(Yp(n)),e.duration=n=>e.check(Qp(n))});function B(e){return Eh(hm,e)}const Me=G("ZodStringFormat",(e,t)=>{Pe.init(e,t),tl.init(e,t)}),pm=G("ZodEmail",(e,t)=>{If.init(e,t),Me.init(e,t)}),ci=G("ZodGUID",(e,t)=>{zf.init(e,t),Me.init(e,t)}),er=G("ZodUUID",(e,t)=>{Of.init(e,t),Me.init(e,t)}),mm=G("ZodURL",(e,t)=>{Rf.init(e,t),Me.init(e,t)}),gm=G("ZodEmoji",(e,t)=>{Pf.init(e,t),Me.init(e,t)}),xm=G("ZodNanoID",(e,t)=>{Mf.init(e,t),Me.init(e,t)}),vm=G("ZodCUID",(e,t)=>{Df.init(e,t),Me.init(e,t)}),ym=G("ZodCUID2",(e,t)=>{Lf.init(e,t),Me.init(e,t)}),bm=G("ZodULID",(e,t)=>{Ff.init(e,t),Me.init(e,t)}),wm=G("ZodXID",(e,t)=>{$f.init(e,t),Me.init(e,t)}),_m=G("ZodKSUID",(e,t)=>{Bf.init(e,t),Me.init(e,t)}),km=G("ZodIPv4",(e,t)=>{Hf.init(e,t),Me.init(e,t)}),Cm=G("ZodIPv6",(e,t)=>{qf.init(e,t),Me.init(e,t)}),Sm=G("ZodCIDRv4",(e,t)=>{Kf.init(e,t),Me.init(e,t)}),jm=G("ZodCIDRv6",(e,t)=>{Jf.init(e,t),Me.init(e,t)}),Nm=G("ZodBase64",(e,t)=>{Gf.init(e,t),Me.init(e,t)}),Em=G("ZodBase64URL",(e,t)=>{Xf.init(e,t),Me.init(e,t)}),Tm=G("ZodE164",(e,t)=>{Qf.init(e,t),Me.init(e,t)}),Am=G("ZodJWT",(e,t)=>{th.init(e,t),Me.init(e,t)}),nl=G("ZodNumber",(e,t)=>{Wa.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(r,s,o)=>Cp(e,r,s),e.gt=(r,s)=>e.check(ai(r,s)),e.gte=(r,s)=>e.check(os(r,s)),e.min=(r,s)=>e.check(os(r,s)),e.lt=(r,s)=>e.check(ii(r,s)),e.lte=(r,s)=>e.check(ss(r,s)),e.max=(r,s)=>e.check(ss(r,s)),e.int=r=>e.check(ui(r)),e.safe=r=>e.check(ui(r)),e.positive=r=>e.check(ai(0,r)),e.nonnegative=r=>e.check(os(0,r)),e.negative=r=>e.check(ii(0,r)),e.nonpositive=r=>e.check(ss(0,r)),e.multipleOf=(r,s)=>e.check(li(r,s)),e.step=(r,s)=>e.check(li(r,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function pe(e){return ep(nl,e)}const zm=G("ZodNumberFormat",(e,t)=>{nh.init(e,t),nl.init(e,t)});function ui(e){return tp(zm,e)}const Om=G("ZodBoolean",(e,t)=>{rh.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Sp(e,n,r)});function Be(e){return np(Om,e)}const Im=G("ZodNull",(e,t)=>{sh.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>jp(e,n,r)});function Ts(e){return rp(Im,e)}const Rm=G("ZodUnknown",(e,t)=>{oh.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Ep()});function As(){return sp(Rm)}const Pm=G("ZodNever",(e,t)=>{ih.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Np(e,n,r)});function Mm(e){return op(Pm,e)}const Dm=G("ZodArray",(e,t)=>{ah.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Ip(e,n,r,s),e.element=t.element,e.min=(n,r)=>e.check(vr(n,r)),e.nonempty=n=>e.check(vr(1,n)),e.max=(n,r)=>e.check(Ja(n,r)),e.length=(n,r)=>e.check(Ga(n,r)),e.unwrap=()=>e.element});function _e(e,t){return xp(Dm,e,t)}const Lm=G("ZodObject",(e,t)=>{ch.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Rp(e,n,r,s),ke(e,"shape",()=>t.shape),e.keyof=()=>Ue(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:As()}),e.loose=()=>e.clone({...e._zod.def,catchall:As()}),e.strict=()=>e.clone({...e._zod.def,catchall:Mm()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Nd(e,n),e.safeExtend=n=>Ed(e,n),e.merge=n=>Td(e,n),e.pick=n=>Sd(e,n),e.omit=n=>jd(e,n),e.partial=(...n)=>Ad(sl,e,n[0]),e.required=(...n)=>zd(ol,e,n[0])});function ne(e,t){const n={type:"object",shape:e??{},...de(t)};return new Lm(n)}const rl=G("ZodUnion",(e,t)=>{qa.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Pp(e,n,r,s),e.options=t.options});function yt(e,t){return new rl({type:"union",options:e,...de(t)})}const Fm=G("ZodDiscriminatedUnion",(e,t)=>{rl.init(e,t),uh.init(e,t)});function Ut(e,t,n){return new Fm({type:"union",options:t,discriminator:e,...de(n)})}const $m=G("ZodIntersection",(e,t)=>{dh.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Mp(e,n,r,s)});function Bm(e,t){return new $m({type:"intersection",left:e,right:t})}const Um=G("ZodRecord",(e,t)=>{fh.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Dp(e,n,r,s),e.keyType=t.keyType,e.valueType=t.valueType});function gt(e,t,n){return new Um({type:"record",keyType:e,valueType:t,...de(n)})}const zs=G("ZodEnum",(e,t)=>{hh.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(r,s,o)=>Tp(e,r,s),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,s)=>{const o={};for(const a of r)if(n.has(a))o[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new zs({...t,checks:[],...de(s),entries:o})},e.exclude=(r,s)=>{const o={...t.entries};for(const a of r)if(n.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new zs({...t,checks:[],...de(s),entries:o})}});function Ue(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new zs({type:"enum",entries:n,...de(t)})}const Zm=G("ZodLiteral",(e,t)=>{ph.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Ap(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ve(e,t){return new Zm({type:"literal",values:Array.isArray(e)?e:[e],...de(t)})}const Wm=G("ZodTransform",(e,t)=>{mh.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Op(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Ea(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(Rn(o,n.value,t));else{const a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(Rn(a))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(o=>(n.value=o,n)):(n.value=s,n)}});function Vm(e){return new Wm({type:"transform",transform:e})}const sl=G("ZodOptional",(e,t)=>{Ka.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>el(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function di(e){return new sl({type:"optional",innerType:e})}const Hm=G("ZodExactOptional",(e,t)=>{gh.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>el(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function qm(e){return new Hm({type:"optional",innerType:e})}const Km=G("ZodNullable",(e,t)=>{xh.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Lp(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function fi(e){return new Km({type:"nullable",innerType:e})}const Jm=G("ZodDefault",(e,t)=>{vh.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>$p(e,n,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Gm(e,t){return new Jm({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Oa(t)}})}const Ym=G("ZodPrefault",(e,t)=>{yh.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Bp(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Xm(e,t){return new Ym({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Oa(t)}})}const ol=G("ZodNonOptional",(e,t)=>{bh.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Fp(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Qm(e,t){return new ol({type:"nonoptional",innerType:e,...de(t)})}const eg=G("ZodCatch",(e,t)=>{wh.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Up(e,n,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function tg(e,t){return new eg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const ng=G("ZodPipe",(e,t)=>{_h.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Zp(e,n,r,s),e.in=t.in,e.out=t.out});function hi(e,t){return new ng({type:"pipe",in:e,out:t})}const rg=G("ZodReadonly",(e,t)=>{kh.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Wp(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function sg(e){return new rg({type:"readonly",innerType:e})}const og=G("ZodLazy",(e,t)=>{Ch.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Vp(e,n,r,s),e.unwrap=()=>e._zod.def.getter()});function ig(e){return new og({type:"lazy",getter:e})}const ag=G("ZodCustom",(e,t)=>{Sh.init(e,t),Ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>zp(e,n)});function lg(e,t={}){return vp(ag,e,t)}function cg(e){return yp(e)}const un=ig(()=>yt([B(),pe(),Be(),Ts(),_e(un),gt(B(),un)]));function il(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ye(e,t){return e===null||typeof e!="object"||Array.isArray(e)?void 0:Object.getOwnPropertyDescriptor(e,t)?.value}const lo=ne({type:B(),ttl:B().optional(),scope:B().optional()}),co=ne({type:ve("text"),text:B(),cache_control:lo.optional()}),al=ne({type:ve("thinking"),thinking:B(),signature:B().optional()}),ug=ne({type:ve("think"),thinking:B(),signature:B().optional()}),dg=ne({type:ve("base64"),media_type:B(),data:B()}),ll=ne({type:ve("image"),source:dg}),cl=ne({type:ve("tool_use"),id:B(),name:B(),input:gt(B(),un)}),fg=Ut("type",[co,ll]),hg=ne({type:ve("tool_result"),tool_use_id:B().optional(),content:yt([B(),_e(fg)]),is_error:Be().optional()}),pg=Ut("type",[co,al,ll,cl,hg]),mg=yt([B(),_e(pg)]),gg=ne({role:Ue(["user","assistant"]),content:mg}),xg=ne({type:ve("text"),text:B(),cache_control:lo.optional()}),vg=ne({type:B(),properties:gt(B(),gt(B(),un)).optional(),required:_e(B()).optional(),additionalProperties:Be().optional(),$schema:B().optional()}),yg=ne({name:B(),description:B().optional(),input_schema:vg.optional(),cache_control:lo.optional()}),bg=Ut("type",[ne({type:ve("enabled"),budget_tokens:pe()}),ne({type:ve("disabled")}),ne({type:ve("adaptive")})]),ul=ne({model:B(),messages:_e(gg),system:_e(xg).optional(),tools:_e(yg).optional(),max_tokens:pe().optional(),temperature:pe().optional(),stream:Be().optional(),thinking:bg.optional(),metadata:ne({user_id:B().optional()}).optional()}),uo=Ut("type",[co,al,ug,cl]),wg=ne({input_tokens:pe().nullable().optional(),output_tokens:pe().nullable().optional(),cache_creation_input_tokens:pe().nullable().optional(),cache_read_input_tokens:pe().nullable().optional()}).passthrough(),dl=ne({id:B(),type:ve("message"),model:B(),role:ve("assistant"),content:_e(uo),stop_reason:B().nullable(),stop_sequence:B().nullable().optional(),usage:wg}).passthrough(),_g=ne({type:ve("message_start"),message:ne({id:B(),type:ve("message"),model:B(),role:ve("assistant"),content:_e(uo),stop_reason:Ts(),stop_sequence:Ts(),usage:ne({input_tokens:pe(),cache_creation_input_tokens:pe().optional(),cache_read_input_tokens:pe().optional()}).passthrough()})}),kg=ne({type:ve("content_block_start"),index:pe(),content_block:uo}),Cg=Ut("type",[ne({type:ve("text_delta"),text:B()}),ne({type:ve("input_json_delta"),partial_json:B()}),ne({type:ve("thinking_delta"),thinking:B()}),ne({type:ve("signature_delta"),signature:B()})]),Sg=ne({type:ve("content_block_delta"),index:pe(),delta:Cg}),jg=ne({type:ve("content_block_stop"),index:pe()}),Ng=ne({type:ve("message_delta"),delta:ne({stop_reason:B().nullable(),stop_sequence:B().nullable().optional()}),usage:ne({output_tokens:pe(),input_tokens:pe().optional(),cache_creation_input_tokens:pe().optional(),cache_read_input_tokens:pe().optional()}).passthrough()}),Eg=ne({type:ve("message_stop")}),Tg=ne({type:ve("ping")}),Ag=ne({type:ve("error"),error:ne({type:B(),message:B()})}),zg=Ut("type",[_g,kg,Sg,jg,Ng,Eg,Tg,Ag]),Og=yt([B(),_e(Ut("type",[ne({type:ve("text"),text:B()}),ne({type:ve("image_url"),image_url:ne({url:B(),detail:B().optional()})})]))]),fl=ne({role:Ue(["system","user","assistant","tool"]),content:Og,name:B().optional(),reasoning_content:B().optional(),thinking:B().optional(),think:B().optional()}),Ig=ne({name:B(),arguments:B()}),hl=ne({index:pe().optional(),id:B().optional(),type:ve("function").optional(),function:ne({name:B().optional(),arguments:B().optional()})});fl.extend({content:yt([B(),_e(ne({type:ve("text"),text:B()}))]).optional(),function_call:Ig.optional(),tool_calls:_e(hl).optional()});const Rg=ne({type:ve("function"),function:ne({name:B(),description:B().optional(),parameters:gt(B(),un)})}),pl=ne({model:B(),messages:_e(fl),temperature:pe().optional(),max_tokens:pe().optional(),stream:Be().optional(),tools:_e(Rg).optional(),tool_choice:yt([Ue(["auto","none","required"]),ne({type:ve("auto")}),ne({type:ve("none")}),ne({type:ve("function"),function:ne({name:B()})})]).optional(),user:B().optional()}),ml=ne({role:Ue(["assistant"]).optional(),content:B().nullable().optional(),reasoning_content:B().nullable().optional(),thinking:B().nullable().optional(),think:B().nullable().optional(),function_call:ne({name:B().optional(),arguments:B().optional()}).nullable().optional(),tool_calls:_e(ne({index:pe(),id:B().optional(),type:ve("function").optional(),function:ne({name:B().optional(),arguments:B().optional()})})).nullable().optional()}),Pg=ne({index:pe(),message:ne({role:Ue(["assistant"]),content:B().nullable(),reasoning_content:B().optional(),thinking:B().optional(),think:B().optional(),function_call:ne({name:B(),arguments:B()}).nullable().optional(),tool_calls:_e(hl).optional()}).optional(),delta:ml.optional(),finish_reason:B().nullable()}),Mg=ne({id:B(),object:ve("chat.completion"),created:pe(),model:B(),choices:_e(Pg),usage:ne({prompt_tokens:pe().nullable().optional(),completion_tokens:pe().nullable().optional(),total_tokens:pe().nullable().optional()}).passthrough(),service_tier:B().nullable().optional(),system_fingerprint:B().nullable().optional()}).passthrough(),Dg=ne({id:B(),object:ve("chat.completion.chunk"),created:pe(),model:B(),choices:_e(ne({index:pe(),delta:ml,finish_reason:B().nullable().optional()})),usage:ne({prompt_tokens:pe().nullable().optional(),completion_tokens:pe().nullable().optional(),total_tokens:pe().nullable().optional()}).passthrough().nullable().optional()}).passthrough();function gl(e){try{const t=JSON.parse(e),n=Mg.safeParse(t);return n.success?n.data:null}catch{return null}}const xl=ne({index:pe(),timestamp:pe(),type:B(),data:un}),Lg=ne({chunks:_e(xl),truncated:Be().optional().default(!1)}),pi=ne({id:pe(),timestamp:B(),method:B(),path:B(),model:B().nullable(),sessionId:B().nullable(),rawRequestBody:B().nullable(),responseStatus:pe().nullable(),responseText:B().nullable(),inputTokens:pe().nullable(),outputTokens:pe().nullable(),cacheCreationInputTokens:pe().nullable(),cacheReadInputTokens:pe().nullable(),elapsedMs:pe().nullable(),streaming:Be(),userAgent:B().nullable(),origin:B().nullable(),rawHeaders:gt(B(),B()).optional(),headers:gt(B(),B()).optional(),apiFormat:Ue(["anthropic","openai","unknown"]).default("unknown"),isTest:Be().optional().default(!1),providerName:B().nullable().optional(),clientPort:pe().nullable().optional(),clientPid:pe().nullable().optional(),clientCwd:B().nullable().optional(),clientProjectFolder:B().nullable().optional(),streamingChunks:Lg.optional(),streamingChunksPath:B().nullable().optional(),error:B().nullable().optional()});ne({model:B()});ne({model:B().optional(),metadata:ne({user_id:B().optional()}).passthrough().optional()});const Fg=ne({error:B()});async function _t(e,t){const n=await e.json();return t.parse(n)}async function rn(e,t){try{const n=await e.json(),r=Fg.safeParse(n);return r.success?r.data.error:t}catch{return t}}async function Zn(e,t,n,r){const s=await fetch(e,n);if(!s.ok){const o=r?.(s)??`Request failed with status ${s.status}`;throw new Error(await rn(s,o))}return _t(s,t)}const br=10,Os=600,wr="time",vl=Ue(["time","full"]),Fr=ne({stripClaudeCodeBillingHeader:Be(),hasSeenOnboarding:Be().default(!1),slowResponseThresholdSeconds:pe().int().min(0).max(Os).default(br),timeDisplayFormat:vl.default(wr)}),zn="/api/config";async function $g(e){return Zn(e,Fr,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function is(e){return Zn(zn,Fr,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function yl(){const e=to(zn,$g,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=ja(),n=e.data?.stripClaudeCodeBillingHeader??!1,r=e.data?.slowResponseThresholdSeconds??br,s=e.data?.timeDisplayFormat??wr,o=u=>({stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:e.data?.hasSeenOnboarding??!1,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??br,timeDisplayFormat:e.data?.timeDisplayFormat??wr,...u}),a=async u=>{await t(zn,is({stripClaudeCodeBillingHeader:u}),{optimisticData:o({stripClaudeCodeBillingHeader:u}),rollbackOnError:!0,revalidate:!1})},l=async u=>{await t(zn,is({slowResponseThresholdSeconds:u}),{optimisticData:o({slowResponseThresholdSeconds:u}),rollbackOnError:!0,revalidate:!1})},c=async u=>{await t(zn,is({timeDisplayFormat:u}),{optimisticData:o({timeDisplayFormat:u}),rollbackOnError:!0,revalidate:!1})};return{strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:s,isLoading:e.isLoading,isError:e.error!==void 0,setStrip:a,setSlowResponseThresholdSeconds:l,setTimeDisplayFormat:c}}const bl=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const Bg=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Ug=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const mi=e=>{const t=Ug(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Zg={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"};const Wg=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const Vg=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:a,...l},c)=>v.createElement("svg",{ref:c,...Zg,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:bl("lucide",s),...!o&&!Wg(l)&&{"aria-hidden":"true"},...l},[...a.map(([u,d])=>v.createElement(u,d)),...Array.isArray(o)?o:[o]]));const fe=(e,t)=>{const n=v.forwardRef(({className:r,...s},o)=>v.createElement(Vg,{ref:o,iconNode:t,className:bl(`lucide-${Bg(mi(e))}`,`lucide-${e}`,r),...s}));return n.displayName=mi(e),n};const Hg=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],qg=fe("arrow-down",Hg);const Kg=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Jg=fe("arrow-left",Kg);const Gg=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Yg=fe("arrow-up",Gg);const Xg=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],wl=fe("brain",Xg);const Qg=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],tt=fe("check",Qg);const e0=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],gn=fe("chevron-down",e0);const t0=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Wn=fe("chevron-right",t0);const n0=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],r0=fe("chevron-up",n0);const s0=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],o0=fe("chevrons-down",s0);const i0=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],a0=fe("chevrons-up",i0);const l0=[["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"}]],Pn=fe("circle-alert",l0);const c0=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],u0=fe("circle-check-big",c0);const d0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],gi=fe("circle-check",d0);const f0=[["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"}]],h0=fe("circle-question-mark",f0);const p0=[["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"}]],_l=fe("circle-x",p0);const m0=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],St=fe("clock",m0);const g0=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],x0=fe("cloud-upload",g0);const v0=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],y0=fe("columns-2",v0);const b0=[["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"}]],Zt=fe("copy",b0);const w0=[["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"}]],fo=fe("download",w0);const _0=[["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"}]],kl=fe("external-link",_0);const k0=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],ho=fe("eye-off",k0);const C0=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],po=fe("eye",C0);const S0=[["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:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]],j0=fe("file-diff",S0);const N0=[["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"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],E0=fe("file-search",N0);const T0=[["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:"m8 16 2-2-2-2",key:"10vzyd"}],["path",{d:"M12 18h4",key:"1wd2n7"}]],A0=fe("file-terminal",T0);const z0=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],O0=fe("gauge",z0);const I0=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]],R0=fe("git-compare-arrows",I0);const P0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],M0=fe("globe",P0);const D0=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],L0=fe("history",D0);const F0=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Mn=fe("loader-circle",F0);const $0=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],B0=fe("lock",$0);const U0=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],$r=fe("message-square",U0);const Z0=[["path",{d:"M5 12h14",key:"1ays0h"}]],W0=fe("minus",Z0);const V0=[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]],H0=fe("octagon-alert",V0);const q0=[["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"}]],Cl=fe("pencil",q0);const K0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Is=fe("plus",K0);const J0=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],G0=fe("radio",J0);const Y0=[["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"}]],xi=fe("refresh-cw",Y0);const X0=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Q0=fe("rotate-ccw",X0);const ex=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Sl=fe("rotate-cw",ex);const tx=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],nx=fe("rows-3",tx);const rx=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],sx=fe("save",rx);const ox=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]],ix=fe("scan",ox);const ax=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],lx=fe("server",ax);const cx=[["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"}]],ux=fe("settings",cx);const dx=[["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:"m9 12 2 2 4-4",key:"dzmm74"}]],vi=fe("shield-check",dx);const fx=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],hx=fe("terminal",fx);const px=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["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"}]],jl=fe("trash-2",px);const mx=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],_r=fe("triangle-alert",mx);const gx=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],xx=fe("upload",gx);const vx=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],yx=fe("user",vx);const bx=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],wx=fe("wifi-off",bx);const _x=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],kx=fe("wifi",_x);const Cx=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Br=fe("wrench",Cx);const Sx=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],mo=fe("x",Sx);const jx=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Dn=fe("zap",jx),Rs="/api/config";async function Nx(e){return Zn(e,Fr,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function Ex(e){return Zn(Rs,Fr,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function Tx(){const e=to(Rs,Nx,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=ja(),n=e.data?.hasSeenOnboarding??!1,r=async()=>{await t(Rs,Ex({hasSeenOnboarding:!0}),{optimisticData:{stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:!0,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??br,timeDisplayFormat:e.data?.timeDisplayFormat??wr},rollbackOnError:!0,revalidate:!1})};return{hasSeenOnboarding:n,isLoading:e.isLoading,markSeen:r}}function Ax(){const{hasSeenOnboarding:e,isLoading:t,markSeen:n}=Tx();return t||e?null:i.jsxs("div",{role:"note","aria-label":"Onboarding tip",className:"mx-4 mt-2 mb-1 flex items-start gap-3 rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3 text-sm",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"mb-1 font-medium text-amber-600 dark:text-amber-400",children:"Agent Inspector is ready"}),i.jsxs("ul",{className:"space-y-0.5 text-xs leading-relaxed text-muted-foreground",children:[i.jsxs("li",{children:[i.jsx("strong",{children:"Trace"}),": requests, responses, streaming chunks, tools, and timing."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Replay"}),": resend captured requests and compare provider behavior."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Memory"}),": create reviewable candidates before promotion to OpenClaw."]})]})]}),i.jsxs("button",{type:"button",onClick:()=>{n()},className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-amber-500/40 px-3 text-xs text-amber-700 transition-colors hover:bg-amber-500/10 dark:text-amber-300","aria-label":"Dismiss onboarding tip",children:[i.jsx(tt,{className:"size-3.5"}),"Got it"]}),i.jsx("button",{type:"button",onClick:()=>{n()},className:"-m-1 shrink-0 p-1 text-muted-foreground transition-colors hover:text-foreground","aria-label":"Dismiss",children:i.jsx(mo,{className:"size-3.5"})})]})}function tr(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var as={exports:{}};var yi;function zx(){return yi||(yi=1,(function(e,t){(function(n){e.exports=n()})(function(){return(function n(r,s,o){function a(u,d){if(!s[u]){if(!r[u]){var p=typeof tr=="function"&&tr;if(!d&&p)return p(u,!0);if(l)return l(u,!0);var g=new Error("Cannot find module '"+u+"'");throw g.code="MODULE_NOT_FOUND",g}var h=s[u]={exports:{}};r[u][0].call(h.exports,function(x){var f=r[u][1][x];return a(f||x)},h,h.exports,n,r,s,o)}return s[u].exports}for(var l=typeof tr=="function"&&tr,c=0;c<o.length;c++)a(o[c]);return a})({1:[function(n,r,s){var o=n("./utils"),a=n("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(c){for(var u,d,p,g,h,x,f,m=[],y=0,w=c.length,k=w,C=o.getTypeOf(c)!=="string";y<c.length;)k=w-y,p=C?(u=c[y++],d=y<w?c[y++]:0,y<w?c[y++]:0):(u=c.charCodeAt(y++),d=y<w?c.charCodeAt(y++):0,y<w?c.charCodeAt(y++):0),g=u>>2,h=(3&u)<<4|d>>4,x=1<k?(15&d)<<2|p>>6:64,f=2<k?63&p:64,m.push(l.charAt(g)+l.charAt(h)+l.charAt(x)+l.charAt(f));return m.join("")},s.decode=function(c){var u,d,p,g,h,x,f=0,m=0,y="data:";if(c.substr(0,y.length)===y)throw new Error("Invalid base64 input, it looks like a data url.");var w,k=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&k--,c.charAt(c.length-2)===l.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(w=a.uint8array?new Uint8Array(0|k):new Array(0|k);f<c.length;)u=l.indexOf(c.charAt(f++))<<2|(g=l.indexOf(c.charAt(f++)))>>4,d=(15&g)<<4|(h=l.indexOf(c.charAt(f++)))>>2,p=(3&h)<<6|(x=l.indexOf(c.charAt(f++))),w[m++]=u,h!==64&&(w[m++]=d),x!==64&&(w[m++]=p);return w}},{"./support":30,"./utils":32}],2:[function(n,r,s){var o=n("./external"),a=n("./stream/DataWorker"),l=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,p,g,h,x){this.compressedSize=d,this.uncompressedSize=p,this.crc32=g,this.compression=h,this.compressedContent=x}u.prototype={getContentWorker:function(){var d=new a(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),p=this;return d.on("end",function(){if(this.streamInfo.data_length!==p.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new a(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,p,g){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(p.compressWorker(g)).pipe(new c("compressedSize")).withStreamInfo("compression",p)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,s){var o=n("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},s.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,s){var o=n("./utils"),a=(function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c})();r.exports=function(l,c){return l!==void 0&&l.length?o.getTypeOf(l)!=="string"?(function(u,d,p,g){var h=a,x=g+p;u^=-1;for(var f=g;f<x;f++)u=u>>>8^h[255&(u^d[f])];return-1^u})(0|c,l,l.length,0):(function(u,d,p,g){var h=a,x=g+p;u^=-1;for(var f=g;f<x;f++)u=u>>>8^h[255&(u^d.charCodeAt(f))];return-1^u})(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(n,r,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(n,r,s){var o=null;o=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:o}},{lie:37}],7:[function(n,r,s){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=n("pako"),l=n("./utils"),c=n("./stream/GenericWorker"),u=o?"uint8array":"array";function d(p,g){c.call(this,"FlateWorker/"+p),this._pako=null,this._pakoAction=p,this._pakoOptions=g,this.meta={}}s.magic="\b\0",l.inherits(d,c),d.prototype.processChunk=function(p){this.meta=p.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,p.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var p=this;this._pako.onData=function(g){p.push({data:g,meta:p.meta})}},s.compressWorker=function(p){return new d("Deflate",p)},s.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,s){function o(h,x){var f,m="";for(f=0;f<x;f++)m+=String.fromCharCode(255&h),h>>>=8;return m}function a(h,x,f,m,y,w){var k,C,S=h.file,O=h.compression,N=w!==u.utf8encode,T=l.transformTo("string",w(S.name)),z=l.transformTo("string",u.utf8encode(S.name)),I=S.comment,K=l.transformTo("string",w(I)),j=l.transformTo("string",u.utf8encode(I)),R=z.length!==S.name.length,_=j.length!==I.length,F="",Z="",P="",M=S.dir,W=S.date,te={crc32:0,compressedSize:0,uncompressedSize:0};x&&!f||(te.crc32=h.crc32,te.compressedSize=h.compressedSize,te.uncompressedSize=h.uncompressedSize);var V=0;x&&(V|=8),N||!R&&!_||(V|=2048);var U=0,re=0;M&&(U|=16),y==="UNIX"?(re=798,U|=(function(J,ue){var X=J;return J||(X=ue?16893:33204),(65535&X)<<16})(S.unixPermissions,M)):(re=20,U|=(function(J){return 63&(J||0)})(S.dosPermissions)),k=W.getUTCHours(),k<<=6,k|=W.getUTCMinutes(),k<<=5,k|=W.getUTCSeconds()/2,C=W.getUTCFullYear()-1980,C<<=4,C|=W.getUTCMonth()+1,C<<=5,C|=W.getUTCDate(),R&&(Z=o(1,1)+o(d(T),4)+z,F+="up"+o(Z.length,2)+Z),_&&(P=o(1,1)+o(d(K),4)+j,F+="uc"+o(P.length,2)+P);var ee="";return ee+=`
41
+ \0`,ee+=o(V,2),ee+=O.magic,ee+=o(k,2),ee+=o(C,2),ee+=o(te.crc32,4),ee+=o(te.compressedSize,4),ee+=o(te.uncompressedSize,4),ee+=o(T.length,2),ee+=o(F.length,2),{fileRecord:p.LOCAL_FILE_HEADER+ee+T+F,dirRecord:p.CENTRAL_FILE_HEADER+o(re,2)+ee+o(K.length,2)+"\0\0\0\0"+o(U,4)+o(m,4)+T+F+K}}var l=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),p=n("../signature");function g(h,x,f,m){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=f,this.encodeFileName=m,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(g,c),g.prototype.push=function(h){var x=h.meta.percent||0,f=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(h):(this.bytesWritten+=h.data.length,c.prototype.push.call(this,{data:h.data,meta:{currentFile:this.currentFile,percent:f?(x+100*(f-m-1))/f:100}}))},g.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var x=this.streamFiles&&!h.file.dir;if(x){var f=a(h,x,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:f.fileRecord,meta:{percent:0}})}else this.accumulate=!0},g.prototype.closedSource=function(h){this.accumulate=!1;var x=this.streamFiles&&!h.file.dir,f=a(h,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(f.dirRecord),x)this.push({data:(function(m){return p.DATA_DESCRIPTOR+o(m.crc32,4)+o(m.compressedSize,4)+o(m.uncompressedSize,4)})(h),meta:{percent:100}});else for(this.push({data:f.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},g.prototype.flush=function(){for(var h=this.bytesWritten,x=0;x<this.dirRecords.length;x++)this.push({data:this.dirRecords[x],meta:{percent:100}});var f=this.bytesWritten-h,m=(function(y,w,k,C,S){var O=l.transformTo("string",S(C));return p.CENTRAL_DIRECTORY_END+"\0\0\0\0"+o(y,2)+o(y,2)+o(w,4)+o(k,4)+o(O.length,2)+O})(this.dirRecords.length,f,h,this.zipComment,this.encodeFileName);this.push({data:m,meta:{percent:100}})},g.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},g.prototype.registerPrevious=function(h){this._sources.push(h);var x=this;return h.on("data",function(f){x.processChunk(f)}),h.on("end",function(){x.closedSource(x.previous.streamInfo),x._sources.length?x.prepareNextSource():x.end()}),h.on("error",function(f){x.error(f)}),this},g.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},g.prototype.error=function(h){var x=this._sources;if(!c.prototype.error.call(this,h))return!1;for(var f=0;f<x.length;f++)try{x[f].error(h)}catch{}return!0},g.prototype.lock=function(){c.prototype.lock.call(this);for(var h=this._sources,x=0;x<h.length;x++)h[x].lock()},r.exports=g},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,s){var o=n("../compressions"),a=n("./ZipFileWorker");s.generateWorker=function(l,c,u){var d=new a(c.streamFiles,u,c.platform,c.encodeFileName),p=0;try{l.forEach(function(g,h){p++;var x=(function(w,k){var C=w||k,S=o[C];if(!S)throw new Error(C+" is not a valid compression method !");return S})(h.options.compression,c.compression),f=h.options.compressionOptions||c.compressionOptions||{},m=h.dir,y=h.date;h._compressWorker(x,f).withStreamInfo("file",{name:g,dir:m,date:y,comment:h.comment||"",unixPermissions:h.unixPermissions,dosPermissions:h.dosPermissions}).pipe(d)}),d.entriesCount=p}catch(g){d.error(g)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,s){function o(){if(!(this instanceof o))return new o;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var a=new o;for(var l in this)typeof this[l]!="function"&&(a[l]=this[l]);return a}}(o.prototype=n("./object")).loadAsync=n("./load"),o.support=n("./support"),o.defaults=n("./defaults"),o.version="3.10.1",o.loadAsync=function(a,l){return new o().loadAsync(a,l)},o.external=n("./external"),r.exports=o},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,s){var o=n("./utils"),a=n("./external"),l=n("./utf8"),c=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function p(g){return new a.Promise(function(h,x){var f=g.decompressed.getContentWorker().pipe(new u);f.on("error",function(m){x(m)}).on("end",function(){f.streamInfo.crc32!==g.decompressed.crc32?x(new Error("Corrupted zip : CRC32 mismatch")):h()}).resume()})}r.exports=function(g,h){var x=this;return h=o.extend(h||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),d.isNode&&d.isStream(g)?a.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):o.prepareContent("the loaded zip file",g,!0,h.optimizedBinaryString,h.base64).then(function(f){var m=new c(h);return m.load(f),m}).then(function(f){var m=[a.Promise.resolve(f)],y=f.files;if(h.checkCRC32)for(var w=0;w<y.length;w++)m.push(p(y[w]));return a.Promise.all(m)}).then(function(f){for(var m=f.shift(),y=m.files,w=0;w<y.length;w++){var k=y[w],C=k.fileNameStr,S=o.resolve(k.fileNameStr);x.file(S,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:h.createFolders}),k.dir||(x.file(S).unsafeOriginalName=C)}return m.zipComment.length&&(x.comment=m.zipComment),x})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,s){var o=n("../utils"),a=n("../stream/GenericWorker");function l(c,u){a.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}o.inherits(l,a),l.prototype._bindStream=function(c){var u=this;(this._stream=c).pause(),c.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},l.prototype.pause=function(){return!!a.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,s){var o=n("readable-stream").Readable;function a(l,c,u){o.call(this,c),this._helper=l;var d=this;l.on("data",function(p,g){d.push(p)||d._helper.pause(),u&&u(g)}).on("error",function(p){d.emit("error",p)}).on("end",function(){d.push(null)})}n("../utils").inherits(a,o),a.prototype._read=function(){this._helper.resume()},r.exports=a},{"../utils":32,"readable-stream":16}],14:[function(n,r,s){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(o,a){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(o,a);if(typeof o=="number")throw new Error('The "data" argument must not be a number');return new Buffer(o,a)},allocBuffer:function(o){if(Buffer.alloc)return Buffer.alloc(o);var a=new Buffer(o);return a.fill(0),a},isBuffer:function(o){return Buffer.isBuffer(o)},isStream:function(o){return o&&typeof o.on=="function"&&typeof o.pause=="function"&&typeof o.resume=="function"}}},{}],15:[function(n,r,s){function o(S,O,N){var T,z=l.getTypeOf(O),I=l.extend(N||{},d);I.date=I.date||new Date,I.compression!==null&&(I.compression=I.compression.toUpperCase()),typeof I.unixPermissions=="string"&&(I.unixPermissions=parseInt(I.unixPermissions,8)),I.unixPermissions&&16384&I.unixPermissions&&(I.dir=!0),I.dosPermissions&&16&I.dosPermissions&&(I.dir=!0),I.dir&&(S=y(S)),I.createFolders&&(T=m(S))&&w.call(this,T,!0);var K=z==="string"&&I.binary===!1&&I.base64===!1;N&&N.binary!==void 0||(I.binary=!K),(O instanceof p&&O.uncompressedSize===0||I.dir||!O||O.length===0)&&(I.base64=!1,I.binary=!0,O="",I.compression="STORE",z="string");var j=null;j=O instanceof p||O instanceof c?O:x.isNode&&x.isStream(O)?new f(S,O):l.prepareContent(S,O,I.binary,I.optimizedBinaryString,I.base64);var R=new g(S,j,I);this.files[S]=R}var a=n("./utf8"),l=n("./utils"),c=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),p=n("./compressedObject"),g=n("./zipObject"),h=n("./generate"),x=n("./nodejsUtils"),f=n("./nodejs/NodejsStreamInputAdapter"),m=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var O=S.lastIndexOf("/");return 0<O?S.substring(0,O):""},y=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},w=function(S,O){return O=O!==void 0?O:d.createFolders,S=y(S),this.files[S]||o.call(this,S,null,{dir:!0,createFolders:O}),this.files[S]};function k(S){return Object.prototype.toString.call(S)==="[object RegExp]"}var C={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(S){var O,N,T;for(O in this.files)T=this.files[O],(N=O.slice(this.root.length,O.length))&&O.slice(0,this.root.length)===this.root&&S(N,T)},filter:function(S){var O=[];return this.forEach(function(N,T){S(N,T)&&O.push(T)}),O},file:function(S,O,N){if(arguments.length!==1)return S=this.root+S,o.call(this,S,O,N),this;if(k(S)){var T=S;return this.filter(function(I,K){return!K.dir&&T.test(I)})}var z=this.files[this.root+S];return z&&!z.dir?z:null},folder:function(S){if(!S)return this;if(k(S))return this.filter(function(z,I){return I.dir&&S.test(z)});var O=this.root+S,N=w.call(this,O),T=this.clone();return T.root=N.name,T},remove:function(S){S=this.root+S;var O=this.files[S];if(O||(S.slice(-1)!=="/"&&(S+="/"),O=this.files[S]),O&&!O.dir)delete this.files[S];else for(var N=this.filter(function(z,I){return I.name.slice(0,S.length)===S}),T=0;T<N.length;T++)delete this.files[N[T].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(S){var O,N={};try{if((N=l.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:a.utf8encode})).type=N.type.toLowerCase(),N.compression=N.compression.toUpperCase(),N.type==="binarystring"&&(N.type="string"),!N.type)throw new Error("No output type specified.");l.checkSupport(N.type),N.platform!=="darwin"&&N.platform!=="freebsd"&&N.platform!=="linux"&&N.platform!=="sunos"||(N.platform="UNIX"),N.platform==="win32"&&(N.platform="DOS");var T=N.comment||this.comment||"";O=h.generateWorker(this,N,T)}catch(z){(O=new c("error")).error(z)}return new u(O,N.type||"string",N.mimeType)},generateAsync:function(S,O){return this.generateInternalStream(S).accumulate(O)},generateNodeStream:function(S,O){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(O)}};r.exports=C},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,s){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,s){var o=n("./DataReader");function a(l){o.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}n("../utils").inherits(a,o),a.prototype.byteAt=function(l){return this.data[this.zero+l]},a.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),p=l.charCodeAt(3),g=this.length-4;0<=g;--g)if(this.data[g]===c&&this.data[g+1]===u&&this.data[g+2]===d&&this.data[g+3]===p)return g-this.zero;return-1},a.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),p=l.charCodeAt(3),g=this.readData(4);return c===g[0]&&u===g[1]&&d===g[2]&&p===g[3]},a.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./DataReader":18}],18:[function(n,r,s){var o=n("../utils");function a(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}a.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,u=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return o.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},r.exports=a},{"../utils":32}],19:[function(n,r,s){var o=n("./Uint8ArrayReader");function a(l){o.call(this,l)}n("../utils").inherits(a,o),a.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,s){var o=n("./DataReader");function a(l){o.call(this,l)}n("../utils").inherits(a,o),a.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},a.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},a.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},a.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./DataReader":18}],21:[function(n,r,s){var o=n("./ArrayReader");function a(l){o.call(this,l)}n("../utils").inherits(a,o),a.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,s){var o=n("../utils"),a=n("../support"),l=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(p){var g=o.getTypeOf(p);return o.checkSupport(g),g!=="string"||a.uint8array?g==="nodebuffer"?new u(p):a.uint8array?new d(o.transformTo("uint8array",p)):new l(o.transformTo("array",p)):new c(p)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,s){var o=n("./GenericWorker"),a=n("../utils");function l(c){o.call(this,"ConvertWorker to "+c),this.destType=c}a.inherits(l,o),l.prototype.processChunk=function(c){this.push({data:a.transformTo(this.destType,c.data),meta:c.meta})},r.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,s){var o=n("./GenericWorker"),a=n("../crc32");function l(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(l,o),l.prototype.processChunk=function(c){this.streamInfo.crc32=a(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,s){var o=n("../utils"),a=n("./GenericWorker");function l(c){a.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}o.inherits(l,a),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}a.prototype.processChunk.call(this,c)},r.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,s){var o=n("../utils"),a=n("./GenericWorker");function l(c){a.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=o.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}o.inherits(l,a),l.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,s){function o(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,l){return this._listeners[a].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,l){if(this._listeners[a])for(var c=0;c<this._listeners[a].length;c++)this._listeners[a][c].call(this,l)},pipe:function(a){return a.registerPrevious(this)},registerPrevious:function(a){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=a.streamInfo,this.mergeStreamInfo(),this.previous=a;var l=this;return a.on("data",function(c){l.processChunk(c)}),a.on("end",function(){l.end()}),a.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var a=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),a=!0),this.previous&&this.previous.resume(),!a},flush:function(){},processChunk:function(a){this.push(a)},withStreamInfo:function(a,l){return this.extraStreamInfo[a]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var a in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,a)&&(this.streamInfo[a]=this.extraStreamInfo[a])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var a="Worker "+this.name;return this.previous?this.previous+" -> "+a:a}},r.exports=o},{}],29:[function(n,r,s){var o=n("../utils"),a=n("./ConvertWorker"),l=n("./GenericWorker"),c=n("../base64"),u=n("../support"),d=n("../external"),p=null;if(u.nodestream)try{p=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function g(x,f){return new d.Promise(function(m,y){var w=[],k=x._internalType,C=x._outputType,S=x._mimeType;x.on("data",function(O,N){w.push(O),f&&f(N)}).on("error",function(O){w=[],y(O)}).on("end",function(){try{var O=(function(N,T,z){switch(N){case"blob":return o.newBlob(o.transformTo("arraybuffer",T),z);case"base64":return c.encode(T);default:return o.transformTo(N,T)}})(C,(function(N,T){var z,I=0,K=null,j=0;for(z=0;z<T.length;z++)j+=T[z].length;switch(N){case"string":return T.join("");case"array":return Array.prototype.concat.apply([],T);case"uint8array":for(K=new Uint8Array(j),z=0;z<T.length;z++)K.set(T[z],I),I+=T[z].length;return K;case"nodebuffer":return Buffer.concat(T);default:throw new Error("concat : unsupported type '"+N+"'")}})(k,w),S);m(O)}catch(N){y(N)}w=[]}).resume()})}function h(x,f,m){var y=f;switch(f){case"blob":case"arraybuffer":y="uint8array";break;case"base64":y="string"}try{this._internalType=y,this._outputType=f,this._mimeType=m,o.checkSupport(y),this._worker=x.pipe(new a(y)),x.lock()}catch(w){this._worker=new l("error"),this._worker.error(w)}}h.prototype={accumulate:function(x){return g(this,x)},on:function(x,f){var m=this;return x==="data"?this._worker.on(x,function(y){f.call(m,y.data,y.meta)}):this._worker.on(x,function(){o.delay(f,arguments,m)}),this},resume:function(){return o.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(x){if(o.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new p(this,{objectMode:this._outputType!=="nodebuffer"},x)}},r.exports=h},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s.nodebuffer=typeof Buffer<"u",s.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")s.blob=!1;else{var o=new ArrayBuffer(0);try{s.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(o),s.blob=a.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!n("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,s){for(var o=n("./utils"),a=n("./support"),l=n("./nodejsUtils"),c=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function p(){c.call(this,"utf-8 decode"),this.leftOver=null}function g(){c.call(this,"utf-8 encode")}s.utf8encode=function(h){return a.nodebuffer?l.newBufferFrom(h,"utf-8"):(function(x){var f,m,y,w,k,C=x.length,S=0;for(w=0;w<C;w++)(64512&(m=x.charCodeAt(w)))==55296&&w+1<C&&(64512&(y=x.charCodeAt(w+1)))==56320&&(m=65536+(m-55296<<10)+(y-56320),w++),S+=m<128?1:m<2048?2:m<65536?3:4;for(f=a.uint8array?new Uint8Array(S):new Array(S),w=k=0;k<S;w++)(64512&(m=x.charCodeAt(w)))==55296&&w+1<C&&(64512&(y=x.charCodeAt(w+1)))==56320&&(m=65536+(m-55296<<10)+(y-56320),w++),m<128?f[k++]=m:(m<2048?f[k++]=192|m>>>6:(m<65536?f[k++]=224|m>>>12:(f[k++]=240|m>>>18,f[k++]=128|m>>>12&63),f[k++]=128|m>>>6&63),f[k++]=128|63&m);return f})(h)},s.utf8decode=function(h){return a.nodebuffer?o.transformTo("nodebuffer",h).toString("utf-8"):(function(x){var f,m,y,w,k=x.length,C=new Array(2*k);for(f=m=0;f<k;)if((y=x[f++])<128)C[m++]=y;else if(4<(w=u[y]))C[m++]=65533,f+=w-1;else{for(y&=w===2?31:w===3?15:7;1<w&&f<k;)y=y<<6|63&x[f++],w--;1<w?C[m++]=65533:y<65536?C[m++]=y:(y-=65536,C[m++]=55296|y>>10&1023,C[m++]=56320|1023&y)}return C.length!==m&&(C.subarray?C=C.subarray(0,m):C.length=m),o.applyFromCharCode(C)})(h=o.transformTo(a.uint8array?"uint8array":"array",h))},o.inherits(p,c),p.prototype.processChunk=function(h){var x=o.transformTo(a.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var f=x;(x=new Uint8Array(f.length+this.leftOver.length)).set(this.leftOver,0),x.set(f,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var m=(function(w,k){var C;for((k=k||w.length)>w.length&&(k=w.length),C=k-1;0<=C&&(192&w[C])==128;)C--;return C<0||C===0?k:C+u[w[C]]>k?C:k})(x),y=x;m!==x.length&&(a.uint8array?(y=x.subarray(0,m),this.leftOver=x.subarray(m,x.length)):(y=x.slice(0,m),this.leftOver=x.slice(m,x.length))),this.push({data:s.utf8decode(y),meta:h.meta})},p.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=p,o.inherits(g,c),g.prototype.processChunk=function(h){this.push({data:s.utf8encode(h.data),meta:h.meta})},s.Utf8EncodeWorker=g},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,s){var o=n("./support"),a=n("./base64"),l=n("./nodejsUtils"),c=n("./external");function u(f){return f}function d(f,m){for(var y=0;y<f.length;++y)m[y]=255&f.charCodeAt(y);return m}n("setimmediate"),s.newBlob=function(f,m){s.checkSupport("blob");try{return new Blob([f],{type:m})}catch{try{var y=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return y.append(f),y.getBlob(m)}catch{throw new Error("Bug : can't construct the Blob.")}}};var p={stringifyByChunk:function(f,m,y){var w=[],k=0,C=f.length;if(C<=y)return String.fromCharCode.apply(null,f);for(;k<C;)m==="array"||m==="nodebuffer"?w.push(String.fromCharCode.apply(null,f.slice(k,Math.min(k+y,C)))):w.push(String.fromCharCode.apply(null,f.subarray(k,Math.min(k+y,C)))),k+=y;return w.join("")},stringifyByChar:function(f){for(var m="",y=0;y<f.length;y++)m+=String.fromCharCode(f[y]);return m},applyCanBeUsed:{uint8array:(function(){try{return o.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return o.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}})()}};function g(f){var m=65536,y=s.getTypeOf(f),w=!0;if(y==="uint8array"?w=p.applyCanBeUsed.uint8array:y==="nodebuffer"&&(w=p.applyCanBeUsed.nodebuffer),w)for(;1<m;)try{return p.stringifyByChunk(f,y,m)}catch{m=Math.floor(m/2)}return p.stringifyByChar(f)}function h(f,m){for(var y=0;y<f.length;y++)m[y]=f[y];return m}s.applyFromCharCode=g;var x={};x.string={string:u,array:function(f){return d(f,new Array(f.length))},arraybuffer:function(f){return x.string.uint8array(f).buffer},uint8array:function(f){return d(f,new Uint8Array(f.length))},nodebuffer:function(f){return d(f,l.allocBuffer(f.length))}},x.array={string:g,array:u,arraybuffer:function(f){return new Uint8Array(f).buffer},uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return l.newBufferFrom(f)}},x.arraybuffer={string:function(f){return g(new Uint8Array(f))},array:function(f){return h(new Uint8Array(f),new Array(f.byteLength))},arraybuffer:u,uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return l.newBufferFrom(new Uint8Array(f))}},x.uint8array={string:g,array:function(f){return h(f,new Array(f.length))},arraybuffer:function(f){return f.buffer},uint8array:u,nodebuffer:function(f){return l.newBufferFrom(f)}},x.nodebuffer={string:g,array:function(f){return h(f,new Array(f.length))},arraybuffer:function(f){return x.nodebuffer.uint8array(f).buffer},uint8array:function(f){return h(f,new Uint8Array(f.length))},nodebuffer:u},s.transformTo=function(f,m){if(m=m||"",!f)return m;s.checkSupport(f);var y=s.getTypeOf(m);return x[y][f](m)},s.resolve=function(f){for(var m=f.split("/"),y=[],w=0;w<m.length;w++){var k=m[w];k==="."||k===""&&w!==0&&w!==m.length-1||(k===".."?y.pop():y.push(k))}return y.join("/")},s.getTypeOf=function(f){return typeof f=="string"?"string":Object.prototype.toString.call(f)==="[object Array]"?"array":o.nodebuffer&&l.isBuffer(f)?"nodebuffer":o.uint8array&&f instanceof Uint8Array?"uint8array":o.arraybuffer&&f instanceof ArrayBuffer?"arraybuffer":void 0},s.checkSupport=function(f){if(!o[f.toLowerCase()])throw new Error(f+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(f){var m,y,w="";for(y=0;y<(f||"").length;y++)w+="\\x"+((m=f.charCodeAt(y))<16?"0":"")+m.toString(16).toUpperCase();return w},s.delay=function(f,m,y){setImmediate(function(){f.apply(y||null,m||[])})},s.inherits=function(f,m){function y(){}y.prototype=m.prototype,f.prototype=new y},s.extend=function(){var f,m,y={};for(f=0;f<arguments.length;f++)for(m in arguments[f])Object.prototype.hasOwnProperty.call(arguments[f],m)&&y[m]===void 0&&(y[m]=arguments[f][m]);return y},s.prepareContent=function(f,m,y,w,k){return c.Promise.resolve(m).then(function(C){return o.blob&&(C instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(C))!==-1)&&typeof FileReader<"u"?new c.Promise(function(S,O){var N=new FileReader;N.onload=function(T){S(T.target.result)},N.onerror=function(T){O(T.target.error)},N.readAsArrayBuffer(C)}):C}).then(function(C){var S=s.getTypeOf(C);return S?(S==="arraybuffer"?C=s.transformTo("uint8array",C):S==="string"&&(k?C=a.decode(C):y&&w!==!0&&(C=(function(O){return d(O,o.uint8array?new Uint8Array(O.length):new Array(O.length))})(C))),C):c.Promise.reject(new Error("Can't read the data of '"+f+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,s){var o=n("./reader/readerFor"),a=n("./utils"),l=n("./signature"),c=n("./zipEntry"),u=n("./support");function d(p){this.files=[],this.loadOptions=p}d.prototype={checkSignature:function(p){if(!this.reader.readAndCheckSignature(p)){this.reader.index-=4;var g=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+a.pretty(g)+", expected "+a.pretty(p)+")")}},isSignature:function(p,g){var h=this.reader.index;this.reader.setIndex(p);var x=this.reader.readString(4)===g;return this.reader.setIndex(h),x},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var p=this.reader.readData(this.zipCommentLength),g=u.uint8array?"uint8array":"array",h=a.transformTo(g,p);this.zipComment=this.loadOptions.decodeFileName(h)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var p,g,h,x=this.zip64EndOfCentralSize-44;0<x;)p=this.reader.readInt(2),g=this.reader.readInt(4),h=this.reader.readData(g),this.zip64ExtensibleData[p]={id:p,length:g,value:h}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var p,g;for(p=0;p<this.files.length;p++)g=this.files[p],this.reader.setIndex(g.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),g.readLocalPart(this.reader),g.handleUTF8(),g.processAttributes()},readCentralDir:function(){var p;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(p=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(p);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var p=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(p<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(p);var g=p;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,(p=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(p),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var h=this.centralDirOffset+this.centralDirSize;this.zip64&&(h+=20,h+=12+this.zip64EndOfCentralSize);var x=g-h;if(0<x)this.isSignature(g,l.CENTRAL_FILE_HEADER)||(this.reader.zero=x);else if(x<0)throw new Error("Corrupted zip: missing "+Math.abs(x)+" bytes.")},prepareReader:function(p){this.reader=o(p)},load:function(p){this.prepareReader(p),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,s){var o=n("./reader/readerFor"),a=n("./utils"),l=n("./compressedObject"),c=n("./crc32"),u=n("./utf8"),d=n("./compressions"),p=n("./support");function g(h,x){this.options=h,this.loadOptions=x}g.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(h){var x,f;if(h.skip(22),this.fileNameLength=h.readInt(2),f=h.readInt(2),this.fileName=h.readData(this.fileNameLength),h.skip(f),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((x=(function(m){for(var y in d)if(Object.prototype.hasOwnProperty.call(d,y)&&d[y].magic===m)return d[y];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,x,h.readData(this.compressedSize))},readCentralPart:function(h){this.versionMadeBy=h.readInt(2),h.skip(2),this.bitFlag=h.readInt(2),this.compressionMethod=h.readString(2),this.date=h.readDate(),this.crc32=h.readInt(4),this.compressedSize=h.readInt(4),this.uncompressedSize=h.readInt(4);var x=h.readInt(2);if(this.extraFieldsLength=h.readInt(2),this.fileCommentLength=h.readInt(2),this.diskNumberStart=h.readInt(2),this.internalFileAttributes=h.readInt(2),this.externalFileAttributes=h.readInt(4),this.localHeaderOffset=h.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");h.skip(x),this.readExtraFields(h),this.parseZIP64ExtraField(h),this.fileComment=h.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var h=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=o(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var x,f,m,y=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4<y;)x=h.readInt(2),f=h.readInt(2),m=h.readData(f),this.extraFields[x]={id:x,length:f,value:m};h.setIndex(y)},handleUTF8:function(){var h=p.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var x=this.findExtraFieldUnicodePath();if(x!==null)this.fileNameStr=x;else{var f=a.transformTo(h,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(f)}var m=this.findExtraFieldUnicodeComment();if(m!==null)this.fileCommentStr=m;else{var y=a.transformTo(h,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(y)}}},findExtraFieldUnicodePath:function(){var h=this.extraFields[28789];if(h){var x=o(h.value);return x.readInt(1)!==1||c(this.fileName)!==x.readInt(4)?null:u.utf8decode(x.readData(h.length-5))}return null},findExtraFieldUnicodeComment:function(){var h=this.extraFields[25461];if(h){var x=o(h.value);return x.readInt(1)!==1||c(this.fileComment)!==x.readInt(4)?null:u.utf8decode(x.readData(h.length-5))}return null}},r.exports=g},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,s){function o(x,f,m){this.name=x,this.dir=m.dir,this.date=m.date,this.comment=m.comment,this.unixPermissions=m.unixPermissions,this.dosPermissions=m.dosPermissions,this._data=f,this._dataBinary=m.binary,this.options={compression:m.compression,compressionOptions:m.compressionOptions}}var a=n("./stream/StreamHelper"),l=n("./stream/DataWorker"),c=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");o.prototype={internalStream:function(x){var f=null,m="string";try{if(!x)throw new Error("No output type specified.");var y=(m=x.toLowerCase())==="string"||m==="text";m!=="binarystring"&&m!=="text"||(m="string"),f=this._decompressWorker();var w=!this._dataBinary;w&&!y&&(f=f.pipe(new c.Utf8EncodeWorker)),!w&&y&&(f=f.pipe(new c.Utf8DecodeWorker))}catch(k){(f=new d("error")).error(k)}return new a(f,m,"")},async:function(x,f){return this.internalStream(x).accumulate(f)},nodeStream:function(x,f){return this.internalStream(x||"nodebuffer").toNodejsStream(f)},_compressWorker:function(x,f){if(this._data instanceof u&&this._data.compression.magic===x.magic)return this._data.getCompressedWorker();var m=this._decompressWorker();return this._dataBinary||(m=m.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(m,x,f)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new l(this._data)}};for(var p=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],g=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},h=0;h<p.length;h++)o.prototype[p[h]]=g;r.exports=o},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,s){(function(o){var a,l,c=o.MutationObserver||o.WebKitMutationObserver;if(c){var u=0,d=new c(x),p=o.document.createTextNode("");d.observe(p,{characterData:!0}),a=function(){p.data=u=++u%2}}else if(o.setImmediate||o.MessageChannel===void 0)a="document"in o&&"onreadystatechange"in o.document.createElement("script")?function(){var f=o.document.createElement("script");f.onreadystatechange=function(){x(),f.onreadystatechange=null,f.parentNode.removeChild(f),f=null},o.document.documentElement.appendChild(f)}:function(){setTimeout(x,0)};else{var g=new o.MessageChannel;g.port1.onmessage=x,a=function(){g.port2.postMessage(0)}}var h=[];function x(){var f,m;l=!0;for(var y=h.length;y;){for(m=h,h=[],f=-1;++f<y;)m[f]();y=h.length}l=!1}r.exports=function(f){h.push(f)!==1||l||a()}}).call(this,typeof Yn<"u"?Yn:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,s){var o=n("immediate");function a(){}var l={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function p(y){if(typeof y!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,y!==a&&f(this,y)}function g(y,w,k){this.promise=y,typeof w=="function"&&(this.onFulfilled=w,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function h(y,w,k){o(function(){var C;try{C=w(k)}catch(S){return l.reject(y,S)}C===y?l.reject(y,new TypeError("Cannot resolve promise with itself")):l.resolve(y,C)})}function x(y){var w=y&&y.then;if(y&&(typeof y=="object"||typeof y=="function")&&typeof w=="function")return function(){w.apply(y,arguments)}}function f(y,w){var k=!1;function C(N){k||(k=!0,l.reject(y,N))}function S(N){k||(k=!0,l.resolve(y,N))}var O=m(function(){w(S,C)});O.status==="error"&&C(O.value)}function m(y,w){var k={};try{k.value=y(w),k.status="success"}catch(C){k.status="error",k.value=C}return k}(r.exports=p).prototype.finally=function(y){if(typeof y!="function")return this;var w=this.constructor;return this.then(function(k){return w.resolve(y()).then(function(){return k})},function(k){return w.resolve(y()).then(function(){throw k})})},p.prototype.catch=function(y){return this.then(null,y)},p.prototype.then=function(y,w){if(typeof y!="function"&&this.state===u||typeof w!="function"&&this.state===c)return this;var k=new this.constructor(a);return this.state!==d?h(k,this.state===u?y:w,this.outcome):this.queue.push(new g(k,y,w)),k},g.prototype.callFulfilled=function(y){l.resolve(this.promise,y)},g.prototype.otherCallFulfilled=function(y){h(this.promise,this.onFulfilled,y)},g.prototype.callRejected=function(y){l.reject(this.promise,y)},g.prototype.otherCallRejected=function(y){h(this.promise,this.onRejected,y)},l.resolve=function(y,w){var k=m(x,w);if(k.status==="error")return l.reject(y,k.value);var C=k.value;if(C)f(y,C);else{y.state=u,y.outcome=w;for(var S=-1,O=y.queue.length;++S<O;)y.queue[S].callFulfilled(w)}return y},l.reject=function(y,w){y.state=c,y.outcome=w;for(var k=-1,C=y.queue.length;++k<C;)y.queue[k].callRejected(w);return y},p.resolve=function(y){return y instanceof this?y:l.resolve(new this(a),y)},p.reject=function(y){var w=new this(a);return l.reject(w,y)},p.all=function(y){var w=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=y.length,C=!1;if(!k)return this.resolve([]);for(var S=new Array(k),O=0,N=-1,T=new this(a);++N<k;)z(y[N],N);return T;function z(I,K){w.resolve(I).then(function(j){S[K]=j,++O!==k||C||(C=!0,l.resolve(T,S))},function(j){C||(C=!0,l.reject(T,j))})}},p.race=function(y){var w=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=y.length,C=!1;if(!k)return this.resolve([]);for(var S=-1,O=new this(a);++S<k;)N=y[S],w.resolve(N).then(function(T){C||(C=!0,l.resolve(O,T))},function(T){C||(C=!0,l.reject(O,T))});var N;return O}},{immediate:36}],38:[function(n,r,s){var o={};(0,n("./lib/utils/common").assign)(o,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=o},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,s){var o=n("./zlib/deflate"),a=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,p=0,g=-1,h=0,x=8;function f(y){if(!(this instanceof f))return new f(y);this.options=a.assign({level:g,method:x,chunkSize:16384,windowBits:15,memLevel:8,strategy:h,to:""},y||{});var w=this.options;w.raw&&0<w.windowBits?w.windowBits=-w.windowBits:w.gzip&&0<w.windowBits&&w.windowBits<16&&(w.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var k=o.deflateInit2(this.strm,w.level,w.method,w.windowBits,w.memLevel,w.strategy);if(k!==p)throw new Error(c[k]);if(w.header&&o.deflateSetHeader(this.strm,w.header),w.dictionary){var C;if(C=typeof w.dictionary=="string"?l.string2buf(w.dictionary):d.call(w.dictionary)==="[object ArrayBuffer]"?new Uint8Array(w.dictionary):w.dictionary,(k=o.deflateSetDictionary(this.strm,C))!==p)throw new Error(c[k]);this._dict_set=!0}}function m(y,w){var k=new f(w);if(k.push(y,!0),k.err)throw k.msg||c[k.err];return k.result}f.prototype.push=function(y,w){var k,C,S=this.strm,O=this.options.chunkSize;if(this.ended)return!1;C=w===~~w?w:w===!0?4:0,typeof y=="string"?S.input=l.string2buf(y):d.call(y)==="[object ArrayBuffer]"?S.input=new Uint8Array(y):S.input=y,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new a.Buf8(O),S.next_out=0,S.avail_out=O),(k=o.deflate(S,C))!==1&&k!==p)return this.onEnd(k),!(this.ended=!0);S.avail_out!==0&&(S.avail_in!==0||C!==4&&C!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(a.shrinkBuf(S.output,S.next_out))):this.onData(a.shrinkBuf(S.output,S.next_out)))}while((0<S.avail_in||S.avail_out===0)&&k!==1);return C===4?(k=o.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===p):C!==2||(this.onEnd(p),!(S.avail_out=0))},f.prototype.onData=function(y){this.chunks.push(y)},f.prototype.onEnd=function(y){y===p&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg},s.Deflate=f,s.deflate=m,s.deflateRaw=function(y,w){return(w=w||{}).raw=!0,m(y,w)},s.gzip=function(y,w){return(w=w||{}).gzip=!0,m(y,w)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,s){var o=n("./zlib/inflate"),a=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),p=n("./zlib/gzheader"),g=Object.prototype.toString;function h(f){if(!(this instanceof h))return new h(f);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},f||{});var m=this.options;m.raw&&0<=m.windowBits&&m.windowBits<16&&(m.windowBits=-m.windowBits,m.windowBits===0&&(m.windowBits=-15)),!(0<=m.windowBits&&m.windowBits<16)||f&&f.windowBits||(m.windowBits+=32),15<m.windowBits&&m.windowBits<48&&(15&m.windowBits)==0&&(m.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var y=o.inflateInit2(this.strm,m.windowBits);if(y!==c.Z_OK)throw new Error(u[y]);this.header=new p,o.inflateGetHeader(this.strm,this.header)}function x(f,m){var y=new h(m);if(y.push(f,!0),y.err)throw y.msg||u[y.err];return y.result}h.prototype.push=function(f,m){var y,w,k,C,S,O,N=this.strm,T=this.options.chunkSize,z=this.options.dictionary,I=!1;if(this.ended)return!1;w=m===~~m?m:m===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof f=="string"?N.input=l.binstring2buf(f):g.call(f)==="[object ArrayBuffer]"?N.input=new Uint8Array(f):N.input=f,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new a.Buf8(T),N.next_out=0,N.avail_out=T),(y=o.inflate(N,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&z&&(O=typeof z=="string"?l.string2buf(z):g.call(z)==="[object ArrayBuffer]"?new Uint8Array(z):z,y=o.inflateSetDictionary(this.strm,O)),y===c.Z_BUF_ERROR&&I===!0&&(y=c.Z_OK,I=!1),y!==c.Z_STREAM_END&&y!==c.Z_OK)return this.onEnd(y),!(this.ended=!0);N.next_out&&(N.avail_out!==0&&y!==c.Z_STREAM_END&&(N.avail_in!==0||w!==c.Z_FINISH&&w!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=l.utf8border(N.output,N.next_out),C=N.next_out-k,S=l.buf2string(N.output,k),N.next_out=C,N.avail_out=T-C,C&&a.arraySet(N.output,N.output,k,C,0),this.onData(S)):this.onData(a.shrinkBuf(N.output,N.next_out)))),N.avail_in===0&&N.avail_out===0&&(I=!0)}while((0<N.avail_in||N.avail_out===0)&&y!==c.Z_STREAM_END);return y===c.Z_STREAM_END&&(w=c.Z_FINISH),w===c.Z_FINISH?(y=o.inflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===c.Z_OK):w!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(N.avail_out=0))},h.prototype.onData=function(f){this.chunks.push(f)},h.prototype.onEnd=function(f){f===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg},s.Inflate=h,s.inflate=x,s.inflateRaw=function(f,m){return(m=m||{}).raw=!0,x(f,m)},s.ungzip=x},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,s){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var p in d)d.hasOwnProperty(p)&&(c[p]=d[p])}}return c},s.shrinkBuf=function(c,u){return c.length===u?c:c.subarray?c.subarray(0,u):(c.length=u,c)};var a={arraySet:function(c,u,d,p,g){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+p),g);else for(var h=0;h<p;h++)c[g+h]=u[d+h]},flattenChunks:function(c){var u,d,p,g,h,x;for(u=p=0,d=c.length;u<d;u++)p+=c[u].length;for(x=new Uint8Array(p),u=g=0,d=c.length;u<d;u++)h=c[u],x.set(h,g),g+=h.length;return x}},l={arraySet:function(c,u,d,p,g){for(var h=0;h<p;h++)c[g+h]=u[d+h]},flattenChunks:function(c){return[].concat.apply([],c)}};s.setTyped=function(c){c?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,a)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,l))},s.setTyped(o)},{}],42:[function(n,r,s){var o=n("./common"),a=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new o.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(p,g){if(g<65537&&(p.subarray&&l||!p.subarray&&a))return String.fromCharCode.apply(null,o.shrinkBuf(p,g));for(var h="",x=0;x<g;x++)h+=String.fromCharCode(p[x]);return h}c[254]=c[254]=1,s.string2buf=function(p){var g,h,x,f,m,y=p.length,w=0;for(f=0;f<y;f++)(64512&(h=p.charCodeAt(f)))==55296&&f+1<y&&(64512&(x=p.charCodeAt(f+1)))==56320&&(h=65536+(h-55296<<10)+(x-56320),f++),w+=h<128?1:h<2048?2:h<65536?3:4;for(g=new o.Buf8(w),f=m=0;m<w;f++)(64512&(h=p.charCodeAt(f)))==55296&&f+1<y&&(64512&(x=p.charCodeAt(f+1)))==56320&&(h=65536+(h-55296<<10)+(x-56320),f++),h<128?g[m++]=h:(h<2048?g[m++]=192|h>>>6:(h<65536?g[m++]=224|h>>>12:(g[m++]=240|h>>>18,g[m++]=128|h>>>12&63),g[m++]=128|h>>>6&63),g[m++]=128|63&h);return g},s.buf2binstring=function(p){return d(p,p.length)},s.binstring2buf=function(p){for(var g=new o.Buf8(p.length),h=0,x=g.length;h<x;h++)g[h]=p.charCodeAt(h);return g},s.buf2string=function(p,g){var h,x,f,m,y=g||p.length,w=new Array(2*y);for(h=x=0;h<y;)if((f=p[h++])<128)w[x++]=f;else if(4<(m=c[f]))w[x++]=65533,h+=m-1;else{for(f&=m===2?31:m===3?15:7;1<m&&h<y;)f=f<<6|63&p[h++],m--;1<m?w[x++]=65533:f<65536?w[x++]=f:(f-=65536,w[x++]=55296|f>>10&1023,w[x++]=56320|1023&f)}return d(w,x)},s.utf8border=function(p,g){var h;for((g=g||p.length)>p.length&&(g=p.length),h=g-1;0<=h&&(192&p[h])==128;)h--;return h<0||h===0?g:h+c[p[h]]>g?h:g}},{"./common":41}],43:[function(n,r,s){r.exports=function(o,a,l,c){for(var u=65535&o|0,d=o>>>16&65535|0,p=0;l!==0;){for(l-=p=2e3<l?2e3:l;d=d+(u=u+a[c++]|0)|0,--p;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,s){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,s){var o=(function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var u=0;u<8;u++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l})();r.exports=function(a,l,c,u){var d=o,p=u+c;a^=-1;for(var g=u;g<p;g++)a=a>>>8^d[255&(a^l[g])];return-1^a}},{}],46:[function(n,r,s){var o,a=n("../utils/common"),l=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),p=0,g=4,h=0,x=-2,f=-1,m=4,y=2,w=8,k=9,C=286,S=30,O=19,N=2*C+1,T=15,z=3,I=258,K=I+z+1,j=42,R=113,_=1,F=2,Z=3,P=4;function M(b,Y){return b.msg=d[Y],Y}function W(b){return(b<<1)-(4<b?9:0)}function te(b){for(var Y=b.length;0<=--Y;)b[Y]=0}function V(b){var Y=b.state,q=Y.pending;q>b.avail_out&&(q=b.avail_out),q!==0&&(a.arraySet(b.output,Y.pending_buf,Y.pending_out,q,b.next_out),b.next_out+=q,Y.pending_out+=q,b.total_out+=q,b.avail_out-=q,Y.pending-=q,Y.pending===0&&(Y.pending_out=0))}function U(b,Y){l._tr_flush_block(b,0<=b.block_start?b.block_start:-1,b.strstart-b.block_start,Y),b.block_start=b.strstart,V(b.strm)}function re(b,Y){b.pending_buf[b.pending++]=Y}function ee(b,Y){b.pending_buf[b.pending++]=Y>>>8&255,b.pending_buf[b.pending++]=255&Y}function J(b,Y){var q,A,E=b.max_chain_length,L=b.strstart,$=b.prev_length,H=b.nice_match,D=b.strstart>b.w_size-K?b.strstart-(b.w_size-K):0,Q=b.window,oe=b.w_mask,se=b.prev,ge=b.strstart+I,Ee=Q[L+$-1],Ce=Q[L+$];b.prev_length>=b.good_match&&(E>>=2),H>b.lookahead&&(H=b.lookahead);do if(Q[(q=Y)+$]===Ce&&Q[q+$-1]===Ee&&Q[q]===Q[L]&&Q[++q]===Q[L+1]){L+=2,q++;do;while(Q[++L]===Q[++q]&&Q[++L]===Q[++q]&&Q[++L]===Q[++q]&&Q[++L]===Q[++q]&&Q[++L]===Q[++q]&&Q[++L]===Q[++q]&&Q[++L]===Q[++q]&&Q[++L]===Q[++q]&&L<ge);if(A=I-(ge-L),L=ge-I,$<A){if(b.match_start=Y,H<=($=A))break;Ee=Q[L+$-1],Ce=Q[L+$]}}while((Y=se[Y&oe])>D&&--E!=0);return $<=b.lookahead?$:b.lookahead}function ue(b){var Y,q,A,E,L,$,H,D,Q,oe,se=b.w_size;do{if(E=b.window_size-b.lookahead-b.strstart,b.strstart>=se+(se-K)){for(a.arraySet(b.window,b.window,se,se,0),b.match_start-=se,b.strstart-=se,b.block_start-=se,Y=q=b.hash_size;A=b.head[--Y],b.head[Y]=se<=A?A-se:0,--q;);for(Y=q=se;A=b.prev[--Y],b.prev[Y]=se<=A?A-se:0,--q;);E+=se}if(b.strm.avail_in===0)break;if($=b.strm,H=b.window,D=b.strstart+b.lookahead,Q=E,oe=void 0,oe=$.avail_in,Q<oe&&(oe=Q),q=oe===0?0:($.avail_in-=oe,a.arraySet(H,$.input,$.next_in,oe,D),$.state.wrap===1?$.adler=c($.adler,H,oe,D):$.state.wrap===2&&($.adler=u($.adler,H,oe,D)),$.next_in+=oe,$.total_in+=oe,oe),b.lookahead+=q,b.lookahead+b.insert>=z)for(L=b.strstart-b.insert,b.ins_h=b.window[L],b.ins_h=(b.ins_h<<b.hash_shift^b.window[L+1])&b.hash_mask;b.insert&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[L+z-1])&b.hash_mask,b.prev[L&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=L,L++,b.insert--,!(b.lookahead+b.insert<z)););}while(b.lookahead<K&&b.strm.avail_in!==0)}function X(b,Y){for(var q,A;;){if(b.lookahead<K){if(ue(b),b.lookahead<K&&Y===p)return _;if(b.lookahead===0)break}if(q=0,b.lookahead>=z&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+z-1])&b.hash_mask,q=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart),q!==0&&b.strstart-q<=b.w_size-K&&(b.match_length=J(b,q)),b.match_length>=z)if(A=l._tr_tally(b,b.strstart-b.match_start,b.match_length-z),b.lookahead-=b.match_length,b.match_length<=b.max_lazy_match&&b.lookahead>=z){for(b.match_length--;b.strstart++,b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+z-1])&b.hash_mask,q=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart,--b.match_length!=0;);b.strstart++}else b.strstart+=b.match_length,b.match_length=0,b.ins_h=b.window[b.strstart],b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+1])&b.hash_mask;else A=l._tr_tally(b,0,b.window[b.strstart]),b.lookahead--,b.strstart++;if(A&&(U(b,!1),b.strm.avail_out===0))return _}return b.insert=b.strstart<z-1?b.strstart:z-1,Y===g?(U(b,!0),b.strm.avail_out===0?Z:P):b.last_lit&&(U(b,!1),b.strm.avail_out===0)?_:F}function ie(b,Y){for(var q,A,E;;){if(b.lookahead<K){if(ue(b),b.lookahead<K&&Y===p)return _;if(b.lookahead===0)break}if(q=0,b.lookahead>=z&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+z-1])&b.hash_mask,q=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart),b.prev_length=b.match_length,b.prev_match=b.match_start,b.match_length=z-1,q!==0&&b.prev_length<b.max_lazy_match&&b.strstart-q<=b.w_size-K&&(b.match_length=J(b,q),b.match_length<=5&&(b.strategy===1||b.match_length===z&&4096<b.strstart-b.match_start)&&(b.match_length=z-1)),b.prev_length>=z&&b.match_length<=b.prev_length){for(E=b.strstart+b.lookahead-z,A=l._tr_tally(b,b.strstart-1-b.prev_match,b.prev_length-z),b.lookahead-=b.prev_length-1,b.prev_length-=2;++b.strstart<=E&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+z-1])&b.hash_mask,q=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart),--b.prev_length!=0;);if(b.match_available=0,b.match_length=z-1,b.strstart++,A&&(U(b,!1),b.strm.avail_out===0))return _}else if(b.match_available){if((A=l._tr_tally(b,0,b.window[b.strstart-1]))&&U(b,!1),b.strstart++,b.lookahead--,b.strm.avail_out===0)return _}else b.match_available=1,b.strstart++,b.lookahead--}return b.match_available&&(A=l._tr_tally(b,0,b.window[b.strstart-1]),b.match_available=0),b.insert=b.strstart<z-1?b.strstart:z-1,Y===g?(U(b,!0),b.strm.avail_out===0?Z:P):b.last_lit&&(U(b,!1),b.strm.avail_out===0)?_:F}function ae(b,Y,q,A,E){this.good_length=b,this.max_lazy=Y,this.nice_length=q,this.max_chain=A,this.func=E}function me(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=w,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(2*N),this.dyn_dtree=new a.Buf16(2*(2*S+1)),this.bl_tree=new a.Buf16(2*(2*O+1)),te(this.dyn_ltree),te(this.dyn_dtree),te(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(T+1),this.heap=new a.Buf16(2*C+1),te(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(2*C+1),te(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function he(b){var Y;return b&&b.state?(b.total_in=b.total_out=0,b.data_type=y,(Y=b.state).pending=0,Y.pending_out=0,Y.wrap<0&&(Y.wrap=-Y.wrap),Y.status=Y.wrap?j:R,b.adler=Y.wrap===2?0:1,Y.last_flush=p,l._tr_init(Y),h):M(b,x)}function we(b){var Y=he(b);return Y===h&&(function(q){q.window_size=2*q.w_size,te(q.head),q.max_lazy_match=o[q.level].max_lazy,q.good_match=o[q.level].good_length,q.nice_match=o[q.level].nice_length,q.max_chain_length=o[q.level].max_chain,q.strstart=0,q.block_start=0,q.lookahead=0,q.insert=0,q.match_length=q.prev_length=z-1,q.match_available=0,q.ins_h=0})(b.state),Y}function Ne(b,Y,q,A,E,L){if(!b)return x;var $=1;if(Y===f&&(Y=6),A<0?($=0,A=-A):15<A&&($=2,A-=16),E<1||k<E||q!==w||A<8||15<A||Y<0||9<Y||L<0||m<L)return M(b,x);A===8&&(A=9);var H=new me;return(b.state=H).strm=b,H.wrap=$,H.gzhead=null,H.w_bits=A,H.w_size=1<<H.w_bits,H.w_mask=H.w_size-1,H.hash_bits=E+7,H.hash_size=1<<H.hash_bits,H.hash_mask=H.hash_size-1,H.hash_shift=~~((H.hash_bits+z-1)/z),H.window=new a.Buf8(2*H.w_size),H.head=new a.Buf16(H.hash_size),H.prev=new a.Buf16(H.w_size),H.lit_bufsize=1<<E+6,H.pending_buf_size=4*H.lit_bufsize,H.pending_buf=new a.Buf8(H.pending_buf_size),H.d_buf=1*H.lit_bufsize,H.l_buf=3*H.lit_bufsize,H.level=Y,H.strategy=L,H.method=q,we(b)}o=[new ae(0,0,0,0,function(b,Y){var q=65535;for(q>b.pending_buf_size-5&&(q=b.pending_buf_size-5);;){if(b.lookahead<=1){if(ue(b),b.lookahead===0&&Y===p)return _;if(b.lookahead===0)break}b.strstart+=b.lookahead,b.lookahead=0;var A=b.block_start+q;if((b.strstart===0||b.strstart>=A)&&(b.lookahead=b.strstart-A,b.strstart=A,U(b,!1),b.strm.avail_out===0)||b.strstart-b.block_start>=b.w_size-K&&(U(b,!1),b.strm.avail_out===0))return _}return b.insert=0,Y===g?(U(b,!0),b.strm.avail_out===0?Z:P):(b.strstart>b.block_start&&(U(b,!1),b.strm.avail_out),_)}),new ae(4,4,8,4,X),new ae(4,5,16,8,X),new ae(4,6,32,32,X),new ae(4,4,16,16,ie),new ae(8,16,32,32,ie),new ae(8,16,128,128,ie),new ae(8,32,128,256,ie),new ae(32,128,258,1024,ie),new ae(32,258,258,4096,ie)],s.deflateInit=function(b,Y){return Ne(b,Y,w,15,8,0)},s.deflateInit2=Ne,s.deflateReset=we,s.deflateResetKeep=he,s.deflateSetHeader=function(b,Y){return b&&b.state?b.state.wrap!==2?x:(b.state.gzhead=Y,h):x},s.deflate=function(b,Y){var q,A,E,L;if(!b||!b.state||5<Y||Y<0)return b?M(b,x):x;if(A=b.state,!b.output||!b.input&&b.avail_in!==0||A.status===666&&Y!==g)return M(b,b.avail_out===0?-5:x);if(A.strm=b,q=A.last_flush,A.last_flush=Y,A.status===j)if(A.wrap===2)b.adler=0,re(A,31),re(A,139),re(A,8),A.gzhead?(re(A,(A.gzhead.text?1:0)+(A.gzhead.hcrc?2:0)+(A.gzhead.extra?4:0)+(A.gzhead.name?8:0)+(A.gzhead.comment?16:0)),re(A,255&A.gzhead.time),re(A,A.gzhead.time>>8&255),re(A,A.gzhead.time>>16&255),re(A,A.gzhead.time>>24&255),re(A,A.level===9?2:2<=A.strategy||A.level<2?4:0),re(A,255&A.gzhead.os),A.gzhead.extra&&A.gzhead.extra.length&&(re(A,255&A.gzhead.extra.length),re(A,A.gzhead.extra.length>>8&255)),A.gzhead.hcrc&&(b.adler=u(b.adler,A.pending_buf,A.pending,0)),A.gzindex=0,A.status=69):(re(A,0),re(A,0),re(A,0),re(A,0),re(A,0),re(A,A.level===9?2:2<=A.strategy||A.level<2?4:0),re(A,3),A.status=R);else{var $=w+(A.w_bits-8<<4)<<8;$|=(2<=A.strategy||A.level<2?0:A.level<6?1:A.level===6?2:3)<<6,A.strstart!==0&&($|=32),$+=31-$%31,A.status=R,ee(A,$),A.strstart!==0&&(ee(A,b.adler>>>16),ee(A,65535&b.adler)),b.adler=1}if(A.status===69)if(A.gzhead.extra){for(E=A.pending;A.gzindex<(65535&A.gzhead.extra.length)&&(A.pending!==A.pending_buf_size||(A.gzhead.hcrc&&A.pending>E&&(b.adler=u(b.adler,A.pending_buf,A.pending-E,E)),V(b),E=A.pending,A.pending!==A.pending_buf_size));)re(A,255&A.gzhead.extra[A.gzindex]),A.gzindex++;A.gzhead.hcrc&&A.pending>E&&(b.adler=u(b.adler,A.pending_buf,A.pending-E,E)),A.gzindex===A.gzhead.extra.length&&(A.gzindex=0,A.status=73)}else A.status=73;if(A.status===73)if(A.gzhead.name){E=A.pending;do{if(A.pending===A.pending_buf_size&&(A.gzhead.hcrc&&A.pending>E&&(b.adler=u(b.adler,A.pending_buf,A.pending-E,E)),V(b),E=A.pending,A.pending===A.pending_buf_size)){L=1;break}L=A.gzindex<A.gzhead.name.length?255&A.gzhead.name.charCodeAt(A.gzindex++):0,re(A,L)}while(L!==0);A.gzhead.hcrc&&A.pending>E&&(b.adler=u(b.adler,A.pending_buf,A.pending-E,E)),L===0&&(A.gzindex=0,A.status=91)}else A.status=91;if(A.status===91)if(A.gzhead.comment){E=A.pending;do{if(A.pending===A.pending_buf_size&&(A.gzhead.hcrc&&A.pending>E&&(b.adler=u(b.adler,A.pending_buf,A.pending-E,E)),V(b),E=A.pending,A.pending===A.pending_buf_size)){L=1;break}L=A.gzindex<A.gzhead.comment.length?255&A.gzhead.comment.charCodeAt(A.gzindex++):0,re(A,L)}while(L!==0);A.gzhead.hcrc&&A.pending>E&&(b.adler=u(b.adler,A.pending_buf,A.pending-E,E)),L===0&&(A.status=103)}else A.status=103;if(A.status===103&&(A.gzhead.hcrc?(A.pending+2>A.pending_buf_size&&V(b),A.pending+2<=A.pending_buf_size&&(re(A,255&b.adler),re(A,b.adler>>8&255),b.adler=0,A.status=R)):A.status=R),A.pending!==0){if(V(b),b.avail_out===0)return A.last_flush=-1,h}else if(b.avail_in===0&&W(Y)<=W(q)&&Y!==g)return M(b,-5);if(A.status===666&&b.avail_in!==0)return M(b,-5);if(b.avail_in!==0||A.lookahead!==0||Y!==p&&A.status!==666){var H=A.strategy===2?(function(D,Q){for(var oe;;){if(D.lookahead===0&&(ue(D),D.lookahead===0)){if(Q===p)return _;break}if(D.match_length=0,oe=l._tr_tally(D,0,D.window[D.strstart]),D.lookahead--,D.strstart++,oe&&(U(D,!1),D.strm.avail_out===0))return _}return D.insert=0,Q===g?(U(D,!0),D.strm.avail_out===0?Z:P):D.last_lit&&(U(D,!1),D.strm.avail_out===0)?_:F})(A,Y):A.strategy===3?(function(D,Q){for(var oe,se,ge,Ee,Ce=D.window;;){if(D.lookahead<=I){if(ue(D),D.lookahead<=I&&Q===p)return _;if(D.lookahead===0)break}if(D.match_length=0,D.lookahead>=z&&0<D.strstart&&(se=Ce[ge=D.strstart-1])===Ce[++ge]&&se===Ce[++ge]&&se===Ce[++ge]){Ee=D.strstart+I;do;while(se===Ce[++ge]&&se===Ce[++ge]&&se===Ce[++ge]&&se===Ce[++ge]&&se===Ce[++ge]&&se===Ce[++ge]&&se===Ce[++ge]&&se===Ce[++ge]&&ge<Ee);D.match_length=I-(Ee-ge),D.match_length>D.lookahead&&(D.match_length=D.lookahead)}if(D.match_length>=z?(oe=l._tr_tally(D,1,D.match_length-z),D.lookahead-=D.match_length,D.strstart+=D.match_length,D.match_length=0):(oe=l._tr_tally(D,0,D.window[D.strstart]),D.lookahead--,D.strstart++),oe&&(U(D,!1),D.strm.avail_out===0))return _}return D.insert=0,Q===g?(U(D,!0),D.strm.avail_out===0?Z:P):D.last_lit&&(U(D,!1),D.strm.avail_out===0)?_:F})(A,Y):o[A.level].func(A,Y);if(H!==Z&&H!==P||(A.status=666),H===_||H===Z)return b.avail_out===0&&(A.last_flush=-1),h;if(H===F&&(Y===1?l._tr_align(A):Y!==5&&(l._tr_stored_block(A,0,0,!1),Y===3&&(te(A.head),A.lookahead===0&&(A.strstart=0,A.block_start=0,A.insert=0))),V(b),b.avail_out===0))return A.last_flush=-1,h}return Y!==g?h:A.wrap<=0?1:(A.wrap===2?(re(A,255&b.adler),re(A,b.adler>>8&255),re(A,b.adler>>16&255),re(A,b.adler>>24&255),re(A,255&b.total_in),re(A,b.total_in>>8&255),re(A,b.total_in>>16&255),re(A,b.total_in>>24&255)):(ee(A,b.adler>>>16),ee(A,65535&b.adler)),V(b),0<A.wrap&&(A.wrap=-A.wrap),A.pending!==0?h:1)},s.deflateEnd=function(b){var Y;return b&&b.state?(Y=b.state.status)!==j&&Y!==69&&Y!==73&&Y!==91&&Y!==103&&Y!==R&&Y!==666?M(b,x):(b.state=null,Y===R?M(b,-3):h):x},s.deflateSetDictionary=function(b,Y){var q,A,E,L,$,H,D,Q,oe=Y.length;if(!b||!b.state||(L=(q=b.state).wrap)===2||L===1&&q.status!==j||q.lookahead)return x;for(L===1&&(b.adler=c(b.adler,Y,oe,0)),q.wrap=0,oe>=q.w_size&&(L===0&&(te(q.head),q.strstart=0,q.block_start=0,q.insert=0),Q=new a.Buf8(q.w_size),a.arraySet(Q,Y,oe-q.w_size,q.w_size,0),Y=Q,oe=q.w_size),$=b.avail_in,H=b.next_in,D=b.input,b.avail_in=oe,b.next_in=0,b.input=Y,ue(q);q.lookahead>=z;){for(A=q.strstart,E=q.lookahead-(z-1);q.ins_h=(q.ins_h<<q.hash_shift^q.window[A+z-1])&q.hash_mask,q.prev[A&q.w_mask]=q.head[q.ins_h],q.head[q.ins_h]=A,A++,--E;);q.strstart=A,q.lookahead=z-1,ue(q)}return q.strstart+=q.lookahead,q.block_start=q.strstart,q.insert=q.lookahead,q.lookahead=0,q.match_length=q.prev_length=z-1,q.match_available=0,b.next_in=H,b.input=D,b.avail_in=$,q.wrap=L,h},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,s){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,s){r.exports=function(o,a){var l,c,u,d,p,g,h,x,f,m,y,w,k,C,S,O,N,T,z,I,K,j,R,_,F;l=o.state,c=o.next_in,_=o.input,u=c+(o.avail_in-5),d=o.next_out,F=o.output,p=d-(a-o.avail_out),g=d+(o.avail_out-257),h=l.dmax,x=l.wsize,f=l.whave,m=l.wnext,y=l.window,w=l.hold,k=l.bits,C=l.lencode,S=l.distcode,O=(1<<l.lenbits)-1,N=(1<<l.distbits)-1;e:do{k<15&&(w+=_[c++]<<k,k+=8,w+=_[c++]<<k,k+=8),T=C[w&O];t:for(;;){if(w>>>=z=T>>>24,k-=z,(z=T>>>16&255)===0)F[d++]=65535&T;else{if(!(16&z)){if((64&z)==0){T=C[(65535&T)+(w&(1<<z)-1)];continue t}if(32&z){l.mode=12;break e}o.msg="invalid literal/length code",l.mode=30;break e}I=65535&T,(z&=15)&&(k<z&&(w+=_[c++]<<k,k+=8),I+=w&(1<<z)-1,w>>>=z,k-=z),k<15&&(w+=_[c++]<<k,k+=8,w+=_[c++]<<k,k+=8),T=S[w&N];n:for(;;){if(w>>>=z=T>>>24,k-=z,!(16&(z=T>>>16&255))){if((64&z)==0){T=S[(65535&T)+(w&(1<<z)-1)];continue n}o.msg="invalid distance code",l.mode=30;break e}if(K=65535&T,k<(z&=15)&&(w+=_[c++]<<k,(k+=8)<z&&(w+=_[c++]<<k,k+=8)),h<(K+=w&(1<<z)-1)){o.msg="invalid distance too far back",l.mode=30;break e}if(w>>>=z,k-=z,(z=d-p)<K){if(f<(z=K-z)&&l.sane){o.msg="invalid distance too far back",l.mode=30;break e}if(R=y,(j=0)===m){if(j+=x-z,z<I){for(I-=z;F[d++]=y[j++],--z;);j=d-K,R=F}}else if(m<z){if(j+=x+m-z,(z-=m)<I){for(I-=z;F[d++]=y[j++],--z;);if(j=0,m<I){for(I-=z=m;F[d++]=y[j++],--z;);j=d-K,R=F}}}else if(j+=m-z,z<I){for(I-=z;F[d++]=y[j++],--z;);j=d-K,R=F}for(;2<I;)F[d++]=R[j++],F[d++]=R[j++],F[d++]=R[j++],I-=3;I&&(F[d++]=R[j++],1<I&&(F[d++]=R[j++]))}else{for(j=d-K;F[d++]=F[j++],F[d++]=F[j++],F[d++]=F[j++],2<(I-=3););I&&(F[d++]=F[j++],1<I&&(F[d++]=F[j++]))}break}}break}}while(c<u&&d<g);c-=I=k>>3,w&=(1<<(k-=I<<3))-1,o.next_in=c,o.next_out=d,o.avail_in=c<u?u-c+5:5-(c-u),o.avail_out=d<g?g-d+257:257-(d-g),l.hold=w,l.bits=k}},{}],49:[function(n,r,s){var o=n("../utils/common"),a=n("./adler32"),l=n("./crc32"),c=n("./inffast"),u=n("./inftrees"),d=1,p=2,g=0,h=-2,x=1,f=852,m=592;function y(j){return(j>>>24&255)+(j>>>8&65280)+((65280&j)<<8)+((255&j)<<24)}function w(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(j){var R;return j&&j.state?(R=j.state,j.total_in=j.total_out=R.total=0,j.msg="",R.wrap&&(j.adler=1&R.wrap),R.mode=x,R.last=0,R.havedict=0,R.dmax=32768,R.head=null,R.hold=0,R.bits=0,R.lencode=R.lendyn=new o.Buf32(f),R.distcode=R.distdyn=new o.Buf32(m),R.sane=1,R.back=-1,g):h}function C(j){var R;return j&&j.state?((R=j.state).wsize=0,R.whave=0,R.wnext=0,k(j)):h}function S(j,R){var _,F;return j&&j.state?(F=j.state,R<0?(_=0,R=-R):(_=1+(R>>4),R<48&&(R&=15)),R&&(R<8||15<R)?h:(F.window!==null&&F.wbits!==R&&(F.window=null),F.wrap=_,F.wbits=R,C(j))):h}function O(j,R){var _,F;return j?(F=new w,(j.state=F).window=null,(_=S(j,R))!==g&&(j.state=null),_):h}var N,T,z=!0;function I(j){if(z){var R;for(N=new o.Buf32(512),T=new o.Buf32(32),R=0;R<144;)j.lens[R++]=8;for(;R<256;)j.lens[R++]=9;for(;R<280;)j.lens[R++]=7;for(;R<288;)j.lens[R++]=8;for(u(d,j.lens,0,288,N,0,j.work,{bits:9}),R=0;R<32;)j.lens[R++]=5;u(p,j.lens,0,32,T,0,j.work,{bits:5}),z=!1}j.lencode=N,j.lenbits=9,j.distcode=T,j.distbits=5}function K(j,R,_,F){var Z,P=j.state;return P.window===null&&(P.wsize=1<<P.wbits,P.wnext=0,P.whave=0,P.window=new o.Buf8(P.wsize)),F>=P.wsize?(o.arraySet(P.window,R,_-P.wsize,P.wsize,0),P.wnext=0,P.whave=P.wsize):(F<(Z=P.wsize-P.wnext)&&(Z=F),o.arraySet(P.window,R,_-F,Z,P.wnext),(F-=Z)?(o.arraySet(P.window,R,_-F,F,0),P.wnext=F,P.whave=P.wsize):(P.wnext+=Z,P.wnext===P.wsize&&(P.wnext=0),P.whave<P.wsize&&(P.whave+=Z))),0}s.inflateReset=C,s.inflateReset2=S,s.inflateResetKeep=k,s.inflateInit=function(j){return O(j,15)},s.inflateInit2=O,s.inflate=function(j,R){var _,F,Z,P,M,W,te,V,U,re,ee,J,ue,X,ie,ae,me,he,we,Ne,b,Y,q,A,E=0,L=new o.Buf8(4),$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!j||!j.state||!j.output||!j.input&&j.avail_in!==0)return h;(_=j.state).mode===12&&(_.mode=13),M=j.next_out,Z=j.output,te=j.avail_out,P=j.next_in,F=j.input,W=j.avail_in,V=_.hold,U=_.bits,re=W,ee=te,Y=g;e:for(;;)switch(_.mode){case x:if(_.wrap===0){_.mode=13;break}for(;U<16;){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}if(2&_.wrap&&V===35615){L[_.check=0]=255&V,L[1]=V>>>8&255,_.check=l(_.check,L,2,0),U=V=0,_.mode=2;break}if(_.flags=0,_.head&&(_.head.done=!1),!(1&_.wrap)||(((255&V)<<8)+(V>>8))%31){j.msg="incorrect header check",_.mode=30;break}if((15&V)!=8){j.msg="unknown compression method",_.mode=30;break}if(U-=4,b=8+(15&(V>>>=4)),_.wbits===0)_.wbits=b;else if(b>_.wbits){j.msg="invalid window size",_.mode=30;break}_.dmax=1<<b,j.adler=_.check=1,_.mode=512&V?10:12,U=V=0;break;case 2:for(;U<16;){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}if(_.flags=V,(255&_.flags)!=8){j.msg="unknown compression method",_.mode=30;break}if(57344&_.flags){j.msg="unknown header flags set",_.mode=30;break}_.head&&(_.head.text=V>>8&1),512&_.flags&&(L[0]=255&V,L[1]=V>>>8&255,_.check=l(_.check,L,2,0)),U=V=0,_.mode=3;case 3:for(;U<32;){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}_.head&&(_.head.time=V),512&_.flags&&(L[0]=255&V,L[1]=V>>>8&255,L[2]=V>>>16&255,L[3]=V>>>24&255,_.check=l(_.check,L,4,0)),U=V=0,_.mode=4;case 4:for(;U<16;){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}_.head&&(_.head.xflags=255&V,_.head.os=V>>8),512&_.flags&&(L[0]=255&V,L[1]=V>>>8&255,_.check=l(_.check,L,2,0)),U=V=0,_.mode=5;case 5:if(1024&_.flags){for(;U<16;){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}_.length=V,_.head&&(_.head.extra_len=V),512&_.flags&&(L[0]=255&V,L[1]=V>>>8&255,_.check=l(_.check,L,2,0)),U=V=0}else _.head&&(_.head.extra=null);_.mode=6;case 6:if(1024&_.flags&&(W<(J=_.length)&&(J=W),J&&(_.head&&(b=_.head.extra_len-_.length,_.head.extra||(_.head.extra=new Array(_.head.extra_len)),o.arraySet(_.head.extra,F,P,J,b)),512&_.flags&&(_.check=l(_.check,F,J,P)),W-=J,P+=J,_.length-=J),_.length))break e;_.length=0,_.mode=7;case 7:if(2048&_.flags){if(W===0)break e;for(J=0;b=F[P+J++],_.head&&b&&_.length<65536&&(_.head.name+=String.fromCharCode(b)),b&&J<W;);if(512&_.flags&&(_.check=l(_.check,F,J,P)),W-=J,P+=J,b)break e}else _.head&&(_.head.name=null);_.length=0,_.mode=8;case 8:if(4096&_.flags){if(W===0)break e;for(J=0;b=F[P+J++],_.head&&b&&_.length<65536&&(_.head.comment+=String.fromCharCode(b)),b&&J<W;);if(512&_.flags&&(_.check=l(_.check,F,J,P)),W-=J,P+=J,b)break e}else _.head&&(_.head.comment=null);_.mode=9;case 9:if(512&_.flags){for(;U<16;){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}if(V!==(65535&_.check)){j.msg="header crc mismatch",_.mode=30;break}U=V=0}_.head&&(_.head.hcrc=_.flags>>9&1,_.head.done=!0),j.adler=_.check=0,_.mode=12;break;case 10:for(;U<32;){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}j.adler=_.check=y(V),U=V=0,_.mode=11;case 11:if(_.havedict===0)return j.next_out=M,j.avail_out=te,j.next_in=P,j.avail_in=W,_.hold=V,_.bits=U,2;j.adler=_.check=1,_.mode=12;case 12:if(R===5||R===6)break e;case 13:if(_.last){V>>>=7&U,U-=7&U,_.mode=27;break}for(;U<3;){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}switch(_.last=1&V,U-=1,3&(V>>>=1)){case 0:_.mode=14;break;case 1:if(I(_),_.mode=20,R!==6)break;V>>>=2,U-=2;break e;case 2:_.mode=17;break;case 3:j.msg="invalid block type",_.mode=30}V>>>=2,U-=2;break;case 14:for(V>>>=7&U,U-=7&U;U<32;){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}if((65535&V)!=(V>>>16^65535)){j.msg="invalid stored block lengths",_.mode=30;break}if(_.length=65535&V,U=V=0,_.mode=15,R===6)break e;case 15:_.mode=16;case 16:if(J=_.length){if(W<J&&(J=W),te<J&&(J=te),J===0)break e;o.arraySet(Z,F,P,J,M),W-=J,P+=J,te-=J,M+=J,_.length-=J;break}_.mode=12;break;case 17:for(;U<14;){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}if(_.nlen=257+(31&V),V>>>=5,U-=5,_.ndist=1+(31&V),V>>>=5,U-=5,_.ncode=4+(15&V),V>>>=4,U-=4,286<_.nlen||30<_.ndist){j.msg="too many length or distance symbols",_.mode=30;break}_.have=0,_.mode=18;case 18:for(;_.have<_.ncode;){for(;U<3;){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}_.lens[$[_.have++]]=7&V,V>>>=3,U-=3}for(;_.have<19;)_.lens[$[_.have++]]=0;if(_.lencode=_.lendyn,_.lenbits=7,q={bits:_.lenbits},Y=u(0,_.lens,0,19,_.lencode,0,_.work,q),_.lenbits=q.bits,Y){j.msg="invalid code lengths set",_.mode=30;break}_.have=0,_.mode=19;case 19:for(;_.have<_.nlen+_.ndist;){for(;ae=(E=_.lencode[V&(1<<_.lenbits)-1])>>>16&255,me=65535&E,!((ie=E>>>24)<=U);){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}if(me<16)V>>>=ie,U-=ie,_.lens[_.have++]=me;else{if(me===16){for(A=ie+2;U<A;){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}if(V>>>=ie,U-=ie,_.have===0){j.msg="invalid bit length repeat",_.mode=30;break}b=_.lens[_.have-1],J=3+(3&V),V>>>=2,U-=2}else if(me===17){for(A=ie+3;U<A;){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}U-=ie,b=0,J=3+(7&(V>>>=ie)),V>>>=3,U-=3}else{for(A=ie+7;U<A;){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}U-=ie,b=0,J=11+(127&(V>>>=ie)),V>>>=7,U-=7}if(_.have+J>_.nlen+_.ndist){j.msg="invalid bit length repeat",_.mode=30;break}for(;J--;)_.lens[_.have++]=b}}if(_.mode===30)break;if(_.lens[256]===0){j.msg="invalid code -- missing end-of-block",_.mode=30;break}if(_.lenbits=9,q={bits:_.lenbits},Y=u(d,_.lens,0,_.nlen,_.lencode,0,_.work,q),_.lenbits=q.bits,Y){j.msg="invalid literal/lengths set",_.mode=30;break}if(_.distbits=6,_.distcode=_.distdyn,q={bits:_.distbits},Y=u(p,_.lens,_.nlen,_.ndist,_.distcode,0,_.work,q),_.distbits=q.bits,Y){j.msg="invalid distances set",_.mode=30;break}if(_.mode=20,R===6)break e;case 20:_.mode=21;case 21:if(6<=W&&258<=te){j.next_out=M,j.avail_out=te,j.next_in=P,j.avail_in=W,_.hold=V,_.bits=U,c(j,ee),M=j.next_out,Z=j.output,te=j.avail_out,P=j.next_in,F=j.input,W=j.avail_in,V=_.hold,U=_.bits,_.mode===12&&(_.back=-1);break}for(_.back=0;ae=(E=_.lencode[V&(1<<_.lenbits)-1])>>>16&255,me=65535&E,!((ie=E>>>24)<=U);){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}if(ae&&(240&ae)==0){for(he=ie,we=ae,Ne=me;ae=(E=_.lencode[Ne+((V&(1<<he+we)-1)>>he)])>>>16&255,me=65535&E,!(he+(ie=E>>>24)<=U);){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}V>>>=he,U-=he,_.back+=he}if(V>>>=ie,U-=ie,_.back+=ie,_.length=me,ae===0){_.mode=26;break}if(32&ae){_.back=-1,_.mode=12;break}if(64&ae){j.msg="invalid literal/length code",_.mode=30;break}_.extra=15&ae,_.mode=22;case 22:if(_.extra){for(A=_.extra;U<A;){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}_.length+=V&(1<<_.extra)-1,V>>>=_.extra,U-=_.extra,_.back+=_.extra}_.was=_.length,_.mode=23;case 23:for(;ae=(E=_.distcode[V&(1<<_.distbits)-1])>>>16&255,me=65535&E,!((ie=E>>>24)<=U);){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}if((240&ae)==0){for(he=ie,we=ae,Ne=me;ae=(E=_.distcode[Ne+((V&(1<<he+we)-1)>>he)])>>>16&255,me=65535&E,!(he+(ie=E>>>24)<=U);){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}V>>>=he,U-=he,_.back+=he}if(V>>>=ie,U-=ie,_.back+=ie,64&ae){j.msg="invalid distance code",_.mode=30;break}_.offset=me,_.extra=15&ae,_.mode=24;case 24:if(_.extra){for(A=_.extra;U<A;){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}_.offset+=V&(1<<_.extra)-1,V>>>=_.extra,U-=_.extra,_.back+=_.extra}if(_.offset>_.dmax){j.msg="invalid distance too far back",_.mode=30;break}_.mode=25;case 25:if(te===0)break e;if(J=ee-te,_.offset>J){if((J=_.offset-J)>_.whave&&_.sane){j.msg="invalid distance too far back",_.mode=30;break}ue=J>_.wnext?(J-=_.wnext,_.wsize-J):_.wnext-J,J>_.length&&(J=_.length),X=_.window}else X=Z,ue=M-_.offset,J=_.length;for(te<J&&(J=te),te-=J,_.length-=J;Z[M++]=X[ue++],--J;);_.length===0&&(_.mode=21);break;case 26:if(te===0)break e;Z[M++]=_.length,te--,_.mode=21;break;case 27:if(_.wrap){for(;U<32;){if(W===0)break e;W--,V|=F[P++]<<U,U+=8}if(ee-=te,j.total_out+=ee,_.total+=ee,ee&&(j.adler=_.check=_.flags?l(_.check,Z,ee,M-ee):a(_.check,Z,ee,M-ee)),ee=te,(_.flags?V:y(V))!==_.check){j.msg="incorrect data check",_.mode=30;break}U=V=0}_.mode=28;case 28:if(_.wrap&&_.flags){for(;U<32;){if(W===0)break e;W--,V+=F[P++]<<U,U+=8}if(V!==(4294967295&_.total)){j.msg="incorrect length check",_.mode=30;break}U=V=0}_.mode=29;case 29:Y=1;break e;case 30:Y=-3;break e;case 31:return-4;default:return h}return j.next_out=M,j.avail_out=te,j.next_in=P,j.avail_in=W,_.hold=V,_.bits=U,(_.wsize||ee!==j.avail_out&&_.mode<30&&(_.mode<27||R!==4))&&K(j,j.output,j.next_out,ee-j.avail_out)?(_.mode=31,-4):(re-=j.avail_in,ee-=j.avail_out,j.total_in+=re,j.total_out+=ee,_.total+=ee,_.wrap&&ee&&(j.adler=_.check=_.flags?l(_.check,Z,ee,j.next_out-ee):a(_.check,Z,ee,j.next_out-ee)),j.data_type=_.bits+(_.last?64:0)+(_.mode===12?128:0)+(_.mode===20||_.mode===15?256:0),(re==0&&ee===0||R===4)&&Y===g&&(Y=-5),Y)},s.inflateEnd=function(j){if(!j||!j.state)return h;var R=j.state;return R.window&&(R.window=null),j.state=null,g},s.inflateGetHeader=function(j,R){var _;return j&&j.state?(2&(_=j.state).wrap)==0?h:((_.head=R).done=!1,g):h},s.inflateSetDictionary=function(j,R){var _,F=R.length;return j&&j.state?(_=j.state).wrap!==0&&_.mode!==11?h:_.mode===11&&a(1,R,F,0)!==_.check?-3:K(j,R,F,F)?(_.mode=31,-4):(_.havedict=1,g):h},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,s){var o=n("../utils/common"),a=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,p,g,h,x,f,m,y){var w,k,C,S,O,N,T,z,I,K=y.bits,j=0,R=0,_=0,F=0,Z=0,P=0,M=0,W=0,te=0,V=0,U=null,re=0,ee=new o.Buf16(16),J=new o.Buf16(16),ue=null,X=0;for(j=0;j<=15;j++)ee[j]=0;for(R=0;R<h;R++)ee[p[g+R]]++;for(Z=K,F=15;1<=F&&ee[F]===0;F--);if(F<Z&&(Z=F),F===0)return x[f++]=20971520,x[f++]=20971520,y.bits=1,0;for(_=1;_<F&&ee[_]===0;_++);for(Z<_&&(Z=_),j=W=1;j<=15;j++)if(W<<=1,(W-=ee[j])<0)return-1;if(0<W&&(d===0||F!==1))return-1;for(J[1]=0,j=1;j<15;j++)J[j+1]=J[j]+ee[j];for(R=0;R<h;R++)p[g+R]!==0&&(m[J[p[g+R]]++]=R);if(N=d===0?(U=ue=m,19):d===1?(U=a,re-=257,ue=l,X-=257,256):(U=c,ue=u,-1),j=_,O=f,M=R=V=0,C=-1,S=(te=1<<(P=Z))-1,d===1&&852<te||d===2&&592<te)return 1;for(;;){for(T=j-M,I=m[R]<N?(z=0,m[R]):m[R]>N?(z=ue[X+m[R]],U[re+m[R]]):(z=96,0),w=1<<j-M,_=k=1<<P;x[O+(V>>M)+(k-=w)]=T<<24|z<<16|I|0,k!==0;);for(w=1<<j-1;V&w;)w>>=1;if(w!==0?(V&=w-1,V+=w):V=0,R++,--ee[j]==0){if(j===F)break;j=p[g+m[R]]}if(Z<j&&(V&S)!==C){for(M===0&&(M=Z),O+=_,W=1<<(P=j-M);P+M<F&&!((W-=ee[P+M])<=0);)P++,W<<=1;if(te+=1<<P,d===1&&852<te||d===2&&592<te)return 1;x[C=V&S]=Z<<24|P<<16|O-f|0}}return V!==0&&(x[O+V]=j-M<<24|64<<16|0),y.bits=Z,0}},{"../utils/common":41}],51:[function(n,r,s){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,s){var o=n("../utils/common"),a=0,l=1;function c(E){for(var L=E.length;0<=--L;)E[L]=0}var u=0,d=29,p=256,g=p+1+d,h=30,x=19,f=2*g+1,m=15,y=16,w=7,k=256,C=16,S=17,O=18,N=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],T=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],K=new Array(2*(g+2));c(K);var j=new Array(2*h);c(j);var R=new Array(512);c(R);var _=new Array(256);c(_);var F=new Array(d);c(F);var Z,P,M,W=new Array(h);function te(E,L,$,H,D){this.static_tree=E,this.extra_bits=L,this.extra_base=$,this.elems=H,this.max_length=D,this.has_stree=E&&E.length}function V(E,L){this.dyn_tree=E,this.max_code=0,this.stat_desc=L}function U(E){return E<256?R[E]:R[256+(E>>>7)]}function re(E,L){E.pending_buf[E.pending++]=255&L,E.pending_buf[E.pending++]=L>>>8&255}function ee(E,L,$){E.bi_valid>y-$?(E.bi_buf|=L<<E.bi_valid&65535,re(E,E.bi_buf),E.bi_buf=L>>y-E.bi_valid,E.bi_valid+=$-y):(E.bi_buf|=L<<E.bi_valid&65535,E.bi_valid+=$)}function J(E,L,$){ee(E,$[2*L],$[2*L+1])}function ue(E,L){for(var $=0;$|=1&E,E>>>=1,$<<=1,0<--L;);return $>>>1}function X(E,L,$){var H,D,Q=new Array(m+1),oe=0;for(H=1;H<=m;H++)Q[H]=oe=oe+$[H-1]<<1;for(D=0;D<=L;D++){var se=E[2*D+1];se!==0&&(E[2*D]=ue(Q[se]++,se))}}function ie(E){var L;for(L=0;L<g;L++)E.dyn_ltree[2*L]=0;for(L=0;L<h;L++)E.dyn_dtree[2*L]=0;for(L=0;L<x;L++)E.bl_tree[2*L]=0;E.dyn_ltree[2*k]=1,E.opt_len=E.static_len=0,E.last_lit=E.matches=0}function ae(E){8<E.bi_valid?re(E,E.bi_buf):0<E.bi_valid&&(E.pending_buf[E.pending++]=E.bi_buf),E.bi_buf=0,E.bi_valid=0}function me(E,L,$,H){var D=2*L,Q=2*$;return E[D]<E[Q]||E[D]===E[Q]&&H[L]<=H[$]}function he(E,L,$){for(var H=E.heap[$],D=$<<1;D<=E.heap_len&&(D<E.heap_len&&me(L,E.heap[D+1],E.heap[D],E.depth)&&D++,!me(L,H,E.heap[D],E.depth));)E.heap[$]=E.heap[D],$=D,D<<=1;E.heap[$]=H}function we(E,L,$){var H,D,Q,oe,se=0;if(E.last_lit!==0)for(;H=E.pending_buf[E.d_buf+2*se]<<8|E.pending_buf[E.d_buf+2*se+1],D=E.pending_buf[E.l_buf+se],se++,H===0?J(E,D,L):(J(E,(Q=_[D])+p+1,L),(oe=N[Q])!==0&&ee(E,D-=F[Q],oe),J(E,Q=U(--H),$),(oe=T[Q])!==0&&ee(E,H-=W[Q],oe)),se<E.last_lit;);J(E,k,L)}function Ne(E,L){var $,H,D,Q=L.dyn_tree,oe=L.stat_desc.static_tree,se=L.stat_desc.has_stree,ge=L.stat_desc.elems,Ee=-1;for(E.heap_len=0,E.heap_max=f,$=0;$<ge;$++)Q[2*$]!==0?(E.heap[++E.heap_len]=Ee=$,E.depth[$]=0):Q[2*$+1]=0;for(;E.heap_len<2;)Q[2*(D=E.heap[++E.heap_len]=Ee<2?++Ee:0)]=1,E.depth[D]=0,E.opt_len--,se&&(E.static_len-=oe[2*D+1]);for(L.max_code=Ee,$=E.heap_len>>1;1<=$;$--)he(E,Q,$);for(D=ge;$=E.heap[1],E.heap[1]=E.heap[E.heap_len--],he(E,Q,1),H=E.heap[1],E.heap[--E.heap_max]=$,E.heap[--E.heap_max]=H,Q[2*D]=Q[2*$]+Q[2*H],E.depth[D]=(E.depth[$]>=E.depth[H]?E.depth[$]:E.depth[H])+1,Q[2*$+1]=Q[2*H+1]=D,E.heap[1]=D++,he(E,Q,1),2<=E.heap_len;);E.heap[--E.heap_max]=E.heap[1],(function(Ce,Ge){var kn,ot,Cn,De,Jn,rs,ht=Ge.dyn_tree,Vo=Ge.max_code,hd=Ge.stat_desc.static_tree,pd=Ge.stat_desc.has_stree,md=Ge.stat_desc.extra_bits,Ho=Ge.stat_desc.extra_base,Sn=Ge.stat_desc.max_length,Gn=0;for(De=0;De<=m;De++)Ce.bl_count[De]=0;for(ht[2*Ce.heap[Ce.heap_max]+1]=0,kn=Ce.heap_max+1;kn<f;kn++)Sn<(De=ht[2*ht[2*(ot=Ce.heap[kn])+1]+1]+1)&&(De=Sn,Gn++),ht[2*ot+1]=De,Vo<ot||(Ce.bl_count[De]++,Jn=0,Ho<=ot&&(Jn=md[ot-Ho]),rs=ht[2*ot],Ce.opt_len+=rs*(De+Jn),pd&&(Ce.static_len+=rs*(hd[2*ot+1]+Jn)));if(Gn!==0){do{for(De=Sn-1;Ce.bl_count[De]===0;)De--;Ce.bl_count[De]--,Ce.bl_count[De+1]+=2,Ce.bl_count[Sn]--,Gn-=2}while(0<Gn);for(De=Sn;De!==0;De--)for(ot=Ce.bl_count[De];ot!==0;)Vo<(Cn=Ce.heap[--kn])||(ht[2*Cn+1]!==De&&(Ce.opt_len+=(De-ht[2*Cn+1])*ht[2*Cn],ht[2*Cn+1]=De),ot--)}})(E,L),X(Q,Ee,E.bl_count)}function b(E,L,$){var H,D,Q=-1,oe=L[1],se=0,ge=7,Ee=4;for(oe===0&&(ge=138,Ee=3),L[2*($+1)+1]=65535,H=0;H<=$;H++)D=oe,oe=L[2*(H+1)+1],++se<ge&&D===oe||(se<Ee?E.bl_tree[2*D]+=se:D!==0?(D!==Q&&E.bl_tree[2*D]++,E.bl_tree[2*C]++):se<=10?E.bl_tree[2*S]++:E.bl_tree[2*O]++,Q=D,Ee=(se=0)===oe?(ge=138,3):D===oe?(ge=6,3):(ge=7,4))}function Y(E,L,$){var H,D,Q=-1,oe=L[1],se=0,ge=7,Ee=4;for(oe===0&&(ge=138,Ee=3),H=0;H<=$;H++)if(D=oe,oe=L[2*(H+1)+1],!(++se<ge&&D===oe)){if(se<Ee)for(;J(E,D,E.bl_tree),--se!=0;);else D!==0?(D!==Q&&(J(E,D,E.bl_tree),se--),J(E,C,E.bl_tree),ee(E,se-3,2)):se<=10?(J(E,S,E.bl_tree),ee(E,se-3,3)):(J(E,O,E.bl_tree),ee(E,se-11,7));Q=D,Ee=(se=0)===oe?(ge=138,3):D===oe?(ge=6,3):(ge=7,4)}}c(W);var q=!1;function A(E,L,$,H){ee(E,(u<<1)+(H?1:0),3),(function(D,Q,oe,se){ae(D),re(D,oe),re(D,~oe),o.arraySet(D.pending_buf,D.window,Q,oe,D.pending),D.pending+=oe})(E,L,$)}s._tr_init=function(E){q||((function(){var L,$,H,D,Q,oe=new Array(m+1);for(D=H=0;D<d-1;D++)for(F[D]=H,L=0;L<1<<N[D];L++)_[H++]=D;for(_[H-1]=D,D=Q=0;D<16;D++)for(W[D]=Q,L=0;L<1<<T[D];L++)R[Q++]=D;for(Q>>=7;D<h;D++)for(W[D]=Q<<7,L=0;L<1<<T[D]-7;L++)R[256+Q++]=D;for($=0;$<=m;$++)oe[$]=0;for(L=0;L<=143;)K[2*L+1]=8,L++,oe[8]++;for(;L<=255;)K[2*L+1]=9,L++,oe[9]++;for(;L<=279;)K[2*L+1]=7,L++,oe[7]++;for(;L<=287;)K[2*L+1]=8,L++,oe[8]++;for(X(K,g+1,oe),L=0;L<h;L++)j[2*L+1]=5,j[2*L]=ue(L,5);Z=new te(K,N,p+1,g,m),P=new te(j,T,0,h,m),M=new te(new Array(0),z,0,x,w)})(),q=!0),E.l_desc=new V(E.dyn_ltree,Z),E.d_desc=new V(E.dyn_dtree,P),E.bl_desc=new V(E.bl_tree,M),E.bi_buf=0,E.bi_valid=0,ie(E)},s._tr_stored_block=A,s._tr_flush_block=function(E,L,$,H){var D,Q,oe=0;0<E.level?(E.strm.data_type===2&&(E.strm.data_type=(function(se){var ge,Ee=4093624447;for(ge=0;ge<=31;ge++,Ee>>>=1)if(1&Ee&&se.dyn_ltree[2*ge]!==0)return a;if(se.dyn_ltree[18]!==0||se.dyn_ltree[20]!==0||se.dyn_ltree[26]!==0)return l;for(ge=32;ge<p;ge++)if(se.dyn_ltree[2*ge]!==0)return l;return a})(E)),Ne(E,E.l_desc),Ne(E,E.d_desc),oe=(function(se){var ge;for(b(se,se.dyn_ltree,se.l_desc.max_code),b(se,se.dyn_dtree,se.d_desc.max_code),Ne(se,se.bl_desc),ge=x-1;3<=ge&&se.bl_tree[2*I[ge]+1]===0;ge--);return se.opt_len+=3*(ge+1)+5+5+4,ge})(E),D=E.opt_len+3+7>>>3,(Q=E.static_len+3+7>>>3)<=D&&(D=Q)):D=Q=$+5,$+4<=D&&L!==-1?A(E,L,$,H):E.strategy===4||Q===D?(ee(E,2+(H?1:0),3),we(E,K,j)):(ee(E,4+(H?1:0),3),(function(se,ge,Ee,Ce){var Ge;for(ee(se,ge-257,5),ee(se,Ee-1,5),ee(se,Ce-4,4),Ge=0;Ge<Ce;Ge++)ee(se,se.bl_tree[2*I[Ge]+1],3);Y(se,se.dyn_ltree,ge-1),Y(se,se.dyn_dtree,Ee-1)})(E,E.l_desc.max_code+1,E.d_desc.max_code+1,oe+1),we(E,E.dyn_ltree,E.dyn_dtree)),ie(E),H&&ae(E)},s._tr_tally=function(E,L,$){return E.pending_buf[E.d_buf+2*E.last_lit]=L>>>8&255,E.pending_buf[E.d_buf+2*E.last_lit+1]=255&L,E.pending_buf[E.l_buf+E.last_lit]=255&$,E.last_lit++,L===0?E.dyn_ltree[2*$]++:(E.matches++,L--,E.dyn_ltree[2*(_[$]+p+1)]++,E.dyn_dtree[2*U(L)]++),E.last_lit===E.lit_bufsize-1},s._tr_align=function(E){ee(E,2,3),J(E,k,K),(function(L){L.bi_valid===16?(re(L,L.bi_buf),L.bi_buf=0,L.bi_valid=0):8<=L.bi_valid&&(L.pending_buf[L.pending++]=255&L.bi_buf,L.bi_buf>>=8,L.bi_valid-=8)})(E)}},{"../utils/common":41}],53:[function(n,r,s){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,s){(function(o){(function(a,l){if(!a.setImmediate){var c,u,d,p,g=1,h={},x=!1,f=a.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(a);m=m&&m.setTimeout?m:a,c={}.toString.call(a.process)==="[object process]"?function(C){process.nextTick(function(){w(C)})}:(function(){if(a.postMessage&&!a.importScripts){var C=!0,S=a.onmessage;return a.onmessage=function(){C=!1},a.postMessage("","*"),a.onmessage=S,C}})()?(p="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",k,!1):a.attachEvent("onmessage",k),function(C){a.postMessage(p+C,"*")}):a.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){w(C.data)},function(C){d.port2.postMessage(C)}):f&&"onreadystatechange"in f.createElement("script")?(u=f.documentElement,function(C){var S=f.createElement("script");S.onreadystatechange=function(){w(C),S.onreadystatechange=null,u.removeChild(S),S=null},u.appendChild(S)}):function(C){setTimeout(w,0,C)},m.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var S=new Array(arguments.length-1),O=0;O<S.length;O++)S[O]=arguments[O+1];var N={callback:C,args:S};return h[g]=N,c(g),g++},m.clearImmediate=y}function y(C){delete h[C]}function w(C){if(x)setTimeout(w,0,C);else{var S=h[C];if(S){x=!0;try{(function(O){var N=O.callback,T=O.args;switch(T.length){case 0:N();break;case 1:N(T[0]);break;case 2:N(T[0],T[1]);break;case 3:N(T[0],T[1],T[2]);break;default:N.apply(l,T)}})(S)}finally{y(C),x=!1}}}}function k(C){C.source===a&&typeof C.data=="string"&&C.data.indexOf(p)===0&&w(+C.data.slice(p.length))}})(typeof self>"u"?o===void 0?this:o:self)}).call(this,typeof Yn<"u"?Yn:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(as)),as.exports}var Ox=zx();const Ix=gd(Ox);async function Rx(e){try{const t=await fetch(`/api/logs/${e}/chunks`);if(!t.ok)return null;const n=await t.json();return JSON.stringify(n,null,2)}catch{return null}}async function Px(e){const t=new Ix;for(const a of e)a.rawRequestBody!==null&&t.file(`#${a.id}.Request.json`,a.rawRequestBody),a.responseText!==null&&t.file(`#${a.id}.Response.json`,a.responseText);const n=e.filter(a=>a.streaming);await Promise.allSettled(n.map(async a=>{const l=await Rx(a.id);l!==null&&t.file(`#${a.id}.SSE.Response.json`,l)}));const r=await t.generateAsync({type:"blob"}),s=URL.createObjectURL(r),o=document.createElement("a");o.href=s,o.download=`agent-inspector-export-${new Date().toISOString().slice(0,10)}.zip`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(s)}function Ps(e,t){switch(t){case"full":return e;case"time":return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function go(e,t,n){return`${Ps(e,n)} - ${Ps(t,n)}`}function Nl(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=Nl(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function El(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Nl(e))&&(r&&(r+=" "),r+=t);return r}const Mx=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Dx=(e,t)=>({classGroupId:e,validator:t}),Tl=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),kr="-",bi=[],Lx="arbitrary..",Fx=e=>{const t=Bx(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return $x(a);const l=a.split(kr),c=l[0]===""&&l.length>1?1:0;return Al(l,c,t)},getConflictingClassGroupIds:(a,l)=>{if(l){const c=r[a],u=n[a];return c?u?Mx(u,c):c:u||bi}return n[a]||bi}}},Al=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const u=Al(e,t+1,o);if(u)return u}const a=n.validators;if(a===null)return;const l=t===0?e.join(kr):e.slice(t).join(kr),c=a.length;for(let u=0;u<c;u++){const d=a[u];if(d.validator(l))return d.classGroupId}},$x=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?Lx+r:void 0})(),Bx=e=>{const{theme:t,classGroups:n}=e;return Ux(n,t)},Ux=(e,t)=>{const n=Tl();for(const r in e){const s=e[r];xo(s,n,r,t)}return n},xo=(e,t,n,r)=>{const s=e.length;for(let o=0;o<s;o++){const a=e[o];Zx(a,t,n,r)}},Zx=(e,t,n,r)=>{if(typeof e=="string"){Wx(e,t,n);return}if(typeof e=="function"){Vx(e,t,n,r);return}Hx(e,t,n,r)},Wx=(e,t,n)=>{const r=e===""?t:zl(t,e);r.classGroupId=n},Vx=(e,t,n,r)=>{if(qx(e)){xo(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Dx(n,e))},Hx=(e,t,n,r)=>{const s=Object.entries(e),o=s.length;for(let a=0;a<o;a++){const[l,c]=s[a];xo(c,zl(t,l),n,r)}},zl=(e,t)=>{let n=e;const r=t.split(kr),s=r.length;for(let o=0;o<s;o++){const a=r[o];let l=n.nextPart.get(a);l||(l=Tl(),n.nextPart.set(a,l)),n=l}return n},qx=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Kx=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(o,a)=>{n[o]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let a=n[o];if(a!==void 0)return a;if((a=r[o])!==void 0)return s(o,a),a},set(o,a){o in n?n[o]=a:s(o,a)}}},Ms="!",wi=":",Jx=[],_i=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),Gx=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const o=[];let a=0,l=0,c=0,u;const d=s.length;for(let f=0;f<d;f++){const m=s[f];if(a===0&&l===0){if(m===wi){o.push(s.slice(c,f)),c=f+1;continue}if(m==="/"){u=f;continue}}m==="["?a++:m==="]"?a--:m==="("?l++:m===")"&&l--}const p=o.length===0?s:s.slice(c);let g=p,h=!1;p.endsWith(Ms)?(g=p.slice(0,-1),h=!0):p.startsWith(Ms)&&(g=p.slice(1),h=!0);const x=u&&u>c?u-c:void 0;return _i(o,h,g,x)};if(t){const s=t+wi,o=r;r=a=>a.startsWith(s)?o(a.slice(s.length)):_i(Jx,!1,a,void 0,!0)}if(n){const s=r;r=o=>n({className:o,parseClassName:s})}return r},Yx=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let o=0;o<n.length;o++){const a=n[o],l=a[0]==="[",c=t.has(a);l||c?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},Xx=e=>({cache:Kx(e.cacheSize),parseClassName:Gx(e),sortModifiers:Yx(e),...Fx(e)}),Qx=/\s+/,e1=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:o}=t,a=[],l=e.trim().split(Qx);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:p,modifiers:g,hasImportantModifier:h,baseClassName:x,maybePostfixModifierPosition:f}=n(d);if(p){c=d+(c.length>0?" "+c:c);continue}let m=!!f,y=r(m?x.substring(0,f):x);if(!y){if(!m){c=d+(c.length>0?" "+c:c);continue}if(y=r(x),!y){c=d+(c.length>0?" "+c:c);continue}m=!1}const w=g.length===0?"":g.length===1?g[0]:o(g).join(":"),k=h?w+Ms:w,C=k+y;if(a.indexOf(C)>-1)continue;a.push(C);const S=s(y,m);for(let O=0;O<S.length;++O){const N=S[O];a.push(k+N)}c=d+(c.length>0?" "+c:c)}return c},t1=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=Ol(n))&&(s&&(s+=" "),s+=r);return s},Ol=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Ol(e[r]))&&(n&&(n+=" "),n+=t);return n},n1=(e,...t)=>{let n,r,s,o;const a=c=>{const u=t.reduce((d,p)=>p(d),e());return n=Xx(u),r=n.cache.get,s=n.cache.set,o=l,l(c)},l=c=>{const u=r(c);if(u)return u;const d=e1(c,n);return s(c,d),d};return o=a,(...c)=>o(t1(...c))},r1=[],Fe=e=>{const t=n=>n[e]||r1;return t.isThemeGetter=!0,t},Il=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Rl=/^\((?:(\w[\w-]*):)?(.+)\)$/i,s1=/^\d+\/\d+$/,o1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,i1=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,a1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,l1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,c1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qt=e=>s1.test(e),be=e=>!!e&&!Number.isNaN(Number(e)),bt=e=>!!e&&Number.isInteger(Number(e)),ls=e=>e.endsWith("%")&&be(e.slice(0,-1)),pt=e=>o1.test(e),u1=()=>!0,d1=e=>i1.test(e)&&!a1.test(e),Pl=()=>!1,f1=e=>l1.test(e),h1=e=>c1.test(e),p1=e=>!le(e)&&!ce(e),m1=e=>xn(e,Ll,Pl),le=e=>Il.test(e),Rt=e=>xn(e,Fl,d1),cs=e=>xn(e,b1,be),ki=e=>xn(e,Ml,Pl),g1=e=>xn(e,Dl,h1),nr=e=>xn(e,$l,f1),ce=e=>Rl.test(e),jn=e=>vn(e,Fl),x1=e=>vn(e,w1),Ci=e=>vn(e,Ml),v1=e=>vn(e,Ll),y1=e=>vn(e,Dl),rr=e=>vn(e,$l,!0),xn=(e,t,n)=>{const r=Il.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},vn=(e,t,n=!1)=>{const r=Rl.exec(e);return r?r[1]?t(r[1]):n:!1},Ml=e=>e==="position"||e==="percentage",Dl=e=>e==="image"||e==="url",Ll=e=>e==="length"||e==="size"||e==="bg-size",Fl=e=>e==="length",b1=e=>e==="number",w1=e=>e==="family-name",$l=e=>e==="shadow",_1=()=>{const e=Fe("color"),t=Fe("font"),n=Fe("text"),r=Fe("font-weight"),s=Fe("tracking"),o=Fe("leading"),a=Fe("breakpoint"),l=Fe("container"),c=Fe("spacing"),u=Fe("radius"),d=Fe("shadow"),p=Fe("inset-shadow"),g=Fe("text-shadow"),h=Fe("drop-shadow"),x=Fe("blur"),f=Fe("perspective"),m=Fe("aspect"),y=Fe("ease"),w=Fe("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...C(),ce,le],O=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],T=()=>[ce,le,c],z=()=>[qt,"full","auto",...T()],I=()=>[bt,"none","subgrid",ce,le],K=()=>["auto",{span:["full",bt,ce,le]},bt,ce,le],j=()=>[bt,"auto",ce,le],R=()=>["auto","min","max","fr",ce,le],_=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],Z=()=>["auto",...T()],P=()=>[qt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],M=()=>[e,ce,le],W=()=>[...C(),Ci,ki,{position:[ce,le]}],te=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",v1,m1,{size:[ce,le]}],U=()=>[ls,jn,Rt],re=()=>["","none","full",u,ce,le],ee=()=>["",be,jn,Rt],J=()=>["solid","dashed","dotted","double"],ue=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>[be,ls,Ci,ki],ie=()=>["","none",x,ce,le],ae=()=>["none",be,ce,le],me=()=>["none",be,ce,le],he=()=>[be,ce,le],we=()=>[qt,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pt],breakpoint:[pt],color:[u1],container:[pt],"drop-shadow":[pt],ease:["in","out","in-out"],font:[p1],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pt],shadow:[pt],spacing:["px",be],text:[pt],"text-shadow":[pt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",qt,le,ce,m]}],container:["container"],columns:[{columns:[be,le,ce,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[bt,"auto",ce,le]}],basis:[{basis:[qt,"full","auto",l,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[be,qt,"auto","initial","none",le]}],grow:[{grow:["",be,ce,le]}],shrink:[{shrink:["",be,ce,le]}],order:[{order:[bt,"first","last","none",ce,le]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:K()}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:K()}],"row-start":[{"row-start":j()}],"row-end":[{"row-end":j()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[..._(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",..._()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":_()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:Z()}],mx:[{mx:Z()}],my:[{my:Z()}],ms:[{ms:Z()}],me:[{me:Z()}],mt:[{mt:Z()}],mr:[{mr:Z()}],mb:[{mb:Z()}],ml:[{ml:Z()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:P()}],w:[{w:[l,"screen",...P()]}],"min-w":[{"min-w":[l,"screen","none",...P()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...P()]}],h:[{h:["screen","lh",...P()]}],"min-h":[{"min-h":["screen","lh","none",...P()]}],"max-h":[{"max-h":["screen","lh",...P()]}],"font-size":[{text:["base",n,jn,Rt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ce,cs]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ls,le]}],"font-family":[{font:[x1,le,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,ce,le]}],"line-clamp":[{"line-clamp":[be,"none",ce,cs]}],leading:[{leading:[o,...T()]}],"list-image":[{"list-image":["none",ce,le]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ce,le]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:[be,"from-font","auto",ce,Rt]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[be,"auto",ce,le]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ce,le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ce,le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:W()}],"bg-repeat":[{bg:te()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},bt,ce,le],radial:["",ce,le],conic:[bt,ce,le]},y1,g1]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...J(),"hidden","none"]}],"divide-style":[{divide:[...J(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...J(),"none","hidden"]}],"outline-offset":[{"outline-offset":[be,ce,le]}],"outline-w":[{outline:["",be,jn,Rt]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",d,rr,nr]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",p,rr,nr]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[be,Rt]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",g,rr,nr]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[be,ce,le]}],"mix-blend":[{"mix-blend":[...ue(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ue()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[be]}],"mask-image-linear-from-pos":[{"mask-linear-from":X()}],"mask-image-linear-to-pos":[{"mask-linear-to":X()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":X()}],"mask-image-t-to-pos":[{"mask-t-to":X()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":X()}],"mask-image-r-to-pos":[{"mask-r-to":X()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":X()}],"mask-image-b-to-pos":[{"mask-b-to":X()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":X()}],"mask-image-l-to-pos":[{"mask-l-to":X()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":X()}],"mask-image-x-to-pos":[{"mask-x-to":X()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":X()}],"mask-image-y-to-pos":[{"mask-y-to":X()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[ce,le]}],"mask-image-radial-from-pos":[{"mask-radial-from":X()}],"mask-image-radial-to-pos":[{"mask-radial-to":X()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[be]}],"mask-image-conic-from-pos":[{"mask-conic-from":X()}],"mask-image-conic-to-pos":[{"mask-conic-to":X()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:W()}],"mask-repeat":[{mask:te()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ce,le]}],filter:[{filter:["","none",ce,le]}],blur:[{blur:ie()}],brightness:[{brightness:[be,ce,le]}],contrast:[{contrast:[be,ce,le]}],"drop-shadow":[{"drop-shadow":["","none",h,rr,nr]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",be,ce,le]}],"hue-rotate":[{"hue-rotate":[be,ce,le]}],invert:[{invert:["",be,ce,le]}],saturate:[{saturate:[be,ce,le]}],sepia:[{sepia:["",be,ce,le]}],"backdrop-filter":[{"backdrop-filter":["","none",ce,le]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[be,ce,le]}],"backdrop-contrast":[{"backdrop-contrast":[be,ce,le]}],"backdrop-grayscale":[{"backdrop-grayscale":["",be,ce,le]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[be,ce,le]}],"backdrop-invert":[{"backdrop-invert":["",be,ce,le]}],"backdrop-opacity":[{"backdrop-opacity":[be,ce,le]}],"backdrop-saturate":[{"backdrop-saturate":[be,ce,le]}],"backdrop-sepia":[{"backdrop-sepia":["",be,ce,le]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ce,le]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[be,"initial",ce,le]}],ease:[{ease:["linear","initial",y,ce,le]}],delay:[{delay:[be,ce,le]}],animate:[{animate:["none",w,ce,le]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,ce,le]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:me()}],"scale-x":[{"scale-x":me()}],"scale-y":[{"scale-y":me()}],"scale-z":[{"scale-z":me()}],"scale-3d":["scale-3d"],skew:[{skew:he()}],"skew-x":[{"skew-x":he()}],"skew-y":[{"skew-y":he()}],transform:[{transform:[ce,le,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:we()}],"translate-x":[{"translate-x":we()}],"translate-y":[{"translate-y":we()}],"translate-z":[{"translate-z":we()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ce,le]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ce,le]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[be,jn,Rt,cs]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},k1=n1(_1);function xe(...e){return k1(El(e))}function $e(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":(e/1e3).toFixed(1).replace(/\.0$/,"")+"K"}function C1(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const S1="2.0.5",j1={version:S1},Si=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ji=El,vo=(e,t)=>n=>{var r;if(t?.variants==null)return ji(e,n?.class,n?.className);const{variants:s,defaultVariants:o}=t,a=Object.keys(s).map(u=>{const d=n?.[u],p=o?.[u];if(d===null)return null;const g=Si(d)||Si(p);return s[u][g]}),l=n&&Object.entries(n).reduce((u,d)=>{let[p,g]=d;return g===void 0||(u[p]=g),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:p,className:g,...h}=d;return Object.entries(h).every(x=>{let[f,m]=x;return Array.isArray(m)?m.includes({...o,...l}[f]):{...o,...l}[f]===m})?[...u,p,g]:u},[]);return ji(e,a,c,n?.class,n?.className)};function Ni(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Bl(...e){return t=>{let n=!1;const r=e.map(s=>{const o=Ni(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():Ni(e[s],null)}}}}function Re(...e){return v.useCallback(Bl(...e),e)}function dn(e){const t=E1(e),n=v.forwardRef((r,s)=>{const{children:o,...a}=r,l=v.Children.toArray(o),c=l.find(A1);if(c){const u=c.props.children,d=l.map(p=>p===c?v.Children.count(u)>1?v.Children.only(null):v.isValidElement(u)?u.props.children:null:p);return i.jsx(t,{...a,ref:s,children:v.isValidElement(u)?v.cloneElement(u,void 0,d):null})}return i.jsx(t,{...a,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var N1=dn("Slot");function E1(e){const t=v.forwardRef((n,r)=>{const{children:s,...o}=n;if(v.isValidElement(s)){const a=O1(s),l=z1(o,s.props);return s.type!==v.Fragment&&(l.ref=r?Bl(r,a):a),v.cloneElement(s,l)}return v.Children.count(s)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ul=Symbol("radix.slottable");function T1(e){const t=({children:n})=>i.jsx(i.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Ul,t}function A1(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ul}function z1(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...l)=>{const c=o(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function O1(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var I1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Se=I1.reduce((e,t)=>{const n=dn(`Primitive.${t}`),r=v.forwardRef((s,o)=>{const{asChild:a,...l}=s,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...l,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function R1(e,t){e&&Un.flushSync(()=>e.dispatchEvent(t))}var Zl=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),P1="VisuallyHidden",Wl=v.forwardRef((e,t)=>i.jsx(Se.span,{...e,ref:t,style:{...Zl,...e.style}}));Wl.displayName=P1;var M1=Wl;function D1(e,t){const n=v.createContext(t),r=o=>{const{children:a,...l}=o,c=v.useMemo(()=>l,Object.values(l));return i.jsx(n.Provider,{value:c,children:a})};r.displayName=e+"Provider";function s(o){const a=v.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,s]}function Wt(e,t=[]){let n=[];function r(o,a){const l=v.createContext(a),c=n.length;n=[...n,a];const u=p=>{const{scope:g,children:h,...x}=p,f=g?.[e]?.[c]||l,m=v.useMemo(()=>x,Object.values(x));return i.jsx(f.Provider,{value:m,children:h})};u.displayName=o+"Provider";function d(p,g){const h=g?.[e]?.[c]||l,x=v.useContext(h);if(x)return x;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[u,d]}const s=()=>{const o=n.map(a=>v.createContext(a));return function(l){const c=l?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,L1(s,...t)]}function L1(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const p=c(o)[`__scope${u}`];return{...l,...p}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function Vl(e){const t=e+"CollectionProvider",[n,r]=Wt(t),[s,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=f=>{const{scope:m,children:y}=f,w=He.useRef(null),k=He.useRef(new Map).current;return i.jsx(s,{scope:m,itemMap:k,collectionRef:w,children:y})};a.displayName=t;const l=e+"CollectionSlot",c=dn(l),u=He.forwardRef((f,m)=>{const{scope:y,children:w}=f,k=o(l,y),C=Re(m,k.collectionRef);return i.jsx(c,{ref:C,children:w})});u.displayName=l;const d=e+"CollectionItemSlot",p="data-radix-collection-item",g=dn(d),h=He.forwardRef((f,m)=>{const{scope:y,children:w,...k}=f,C=He.useRef(null),S=Re(m,C),O=o(d,y);return He.useEffect(()=>(O.itemMap.set(C,{ref:C,...k}),()=>{O.itemMap.delete(C)})),i.jsx(g,{[p]:"",ref:S,children:w})});h.displayName=d;function x(f){const m=o(e+"CollectionConsumer",f);return He.useCallback(()=>{const w=m.collectionRef.current;if(!w)return[];const k=Array.from(w.querySelectorAll(`[${p}]`));return Array.from(m.itemMap.values()).sort((O,N)=>k.indexOf(O.ref.current)-k.indexOf(N.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:h},x,r]}function ye(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s.defaultPrevented)return t?.(s)}}var We=globalThis?.document?v.useLayoutEffect:()=>{},F1=Na[" useInsertionEffect ".trim().toString()]||We;function fn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,a]=$1({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:s;{const d=v.useRef(e!==void 0);v.useEffect(()=>{const p=d.current;p!==l&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,r])}const u=v.useCallback(d=>{if(l){const p=B1(d)?d(e):d;p!==e&&a.current?.(p)}else o(d)},[l,e,o,a]);return[c,u]}function $1({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),s=v.useRef(n),o=v.useRef(t);return F1(()=>{o.current=t},[t]),v.useEffect(()=>{s.current!==n&&(o.current?.(n),s.current=n)},[n,s]),[n,r,o]}function B1(e){return typeof e=="function"}function U1(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var Vt=e=>{const{present:t,children:n}=e,r=Z1(t),s=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),o=Re(r.ref,W1(s));return typeof n=="function"||r.isPresent?v.cloneElement(s,{ref:o}):null};Vt.displayName="Presence";function Z1(e){const[t,n]=v.useState(),r=v.useRef(null),s=v.useRef(e),o=v.useRef("none"),a=e?"mounted":"unmounted",[l,c]=U1(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=sr(r.current);o.current=l==="mounted"?u:"none"},[l]),We(()=>{const u=r.current,d=s.current;if(d!==e){const g=o.current,h=sr(u);e?c("MOUNT"):h==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&g!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),We(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,p=h=>{const f=sr(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&f&&(c("ANIMATION_END"),!s.current)){const m=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=m)})}},g=h=>{h.target===t&&(o.current=sr(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:v.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function sr(e){return e?.animationName||"none"}function W1(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var V1=Na[" useId ".trim().toString()]||(()=>{}),H1=0;function mt(e){const[t,n]=v.useState(V1());return We(()=>{n(r=>r??String(H1++))},[e]),e||(t?`radix-${t}`:"")}var q1=v.createContext(void 0);function yo(e){const t=v.useContext(q1);return e||t||"ltr"}function jt(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>t.current?.(...n),[])}function K1(e,t=globalThis?.document){const n=jt(e);v.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var J1="DismissableLayer",Ds="dismissableLayer.update",G1="dismissableLayer.pointerDownOutside",Y1="dismissableLayer.focusOutside",Ei,Hl=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ur=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=e,u=v.useContext(Hl),[d,p]=v.useState(null),g=d?.ownerDocument??globalThis?.document,[,h]=v.useState({}),x=Re(t,N=>p(N)),f=Array.from(u.layers),[m]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=f.indexOf(m),w=d?f.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,C=w>=y,S=ev(N=>{const T=N.target,z=[...u.branches].some(I=>I.contains(T));!C||z||(s?.(N),a?.(N),N.defaultPrevented||l?.())},g),O=tv(N=>{const T=N.target;[...u.branches].some(I=>I.contains(T))||(o?.(N),a?.(N),N.defaultPrevented||l?.())},g);return K1(N=>{w===u.layers.size-1&&(r?.(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},g),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Ei=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Ti(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Ei)}},[d,g,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Ti())},[d,u]),v.useEffect(()=>{const N=()=>h({});return document.addEventListener(Ds,N),()=>document.removeEventListener(Ds,N)},[]),i.jsx(Se.div,{...c,ref:x,style:{pointerEvents:k?C?"auto":"none":void 0,...e.style},onFocusCapture:ye(e.onFocusCapture,O.onFocusCapture),onBlurCapture:ye(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:ye(e.onPointerDownCapture,S.onPointerDownCapture)})});Ur.displayName=J1;var X1="DismissableLayerBranch",Q1=v.forwardRef((e,t)=>{const n=v.useContext(Hl),r=v.useRef(null),s=Re(t,r);return v.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),i.jsx(Se.div,{...e,ref:s})});Q1.displayName=X1;function ev(e,t=globalThis?.document){const n=jt(e),r=v.useRef(!1),s=v.useRef(()=>{});return v.useEffect(()=>{const o=l=>{if(l.target&&!r.current){let c=function(){ql(G1,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function tv(e,t=globalThis?.document){const n=jt(e),r=v.useRef(!1);return v.useEffect(()=>{const s=o=>{o.target&&!r.current&&ql(Y1,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ti(){const e=new CustomEvent(Ds);document.dispatchEvent(e)}function ql(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?R1(s,o):s.dispatchEvent(o)}var us="focusScope.autoFocusOnMount",ds="focusScope.autoFocusOnUnmount",Ai={bubbles:!1,cancelable:!0},nv="FocusScope",bo=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...a}=e,[l,c]=v.useState(null),u=jt(s),d=jt(o),p=v.useRef(null),g=Re(t,f=>c(f)),h=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let f=function(k){if(h.paused||!l)return;const C=k.target;l.contains(C)?p.current=C:wt(p.current,{select:!0})},m=function(k){if(h.paused||!l)return;const C=k.relatedTarget;C!==null&&(l.contains(C)||wt(p.current,{select:!0}))},y=function(k){if(document.activeElement===document.body)for(const S of k)S.removedNodes.length>0&&wt(l)};document.addEventListener("focusin",f),document.addEventListener("focusout",m);const w=new MutationObserver(y);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",m),w.disconnect()}}},[r,l,h.paused]),v.useEffect(()=>{if(l){Oi.add(h);const f=document.activeElement;if(!l.contains(f)){const y=new CustomEvent(us,Ai);l.addEventListener(us,u),l.dispatchEvent(y),y.defaultPrevented||(rv(lv(Kl(l)),{select:!0}),document.activeElement===f&&wt(l))}return()=>{l.removeEventListener(us,u),setTimeout(()=>{const y=new CustomEvent(ds,Ai);l.addEventListener(ds,d),l.dispatchEvent(y),y.defaultPrevented||wt(f??document.body,{select:!0}),l.removeEventListener(ds,d),Oi.remove(h)},0)}}},[l,u,d,h]);const x=v.useCallback(f=>{if(!n&&!r||h.paused)return;const m=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,y=document.activeElement;if(m&&y){const w=f.currentTarget,[k,C]=sv(w);k&&C?!f.shiftKey&&y===C?(f.preventDefault(),n&&wt(k,{select:!0})):f.shiftKey&&y===k&&(f.preventDefault(),n&&wt(C,{select:!0})):y===w&&f.preventDefault()}},[n,r,h.paused]);return i.jsx(Se.div,{tabIndex:-1,...a,ref:g,onKeyDown:x})});bo.displayName=nv;function rv(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(wt(r,{select:t}),document.activeElement!==n)return}function sv(e){const t=Kl(e),n=zi(t,e),r=zi(t.reverse(),e);return[n,r]}function Kl(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function zi(e,t){for(const n of e)if(!ov(n,{upTo:t}))return n}function ov(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function iv(e){return e instanceof HTMLInputElement&&"select"in e}function wt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&iv(e)&&t&&e.select()}}var Oi=av();function av(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Ii(e,t),e.unshift(t)},remove(t){e=Ii(e,t),e[0]?.resume()}}}function Ii(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function lv(e){return e.filter(t=>t.tagName!=="A")}var cv="Portal",Zr=v.forwardRef((e,t)=>{const{container:n,...r}=e,[s,o]=v.useState(!1);We(()=>o(!0),[]);const a=n||s&&globalThis?.document?.body;return a?xd.createPortal(i.jsx(Se.div,{...r,ref:t}),a):null});Zr.displayName=cv;var fs=0;function Jl(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ri()),document.body.insertAdjacentElement("beforeend",e[1]??Ri()),fs++,()=>{fs===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),fs--}},[])}function Ri(){const 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 lt=function(){return lt=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},lt.apply(this,arguments)};function Gl(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function uv(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var hr="right-scroll-bar-position",pr="width-before-scroll-bar",dv="with-scroll-bars-hidden",fv="--removed-body-scroll-bar-size";function hs(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function hv(e,t){var n=v.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var pv=typeof window<"u"?v.useLayoutEffect:v.useEffect,Pi=new WeakMap;function mv(e,t){var n=hv(null,function(r){return e.forEach(function(s){return hs(s,r)})});return pv(function(){var r=Pi.get(n);if(r){var s=new Set(r),o=new Set(e),a=n.current;s.forEach(function(l){o.has(l)||hs(l,null)}),o.forEach(function(l){s.has(l)||hs(l,a)})}Pi.set(n,e)},[e]),n}function gv(e){return e}function xv(e,t){t===void 0&&(t=gv);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var a=t(o,r);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(o){for(r=!0;n.length;){var a=n;n=[],a.forEach(o)}n={push:function(l){return o(l)},filter:function(){return n}}},assignMedium:function(o){r=!0;var a=[];if(n.length){var l=n;n=[],l.forEach(o),a=n}var c=function(){var d=a;a=[],d.forEach(o)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){a.push(d),u()},filter:function(d){return a=a.filter(d),n}}}};return s}function vv(e){e===void 0&&(e={});var t=xv(null);return t.options=lt({async:!0,ssr:!1},e),t}var Yl=function(e){var t=e.sideCar,n=Gl(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return v.createElement(r,lt({},n))};Yl.isSideCarExport=!0;function yv(e,t){return e.useMedium(t),Yl}var Xl=vv(),ps=function(){},Wr=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:ps,onWheelCapture:ps,onTouchMoveCapture:ps}),s=r[0],o=r[1],a=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,p=e.shards,g=e.sideCar,h=e.noRelative,x=e.noIsolation,f=e.inert,m=e.allowPinchZoom,y=e.as,w=y===void 0?"div":y,k=e.gapMode,C=Gl(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=g,O=mv([n,t]),N=lt(lt({},C),s);return v.createElement(v.Fragment,null,d&&v.createElement(S,{sideCar:Xl,removeScrollBar:u,shards:p,noRelative:h,noIsolation:x,inert:f,setCallbacks:o,allowPinchZoom:!!m,lockRef:n,gapMode:k}),a?v.cloneElement(v.Children.only(l),lt(lt({},N),{ref:O})):v.createElement(w,lt({},N,{className:c,ref:O}),l))});Wr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Wr.classNames={fullWidth:pr,zeroRight:hr};var bv=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function wv(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=bv();return t&&e.setAttribute("nonce",t),e}function _v(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function kv(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Cv=function(){var e=0,t=null;return{add:function(n){e==0&&(t=wv())&&(_v(t,n),kv(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Sv=function(){var e=Cv();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ql=function(){var e=Sv(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},jv={left:0,top:0,right:0,gap:0},ms=function(e){return parseInt(e||"",10)||0},Nv=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[ms(n),ms(r),ms(s)]},Ev=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return jv;var t=Nv(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Tv=Ql(),sn="data-scroll-locked",Av=function(e,t,n,r){var s=e.left,o=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),`
42
+ .`.concat(dv,` {
43
+ overflow: hidden `).concat(r,`;
44
+ padding-right: `).concat(l,"px ").concat(r,`;
45
+ }
46
+ body[`).concat(sn,`] {
47
+ overflow: hidden `).concat(r,`;
48
+ overscroll-behavior: contain;
49
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
50
+ padding-left: `.concat(s,`px;
51
+ padding-top: `).concat(o,`px;
52
+ padding-right: `).concat(a,`px;
53
+ margin-left:0;
54
+ margin-top:0;
55
+ margin-right: `).concat(l,"px ").concat(r,`;
56
+ `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
57
+ }
58
+
59
+ .`).concat(hr,` {
60
+ right: `).concat(l,"px ").concat(r,`;
61
+ }
62
+
63
+ .`).concat(pr,` {
64
+ margin-right: `).concat(l,"px ").concat(r,`;
65
+ }
66
+
67
+ .`).concat(hr," .").concat(hr,` {
68
+ right: 0 `).concat(r,`;
69
+ }
70
+
71
+ .`).concat(pr," .").concat(pr,` {
72
+ margin-right: 0 `).concat(r,`;
73
+ }
74
+
75
+ body[`).concat(sn,`] {
76
+ `).concat(fv,": ").concat(l,`px;
77
+ }
78
+ `)},Mi=function(){var e=parseInt(document.body.getAttribute(sn)||"0",10);return isFinite(e)?e:0},zv=function(){v.useEffect(function(){return document.body.setAttribute(sn,(Mi()+1).toString()),function(){var e=Mi()-1;e<=0?document.body.removeAttribute(sn):document.body.setAttribute(sn,e.toString())}},[])},Ov=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;zv();var o=v.useMemo(function(){return Ev(s)},[s]);return v.createElement(Tv,{styles:Av(o,!t,s,n?"":"!important")})},Ls=!1;if(typeof window<"u")try{var or=Object.defineProperty({},"passive",{get:function(){return Ls=!0,!0}});window.addEventListener("test",or,or),window.removeEventListener("test",or,or)}catch{Ls=!1}var Kt=Ls?{passive:!1}:!1,Iv=function(e){return e.tagName==="TEXTAREA"},ec=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Iv(e)&&n[t]==="visible")},Rv=function(e){return ec(e,"overflowY")},Pv=function(e){return ec(e,"overflowX")},Di=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=tc(e,r);if(s){var o=nc(e,r),a=o[1],l=o[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Mv=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Dv=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},tc=function(e,t){return e==="v"?Rv(t):Pv(t)},nc=function(e,t){return e==="v"?Mv(t):Dv(t)},Lv=function(e,t){return e==="h"&&t==="rtl"?-1:1},Fv=function(e,t,n,r,s){var o=Lv(e,window.getComputedStyle(t).direction),a=o*r,l=n.target,c=t.contains(l),u=!1,d=a>0,p=0,g=0;do{if(!l)break;var h=nc(e,l),x=h[0],f=h[1],m=h[2],y=f-m-o*x;(x||y)&&tc(e,l)&&(p+=y,g+=x);var w=l.parentNode;l=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(p)<1||!d&&Math.abs(g)<1)&&(u=!0),u},ir=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Li=function(e){return[e.deltaX,e.deltaY]},Fi=function(e){return e&&"current"in e?e.current:e},$v=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Bv=function(e){return`
79
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
80
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
81
+ `)},Uv=0,Jt=[];function Zv(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),s=v.useState(Uv++)[0],o=v.useState(Ql)[0],a=v.useRef(e);v.useEffect(function(){a.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var f=uv([e.lockRef.current],(e.shards||[]).map(Fi),!0).filter(Boolean);return f.forEach(function(m){return m.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),f.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=v.useCallback(function(f,m){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!a.current.allowPinchZoom;var y=ir(f),w=n.current,k="deltaX"in f?f.deltaX:w[0]-y[0],C="deltaY"in f?f.deltaY:w[1]-y[1],S,O=f.target,N=Math.abs(k)>Math.abs(C)?"h":"v";if("touches"in f&&N==="h"&&O.type==="range")return!1;var T=window.getSelection(),z=T&&T.anchorNode,I=z?z===O||z.contains(O):!1;if(I)return!1;var K=Di(N,O);if(!K)return!0;if(K?S=N:(S=N==="v"?"h":"v",K=Di(N,O)),!K)return!1;if(!r.current&&"changedTouches"in f&&(k||C)&&(r.current=S),!S)return!0;var j=r.current||S;return Fv(j,m,f,j==="h"?k:C)},[]),c=v.useCallback(function(f){var m=f;if(!(!Jt.length||Jt[Jt.length-1]!==o)){var y="deltaY"in m?Li(m):ir(m),w=t.current.filter(function(S){return S.name===m.type&&(S.target===m.target||m.target===S.shadowParent)&&$v(S.delta,y)})[0];if(w&&w.should){m.cancelable&&m.preventDefault();return}if(!w){var k=(a.current.shards||[]).map(Fi).filter(Boolean).filter(function(S){return S.contains(m.target)}),C=k.length>0?l(m,k[0]):!a.current.noIsolation;C&&m.cancelable&&m.preventDefault()}}},[]),u=v.useCallback(function(f,m,y,w){var k={name:f,delta:m,target:y,should:w,shadowParent:Wv(y)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(C){return C!==k})},1)},[]),d=v.useCallback(function(f){n.current=ir(f),r.current=void 0},[]),p=v.useCallback(function(f){u(f.type,Li(f),f.target,l(f,e.lockRef.current))},[]),g=v.useCallback(function(f){u(f.type,ir(f),f.target,l(f,e.lockRef.current))},[]);v.useEffect(function(){return Jt.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:g}),document.addEventListener("wheel",c,Kt),document.addEventListener("touchmove",c,Kt),document.addEventListener("touchstart",d,Kt),function(){Jt=Jt.filter(function(f){return f!==o}),document.removeEventListener("wheel",c,Kt),document.removeEventListener("touchmove",c,Kt),document.removeEventListener("touchstart",d,Kt)}},[]);var h=e.removeScrollBar,x=e.inert;return v.createElement(v.Fragment,null,x?v.createElement(o,{styles:Bv(s)}):null,h?v.createElement(Ov,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Wv(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Vv=yv(Xl,Zv);var wo=v.forwardRef(function(e,t){return v.createElement(Wr,lt({},e,{ref:t,sideCar:Vv}))});wo.classNames=Wr.classNames;var Hv=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Gt=new WeakMap,ar=new WeakMap,lr={},gs=0,rc=function(e){return e&&(e.host||rc(e.parentNode))},qv=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=rc(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Kv=function(e,t,n,r){var s=qv(t,Array.isArray(e)?e:[e]);lr[n]||(lr[n]=new WeakMap);var o=lr[n],a=[],l=new Set,c=new Set(s),u=function(p){!p||l.has(p)||(l.add(p),u(p.parentNode))};s.forEach(u);var d=function(p){!p||c.has(p)||Array.prototype.forEach.call(p.children,function(g){if(l.has(g))d(g);else try{var h=g.getAttribute(r),x=h!==null&&h!=="false",f=(Gt.get(g)||0)+1,m=(o.get(g)||0)+1;Gt.set(g,f),o.set(g,m),a.push(g),f===1&&x&&ar.set(g,!0),m===1&&g.setAttribute(n,"true"),x||g.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",g,y)}})};return d(t),l.clear(),gs++,function(){a.forEach(function(p){var g=Gt.get(p)-1,h=o.get(p)-1;Gt.set(p,g),o.set(p,h),g||(ar.has(p)||p.removeAttribute(r),ar.delete(p)),h||p.removeAttribute(n)}),gs--,gs||(Gt=new WeakMap,Gt=new WeakMap,ar=new WeakMap,lr={})}},sc=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Hv(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Kv(r,s,n,"aria-hidden")):function(){return null}},Vr="Dialog",[oc]=Wt(Vr),[Jv,st]=oc(Vr),ic=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,l=v.useRef(null),c=v.useRef(null),[u,d]=fn({prop:r,defaultProp:s??!1,onChange:o,caller:Vr});return i.jsx(Jv,{scope:t,triggerRef:l,contentRef:c,contentId:mt(),titleId:mt(),descriptionId:mt(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(p=>!p),[d]),modal:a,children:n})};ic.displayName=Vr;var ac="DialogTrigger",lc=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=st(ac,n),o=Re(t,s.triggerRef);return i.jsx(Se.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Co(s.open),...r,ref:o,onClick:ye(e.onClick,s.onOpenToggle)})});lc.displayName=ac;var _o="DialogPortal",[Gv,cc]=oc(_o,{forceMount:void 0}),uc=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=st(_o,t);return i.jsx(Gv,{scope:t,forceMount:n,children:v.Children.map(r,a=>i.jsx(Vt,{present:n||o.open,children:i.jsx(Zr,{asChild:!0,container:s,children:a})}))})};uc.displayName=_o;var Cr="DialogOverlay",dc=v.forwardRef((e,t)=>{const n=cc(Cr,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=st(Cr,e.__scopeDialog);return o.modal?i.jsx(Vt,{present:r||o.open,children:i.jsx(Xv,{...s,ref:t})}):null});dc.displayName=Cr;var Yv=dn("DialogOverlay.RemoveScroll"),Xv=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=st(Cr,n);return i.jsx(wo,{as:Yv,allowPinchZoom:!0,shards:[s.contentRef],children:i.jsx(Se.div,{"data-state":Co(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Mt="DialogContent",fc=v.forwardRef((e,t)=>{const n=cc(Mt,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=st(Mt,e.__scopeDialog);return i.jsx(Vt,{present:r||o.open,children:o.modal?i.jsx(Qv,{...s,ref:t}):i.jsx(ey,{...s,ref:t})})});fc.displayName=Mt;var Qv=v.forwardRef((e,t)=>{const n=st(Mt,e.__scopeDialog),r=v.useRef(null),s=Re(t,n.contentRef,r);return v.useEffect(()=>{const o=r.current;if(o)return sc(o)},[]),i.jsx(hc,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ye(e.onCloseAutoFocus,o=>{o.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:ye(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0;(a.button===2||l)&&o.preventDefault()}),onFocusOutside:ye(e.onFocusOutside,o=>o.preventDefault())})}),ey=v.forwardRef((e,t)=>{const n=st(Mt,e.__scopeDialog),r=v.useRef(!1),s=v.useRef(!1);return i.jsx(hc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||n.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=o.target;n.triggerRef.current?.contains(a)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),hc=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,...a}=e,l=st(Mt,n),c=v.useRef(null),u=Re(t,c);return Jl(),i.jsxs(i.Fragment,{children:[i.jsx(bo,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:i.jsx(Ur,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Co(l.open),...a,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(ny,{titleId:l.titleId}),i.jsx(sy,{contentRef:c,descriptionId:l.descriptionId})]})]})}),ko="DialogTitle",pc=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=st(ko,n);return i.jsx(Se.h2,{id:s.titleId,...r,ref:t})});pc.displayName=ko;var mc="DialogDescription",ty=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=st(mc,n);return i.jsx(Se.p,{id:s.descriptionId,...r,ref:t})});ty.displayName=mc;var gc="DialogClose",xc=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=st(gc,n);return i.jsx(Se.button,{type:"button",...r,ref:t,onClick:ye(e.onClick,()=>s.onOpenChange(!1))})});xc.displayName=gc;function Co(e){return e?"open":"closed"}var vc="DialogTitleWarning",[aC,yc]=D1(vc,{contentName:Mt,titleName:ko,docsSlug:"dialog"}),ny=({titleId:e})=>{const t=yc(vc),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
82
+
83
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
84
+
85
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},ry="DialogDescriptionWarning",sy=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${yc(ry).contentName}}.`;return v.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},oy=ic,iy=lc,ay=uc,ly=dc,cy=fc,uy=pc,dy=xc;function fy(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function hy(e){const[t,n]=v.useState(void 0);return We(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let a,l;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const py=["top","right","bottom","left"],Nt=Math.min,Ke=Math.max,Sr=Math.round,cr=Math.floor,ut=e=>({x:e,y:e}),my={left:"right",right:"left",bottom:"top",top:"bottom"},gy={start:"end",end:"start"};function Fs(e,t,n){return Ke(e,Nt(t,n))}function xt(e,t){return typeof e=="function"?e(t):e}function vt(e){return e.split("-")[0]}function yn(e){return e.split("-")[1]}function So(e){return e==="x"?"y":"x"}function jo(e){return e==="y"?"height":"width"}const xy=new Set(["top","bottom"]);function ct(e){return xy.has(vt(e))?"y":"x"}function No(e){return So(ct(e))}function vy(e,t,n){n===void 0&&(n=!1);const r=yn(e),s=No(e),o=jo(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=jr(a)),[a,jr(a)]}function yy(e){const t=jr(e);return[$s(e),t,$s(t)]}function $s(e){return e.replace(/start|end/g,t=>gy[t])}const $i=["left","right"],Bi=["right","left"],by=["top","bottom"],wy=["bottom","top"];function _y(e,t,n){switch(e){case"top":case"bottom":return n?t?Bi:$i:t?$i:Bi;case"left":case"right":return t?by:wy;default:return[]}}function ky(e,t,n,r){const s=yn(e);let o=_y(vt(e),n==="start",r);return s&&(o=o.map(a=>a+"-"+s),t&&(o=o.concat(o.map($s)))),o}function jr(e){return e.replace(/left|right|bottom|top/g,t=>my[t])}function Cy(e){return{top:0,right:0,bottom:0,left:0,...e}}function bc(e){return typeof e!="number"?Cy(e):{top:e,right:e,bottom:e,left:e}}function Nr(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function Ui(e,t,n){let{reference:r,floating:s}=e;const o=ct(t),a=No(t),l=jo(a),c=vt(t),u=o==="y",d=r.x+r.width/2-s.width/2,p=r.y+r.height/2-s.height/2,g=r[l]/2-s[l]/2;let h;switch(c){case"top":h={x:d,y:r.y-s.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:p};break;case"left":h={x:r.x-s.width,y:p};break;default:h={x:r.x,y:r.y}}switch(yn(t)){case"start":h[a]-=g*(n&&u?-1:1);break;case"end":h[a]+=g*(n&&u?-1:1);break}return h}async function Sy(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:a,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:g=!1,padding:h=0}=xt(t,e),x=bc(h),m=l[g?p==="floating"?"reference":"floating":p],y=Nr(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(m)))==null||n?m:m.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),w=p==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),C=await(o.isElement==null?void 0:o.isElement(k))?await(o.getScale==null?void 0:o.getScale(k))||{x:1,y:1}:{x:1,y:1},S=Nr(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:k,strategy:c}):w);return{top:(y.top-S.top+x.top)/C.y,bottom:(S.bottom-y.bottom+x.bottom)/C.y,left:(y.left-S.left+x.left)/C.x,right:(S.right-y.right+x.right)/C.x}}const jy=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:a}=n,l=o.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:p}=Ui(u,r,c),g=r,h={},x=0;for(let m=0;m<l.length;m++){var f;const{name:y,fn:w}=l[m],{x:k,y:C,data:S,reset:O}=await w({x:d,y:p,initialPlacement:r,placement:g,strategy:s,middlewareData:h,rects:u,platform:{...a,detectOverflow:(f=a.detectOverflow)!=null?f:Sy},elements:{reference:e,floating:t}});d=k??d,p=C??p,h={...h,[y]:{...h[y],...S}},O&&x<=50&&(x++,typeof O=="object"&&(O.placement&&(g=O.placement),O.rects&&(u=O.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):O.rects),{x:d,y:p}=Ui(u,g,c)),m=-1)}return{x:d,y:p,placement:g,strategy:s,middlewareData:h}},Ny=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:a,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=xt(e,t)||{};if(u==null)return{};const p=bc(d),g={x:n,y:r},h=No(s),x=jo(h),f=await a.getDimensions(u),m=h==="y",y=m?"top":"left",w=m?"bottom":"right",k=m?"clientHeight":"clientWidth",C=o.reference[x]+o.reference[h]-g[h]-o.floating[x],S=g[h]-o.reference[h],O=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let N=O?O[k]:0;(!N||!await(a.isElement==null?void 0:a.isElement(O)))&&(N=l.floating[k]||o.floating[x]);const T=C/2-S/2,z=N/2-f[x]/2-1,I=Nt(p[y],z),K=Nt(p[w],z),j=I,R=N-f[x]-K,_=N/2-f[x]/2+T,F=Fs(j,_,R),Z=!c.arrow&&yn(s)!=null&&_!==F&&o.reference[x]/2-(_<j?I:K)-f[x]/2<0,P=Z?_<j?_-j:_-R:0;return{[h]:g[h]+P,data:{[h]:F,centerOffset:_-F-P,...Z&&{alignmentOffset:P}},reset:Z}}}),Ey=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:a,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:g,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:f=!0,...m}=xt(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const y=vt(s),w=ct(l),k=vt(l)===l,C=await(c.isRTL==null?void 0:c.isRTL(u.floating)),S=g||(k||!f?[jr(l)]:yy(l)),O=x!=="none";!g&&O&&S.push(...ky(l,f,x,C));const N=[l,...S],T=await c.detectOverflow(t,m),z=[];let I=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&z.push(T[y]),p){const _=vy(s,a,C);z.push(T[_[0]],T[_[1]])}if(I=[...I,{placement:s,overflows:z}],!z.every(_=>_<=0)){var K,j;const _=(((K=o.flip)==null?void 0:K.index)||0)+1,F=N[_];if(F&&(!(p==="alignment"?w!==ct(F):!1)||I.every(M=>ct(M.placement)===w?M.overflows[0]>0:!0)))return{data:{index:_,overflows:I},reset:{placement:F}};let Z=(j=I.filter(P=>P.overflows[0]<=0).sort((P,M)=>P.overflows[1]-M.overflows[1])[0])==null?void 0:j.placement;if(!Z)switch(h){case"bestFit":{var R;const P=(R=I.filter(M=>{if(O){const W=ct(M.placement);return W===w||W==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(W=>W>0).reduce((W,te)=>W+te,0)]).sort((M,W)=>M[1]-W[1])[0])==null?void 0:R[0];P&&(Z=P);break}case"initialPlacement":Z=l;break}if(s!==Z)return{reset:{placement:Z}}}return{}}}};function Zi(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Wi(e){return py.some(t=>e[t]>=0)}const Ty=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...o}=xt(e,t);switch(s){case"referenceHidden":{const a=await r.detectOverflow(t,{...o,elementContext:"reference"}),l=Zi(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Wi(l)}}}case"escaped":{const a=await r.detectOverflow(t,{...o,altBoundary:!0}),l=Zi(a,n.floating);return{data:{escapedOffsets:l,escaped:Wi(l)}}}default:return{}}}}},wc=new Set(["left","top"]);async function Ay(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=vt(n),l=yn(n),c=ct(n)==="y",u=wc.has(a)?-1:1,d=o&&c?-1:1,p=xt(t,e);let{mainAxis:g,crossAxis:h,alignmentAxis:x}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof x=="number"&&(h=l==="end"?x*-1:x),c?{x:h*d,y:g*u}:{x:g*u,y:h*d}}const zy=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:a,middlewareData:l}=t,c=await Ay(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:a}}}}},Oy=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:o}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:y=>{let{x:w,y:k}=y;return{x:w,y:k}}},...u}=xt(e,t),d={x:n,y:r},p=await o.detectOverflow(t,u),g=ct(vt(s)),h=So(g);let x=d[h],f=d[g];if(a){const y=h==="y"?"top":"left",w=h==="y"?"bottom":"right",k=x+p[y],C=x-p[w];x=Fs(k,x,C)}if(l){const y=g==="y"?"top":"left",w=g==="y"?"bottom":"right",k=f+p[y],C=f-p[w];f=Fs(k,f,C)}const m=c.fn({...t,[h]:x,[g]:f});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:a,[g]:l}}}}}},Iy=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:a}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=xt(e,t),d={x:n,y:r},p=ct(s),g=So(p);let h=d[g],x=d[p];const f=xt(l,t),m=typeof f=="number"?{mainAxis:f,crossAxis:0}:{mainAxis:0,crossAxis:0,...f};if(c){const k=g==="y"?"height":"width",C=o.reference[g]-o.floating[k]+m.mainAxis,S=o.reference[g]+o.reference[k]-m.mainAxis;h<C?h=C:h>S&&(h=S)}if(u){var y,w;const k=g==="y"?"width":"height",C=wc.has(vt(s)),S=o.reference[p]-o.floating[k]+(C&&((y=a.offset)==null?void 0:y[p])||0)+(C?0:m.crossAxis),O=o.reference[p]+o.reference[k]+(C?0:((w=a.offset)==null?void 0:w[p])||0)-(C?m.crossAxis:0);x<S?x=S:x>O&&(x=O)}return{[g]:h,[p]:x}}}},Ry=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:a,elements:l}=t,{apply:c=()=>{},...u}=xt(e,t),d=await a.detectOverflow(t,u),p=vt(s),g=yn(s),h=ct(s)==="y",{width:x,height:f}=o.floating;let m,y;p==="top"||p==="bottom"?(m=p,y=g===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(y=p,m=g==="end"?"top":"bottom");const w=f-d.top-d.bottom,k=x-d.left-d.right,C=Nt(f-d[m],w),S=Nt(x-d[y],k),O=!t.middlewareData.shift;let N=C,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(N=w),O&&!g){const I=Ke(d.left,0),K=Ke(d.right,0),j=Ke(d.top,0),R=Ke(d.bottom,0);h?T=x-2*(I!==0||K!==0?I+K:Ke(d.left,d.right)):N=f-2*(j!==0||R!==0?j+R:Ke(d.top,d.bottom))}await c({...t,availableWidth:T,availableHeight:N});const z=await a.getDimensions(l.floating);return x!==z.width||f!==z.height?{reset:{rects:!0}}:{}}}};function Hr(){return typeof window<"u"}function bn(e){return _c(e)?(e.nodeName||"").toLowerCase():"#document"}function Je(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ft(e){var t;return(t=(_c(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function _c(e){return Hr()?e instanceof Node||e instanceof Je(e).Node:!1}function nt(e){return Hr()?e instanceof Element||e instanceof Je(e).Element:!1}function dt(e){return Hr()?e instanceof HTMLElement||e instanceof Je(e).HTMLElement:!1}function Vi(e){return!Hr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Je(e).ShadowRoot}const Py=new Set(["inline","contents"]);function Vn(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=rt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Py.has(s)}const My=new Set(["table","td","th"]);function Dy(e){return My.has(bn(e))}const Ly=[":popover-open",":modal"];function qr(e){return Ly.some(t=>{try{return e.matches(t)}catch{return!1}})}const Fy=["transform","translate","scale","rotate","perspective"],$y=["transform","translate","scale","rotate","perspective","filter"],By=["paint","layout","strict","content"];function Eo(e){const t=To(),n=nt(e)?rt(e):e;return Fy.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||$y.some(r=>(n.willChange||"").includes(r))||By.some(r=>(n.contain||"").includes(r))}function Uy(e){let t=Et(e);for(;dt(t)&&!hn(t);){if(Eo(t))return t;if(qr(t))return null;t=Et(t)}return null}function To(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Zy=new Set(["html","body","#document"]);function hn(e){return Zy.has(bn(e))}function rt(e){return Je(e).getComputedStyle(e)}function Kr(e){return nt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Et(e){if(bn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Vi(e)&&e.host||ft(e);return Vi(t)?t.host:t}function kc(e){const t=Et(e);return hn(t)?e.ownerDocument?e.ownerDocument.body:e.body:dt(t)&&Vn(t)?t:kc(t)}function Ln(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=kc(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),a=Je(s);if(o){const l=Bs(a);return t.concat(a,a.visualViewport||[],Vn(s)?s:[],l&&n?Ln(l):[])}return t.concat(s,Ln(s,[],n))}function Bs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Cc(e){const t=rt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=dt(e),o=s?e.offsetWidth:n,a=s?e.offsetHeight:r,l=Sr(n)!==o||Sr(r)!==a;return l&&(n=o,r=a),{width:n,height:r,$:l}}function Ao(e){return nt(e)?e:e.contextElement}function on(e){const t=Ao(e);if(!dt(t))return ut(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=Cc(t);let a=(o?Sr(n.width):n.width)/r,l=(o?Sr(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const Wy=ut(0);function Sc(e){const t=Je(e);return!To()||!t.visualViewport?Wy:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Vy(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Je(e)?!1:t}function Dt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=Ao(e);let a=ut(1);t&&(r?nt(r)&&(a=on(r)):a=on(e));const l=Vy(o,n,r)?Sc(o):ut(0);let c=(s.left+l.x)/a.x,u=(s.top+l.y)/a.y,d=s.width/a.x,p=s.height/a.y;if(o){const g=Je(o),h=r&&nt(r)?Je(r):r;let x=g,f=Bs(x);for(;f&&r&&h!==x;){const m=on(f),y=f.getBoundingClientRect(),w=rt(f),k=y.left+(f.clientLeft+parseFloat(w.paddingLeft))*m.x,C=y.top+(f.clientTop+parseFloat(w.paddingTop))*m.y;c*=m.x,u*=m.y,d*=m.x,p*=m.y,c+=k,u+=C,x=Je(f),f=Bs(x)}}return Nr({width:d,height:p,x:c,y:u})}function Jr(e,t){const n=Kr(e).scrollLeft;return t?t.left+n:Dt(ft(e)).left+n}function jc(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Jr(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Hy(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",a=ft(r),l=t?qr(t.floating):!1;if(r===a||l&&o)return n;let c={scrollLeft:0,scrollTop:0},u=ut(1);const d=ut(0),p=dt(r);if((p||!p&&!o)&&((bn(r)!=="body"||Vn(a))&&(c=Kr(r)),dt(r))){const h=Dt(r);u=on(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const g=a&&!p&&!o?jc(a,c):ut(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+g.x,y:n.y*u.y-c.scrollTop*u.y+d.y+g.y}}function qy(e){return Array.from(e.getClientRects())}function Ky(e){const t=ft(e),n=Kr(e),r=e.ownerDocument.body,s=Ke(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Ke(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Jr(e);const l=-n.scrollTop;return rt(r).direction==="rtl"&&(a+=Ke(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:a,y:l}}const Hi=25;function Jy(e,t){const n=Je(e),r=ft(e),s=n.visualViewport;let o=r.clientWidth,a=r.clientHeight,l=0,c=0;if(s){o=s.width,a=s.height;const d=To();(!d||d&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const u=Jr(r);if(u<=0){const d=r.ownerDocument,p=d.body,g=getComputedStyle(p),h=d.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,x=Math.abs(r.clientWidth-p.clientWidth-h);x<=Hi&&(o-=x)}else u<=Hi&&(o+=u);return{width:o,height:a,x:l,y:c}}const Gy=new Set(["absolute","fixed"]);function Yy(e,t){const n=Dt(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=dt(e)?on(e):ut(1),a=e.clientWidth*o.x,l=e.clientHeight*o.y,c=s*o.x,u=r*o.y;return{width:a,height:l,x:c,y:u}}function qi(e,t,n){let r;if(t==="viewport")r=Jy(e,n);else if(t==="document")r=Ky(ft(e));else if(nt(t))r=Yy(t,n);else{const s=Sc(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Nr(r)}function Nc(e,t){const n=Et(e);return n===t||!nt(n)||hn(n)?!1:rt(n).position==="fixed"||Nc(n,t)}function Xy(e,t){const n=t.get(e);if(n)return n;let r=Ln(e,[],!1).filter(l=>nt(l)&&bn(l)!=="body"),s=null;const o=rt(e).position==="fixed";let a=o?Et(e):e;for(;nt(a)&&!hn(a);){const l=rt(a),c=Eo(a);!c&&l.position==="fixed"&&(s=null),(o?!c&&!s:!c&&l.position==="static"&&!!s&&Gy.has(s.position)||Vn(a)&&!c&&Nc(e,a))?r=r.filter(d=>d!==a):s=l,a=Et(a)}return t.set(e,r),r}function Qy(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?qr(t)?[]:Xy(t,this._c):[].concat(n),r],l=a[0],c=a.reduce((u,d)=>{const p=qi(t,d,s);return u.top=Ke(p.top,u.top),u.right=Nt(p.right,u.right),u.bottom=Nt(p.bottom,u.bottom),u.left=Ke(p.left,u.left),u},qi(t,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function eb(e){const{width:t,height:n}=Cc(e);return{width:t,height:n}}function tb(e,t,n){const r=dt(t),s=ft(t),o=n==="fixed",a=Dt(e,!0,o,t);let l={scrollLeft:0,scrollTop:0};const c=ut(0);function u(){c.x=Jr(s)}if(r||!r&&!o)if((bn(t)!=="body"||Vn(s))&&(l=Kr(t)),r){const h=Dt(t,!0,o,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else s&&u();o&&!r&&s&&u();const d=s&&!r&&!o?jc(s,l):ut(0),p=a.left+l.scrollLeft-c.x-d.x,g=a.top+l.scrollTop-c.y-d.y;return{x:p,y:g,width:a.width,height:a.height}}function xs(e){return rt(e).position==="static"}function Ki(e,t){if(!dt(e)||rt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ft(e)===n&&(n=n.ownerDocument.body),n}function Ec(e,t){const n=Je(e);if(qr(e))return n;if(!dt(e)){let s=Et(e);for(;s&&!hn(s);){if(nt(s)&&!xs(s))return s;s=Et(s)}return n}let r=Ki(e,t);for(;r&&Dy(r)&&xs(r);)r=Ki(r,t);return r&&hn(r)&&xs(r)&&!Eo(r)?n:r||Uy(e)||n}const nb=async function(e){const t=this.getOffsetParent||Ec,n=this.getDimensions,r=await n(e.floating);return{reference:tb(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function rb(e){return rt(e).direction==="rtl"}const sb={convertOffsetParentRelativeRectToViewportRelativeRect:Hy,getDocumentElement:ft,getClippingRect:Qy,getOffsetParent:Ec,getElementRects:nb,getClientRects:qy,getDimensions:eb,getScale:on,isElement:nt,isRTL:rb};function Tc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ob(e,t){let n=null,r;const s=ft(e);function o(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),o();const u=e.getBoundingClientRect(),{left:d,top:p,width:g,height:h}=u;if(l||t(),!g||!h)return;const x=cr(p),f=cr(s.clientWidth-(d+g)),m=cr(s.clientHeight-(p+h)),y=cr(d),k={rootMargin:-x+"px "+-f+"px "+-m+"px "+-y+"px",threshold:Ke(0,Nt(1,c))||1};let C=!0;function S(O){const N=O[0].intersectionRatio;if(N!==c){if(!C)return a();N?a(!1,N):r=setTimeout(()=>{a(!1,1e-7)},1e3)}N===1&&!Tc(u,e.getBoundingClientRect())&&a(),C=!1}try{n=new IntersectionObserver(S,{...k,root:s.ownerDocument})}catch{n=new IntersectionObserver(S,k)}n.observe(e)}return a(!0),o}function ib(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Ao(e),d=s||o?[...u?Ln(u):[],...Ln(t)]:[];d.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),o&&y.addEventListener("resize",n)});const p=u&&l?ob(u,n):null;let g=-1,h=null;a&&(h=new ResizeObserver(y=>{let[w]=y;w&&w.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var k;(k=h)==null||k.observe(t)})),n()}),u&&!c&&h.observe(u),h.observe(t));let x,f=c?Dt(e):null;c&&m();function m(){const y=Dt(e);f&&!Tc(f,y)&&n(),f=y,x=requestAnimationFrame(m)}return n(),()=>{var y;d.forEach(w=>{s&&w.removeEventListener("scroll",n),o&&w.removeEventListener("resize",n)}),p?.(),(y=h)==null||y.disconnect(),h=null,c&&cancelAnimationFrame(x)}}const ab=zy,lb=Oy,cb=Ey,ub=Ry,db=Ty,Ji=Ny,fb=Iy,hb=(e,t,n)=>{const r=new Map,s={platform:sb,...n},o={...s.platform,_c:r};return jy(e,t,{...s,platform:o})};var pb=typeof document<"u",mb=function(){},mr=pb?v.useLayoutEffect:mb;function Er(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Er(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!Er(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Ac(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Gi(e,t){const n=Ac(e);return Math.round(t*n)/n}function vs(e){const t=v.useRef(e);return mr(()=>{t.current=e}),t}function gb(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,p]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,h]=v.useState(r);Er(g,r)||h(r);const[x,f]=v.useState(null),[m,y]=v.useState(null),w=v.useCallback(M=>{M!==O.current&&(O.current=M,f(M))},[]),k=v.useCallback(M=>{M!==N.current&&(N.current=M,y(M))},[]),C=o||x,S=a||m,O=v.useRef(null),N=v.useRef(null),T=v.useRef(d),z=c!=null,I=vs(c),K=vs(s),j=vs(u),R=v.useCallback(()=>{if(!O.current||!N.current)return;const M={placement:t,strategy:n,middleware:g};K.current&&(M.platform=K.current),hb(O.current,N.current,M).then(W=>{const te={...W,isPositioned:j.current!==!1};_.current&&!Er(T.current,te)&&(T.current=te,Un.flushSync(()=>{p(te)}))})},[g,t,n,K,j]);mr(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,p(M=>({...M,isPositioned:!1})))},[u]);const _=v.useRef(!1);mr(()=>(_.current=!0,()=>{_.current=!1}),[]),mr(()=>{if(C&&(O.current=C),S&&(N.current=S),C&&S){if(I.current)return I.current(C,S,R);R()}},[C,S,R,I,z]);const F=v.useMemo(()=>({reference:O,floating:N,setReference:w,setFloating:k}),[w,k]),Z=v.useMemo(()=>({reference:C,floating:S}),[C,S]),P=v.useMemo(()=>{const M={position:n,left:0,top:0};if(!Z.floating)return M;const W=Gi(Z.floating,d.x),te=Gi(Z.floating,d.y);return l?{...M,transform:"translate("+W+"px, "+te+"px)",...Ac(Z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:te}},[n,l,Z.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:R,refs:F,elements:Z,floatingStyles:P}),[d,R,F,Z,P])}const xb=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Ji({element:r.current,padding:s}).fn(n):{}:r?Ji({element:r,padding:s}).fn(n):{}}}},vb=(e,t)=>({...ab(e),options:[e,t]}),yb=(e,t)=>({...lb(e),options:[e,t]}),bb=(e,t)=>({...fb(e),options:[e,t]}),wb=(e,t)=>({...cb(e),options:[e,t]}),_b=(e,t)=>({...ub(e),options:[e,t]}),kb=(e,t)=>({...db(e),options:[e,t]}),Cb=(e,t)=>({...xb(e),options:[e,t]});var Sb="Arrow",zc=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return i.jsx(Se.svg,{...o,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});zc.displayName=Sb;var jb=zc,zo="Popper",[Oc,Gr]=Wt(zo),[Nb,Ic]=Oc(zo),Rc=e=>{const{__scopePopper:t,children:n}=e,[r,s]=v.useState(null);return i.jsx(Nb,{scope:t,anchor:r,onAnchorChange:s,children:n})};Rc.displayName=zo;var Pc="PopperAnchor",Mc=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=Ic(Pc,n),a=v.useRef(null),l=Re(t,a),c=v.useRef(null);return v.useEffect(()=>{const u=c.current;c.current=r?.current||a.current,u!==c.current&&o.onAnchorChange(c.current)}),r?null:i.jsx(Se.div,{...s,ref:l})});Mc.displayName=Pc;var Oo="PopperContent",[Eb,Tb]=Oc(Oo),Dc=v.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:p="partial",hideWhenDetached:g=!1,updatePositionStrategy:h="optimized",onPlaced:x,...f}=e,m=Ic(Oo,n),[y,w]=v.useState(null),k=Re(t,X=>w(X)),[C,S]=v.useState(null),O=hy(C),N=O?.width??0,T=O?.height??0,z=r+(o!=="center"?"-"+o:""),I=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},K=Array.isArray(u)?u:[u],j=K.length>0,R={padding:I,boundary:K.filter(zb),altBoundary:j},{refs:_,floatingStyles:F,placement:Z,isPositioned:P,middlewareData:M}=gb({strategy:"fixed",placement:z,whileElementsMounted:(...X)=>ib(...X,{animationFrame:h==="always"}),elements:{reference:m.anchor},middleware:[vb({mainAxis:s+T,alignmentAxis:a}),c&&yb({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?bb():void 0,...R}),c&&wb({...R}),_b({...R,apply:({elements:X,rects:ie,availableWidth:ae,availableHeight:me})=>{const{width:he,height:we}=ie.reference,Ne=X.floating.style;Ne.setProperty("--radix-popper-available-width",`${ae}px`),Ne.setProperty("--radix-popper-available-height",`${me}px`),Ne.setProperty("--radix-popper-anchor-width",`${he}px`),Ne.setProperty("--radix-popper-anchor-height",`${we}px`)}}),C&&Cb({element:C,padding:l}),Ob({arrowWidth:N,arrowHeight:T}),g&&kb({strategy:"referenceHidden",...R})]}),[W,te]=$c(Z),V=jt(x);We(()=>{P&&V?.()},[P,V]);const U=M.arrow?.x,re=M.arrow?.y,ee=M.arrow?.centerOffset!==0,[J,ue]=v.useState();return We(()=>{y&&ue(window.getComputedStyle(y).zIndex)},[y]),i.jsx("div",{ref:_.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:P?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(" "),...M.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:i.jsx(Eb,{scope:n,placedSide:W,onArrowChange:S,arrowX:U,arrowY:re,shouldHideArrow:ee,children:i.jsx(Se.div,{"data-side":W,"data-align":te,...f,ref:k,style:{...f.style,animation:P?void 0:"none"}})})})});Dc.displayName=Oo;var Lc="PopperArrow",Ab={top:"bottom",right:"left",bottom:"top",left:"right"},Fc=v.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=Tb(Lc,r),a=Ab[o.placedSide];return i.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:i.jsx(jb,{...s,ref:n,style:{...s.style,display:"block"}})})});Fc.displayName=Lc;function zb(e){return e!==null}var Ob=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:s}=t,a=s.arrow?.centerOffset!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[u,d]=$c(n),p={start:"0%",center:"50%",end:"100%"}[d],g=(s.arrow?.x??0)+l/2,h=(s.arrow?.y??0)+c/2;let x="",f="";return u==="bottom"?(x=a?p:`${g}px`,f=`${-c}px`):u==="top"?(x=a?p:`${g}px`,f=`${r.floating.height+c}px`):u==="right"?(x=`${-c}px`,f=a?p:`${h}px`):u==="left"&&(x=`${r.floating.width+c}px`,f=a?p:`${h}px`),{data:{x,y:f}}}});function $c(e){const[t,n="center"]=e.split("-");return[t,n]}var Bc=Rc,Uc=Mc,Zc=Dc,Wc=Fc,ys="rovingFocusGroup.onEntryFocus",Ib={bubbles:!1,cancelable:!0},Hn="RovingFocusGroup",[Us,Vc,Rb]=Vl(Hn),[Pb,Hc]=Wt(Hn,[Rb]),[Mb,Db]=Pb(Hn),qc=v.forwardRef((e,t)=>i.jsx(Us.Provider,{scope:e.__scopeRovingFocusGroup,children:i.jsx(Us.Slot,{scope:e.__scopeRovingFocusGroup,children:i.jsx(Lb,{...e,ref:t})})}));qc.displayName=Hn;var Lb=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...p}=e,g=v.useRef(null),h=Re(t,g),x=yo(o),[f,m]=fn({prop:a,defaultProp:l??null,onChange:c,caller:Hn}),[y,w]=v.useState(!1),k=jt(u),C=Vc(n),S=v.useRef(!1),[O,N]=v.useState(0);return v.useEffect(()=>{const T=g.current;if(T)return T.addEventListener(ys,k),()=>T.removeEventListener(ys,k)},[k]),i.jsx(Mb,{scope:n,orientation:r,dir:x,loop:s,currentTabStopId:f,onItemFocus:v.useCallback(T=>m(T),[m]),onItemShiftTab:v.useCallback(()=>w(!0),[]),onFocusableItemAdd:v.useCallback(()=>N(T=>T+1),[]),onFocusableItemRemove:v.useCallback(()=>N(T=>T-1),[]),children:i.jsx(Se.div,{tabIndex:y||O===0?-1:0,"data-orientation":r,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:ye(e.onMouseDown,()=>{S.current=!0}),onFocus:ye(e.onFocus,T=>{const z=!S.current;if(T.target===T.currentTarget&&z&&!y){const I=new CustomEvent(ys,Ib);if(T.currentTarget.dispatchEvent(I),!I.defaultPrevented){const K=C().filter(Z=>Z.focusable),j=K.find(Z=>Z.active),R=K.find(Z=>Z.id===f),F=[j,R,...K].filter(Boolean).map(Z=>Z.ref.current);Gc(F,d)}}S.current=!1}),onBlur:ye(e.onBlur,()=>w(!1))})})}),Kc="RovingFocusGroupItem",Jc=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:o,children:a,...l}=e,c=mt(),u=o||c,d=Db(Kc,n),p=d.currentTabStopId===u,g=Vc(n),{onFocusableItemAdd:h,onFocusableItemRemove:x,currentTabStopId:f}=d;return v.useEffect(()=>{if(r)return h(),()=>x()},[r,h,x]),i.jsx(Us.ItemSlot,{scope:n,id:u,focusable:r,active:s,children:i.jsx(Se.span,{tabIndex:p?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:ye(e.onMouseDown,m=>{r?d.onItemFocus(u):m.preventDefault()}),onFocus:ye(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:ye(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){d.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const y=Bb(m,d.orientation,d.dir);if(y!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let k=g().filter(C=>C.focusable).map(C=>C.ref.current);if(y==="last")k.reverse();else if(y==="prev"||y==="next"){y==="prev"&&k.reverse();const C=k.indexOf(m.currentTarget);k=d.loop?Ub(k,C+1):k.slice(C+1)}setTimeout(()=>Gc(k))}}),children:typeof a=="function"?a({isCurrentTabStop:p,hasTabStop:f!=null}):a})})});Jc.displayName=Kc;var Fb={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $b(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Bb(e,t,n){const r=$b(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Fb[r]}function Gc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Ub(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Zb=qc,Wb=Jc;function Yi(e,[t,n]){return Math.min(n,Math.max(t,e))}var Vb=[" ","Enter","ArrowUp","ArrowDown"],Hb=[" ","Enter"],Lt="Select",[Yr,Xr,qb]=Vl(Lt),[wn]=Wt(Lt,[qb,Gr]),Qr=Gr(),[Kb,zt]=wn(Lt),[Jb,Gb]=wn(Lt),Yc=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:o,value:a,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:p,disabled:g,required:h,form:x}=e,f=Qr(t),[m,y]=v.useState(null),[w,k]=v.useState(null),[C,S]=v.useState(!1),O=yo(u),[N,T]=fn({prop:r,defaultProp:s??!1,onChange:o,caller:Lt}),[z,I]=fn({prop:a,defaultProp:l,onChange:c,caller:Lt}),K=v.useRef(null),j=m?x||!!m.closest("form"):!0,[R,_]=v.useState(new Set),F=Array.from(R).map(Z=>Z.props.value).join(";");return i.jsx(Bc,{...f,children:i.jsxs(Kb,{required:h,scope:t,trigger:m,onTriggerChange:y,valueNode:w,onValueNodeChange:k,valueNodeHasChildren:C,onValueNodeHasChildrenChange:S,contentId:mt(),value:z,onValueChange:I,open:N,onOpenChange:T,dir:O,triggerPointerDownPosRef:K,disabled:g,children:[i.jsx(Yr.Provider,{scope:t,children:i.jsx(Jb,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(Z=>{_(P=>new Set(P).add(Z))},[]),onNativeOptionRemove:v.useCallback(Z=>{_(P=>{const M=new Set(P);return M.delete(Z),M})},[]),children:n})}),j?i.jsxs(yu,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:p,value:z,onChange:Z=>I(Z.target.value),disabled:g,form:x,children:[z===void 0?i.jsx("option",{value:""}):null,Array.from(R)]},F):null]})})};Yc.displayName=Lt;var Xc="SelectTrigger",Qc=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,o=Qr(n),a=zt(Xc,n),l=a.disabled||r,c=Re(t,a.onTriggerChange),u=Xr(n),d=v.useRef("touch"),[p,g,h]=wu(f=>{const m=u().filter(k=>!k.disabled),y=m.find(k=>k.value===a.value),w=_u(m,f,y);w!==void 0&&a.onValueChange(w.value)}),x=f=>{l||(a.onOpenChange(!0),h()),f&&(a.triggerPointerDownPosRef.current={x:Math.round(f.pageX),y:Math.round(f.pageY)})};return i.jsx(Uc,{asChild:!0,...o,children:i.jsx(Se.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":bu(a.value)?"":void 0,...s,ref:c,onClick:ye(s.onClick,f=>{f.currentTarget.focus(),d.current!=="mouse"&&x(f)}),onPointerDown:ye(s.onPointerDown,f=>{d.current=f.pointerType;const m=f.target;m.hasPointerCapture(f.pointerId)&&m.releasePointerCapture(f.pointerId),f.button===0&&f.ctrlKey===!1&&f.pointerType==="mouse"&&(x(f),f.preventDefault())}),onKeyDown:ye(s.onKeyDown,f=>{const m=p.current!=="";!(f.ctrlKey||f.altKey||f.metaKey)&&f.key.length===1&&g(f.key),!(m&&f.key===" ")&&Vb.includes(f.key)&&(x(),f.preventDefault())})})})});Qc.displayName=Xc;var eu="SelectValue",tu=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:o,placeholder:a="",...l}=e,c=zt(eu,n),{onValueNodeHasChildrenChange:u}=c,d=o!==void 0,p=Re(t,c.onValueNodeChange);return We(()=>{u(d)},[u,d]),i.jsx(Se.span,{...l,ref:p,style:{pointerEvents:"none"},children:bu(c.value)?i.jsx(i.Fragment,{children:a}):o})});tu.displayName=eu;var Yb="SelectIcon",nu=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return i.jsx(Se.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});nu.displayName=Yb;var Xb="SelectPortal",ru=e=>i.jsx(Zr,{asChild:!0,...e});ru.displayName=Xb;var Ft="SelectContent",su=v.forwardRef((e,t)=>{const n=zt(Ft,e.__scopeSelect),[r,s]=v.useState();if(We(()=>{s(new DocumentFragment)},[]),!n.open){const o=r;return o?Un.createPortal(i.jsx(ou,{scope:e.__scopeSelect,children:i.jsx(Yr.Slot,{scope:e.__scopeSelect,children:i.jsx("div",{children:e.children})})}),o):null}return i.jsx(iu,{...e,ref:t})});su.displayName=Ft;var et=10,[ou,Ot]=wn(Ft),Qb="SelectContentImpl",e2=dn("SelectContent.RemoveScroll"),iu=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:a,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:g,collisionPadding:h,sticky:x,hideWhenDetached:f,avoidCollisions:m,...y}=e,w=zt(Ft,n),[k,C]=v.useState(null),[S,O]=v.useState(null),N=Re(t,X=>C(X)),[T,z]=v.useState(null),[I,K]=v.useState(null),j=Xr(n),[R,_]=v.useState(!1),F=v.useRef(!1);v.useEffect(()=>{if(k)return sc(k)},[k]),Jl();const Z=v.useCallback(X=>{const[ie,...ae]=j().map(we=>we.ref.current),[me]=ae.slice(-1),he=document.activeElement;for(const we of X)if(we===he||(we?.scrollIntoView({block:"nearest"}),we===ie&&S&&(S.scrollTop=0),we===me&&S&&(S.scrollTop=S.scrollHeight),we?.focus(),document.activeElement!==he))return},[j,S]),P=v.useCallback(()=>Z([T,k]),[Z,T,k]);v.useEffect(()=>{R&&P()},[R,P]);const{onOpenChange:M,triggerPointerDownPosRef:W}=w;v.useEffect(()=>{if(k){let X={x:0,y:0};const ie=me=>{X={x:Math.abs(Math.round(me.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(me.pageY)-(W.current?.y??0))}},ae=me=>{X.x<=10&&X.y<=10?me.preventDefault():k.contains(me.target)||M(!1),document.removeEventListener("pointermove",ie),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",ae,{capture:!0})}}},[k,M,W]),v.useEffect(()=>{const X=()=>M(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[M]);const[te,V]=wu(X=>{const ie=j().filter(he=>!he.disabled),ae=ie.find(he=>he.ref.current===document.activeElement),me=_u(ie,X,ae);me&&setTimeout(()=>me.ref.current.focus())}),U=v.useCallback((X,ie,ae)=>{const me=!F.current&&!ae;(w.value!==void 0&&w.value===ie||me)&&(z(X),me&&(F.current=!0))},[w.value]),re=v.useCallback(()=>k?.focus(),[k]),ee=v.useCallback((X,ie,ae)=>{const me=!F.current&&!ae;(w.value!==void 0&&w.value===ie||me)&&K(X)},[w.value]),J=r==="popper"?Zs:au,ue=J===Zs?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:g,collisionPadding:h,sticky:x,hideWhenDetached:f,avoidCollisions:m}:{};return i.jsx(ou,{scope:n,content:k,viewport:S,onViewportChange:O,itemRefCallback:U,selectedItem:T,onItemLeave:re,itemTextRefCallback:ee,focusSelectedItem:P,selectedItemText:I,position:r,isPositioned:R,searchRef:te,children:i.jsx(wo,{as:e2,allowPinchZoom:!0,children:i.jsx(bo,{asChild:!0,trapped:w.open,onMountAutoFocus:X=>{X.preventDefault()},onUnmountAutoFocus:ye(s,X=>{w.trigger?.focus({preventScroll:!0}),X.preventDefault()}),children:i.jsx(Ur,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:X=>X.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:i.jsx(J,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:X=>X.preventDefault(),...y,...ue,onPlaced:()=>_(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:ye(y.onKeyDown,X=>{const ie=X.ctrlKey||X.altKey||X.metaKey;if(X.key==="Tab"&&X.preventDefault(),!ie&&X.key.length===1&&V(X.key),["ArrowUp","ArrowDown","Home","End"].includes(X.key)){let me=j().filter(he=>!he.disabled).map(he=>he.ref.current);if(["ArrowUp","End"].includes(X.key)&&(me=me.slice().reverse()),["ArrowUp","ArrowDown"].includes(X.key)){const he=X.target,we=me.indexOf(he);me=me.slice(we+1)}setTimeout(()=>Z(me)),X.preventDefault()}})})})})})})});iu.displayName=Qb;var t2="SelectItemAlignedPosition",au=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,o=zt(Ft,n),a=Ot(Ft,n),[l,c]=v.useState(null),[u,d]=v.useState(null),p=Re(t,N=>d(N)),g=Xr(n),h=v.useRef(!1),x=v.useRef(!0),{viewport:f,selectedItem:m,selectedItemText:y,focusSelectedItem:w}=a,k=v.useCallback(()=>{if(o.trigger&&o.valueNode&&l&&u&&f&&m&&y){const N=o.trigger.getBoundingClientRect(),T=u.getBoundingClientRect(),z=o.valueNode.getBoundingClientRect(),I=y.getBoundingClientRect();if(o.dir!=="rtl"){const he=I.left-T.left,we=z.left-he,Ne=N.left-we,b=N.width+Ne,Y=Math.max(b,T.width),q=window.innerWidth-et,A=Yi(we,[et,Math.max(et,q-Y)]);l.style.minWidth=b+"px",l.style.left=A+"px"}else{const he=T.right-I.right,we=window.innerWidth-z.right-he,Ne=window.innerWidth-N.right-we,b=N.width+Ne,Y=Math.max(b,T.width),q=window.innerWidth-et,A=Yi(we,[et,Math.max(et,q-Y)]);l.style.minWidth=b+"px",l.style.right=A+"px"}const K=g(),j=window.innerHeight-et*2,R=f.scrollHeight,_=window.getComputedStyle(u),F=parseInt(_.borderTopWidth,10),Z=parseInt(_.paddingTop,10),P=parseInt(_.borderBottomWidth,10),M=parseInt(_.paddingBottom,10),W=F+Z+R+M+P,te=Math.min(m.offsetHeight*5,W),V=window.getComputedStyle(f),U=parseInt(V.paddingTop,10),re=parseInt(V.paddingBottom,10),ee=N.top+N.height/2-et,J=j-ee,ue=m.offsetHeight/2,X=m.offsetTop+ue,ie=F+Z+X,ae=W-ie;if(ie<=ee){const he=K.length>0&&m===K[K.length-1].ref.current;l.style.bottom="0px";const we=u.clientHeight-f.offsetTop-f.offsetHeight,Ne=Math.max(J,ue+(he?re:0)+we+P),b=ie+Ne;l.style.height=b+"px"}else{const he=K.length>0&&m===K[0].ref.current;l.style.top="0px";const Ne=Math.max(ee,F+f.offsetTop+(he?U:0)+ue)+ae;l.style.height=Ne+"px",f.scrollTop=ie-ee+f.offsetTop}l.style.margin=`${et}px 0`,l.style.minHeight=te+"px",l.style.maxHeight=j+"px",r?.(),requestAnimationFrame(()=>h.current=!0)}},[g,o.trigger,o.valueNode,l,u,f,m,y,o.dir,r]);We(()=>k(),[k]);const[C,S]=v.useState();We(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]);const O=v.useCallback(N=>{N&&x.current===!0&&(k(),w?.(),x.current=!1)},[k,w]);return i.jsx(r2,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:O,children:i.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:i.jsx(Se.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});au.displayName=t2;var n2="SelectPopperPosition",Zs=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=et,...o}=e,a=Qr(n);return i.jsx(Zc,{...a,...o,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Zs.displayName=n2;var[r2,Io]=wn(Ft,{}),Ws="SelectViewport",lu=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,o=Ot(Ws,n),a=Io(Ws,n),l=Re(t,o.onViewportChange),c=v.useRef(0);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),i.jsx(Yr.Slot,{scope:n,children:i.jsx(Se.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:ye(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:g}=a;if(g?.current&&p){const h=Math.abs(c.current-d.scrollTop);if(h>0){const x=window.innerHeight-et*2,f=parseFloat(p.style.minHeight),m=parseFloat(p.style.height),y=Math.max(f,m);if(y<x){const w=y+h,k=Math.min(x,w),C=w-k;p.style.height=k+"px",p.style.bottom==="0px"&&(d.scrollTop=C>0?C:0,p.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});lu.displayName=Ws;var cu="SelectGroup",[s2,o2]=wn(cu),i2=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=mt();return i.jsx(s2,{scope:n,id:s,children:i.jsx(Se.div,{role:"group","aria-labelledby":s,...r,ref:t})})});i2.displayName=cu;var uu="SelectLabel",a2=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=o2(uu,n);return i.jsx(Se.div,{id:s.id,...r,ref:t})});a2.displayName=uu;var Tr="SelectItem",[l2,du]=wn(Tr),fu=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:o,...a}=e,l=zt(Tr,n),c=Ot(Tr,n),u=l.value===r,[d,p]=v.useState(o??""),[g,h]=v.useState(!1),x=Re(t,w=>c.itemRefCallback?.(w,r,s)),f=mt(),m=v.useRef("touch"),y=()=>{s||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return i.jsx(l2,{scope:n,value:r,disabled:s,textId:f,isSelected:u,onItemTextChange:v.useCallback(w=>{p(k=>k||(w?.textContent??"").trim())},[]),children:i.jsx(Yr.ItemSlot,{scope:n,value:r,disabled:s,textValue:d,children:i.jsx(Se.div,{role:"option","aria-labelledby":f,"data-highlighted":g?"":void 0,"aria-selected":u&&g,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...a,ref:x,onFocus:ye(a.onFocus,()=>h(!0)),onBlur:ye(a.onBlur,()=>h(!1)),onClick:ye(a.onClick,()=>{m.current!=="mouse"&&y()}),onPointerUp:ye(a.onPointerUp,()=>{m.current==="mouse"&&y()}),onPointerDown:ye(a.onPointerDown,w=>{m.current=w.pointerType}),onPointerMove:ye(a.onPointerMove,w=>{m.current=w.pointerType,s?c.onItemLeave?.():m.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ye(a.onPointerLeave,w=>{w.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:ye(a.onKeyDown,w=>{c.searchRef?.current!==""&&w.key===" "||(Hb.includes(w.key)&&y(),w.key===" "&&w.preventDefault())})})})})});fu.displayName=Tr;var On="SelectItemText",hu=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...o}=e,a=zt(On,n),l=Ot(On,n),c=du(On,n),u=Gb(On,n),[d,p]=v.useState(null),g=Re(t,y=>p(y),c.onItemTextChange,y=>l.itemTextRefCallback?.(y,c.value,c.disabled)),h=d?.textContent,x=v.useMemo(()=>i.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:f,onNativeOptionRemove:m}=u;return We(()=>(f(x),()=>m(x)),[f,m,x]),i.jsxs(i.Fragment,{children:[i.jsx(Se.span,{id:c.textId,...o,ref:g}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Un.createPortal(o.children,a.valueNode):null]})});hu.displayName=On;var pu="SelectItemIndicator",mu=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return du(pu,n).isSelected?i.jsx(Se.span,{"aria-hidden":!0,...r,ref:t}):null});mu.displayName=pu;var Vs="SelectScrollUpButton",gu=v.forwardRef((e,t)=>{const n=Ot(Vs,e.__scopeSelect),r=Io(Vs,e.__scopeSelect),[s,o]=v.useState(!1),a=Re(t,r.onScrollButtonChange);return We(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;o(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?i.jsx(vu,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});gu.displayName=Vs;var Hs="SelectScrollDownButton",xu=v.forwardRef((e,t)=>{const n=Ot(Hs,e.__scopeSelect),r=Io(Hs,e.__scopeSelect),[s,o]=v.useState(!1),a=Re(t,r.onScrollButtonChange);return We(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;o(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?i.jsx(vu,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});xu.displayName=Hs;var vu=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,o=Ot("SelectScrollButton",n),a=v.useRef(null),l=Xr(n),c=v.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),We(()=>{l().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),i.jsx(Se.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ye(s.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(r,50))}),onPointerMove:ye(s.onPointerMove,()=>{o.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(r,50))}),onPointerLeave:ye(s.onPointerLeave,()=>{c()})})}),c2="SelectSeparator",u2=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return i.jsx(Se.div,{"aria-hidden":!0,...r,ref:t})});u2.displayName=c2;var qs="SelectArrow",d2=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Qr(n),o=zt(qs,n),a=Ot(qs,n);return o.open&&a.position==="popper"?i.jsx(Wc,{...s,...r,ref:t}):null});d2.displayName=qs;var f2="SelectBubbleInput",yu=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const s=v.useRef(null),o=Re(r,s),a=fy(t);return v.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==t&&d){const p=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(p)}},[a,t]),i.jsx(Se.select,{...n,style:{...Zl,...n.style},ref:o,defaultValue:t})});yu.displayName=f2;function bu(e){return e===""||e===void 0}function wu(e){const t=jt(e),n=v.useRef(""),r=v.useRef(0),s=v.useCallback(a=>{const l=n.current+a;t(l),(function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),o=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,o]}function _u(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let a=h2(e,Math.max(o,0));s.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function h2(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var p2=Yc,m2=Qc,g2=tu,x2=nu,v2=ru,y2=su,b2=lu,w2=fu,_2=hu,k2=mu,C2=gu,S2=xu,es="Tabs",[j2]=Wt(es,[Hc]),ku=Hc(),[N2,Ro]=j2(es),Cu=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:o,orientation:a="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=yo(l),[p,g]=fn({prop:r,onChange:s,defaultProp:o??"",caller:es});return i.jsx(N2,{scope:n,baseId:mt(),value:p,onValueChange:g,orientation:a,dir:d,activationMode:c,children:i.jsx(Se.div,{dir:d,"data-orientation":a,...u,ref:t})})});Cu.displayName=es;var Su="TabsList",ju=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,o=Ro(Su,n),a=ku(n);return i.jsx(Zb,{asChild:!0,...a,orientation:o.orientation,dir:o.dir,loop:r,children:i.jsx(Se.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});ju.displayName=Su;var Nu="TabsTrigger",Eu=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...o}=e,a=Ro(Nu,n),l=ku(n),c=zu(a.baseId,r),u=Ou(a.baseId,r),d=r===a.value;return i.jsx(Wb,{asChild:!0,...l,focusable:!s,active:d,children:i.jsx(Se.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...o,ref:t,onMouseDown:ye(e.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?a.onValueChange(r):p.preventDefault()}),onKeyDown:ye(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&a.onValueChange(r)}),onFocus:ye(e.onFocus,()=>{const p=a.activationMode!=="manual";!d&&!s&&p&&a.onValueChange(r)})})})});Eu.displayName=Nu;var Tu="TabsContent",Au=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:o,...a}=e,l=Ro(Tu,n),c=zu(l.baseId,r),u=Ou(l.baseId,r),d=r===l.value,p=v.useRef(d);return v.useEffect(()=>{const g=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(g)},[]),i.jsx(Vt,{present:s||d,children:({present:g})=>i.jsx(Se.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:u,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:g&&o})})});Au.displayName=Tu;function zu(e,t){return`${e}-trigger-${t}`}function Ou(e,t){return`${e}-content-${t}`}var E2=Cu,T2=ju,A2=Eu,z2=Au,[ts]=Wt("Tooltip",[Gr]),ns=Gr(),Iu="TooltipProvider",O2=700,Ks="tooltip.open",[I2,Po]=ts(Iu),Ru=e=>{const{__scopeTooltip:t,delayDuration:n=O2,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:o}=e,a=v.useRef(!0),l=v.useRef(!1),c=v.useRef(0);return v.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),i.jsx(I2,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:v.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:v.useCallback(u=>{l.current=u},[]),disableHoverableContent:s,children:o})};Ru.displayName=Iu;var Fn="Tooltip",[R2,qn]=ts(Fn),Pu=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:o,disableHoverableContent:a,delayDuration:l}=e,c=Po(Fn,e.__scopeTooltip),u=ns(t),[d,p]=v.useState(null),g=mt(),h=v.useRef(0),x=a??c.disableHoverableContent,f=l??c.delayDuration,m=v.useRef(!1),[y,w]=fn({prop:r,defaultProp:s??!1,onChange:N=>{N?(c.onOpen(),document.dispatchEvent(new CustomEvent(Ks))):c.onClose(),o?.(N)},caller:Fn}),k=v.useMemo(()=>y?m.current?"delayed-open":"instant-open":"closed",[y]),C=v.useCallback(()=>{window.clearTimeout(h.current),h.current=0,m.current=!1,w(!0)},[w]),S=v.useCallback(()=>{window.clearTimeout(h.current),h.current=0,w(!1)},[w]),O=v.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{m.current=!0,w(!0),h.current=0},f)},[f,w]);return v.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),i.jsx(Bc,{...u,children:i.jsx(R2,{scope:t,contentId:g,open:y,stateAttribute:k,trigger:d,onTriggerChange:p,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayedRef.current?O():C()},[c.isOpenDelayedRef,O,C]),onTriggerLeave:v.useCallback(()=>{x?S():(window.clearTimeout(h.current),h.current=0)},[S,x]),onOpen:C,onClose:S,disableHoverableContent:x,children:n})})};Pu.displayName=Fn;var Js="TooltipTrigger",Mu=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=qn(Js,n),o=Po(Js,n),a=ns(n),l=v.useRef(null),c=Re(t,l,s.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),p=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),i.jsx(Uc,{asChild:!0,...a,children:i.jsx(Se.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:ye(e.onPointerMove,g=>{g.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:ye(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:ye(e.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:ye(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:ye(e.onBlur,s.onClose),onClick:ye(e.onClick,s.onClose)})})});Mu.displayName=Js;var Mo="TooltipPortal",[P2,M2]=ts(Mo,{forceMount:void 0}),Du=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,o=qn(Mo,t);return i.jsx(P2,{scope:t,forceMount:n,children:i.jsx(Vt,{present:n||o.open,children:i.jsx(Zr,{asChild:!0,container:s,children:r})})})};Du.displayName=Mo;var pn="TooltipContent",Lu=v.forwardRef((e,t)=>{const n=M2(pn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...o}=e,a=qn(pn,e.__scopeTooltip);return i.jsx(Vt,{present:r||a.open,children:a.disableHoverableContent?i.jsx(Fu,{side:s,...o,ref:t}):i.jsx(D2,{side:s,...o,ref:t})})}),D2=v.forwardRef((e,t)=>{const n=qn(pn,e.__scopeTooltip),r=Po(pn,e.__scopeTooltip),s=v.useRef(null),o=Re(t,s),[a,l]=v.useState(null),{trigger:c,onClose:u}=n,d=s.current,{onPointerInTransitChange:p}=r,g=v.useCallback(()=>{l(null),p(!1)},[p]),h=v.useCallback((x,f)=>{const m=x.currentTarget,y={x:x.clientX,y:x.clientY},w=B2(y,m.getBoundingClientRect()),k=U2(y,w),C=Z2(f.getBoundingClientRect()),S=V2([...k,...C]);l(S),p(!0)},[p]);return v.useEffect(()=>()=>g(),[g]),v.useEffect(()=>{if(c&&d){const x=m=>h(m,d),f=m=>h(m,c);return c.addEventListener("pointerleave",x),d.addEventListener("pointerleave",f),()=>{c.removeEventListener("pointerleave",x),d.removeEventListener("pointerleave",f)}}},[c,d,h,g]),v.useEffect(()=>{if(a){const x=f=>{const m=f.target,y={x:f.clientX,y:f.clientY},w=c?.contains(m)||d?.contains(m),k=!W2(y,a);w?g():k&&(g(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,d,a,u,g]),i.jsx(Fu,{...e,ref:o})}),[L2,F2]=ts(Fn,{isInside:!1}),$2=T1("TooltipContent"),Fu=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:a,...l}=e,c=qn(pn,n),u=ns(n),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(Ks,d),()=>document.removeEventListener(Ks,d)),[d]),v.useEffect(()=>{if(c.trigger){const p=g=>{g.target?.contains(c.trigger)&&d()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[c.trigger,d]),i.jsx(Ur,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:p=>p.preventDefault(),onDismiss:d,children:i.jsxs(Zc,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[i.jsx($2,{children:r}),i.jsx(L2,{scope:n,isInside:!0,children:i.jsx(M1,{id:c.contentId,role:"tooltip",children:s||r})})]})})});Lu.displayName=pn;var $u="TooltipArrow",Bu=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=ns(n);return F2($u,n).isInside?null:i.jsx(Wc,{...s,...r,ref:t})});Bu.displayName=$u;function B2(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,s,o)){case o:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function U2(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Z2(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function W2(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const l=t[o],c=t[a],u=l.x,d=l.y,p=c.x,g=c.y;d>r!=g>r&&n<(p-u)*(r-d)/(g-d)+u&&(s=!s)}return s}function V2(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),H2(t)}function H2(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const o=t[t.length-1],a=t[t.length-2];if((o.x-a.x)*(s.y-a.y)>=(o.y-a.y)*(s.x-a.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const o=n[n.length-1],a=n[n.length-2];if((o.x-a.x)*(s.y-a.y)>=(o.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var q2=Ru,K2=Pu,J2=Mu,G2=Du,Y2=Lu,X2=Bu;const Q2=vo("inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function $n({className:e,variant:t="default",asChild:n=!1,...r}){const s=n?N1:"span";return i.jsx(s,{"data-slot":"badge","data-variant":t,className:xe(Q2({variant:t}),e),...r})}function Do({...e}){return i.jsx(oy,{"data-slot":"dialog",...e})}function ew({...e}){return i.jsx(iy,{"data-slot":"dialog-trigger",...e})}function tw({...e}){return i.jsx(ay,{"data-slot":"dialog-portal",...e})}function nw({className:e,...t}){return i.jsx(ly,{"data-slot":"dialog-overlay",className:xe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t})}function Lo({className:e,children:t,...n}){return i.jsxs(tw,{children:[i.jsx(nw,{}),i.jsxs(cy,{"data-slot":"dialog-content",className:xe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",e),...n,children:[t,i.jsxs(dy,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none 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",children:[i.jsx(mo,{className:"size-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Fo({className:e,...t}){return i.jsx("div",{"data-slot":"dialog-header",className:xe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function $o({className:e,...t}){return i.jsx(uy,{"data-slot":"dialog-title",className:xe("text-lg font-semibold leading-none tracking-tight",e),...t})}const rw=vo("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function je({className:e,variant:t,size:n,...r}){return i.jsx("button",{"data-slot":"button",className:xe(rw({variant:t,size:n,className:e})),...r})}function Uu({open:e,onOpenChange:t,title:n,description:r,confirmLabel:s="Confirm",variant:o="default",onConfirm:a}){return i.jsx(Do,{open:e,onOpenChange:t,children:i.jsxs(Lo,{children:[i.jsx(Fo,{children:i.jsx($o,{children:n})}),i.jsx("p",{className:"text-sm text-muted-foreground",children:r}),i.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[i.jsx(je,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),i.jsx(je,{variant:o,size:"sm",onClick:()=>{a(),t(!1)},children:s})]})]})})}const sw={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function ow({conversationId:e,startTime:t,endTime:n,totalCalls:r,totalInputTokens:s,totalOutputTokens:o,apiFormat:a,expanded:l,onToggle:c,hideApiFormat:u=!1,isLoading:d=!1,userAgent:p,timeDisplayFormat:g,onClear:h}){const[x,f]=v.useState(!1),m=w=>{w.stopPropagation(),h!==void 0&&f(!0)},y=v.useCallback(w=>{w.stopPropagation(),window.open(vd(e),"_blank","noopener,noreferrer")},[e]);return i.jsxs("div",{role:"button",tabIndex:0,"data-nav-id":`conv-${e}`,"data-nav-action":l?"collapse":"expand",className:xe("flex items-center gap-3 px-3 py-2 cursor-pointer transition-colors","hover:bg-muted/50","select-none","border border-border rounded-lg mb-2 bg-background sticky top-0 z-10","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:c,onKeyDown:w=>{w.target===w.currentTarget&&(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),c())},children:[l?i.jsx(gn,{className:"size-4 text-muted-foreground shrink-0"}):d?i.jsx(Mn,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):i.jsx(Wn,{className:"size-4 text-muted-foreground shrink-0"}),i.jsx("span",{className:"text-purple-400/90 font-mono text-xs font-semibold shrink-0",title:e,children:e.startsWith("PID:")||e.includes("|")?e:e.length>24?e.slice(0,12)+"..."+e.slice(-12):e}),p!=null&&p!==""&&i.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:p,children:[i.jsx(yx,{className:"size-3"}),i.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:p})]}),!u&&i.jsx($n,{variant:"outline",className:xe("text-[10px] px-1.5 py-0 h-5 font-mono shrink-0",a==="openai"&&"border-blue-500/40 text-blue-400",a==="anthropic"&&"border-orange-500/40 text-orange-400",a==="unknown"&&"border-muted text-muted-foreground"),children:sw[a]}),i.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[i.jsx(St,{className:"size-3"}),i.jsx("span",{className:"font-mono tabular-nums",children:go(t,n,g)})]}),i.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[i.jsx($r,{className:"size-3"}),i.jsxs("span",{className:"font-mono tabular-nums",children:[r," call",r!==1?"s":""]})]}),i.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[i.jsx(Dn,{className:"size-3 text-muted-foreground"}),i.jsxs("span",{className:"font-mono tabular-nums",children:[i.jsx("span",{className:"text-blue-400",children:$e(s)})," / ",i.jsx("span",{className:"text-amber-400",children:$e(o)})]})]}),i.jsx("span",{className:"flex-1 min-w-0"}),i.jsx("button",{type:"button",onClick:y,onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&y(w)},"aria-label":`Open session ${e} in a new tab`,title:"Open this session in a new tab",className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 inline-flex items-center justify-center size-8 rounded hover:bg-muted cursor-pointer",children:i.jsx(kl,{className:"size-3.5"})}),h!==void 0&&i.jsx("button",{type:"button",onClick:m,"aria-label":`Clear group (${r} request${r!==1?"s":""})`,title:"Clear this group",className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 inline-flex items-center justify-center size-8 rounded hover:bg-muted cursor-pointer",children:i.jsx(jl,{className:"size-3.5"})}),i.jsx(Uu,{open:x,onOpenChange:f,title:"Clear this group?",description:`This will remove ${r} request${r!==1?"s":""} from this conversation. This action cannot be undone.`,confirmLabel:"Clear",variant:"destructive",onConfirm:()=>{h?.()}})]})}function iw(e){const t=e.find(n=>n.apiFormat!=="unknown");return t!==void 0?t.apiFormat:e[0]?.apiFormat??"unknown"}function aw(e){let t=!1,n=!1;for(const r of e)if(r.apiFormat==="anthropic"?t=!0:r.apiFormat==="openai"&&(n=!0),t&&n)return!0;return!1}function lw(e){if(e.isTest===!0)return"provider-test";if(e.sessionId!==null&&e.sessionId!==""&&e.sessionId!==void 0)return e.sessionId;const t=e.clientPid!==null&&e.clientPid!==void 0,n=e.clientProjectFolder!==null&&e.clientProjectFolder!==void 0;if(!t&&!n)return"default";const r=t?`PID:${e.clientPid}`:"unknown",s=n?e.clientProjectFolder:"no-folder";return`${r}|${s}`}function cw(e){const t=new Map;for(const r of e){const s=lw(r),o=t.get(s);o!==void 0?o.push(r):t.set(s,[r])}const n=[];for(const[r,s]of t){const o=[...s].sort((a,l)=>a.timestamp.localeCompare(l.timestamp));n.push({id:r,conversationId:r,logs:o})}return n.sort((r,s)=>(r.logs[0]?.timestamp??"").localeCompare(s.logs[0]?.timestamp??"")),n}function Xi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function uw(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),Xi(t)?typeof t.stop_reason=="string"?t.stop_reason==="end_turn"||t.stop_reason==="tool_use"?t.stop_reason:null:Array.isArray(t.choices)&&t.choices.length>0&&Xi(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}function Zu(e){return e==="end_turn"||e==="stop"}function Qe({className:e,style:t,d:n,eyeStalks:r,eyes:s,legs:o,extras:a}){return i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:t,className:xe("inline-block size-5",e),children:[i.jsx("path",{d:n}),r,s,o,a]})}const It=i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),i.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),i.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),i.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]}),Wu=i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"7",y1:"16",x2:"5.5",y2:"18.5"}),i.jsx("line",{x1:"9.5",y1:"17",x2:"8.5",y2:"19.5"}),i.jsx("line",{x1:"14.5",y1:"17",x2:"15.5",y2:"19.5"}),i.jsx("line",{x1:"17",y1:"16",x2:"18.5",y2:"18.5"})]});function Vu({className:e}){return i.jsx(Qe,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"})]}),legs:It,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function dw({className:e}){return i.jsx(Qe,{className:e,d:"M4 13 C4 7 7.5 5.5 12 5.5 C16.5 5.5 20 7 20 13 C20 17.5 16.5 19 12 19 C7.5 19 4 17.5 4 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"9.5",y1:"6.5",x2:"9.5",y2:"4.5"}),i.jsx("line",{x1:"14.5",y1:"6.5",x2:"14.5",y2:"4.5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"})]}),legs:Wu,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C4 9.5 2.5 10 3 12 C3.5 13.5 4.5 13 5 12"}),i.jsx("path",{d:"M19 11 C20 9.5 21.5 10 21 12 C20.5 13.5 19.5 13 19 12"})]})})}function fw({className:e}){return i.jsx(Qe,{className:e,d:"M3 13.5 C3 8 7 6 12 6 C17 6 21 8 21 13.5 C21 17 17 19 12 19 C7 19 3 17 3 13.5 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"7",y1:"7",x2:"6.5",y2:"4.5"}),i.jsx("line",{x1:"17",y1:"7",x2:"17.5",y2:"4.5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"6.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"17.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:It,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M4 12 C2.5 10.5 1 11 1.5 13 C2 14.5 3.5 14 4.5 13"}),i.jsx("path",{d:"M20 12 C21.5 10.5 23 11 22.5 13 C22 14.5 20.5 14 19.5 13"})]})})}function hw({className:e}){return i.jsx(Qe,{className:e,d:"M6 14 C6 8 9 5.5 12 5.5 C15 5.5 18 8 18 14 C18 18 15 20 12 20 C9 20 6 18 6 14 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"6.5",x2:"10",y2:"3.5"}),i.jsx("line",{x1:"14",y1:"6.5",x2:"14",y2:"3.5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"10",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"7",y1:"17",x2:"5",y2:"20.5"}),i.jsx("line",{x1:"9.5",y1:"18.5",x2:"8.5",y2:"21.5"}),i.jsx("line",{x1:"14.5",y1:"18.5",x2:"15.5",y2:"21.5"}),i.jsx("line",{x1:"17",y1:"17",x2:"19",y2:"20.5"})]}),extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M6.5 11 C5 8.5 3 9 3.5 11.5 C4 13.5 5 13 6 12"}),i.jsx("path",{d:"M17.5 11 C19 8.5 21 9 20.5 11.5 C20 13.5 19 13 18 12"})]})})}function pw({className:e}){return i.jsx(Qe,{className:e,d:"M5 13 C5 9 8 7 12 7 L13 4 L14 7 C16 7 19 9 19 13 C19 16 16 18 13 18 L12 21 L11 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:It,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function mw({className:e}){return i.jsx(Qe,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),i.jsx("line",{x1:"13.5",y1:"4",x2:"15.5",y2:"5"})]}),legs:It,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function gw({className:e}){return i.jsx(Qe,{className:e,d:"M5.5 13.5 C5.5 10 8.5 8 12 8 C15.5 8 18.5 10 18.5 13.5 C18.5 16 15.5 17.5 12 17.5 C8.5 17.5 5.5 16 5.5 13.5 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"6"}),i.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"6"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"9",y1:"6",x2:"11",y2:"6.5"}),i.jsx("line",{x1:"13",y1:"6",x2:"15",y2:"6.5"})]}),legs:Wu,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M6 11.5 C4.5 10.5 3 11 3.5 12.5 C4 13.5 5 13 5.5 12.5"}),i.jsx("path",{d:"M18 11.5 C19.5 10.5 21 11 20.5 12.5 C20 13.5 19 13 18.5 12.5"})]})})}function xw({className:e}){return i.jsx(Qe,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:It,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),i.jsx("line",{x1:"8.5",y1:"4",x2:"10.5",y2:"4.5"}),i.jsx("line",{x1:"15.5",y1:"4",x2:"13.5",y2:"4.5"}),i.jsx("path",{d:"M9 15.5 C10 14.5 14 14.5 15 15.5"})]})})}function vw({className:e}){return i.jsx(Qe,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"}),i.jsx("circle",{cx:"14.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"})]}),legs:It,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),i.jsx("ellipse",{cx:"12",cy:"15",rx:"2",ry:"1.5",fill:"currentColor",stroke:"none"})]})})}function yw({className:e}){return i.jsx(Qe,{className:e,d:"M4.5 13 C4.5 8 7.5 6 12 6 C16.5 6 19.5 8 19.5 13 C19.5 17 16.5 18.5 12 18.5 C7.5 18.5 4.5 17 4.5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"9.5",y1:"7",x2:"9",y2:"5"}),i.jsx("line",{x1:"14.5",y1:"7",x2:"15",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"15",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"})]}),legs:It,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9 2 9.5 2.5 12 C3 14 4 13 5 12"}),i.jsx("path",{d:"M19 11 C20.5 9 22 9.5 21.5 12 C21 14 20 13 19 12"}),i.jsx("path",{d:"M9 14.5 C10 16 14 16 15 14.5"}),i.jsx("circle",{cx:"7",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"}),i.jsx("circle",{cx:"17",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"})]})})}function bw({className:e}){return i.jsx(Qe,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5.5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5.5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"7.5",y1:"5.5",x2:"16.5",y2:"5.5"}),i.jsx("rect",{x:"7",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"}),i.jsx("rect",{x:"13",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"})]}),legs:It,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),i.jsx("path",{d:"M9.5 15 C10.5 16 13.5 16 14.5 15"})]})})}function ww({className:e}){return i.jsx(Qe,{className:e,d:"M7 13.5 C7 10.5 9.5 9 12 9 C14.5 9 17 10.5 17 13.5 C17 16 14.5 17.5 12 17.5 C9.5 17.5 7 16 7 13.5 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10.5",y1:"9.5",x2:"10.5",y2:"8"}),i.jsx("line",{x1:"13.5",y1:"9.5",x2:"13.5",y2:"8"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"10.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"13.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"8",y1:"16",x2:"6.5",y2:"18"}),i.jsx("line",{x1:"10",y1:"17",x2:"9.5",y2:"19"}),i.jsx("line",{x1:"14",y1:"17",x2:"14.5",y2:"19"}),i.jsx("line",{x1:"16",y1:"16",x2:"17.5",y2:"18"})]}),extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M7.5 12 C6.5 11 5.5 11.5 6 13 C6.5 14 7 13.5 7.5 13"}),i.jsx("path",{d:"M16.5 12 C17.5 11 18.5 11.5 18 13 C17.5 14 17 13.5 16.5 13"})]})})}const Bn=[Vu,dw,fw,hw,pw,mw,gw,xw,vw,yw,bw,ww];function Ar(e){return Bn[Math.abs(e)%Bn.length]??Vu}function _w(e){const t=Bn.length-2;return t<=0?0:1+((Number.isFinite(e)?Math.trunc(e):0)%t+t)%t}function kw(e){return Ar(_w(e))}const Cw="data:image/svg+xml,%3csvg%20height='2500'%20viewBox='0%206.603%201192.672%201193.397'%20width='2500'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m233.96%20800.215%20234.684-131.678%203.947-11.436-3.947-6.363h-11.436l-39.221-2.416-134.094-3.624-116.296-4.832-112.67-6.04-28.35-6.04-26.577-35.035%202.738-17.477%2023.84-16.027%2034.147%202.98%2075.463%205.155%20113.235%207.812%2082.147%204.832%20121.692%2012.644h19.329l2.738-7.812-6.604-4.832-5.154-4.832-117.182-79.41-126.845-83.92-66.443-48.321-35.92-24.484-18.12-22.953-7.813-50.093%2032.618-35.92%2043.812%202.98%2011.195%202.98%2044.375%2034.147%2094.792%2073.37%20123.786%2091.167%2018.12%2015.06%207.249-5.154.886-3.624-8.135-13.61-67.329-121.692-71.838-123.785-31.974-51.302-8.456-30.765c-2.98-12.645-5.154-23.275-5.154-36.242l37.127-50.416%2020.537-6.604%2049.53%206.604%2020.86%2018.121%2030.765%2070.39%2049.852%20110.818%2077.315%20150.684%2022.631%2044.698%2012.08%2041.396%204.51%2012.645h7.813v-7.248l6.362-84.886%2011.759-104.215%2011.436-134.094%203.946-37.772%2018.685-45.262%2037.127-24.482%2028.994%2013.852%2023.839%2034.148-3.303%2022.067-14.174%2092.134-27.785%20144.323-18.121%2096.644h10.55l12.08-12.08%2048.887-64.913%2082.147-102.685%2036.242-40.752%2042.282-45.02%2027.14-21.423h51.303l37.772%2056.135-16.913%2057.986-52.832%2067.007-43.812%2056.779-62.82%2084.563-39.22%2067.651%203.623%205.396%209.343-.886%20141.906-30.201%2076.671-13.852%2091.49-15.705%2041.396%2019.329%204.51%2019.65-16.269%2040.189-97.852%2024.16-114.764%2022.954-170.9%2040.43-2.093%201.53%202.416%202.98%2076.993%207.248%2032.94%201.771h80.617l150.12%2011.195%2039.222%2025.933%2023.517%2031.732-3.946%2024.16-60.403%2030.766-81.503-19.33-190.228-45.26-65.235-16.27h-9.02v5.397l54.362%2053.154%2099.624%2089.96%20124.752%20115.973%206.362%2028.671-16.027%2022.63-16.912-2.415-109.611-82.47-42.282-37.127-95.758-80.618h-6.363v8.456l22.067%2032.296%20116.537%20175.167%206.04%2053.719-8.456%2017.476-30.201%2010.55-33.181-6.04-68.215-95.758-70.39-107.84-56.778-96.644-6.926%203.947-33.503%20360.886-15.705%2018.443-36.243%2013.852-30.201-22.953-16.027-37.127%2016.027-73.37%2019.329-95.758%2015.704-76.107%2014.175-94.55%208.456-31.41-.563-2.094-6.927.886-71.275%2097.852-108.402%20146.497-85.772%2091.812-20.537%208.134-35.597-18.443%203.301-32.94%2019.893-29.315%20118.712-151.007%2071.597-93.583%2046.228-54.04-.322-7.813h-2.738l-315.302%20204.725-56.135%207.248-24.16-22.63%202.98-37.128%2011.435-12.08%2094.792-65.236-.322.323z'%20fill='%23d97757'/%3e%3c/svg%3e",Sw="data:image/svg+xml,%3csvg%20height='2500'%20viewBox='-1%20-.1%20949.1%20959.8'%20width='2474'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m925.8%20456.3c10.4%2023.2%2017%2048%2019.7%2073.3%202.6%2025.3%201.3%2050.9-4.1%2075.8-5.3%2024.9-14.5%2048.8-27.3%2070.8-8.4%2014.7-18.3%2028.5-29.7%2041.2-11.3%2012.6-23.9%2024-37.6%2034-13.8%2010-28.5%2018.4-44.1%2025.3-15.5%206.8-31.7%2012-48.3%2015.4-7.8%2024.2-19.4%2047.1-34.4%2067.7-14.9%2020.6-33%2038.7-53.6%2053.6-20.6%2015-43.4%2026.6-67.6%2034.4-24.2%207.9-49.5%2011.8-75%2011.8-16.9.1-33.9-1.7-50.5-5.1-16.5-3.5-32.7-8.8-48.2-15.7s-30.2-15.5-43.9-25.5c-13.6-10-26.2-21.5-37.4-34.2-25%205.4-50.6%206.7-75.9%204.1-25.3-2.7-50.1-9.3-73.4-19.7-23.2-10.3-44.7-24.3-63.6-41.4s-35-37.1-47.7-59.1c-8.5-14.7-15.5-30.2-20.8-46.3s-8.8-32.7-10.6-49.6c-1.8-16.8-1.7-33.8.1-50.7%201.8-16.8%205.5-33.4%2010.8-49.5-17-18.9-31-40.4-41.4-63.6-10.3-23.3-17-48-19.6-73.3-2.7-25.3-1.3-50.9%204-75.8s14.5-48.8%2027.3-70.8c8.4-14.7%2018.3-28.6%2029.6-41.2s24-24%2037.7-34%2028.5-18.5%2044-25.3c15.6-6.9%2031.8-12%2048.4-15.4%207.8-24.3%2019.4-47.1%2034.3-67.7%2015-20.6%2033.1-38.7%2053.7-53.7%2020.6-14.9%2043.4-26.5%2067.6-34.4%2024.2-7.8%2049.5-11.8%2075-11.7%2016.9-.1%2033.9%201.6%2050.5%205.1s32.8%208.7%2048.3%2015.6c15.5%207%2030.2%2015.5%2043.9%2025.5%2013.7%2010.1%2026.3%2021.5%2037.5%2034.2%2024.9-5.3%2050.5-6.6%2075.8-4s50%209.3%2073.3%2019.6c23.2%2010.4%2044.7%2024.3%2063.6%2041.4%2018.9%2017%2035%2036.9%2047.7%2059%208.5%2014.6%2015.5%2030.1%2020.8%2046.3%205.3%2016.1%208.9%2032.7%2010.6%2049.6%201.8%2016.9%201.8%2033.9-.1%2050.8-1.8%2016.9-5.5%2033.5-10.8%2049.6%2017.1%2018.9%2031%2040.3%2041.4%2063.6zm-333.2%20426.9c21.8-9%2041.6-22.3%2058.3-39s30-36.5%2039-58.4c9-21.8%2013.7-45.2%2013.7-68.8v-223q-.1-.3-.2-.7-.1-.3-.3-.6-.2-.3-.5-.5-.3-.3-.6-.4l-80.7-46.6v269.4c0%202.7-.4%205.5-1.1%208.1-.7%202.7-1.7%205.2-3.1%207.6s-3%204.6-5%206.5a32.1%2032.1%200%200%201%20-6.5%205l-191.1%20110.3c-1.6%201-4.3%202.4-5.7%203.2%207.9%206.7%2016.5%2012.6%2025.5%2017.8%209.1%205.2%2018.5%209.6%2028.3%2013.2%209.8%203.5%2019.9%206.2%2030.1%208%2010.3%201.8%2020.7%202.7%2031.1%202.7%2023.6%200%2047-4.7%2068.8-13.8zm-455.1-151.4c11.9%2020.5%2027.6%2038.3%2046.3%2052.7%2018.8%2014.4%2040.1%2024.9%2062.9%2031s46.6%207.7%2070%204.6%2045.9-10.7%2066.4-22.5l193.2-111.5.5-.5q.2-.2.3-.6.2-.3.3-.6v-94l-233.2%20134.9c-2.4%201.4-4.9%202.4-7.5%203.2-2.7.7-5.4%201-8.2%201-2.7%200-5.4-.3-8.1-1-2.6-.8-5.2-1.8-7.6-3.2l-191.1-110.4c-1.7-1-4.2-2.5-5.6-3.4-1.8%2010.3-2.7%2020.7-2.7%2031.1s1%2020.8%202.8%2031.1c1.8%2010.2%204.6%2020.3%208.1%2030.1%203.6%209.8%208%2019.2%2013.2%2028.2zm-50.2-417c-11.8%2020.5-19.4%2043.1-22.5%2066.5s-1.5%2047.1%204.6%2070c6.1%2022.8%2016.6%2044.1%2031%2062.9%2014.4%2018.7%2032.3%2034.4%2052.7%2046.2l193.1%20111.6q.3.1.7.2h.7q.4%200%20.7-.2.3-.1.6-.3l81-46.8-233.2-134.6c-2.3-1.4-4.5-3.1-6.5-5a32.1%2032.1%200%200%201%20-5-6.5c-1.3-2.4-2.4-4.9-3.1-7.6-.7-2.6-1.1-5.3-1-8.1v-227.1c-9.8%203.6-19.3%208-28.3%2013.2-9%205.3-17.5%2011.3-25.5%2018-7.9%206.7-15.3%2014.1-22%2022.1-6.7%207.9-12.6%2016.5-17.8%2025.5zm663.3%20154.4c2.4%201.4%204.6%203%206.6%205%201.9%201.9%203.6%204.1%205%206.5%201.3%202.4%202.4%205%203.1%207.6.6%202.7%201%205.4.9%208.2v227.1c32.1-11.8%2060.1-32.5%2080.8-59.7%2020.8-27.2%2033.3-59.7%2036.2-93.7s-3.9-68.2-19.7-98.5-39.9-55.5-69.5-72.5l-193.1-111.6q-.3-.1-.7-.2h-.7q-.3.1-.7.2-.3.1-.6.3l-80.6%2046.6%20233.2%20134.7zm80.5-121h-.1v.1zm-.1-.1c5.8-33.6%201.9-68.2-11.3-99.7-13.1-31.5-35-58.6-63-78.2-28-19.5-61-30.7-95.1-32.2-34.2-1.4-68%206.9-97.6%2023.9l-193.1%20111.5q-.3.2-.5.5l-.4.6q-.1.3-.2.7-.1.3-.1.7v93.2l233.2-134.7c2.4-1.4%205-2.4%207.6-3.2%202.7-.7%205.4-1%208.1-1%202.8%200%205.5.3%208.2%201%202.6.8%205.1%201.8%207.5%203.2l191.1%20110.4c1.7%201%204.2%202.4%205.6%203.3zm-505.3-103.2c0-2.7.4-5.4%201.1-8.1.7-2.6%201.7-5.2%203.1-7.6%201.4-2.3%203-4.5%205-6.5%201.9-1.9%204.1-3.6%206.5-4.9l191.1-110.3c1.8-1.1%204.3-2.5%205.7-3.2-26.2-21.9-58.2-35.9-92.1-40.2-33.9-4.4-68.3%201-99.2%2015.5-31%2014.5-57.2%2037.6-75.5%2066.4-18.3%2028.9-28%2062.3-28%2096.5v223q.1.4.2.7.1.3.3.6.2.3.5.6.2.2.6.4l80.7%2046.6zm43.8%20294.7%20103.9%2060%20103.9-60v-119.9l-103.8-60-103.9%2060z'/%3e%3c/svg%3e",jw="data:image/svg+xml,%3csvg%20fill='none'%20height='1320'%20viewBox='3.771%206.973%2023.993%2017.652'%20width='2500'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m27.501%208.469c-.252-.123-.36.111-.508.23-.05.04-.093.09-.135.135-.368.395-.797.652-1.358.621-.821-.045-1.521.213-2.14.842-.132-.776-.57-1.238-1.235-1.535-.349-.155-.701-.309-.944-.645-.171-.238-.217-.504-.303-.765-.054-.159-.108-.32-.29-.348-.197-.031-.274.135-.352.273-.31.567-.43%201.192-.419%201.825.028%201.421.628%202.554%201.82%203.36.136.093.17.186.128.321-.081.278-.178.547-.264.824-.054.178-.135.217-.324.14a5.448%205.448%200%200%201%20-1.719-1.169c-.848-.82-1.614-1.726-2.57-2.435-.225-.166-.449-.32-.681-.467-.976-.95.128-1.729.383-1.82.267-.096.093-.428-.77-.424s-1.653.293-2.659.677a2.782%202.782%200%200%201%20-.46.135%209.554%209.554%200%200%200%20-2.853-.1c-1.866.21-3.356%201.092-4.452%202.6-1.315%201.81-1.625%203.87-1.246%206.018.399%202.261%201.552%204.136%203.326%205.601%201.837%201.518%203.955%202.262%206.37%202.12%201.466-.085%203.1-.282%204.942-1.842.465.23.952.322%201.762.392.623.059%201.223-.031%201.687-.127.728-.154.677-.828.414-.953-2.132-.994-1.665-.59-2.09-.916%201.084-1.285%202.717-2.619%203.356-6.94.05-.343.007-.558%200-.837-.004-.168.034-.235.228-.254a4.084%204.084%200%200%200%201.529-.47c1.382-.757%201.938-1.997%202.07-3.485.02-.227-.004-.463-.243-.582zm-12.041%2013.391c-2.067-1.627-3.07-2.162-3.483-2.138-.387.021-.318.465-.233.754.089.285.205.482.368.732.113.166.19.414-.112.598-.666.414-1.823-.139-1.878-.166-1.347-.793-2.473-1.842-3.267-3.276-.765-1.38-1.21-2.861-1.284-4.441-.02-.383.093-.518.472-.586a4.692%204.692%200%200%201%201.514-.04c2.109.31%203.905%201.255%205.41%202.749.86.853%201.51%201.871%202.18%202.865.711%201.057%201.478%202.063%202.454%202.887.343.289.619.51.881.672-.792.088-2.117.107-3.022-.61zm.99-6.38a.304.304%200%201%201%20.609%200c0%20.17-.136.304-.306.304a.3.3%200%200%201%20-.303-.305zm3.077%201.581c-.197.08-.394.15-.584.159a1.246%201.246%200%200%201%20-.79-.252c-.27-.227-.463-.354-.546-.752a1.752%201.752%200%200%201%20.016-.582c.07-.324-.008-.531-.235-.72-.187-.155-.422-.196-.682-.196a.551.551%200%200%201%20-.252-.078c-.108-.055-.197-.19-.112-.356.027-.053.159-.183.19-.207.352-.201.758-.135%201.134.016.349.142.611.404.99.773.388.448.457.573.678.906.174.264.333.534.441.842.066.192-.02.35-.248.448z'%20fill='%234d6bfe'/%3e%3c/svg%3e",Nw="/assets/minimax-BPMzvuL-.jpeg",Ew="/assets/alibaba-TTwafVwX.svg",Tw="/assets/qwen-CONDcHqt.png",Aw="/assets/zhipuai-BPNAnxo-.svg",zw={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function Hu(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(zw))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const Ht={width:24,height:24,objectFit:"contain"},Ow=He.memo(({className:e})=>i.jsx("img",{src:Cw,alt:"Anthropic",className:e,style:Ht})),Iw=He.memo(({className:e})=>i.jsx("img",{src:Sw,alt:"OpenAI",className:e,style:{...Ht,background:"white",borderRadius:"4px"}})),Rw=He.memo(({className:e})=>i.jsx("img",{src:jw,alt:"DeepSeek",className:e,style:Ht})),Pw=He.memo(({className:e})=>i.jsx("img",{src:Nw,alt:"MiniMax",className:e,style:Ht})),Mw=He.memo(({className:e})=>i.jsx("img",{src:Ew,alt:"Alibaba",className:e,style:Ht})),Dw=He.memo(({className:e})=>i.jsx("img",{src:Tw,alt:"Qwen",className:e,style:Ht})),Lw=He.memo(({className:e})=>i.jsx("img",{src:Aw,alt:"ZhipuAI",className:e,style:Ht}));function qu({provider:e,className:t}){switch(e){case"anthropic":return i.jsx(Ow,{className:t});case"openai":return i.jsx(Iw,{className:t});case"deepseek":return i.jsx(Rw,{className:t});case"minimax":return i.jsx(Pw,{className:t});case"alibaba":return i.jsx(Mw,{className:t});case"qwen":return i.jsx(Dw,{className:t});case"zhipuai":return i.jsx(Lw,{className:t});case"unknown":return null}}function Ze({delayDuration:e=0,...t}){return i.jsx(q2,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function ze({...e}){return i.jsx(K2,{"data-slot":"tooltip",...e})}function Oe({...e}){return i.jsx(J2,{"data-slot":"tooltip-trigger",...e})}function Ie({className:e,sideOffset:t=0,children:n,...r}){return i.jsx(G2,{children:i.jsxs(Y2,{"data-slot":"tooltip-content",sideOffset:t,className:xe("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,i.jsx(X2,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const Fw="x-anthropic-billing-header:";function $w(e){return e.trimStart().toLowerCase().startsWith(Fw)}function Bw(e){return il(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function Uw(e){if(!il(e))return!1;const t=Ye(e,"type"),n=Ye(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:$w(n)}function Zw(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!Bw(t))return{body:e,removed:0};const n=t.system;if(!Array.isArray(n)||n.length===0)return{body:e,removed:0};const r=[];let s=0;for(const o of n){if(Uw(o)){s+=1;continue}r.push(o)}return s===0?{body:e,removed:0}:(r.length===0?delete t.system:t.system=r,{body:JSON.stringify(t),removed:s})}function Ww(e){return{depth:Number.POSITIVE_INFINITY}}function Vw(e){try{const t=JSON.parse(e);return{kind:"json",data:Gs(t)}}catch{return{kind:"text"}}}function bs(e){const t=v.useMemo(()=>e===null?null:Vw(e),[e]),n=t?.kind==="json"?t.data:null,r=v.useMemo(()=>n===null?null:Ww(),[n]),[s,o]=v.useState(!1),[a,l]=v.useState(0),[c,u]=v.useState(0),[d,p]=v.useTransition(),g=v.useCallback(()=>{const h=!s,x=h&&r!==null?r.depth:0;p(()=>{o(h),l(x),u(f=>f+1)})},[s,r]);return{parsedData:n,policy:r,isExpanded:s,toggle:g,isPending:d,bulkDepth:a,bulkRevision:c}}function Gs(e){if(e==null)return null;switch(typeof e){case"string":return e;case"number":return e;case"boolean":return e;case"object":{if(Array.isArray(e))return e.map(n=>Gs(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=Gs(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function Ku({className:e,orientation:t="horizontal",...n}){return i.jsx(E2,{"data-slot":"tabs","data-orientation":t,orientation:t,className:xe("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const Hw=vo("rounded-lg p-[3px] group-data-[orientation=horizontal]/tabs:h-9 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Ju({className:e,variant:t="default",...n}){return i.jsx(T2,{"data-slot":"tabs-list","data-variant":t,className:xe(Hw({variant:t}),e),...n})}function it({className:e,...t}){return i.jsx(A2,{"data-slot":"tabs-trigger",className:xe("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background dark:data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 data-[state=active]:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",e),...t})}function at({className:e,...t}){return i.jsx(z2,{"data-slot":"tabs-content",className:xe("flex-1 outline-none",e),...t})}function Qt(e){const[t,n]=v.useState(!1),r=v.useRef(null);v.useEffect(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);const s=v.useCallback(o=>{o.stopPropagation(),e!==null&&window.navigator.clipboard.writeText(e).then(()=>{n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),2e3)})},[e]);return{copied:t,copy:s}}const qw=v.lazy(()=>$t(()=>import("./CompareDrawer-3nRwtk8J.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.CompareDrawer}))),Kw=v.lazy(()=>$t(()=>import("./ReplayDialog-Cl62N9PI.js"),__vite__mapDeps([3,1,4,2])).then(e=>({default:e.ReplayDialog}))),Jw=v.lazy(()=>$t(()=>import("./RequestAnatomy-DgQWGvjs.js"),__vite__mapDeps([5,1])).then(e=>({default:e.RequestAnatomy}))),Gw=v.lazy(()=>$t(()=>import("./ResponseView-Cvc-ct4E.js"),__vite__mapDeps([4,1,2])).then(e=>({default:e.ResponseView}))),Yw=v.lazy(()=>$t(()=>import("./StreamingChunkSequence-BCQaCAIe.js"),__vite__mapDeps([6,1,2])).then(e=>({default:e.StreamingChunkSequence}))),Qi=v.lazy(()=>$t(()=>import("./json-viewer-IXejqXB0.js").then(e=>e.j),__vite__mapDeps([2,1])).then(e=>({default:e.JsonViewer}))),Xw=v.lazy(()=>$t(()=>import("./json-viewer-IXejqXB0.js").then(e=>e.j),__vite__mapDeps([2,1])).then(e=>({default:e.JsonViewerFromString}))),Qw=1200,e_=12;function t_(e){const{containerRef:t,setExpandToPath:n,ensureTabActive:r,highlightMs:s}=e,o=v.useRef(null);return v.useCallback(a=>{r?.(),n(a.path);const l=p=>{p.scrollIntoView({behavior:"smooth",block:"center"}),p.classList.add("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),o.current!==null&&clearTimeout(o.current),o.current=setTimeout(()=>{p.classList.remove("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),n(null)},s??Qw)},u=`[data-anatomy-path="${(p=>typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(p):p.replace(/(["'\\[\](){}])/g,"\\$1"))(a.path)}"]`,d=p=>{const g=t.current;if(g!==null){const h=g.querySelector(u);if(h!==null){l(h);return}}p>0?window.requestAnimationFrame(()=>d(p-1)):n(null)};window.requestAnimationFrame(()=>d(e_))},[t,r,s,n])}class Gu{diff(t,n,r={}){let s;typeof r=="function"?(s=r,r={}):"callback"in r&&(s=r.callback);const o=this.castInput(t,r),a=this.castInput(n,r),l=this.removeEmpty(this.tokenize(o,r)),c=this.removeEmpty(this.tokenize(a,r));return this.diffWithOptionsObj(l,c,r,s)}diffWithOptionsObj(t,n,r,s){var o;const a=w=>{if(w=this.postProcess(w,r),s){setTimeout(function(){s(w)},0);return}else return w},l=n.length,c=t.length;let u=1,d=l+c;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const p=(o=r.timeout)!==null&&o!==void 0?o:1/0,g=Date.now()+p,h=[{oldPos:-1,lastComponent:void 0}];let x=this.extractCommon(h[0],n,t,0,r);if(h[0].oldPos+1>=c&&x+1>=l)return a(this.buildValues(h[0].lastComponent,n,t));let f=-1/0,m=1/0;const y=()=>{for(let w=Math.max(f,-u);w<=Math.min(m,u);w+=2){let k;const C=h[w-1],S=h[w+1];C&&(h[w-1]=void 0);let O=!1;if(S){const T=S.oldPos-w;O=S&&0<=T&&T<l}const N=C&&C.oldPos+1<c;if(!O&&!N){h[w]=void 0;continue}if(!N||O&&C.oldPos<S.oldPos?k=this.addToPath(S,!0,!1,0,r):k=this.addToPath(C,!1,!0,1,r),x=this.extractCommon(k,n,t,w,r),k.oldPos+1>=c&&x+1>=l)return a(this.buildValues(k.lastComponent,n,t))||!0;h[w]=k,k.oldPos+1>=c&&(m=Math.min(m,w-1)),x+1>=l&&(f=Math.max(f,w+1))}u++};if(s)(function w(){setTimeout(function(){if(u>d||Date.now()>g)return s(void 0);y()||w()},0)})();else for(;u<=d&&Date.now()<=g;){const w=y();if(w)return w}}addToPath(t,n,r,s,o){const a=t.lastComponent;return a&&!o.oneChangePerToken&&a.added===n&&a.removed===r?{oldPos:t.oldPos+s,lastComponent:{count:a.count+1,added:n,removed:r,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+s,lastComponent:{count:1,added:n,removed:r,previousComponent:a}}}extractCommon(t,n,r,s,o){const a=n.length,l=r.length;let c=t.oldPos,u=c-s,d=0;for(;u+1<a&&c+1<l&&this.equals(r[c+1],n[u+1],o);)u++,c++,d++,o.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!o.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const s=[];let o;for(;t;)s.push(t),o=t.previousComponent,delete t.previousComponent,t=o;s.reverse();const a=s.length;let l=0,c=0,u=0;for(;l<a;l++){const d=s[l];if(d.removed)d.value=this.join(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let p=n.slice(c,c+d.count);p=p.map(function(g,h){const x=r[u+h];return x.length>g.length?x:g}),d.value=this.join(p)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return s}}class n_ extends Gu{constructor(){super(...arguments),this.tokenize=Xu}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
86
+ `))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
87
+ `))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
88
+ `)&&(t=t.slice(0,-1)),n.endsWith(`
89
+ `)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const r_=new n_;function Yu(e,t,n){return r_.diff(e,t,n)}function Xu(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
90
+ `));const n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let s=0;s<r.length;s++){const o=r[s];s%2&&!t.newlineIsToken?n[n.length-1]+=o:n.push(o)}return n}class s_ extends Gu{constructor(){super(...arguments),this.tokenize=Xu}get useLongestToken(){return!0}castInput(t,n){const{undefinedReplacement:r,stringifyReplacer:s=(o,a)=>typeof a>"u"?r:a}=n;return typeof t=="string"?t:JSON.stringify(Ys(t,null,null,s),null," ")}equals(t,n,r){return super.equals(t.replace(/,([\r\n])/g,"$1"),n.replace(/,([\r\n])/g,"$1"),r)}}const o_=new s_;function i_(e,t,n){return o_.diff(e,t,n)}function Ys(e,t,n,r,s){t=t||[],n=n||[],r&&(e=r(s===void 0?"":s,e));let o;for(o=0;o<t.length;o+=1)if(t[o]===e)return n[o];let a;if(Object.prototype.toString.call(e)==="[object Array]"){for(t.push(e),a=new Array(e.length),n.push(a),o=0;o<e.length;o+=1)a[o]=Ys(e[o],t,n,r,String(o));return t.pop(),n.pop(),a}if(e&&e.toJSON&&(e=e.toJSON()),typeof e=="object"&&e!==null){t.push(e),a={},n.push(a);const l=[];let c;for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&l.push(c);for(l.sort(),o=0;o<l.length;o+=1)c=l[o],a[c]=Ys(e[c],t,n,r,c);t.pop(),n.pop()}else a=e;return a}function ea(e){return e===void 0?[]:Object.entries(e).map(t=>[t[0].toLowerCase(),t[1]]).sort(([t],[n])=>t.localeCompare(n))}function ta([e,t]){return`${e}: ${t}`}function Xs(e){const t=[];let n=0,r=0;for(const s of e){const o=s.value.split(`
91
+ `);o.length>0&&o[o.length-1]===""&&o.pop();for(const a of o)s.added?(r+=1,t.push({kind:"added",text:a,oldLineNumber:null,newLineNumber:r})):s.removed?(n+=1,t.push({kind:"removed",text:a,oldLineNumber:n,newLineNumber:null})):(n+=1,r+=1,t.push({kind:"context",text:a,oldLineNumber:n,newLineNumber:r}))}return t}function a_(e,t){const n=ea(e).map(ta).join(`
92
+ `),r=ea(t).map(ta).join(`
93
+ `);if(n===r)return{lines:[],isEmpty:!0};const s=Yu(n,r);return{lines:Xs(s),isEmpty:!1}}function na(e){try{const t=JSON.parse(e);return t===null||typeof t=="string"||typeof t=="object"?t:null}catch{return null}}function l_(e,t){const n=e??"",r=t??"";if(n===r)return{lines:[],isEmpty:!0};const s=na(n),o=na(r);if(s!==null&&o!==null){const l=i_(s,o)??[];if(l.length===1){const c=l[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:Xs(l),isEmpty:!1}}const a=Yu(n,r);return{lines:Xs(a),isEmpty:!1}}function c_(e,t,n){const r=new Array(e);return new Proxy(r,{get(s,o,a){if(typeof o=="string"){const l=o.charCodeAt(0);if(l>=48&&l<=57){const c=+o;if(Number.isInteger(c)&&c>=0&&c<e){let u=s[c];if(!u){const d=t[c*2];u=s[c]={index:c,key:n(c),start:d,size:t[c*2+1],end:d+t[c*2+1],lane:0}}return u}}if(o==="length")return e}return Reflect.get(s,o,a)}})}function Yt(e,t,n){let r=n.initialDeps??[],s,o=!0;function a(){const l=e();return(l.length!==r.length||l.some((u,d)=>r[d]!==u))&&(r=l,s=t(...l),n?.onChange&&!(o&&n.skipInitialOnChange)&&n.onChange(s),o=!1),s}return a.updateDeps=l=>{r=l},a}function ra(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const sa=(e,t)=>Math.abs(e-t)<1.01,u_=(e,t,n)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,s),n)}};let Nn;const oa=()=>{if(Nn!==void 0)return Nn;if(typeof navigator>"u")return Nn=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Nn=!0;const e=navigator.maxTouchPoints;return Nn=navigator.platform==="MacIntel"&&e!==void 0&&e>0},ia=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},d_=e=>e,f_=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,s=new Array(r);for(let o=0;o<r;o++)s[o]=t+o;return s},h_=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const s=a=>{const{width:l,height:c}=a;t({width:Math.round(l),height:Math.round(c)})};if(s(ia(n)),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(a=>{const l=()=>{const c=a[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){s({width:u.inlineSize,height:u.blockSize});return}}s(ia(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},zr={passive:!0},p_=typeof window>"u"?!0:"onscrollend"in window,m_=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const s=e.targetWindow;if(!s)return;const o=e.options.useScrollendEvent&&p_;let a=0;const l=o?null:u_(s,()=>t(a,!1),e.options.isScrollingResetDelay),c=p=>()=>{a=n(r),l?.(),t(a,p)},u=c(!0),d=c(!1);return r.addEventListener("scroll",u,zr),o&&r.addEventListener("scrollend",d,zr),()=>{r.removeEventListener("scroll",u),o&&r.removeEventListener("scrollend",d)}},g_=(e,t)=>m_(e,t,n=>{const{horizontal:r,isRtl:s}=e.options;return r?n.scrollLeft*(s&&-1||1):n.scrollTop}),x_=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},v_=(e,{adjustments:t=0,behavior:n},r)=>{var s,o;(o=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||o.call(s,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},y_=v_;class b_{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,s;return((s=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:s.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(s=>{s.forEach(o=>{const a=()=>{const l=o.target,c=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);for(const[u,d]of this.elementsCache)if(d===l){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(l,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),n=null},observe:s=>{var o;return(o=r())==null?void 0:o.observe(s,{box:"border-box"})},unobserve:s=>{var o;return(o=r())==null?void 0:o.unobserve(s)}}})(),this.range=null,this.setOptions=n=>{var r,s;const o={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:d_,rangeExtractor:f_,onChange:()=>{},measureElement:x_,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(const u in n){const d=n[u];d!==void 0&&(o[u]=d)}const a=this.options;let l=null,c=null;if(a!==void 0&&a.enabled&&o.enabled&&o.anchorTo==="end"&&this.scrollElement!==null){const u=a.count,d=o.count,p=this.getMeasurements(),g=u>0?((r=p[0])==null?void 0:r.key)??a.getItemKey(0):null,h=u>0?((s=p[u-1])==null?void 0:s.key)??a.getItemKey(u-1):null;if(d!==u||u>0&&d>0&&(o.getItemKey(0)!==g||o.getItemKey(d-1)!==h)){const m=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??p[0]:null;m&&(l=[m.key,this.getScrollOffset()-m.start]);const y=o.followOnAppend===!0?"auto":o.followOnAppend||null;y&&d>u&&this.isAtEnd(a.scrollEndThreshold)&&(u===0||o.getItemKey(d-1)!==h)&&(c=y)}}this.options=o,(l||c)&&(this.pendingScrollAnchor=[l?.[0]??null,l?.[1]??0,c])},this.notify=n=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=Yt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,a)=>{this._intendedScrollOffset!==null&&Math.abs(o-this._intendedScrollOffset)<1.5&&(o=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=a,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const o=this.scrollElement,a=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},l=()=>{this._iosTouching=!1,!(!oa()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};o.addEventListener("touchstart",a,zr),o.addEventListener("touchend",l,zr),this.unsubs.push(()=>{o.removeEventListener("touchstart",a),o.removeEventListener("touchend",l),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const s=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,s&&this.scrollElement&&this.options.enabled){const[o,a,l]=s;if(o!==null){const{count:c,getItemKey:u}=this.options;let d=0;for(;d<c&&u(d)!==o;)d++;const p=d<c?this.getMeasurements()[d]:void 0;if(p){const g=p.start+a-this.getScrollOffset();sa(g,0)||this.applyScrollAdjustment(g)}}l&&this.scrollToEnd({behavior:l})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;const s=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=s,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const s=new Map,o=new Map;for(let a=r-1;a>=0;a--){const l=n[a];if(s.has(l.lane))continue;const c=o.get(l.lane);if(c==null||l.end>c.end?o.set(l.lane,l):l.end<c.end&&s.set(l.lane,!0),s.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((a,l)=>a.end===l.end?a.index-l.index:a.end-l.end)[0]:void 0},this.getMeasurementOptions=Yt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,r,s,o,a,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:a,lanes:l,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=Yt(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:a,lanes:l,laneAssignmentMode:c},u)=>{const d=this.itemSizeCache;if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const x of this.laneAssignments.keys())x>=n&&this.laneAssignments.delete(x);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(x=>{this.itemSizeCache.set(x.key,x.size)}));const p=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),l===1){const x=this.options.gap,f=n*2;let m=this._flatMeasurements;if(!m||m.length<f){const k=new Float64Array(f);m&&p>0&&k.set(m.subarray(0,p*2)),m=k,this._flatMeasurements=m}let y;if(p===0)y=r+s;else{const k=p-1;y=m[k*2]+m[k*2+1]+x}for(let k=p;k<n;k++){const C=o(k),S=d.get(C),O=typeof S=="number"?S:this.options.estimateSize(k);m[k*2]=y,m[k*2+1]=O,y+=O+x}const w=c_(n,m,o);return this.measurementsCache=w,w}const g=this.measurementsCache.slice(0,p),h=new Array(l).fill(void 0);for(let x=0;x<p;x++){const f=g[x];f&&(h[f.lane]=x)}for(let x=p;x<n;x++){const f=o(x),m=this.laneAssignments.get(x);let y,w;const k=c==="estimate"||d.has(f);if(m!==void 0&&this.options.lanes>1){y=m;const N=h[y],T=N!==void 0?g[N]:void 0;w=T?T.end+this.options.gap:r+s}else{const N=this.options.lanes===1?g[x-1]:this.getFurthestMeasurement(g,x);w=N?N.end+this.options.gap:r+s,y=N?N.lane:x%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(x,y)}const C=d.get(f),S=typeof C=="number"?C:this.options.estimateSize(x),O=w+S;g[x]={index:x,start:w,size:S,end:O,key:f,lane:y},h[y]=x}return this.measurementsCache=g,g},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Yt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,o)=>this.range=n.length>0&&r>0?w_({measurements:n,outerSize:r,scrollOffset:s,lanes:o,flat:o===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Yt(()=>{let n=null,r=null;const s=this.calculateRange();return s&&(n=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,s,o,a)=>o===null||a===null?[]:n({startIndex:o,endIndex:a,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,s=n.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const s=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(s!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,s-o),l=Math.min(this.options.count-1,s+o);return n>=a&&n<=l}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((a,l)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(l))});return}const r=this.indexFromElement(n),s=this.options.getItemKey(r),o=this.elementsCache.get(s);o!==n&&(o&&this.observer.unobserve(o),this.observer.observe(n),this.elementsCache.set(s,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var s,o;if(n<0||n>=this.options.count)return;let a,l,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),l=u[n*2],a=u[n*2+1];else{const g=this.measurementsCache[n];if(!g)return;c=g.key,l=g.start,a=g.size}const d=this.itemSizeCache.get(c)??a,p=r-d;if(p!==0){const g=this.options.anchorTo==="end"&&((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,h=g?this.getTotalSize():0,x=((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:c,start:l,size:a,end:l+a,lane:0},p,this):l<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(c,r),this.itemSizeCacheVersion++,g?this.applyScrollAdjustment(this.getTotalSize()-h):x&&this.applyScrollAdjustment(p),this.notify(!1)}},this.getVirtualItems=Yt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let o=0,a=n.length;o<a;o++){const l=n[o],c=r[l];s.push(c)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const s=this._flatMeasurements,o=this.options.lanes===1&&s!=null,a=Qu(0,r.length-1,o?l=>s[l*2]:l=>ra(r[l]).start,n);return ra(r[a])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,s=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+o?"end":"start"),r==="center"?n+=(s-o)/2:r==="end"&&(n-=o);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.getSize(),o=this.getScrollOffset(),a=this.measurementsCache[n];if(!a)return;if(r==="auto")if(a.end>=o+s-this.options.scrollPaddingEnd)r="end";else if(a.start<=o+this.options.scrollPaddingStart)r="start";else return[o,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const l=r==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,r,a.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:s="auto"}={})=>{const o=this.getOffsetForAlignment(n,r),a=this.now();this.scrollState={index:null,align:r,behavior:s,startedAt:a,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:s="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.getOffsetForIndex(n,r);if(!o)return;const[a,l]=o,c=this.now();this.scrollState={index:n,align:l,behavior:s,startedAt:c,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const s=this.getScrollOffset()+n,o=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:o,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1){const o=r.length-1,a=this._flatMeasurements;a!=null?s=a[o*2]+a[o*2+1]:s=((n=r[o])==null?void 0:n.end)??0}else{const o=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&o.some(l=>l===null);){const l=r[a];o[l.lane]===null&&(o[l.lane]=l.end),a--}s=Math.max(...o.filter(l=>l!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const s of r)s&&this.itemSizeCache.has(s.key)&&n.push({index:s.index,key:s.key,start:s.start,size:s.size,end:s.end,lane:s.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:s})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:s,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){t!==0&&(oa()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=r?r[0]:this.scrollState.lastTargetOffset,o=1,a=s!==this.scrollState.lastTargetOffset;if(!a&&sa(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.getScrollOffset()!==s&&this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,a){const l=this.getSize()||600,c=Math.abs(s-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&c>l;this.scrollState.lastTargetOffset=s,u||(this.scrollState.behavior="auto"),this._scrollToOffset(s,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Qu=(e,t,n,r)=>{for(;e<=t;){const s=(e+t)/2|0,o=n(s);if(o<r)e=s+1;else if(o>r)t=s-1;else return s}return e>0?e-1:0};function w_({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:s}){const o=e.length-1,a=s?d=>s[d*2]:d=>e[d].start,l=s?d=>s[d*2]+s[d*2+1]:d=>e[d].end;if(e.length<=r)return{startIndex:0,endIndex:o};let c=Qu(0,o,a,n),u=c;if(r===1)for(;u<o&&l(u)<n+t;)u++;else if(r>1){const d=Array(r).fill(0);for(;u<o&&d.some(g=>g<n+t);){const g=e[u];d[g.lane]=g.end,u++}const p=Array(r).fill(n+t);for(;c>=0&&p.some(g=>g>=n);){const g=e[c];p[g.lane]=g.start,c--}c=Math.max(0,c-c%r),u=Math.min(o,u+(r-1-u%r))}return{startIndex:c,endIndex:u}}const aa=typeof document<"u"?v.useLayoutEffect:v.useEffect;function __({useFlushSync:e=!0,...t}){const n=v.useReducer(o=>o+1,0)[1],r={...t,onChange:(o,a)=>{var l;e&&a?Un.flushSync(n):n(),(l=t.onChange)==null||l.call(t,o,a)}},[s]=v.useState(()=>new b_(r));return s.setOptions(r),aa(()=>s._didMount(),[]),aa(()=>s._willUpdate()),s}function k_(e){return __({observeElementRect:h_,observeElementOffset:g_,scrollToFn:y_,...e})}const C_=22,ws=1e4;function S_(e){return e==="added"?"+":e==="removed"?"-":" "}function j_(e){return e==="added"?"bg-green-500/10 text-green-700 dark:text-green-300":e==="removed"?"bg-red-500/10 text-red-700 dark:text-red-300":"text-foreground/80"}const N_=function({result:t,emptyLabel:n}){const[r,s]=v.useState("unified"),o=v.useRef(null),a=k_({count:t.lines.length,getScrollElement:()=>o.current,estimateSize:()=>C_,overscan:10});if(t.isEmpty)return i.jsx("div",{className:"rounded border border-dashed border-border bg-muted/30 px-4 py-6 text-center text-xs text-muted-foreground","data-testid":"diff-empty",children:n??"No transformation applied — raw and processed are identical."});const l=t.lines.length,c=l>ws,u=c?t.lines.slice(0,ws):t.lines;return i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[i.jsxs("span",{children:[l.toLocaleString()," line",l===1?"":"s",c&&` (showing first ${ws.toLocaleString()})`]}),i.jsxs("div",{className:"inline-flex rounded-md border border-border overflow-hidden",children:[i.jsxs("button",{type:"button",onClick:()=>s("unified"),"aria-pressed":r==="unified",className:xe("flex items-center gap-1 px-2 py-1 transition-colors",r==="unified"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Unified diff (single column)",children:[i.jsx(nx,{className:"size-3"}),"Unified"]}),i.jsxs("button",{type:"button",onClick:()=>s("split"),"aria-pressed":r==="split",className:xe("flex items-center gap-1 px-2 py-1 transition-colors border-l border-border",r==="split"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Split diff (side by side)",children:[i.jsx(y0,{className:"size-3"}),"Split"]})]})]}),i.jsx("div",{ref:o,className:"max-h-[60vh] overflow-auto rounded border border-border bg-background font-mono text-xs","data-testid":"diff-viewport",children:r==="unified"?i.jsx(E_,{virtualizer:a,lines:u}):i.jsx(z_,{lines:u})})]})};function E_({virtualizer:e,lines:t}){return i.jsx("div",{style:{height:`${e.getTotalSize()}px`,width:"100%",position:"relative"},children:e.getVirtualItems().map(n=>{const r=t[n.index];return r===void 0?null:i.jsxs("div",{"data-index":n.index,ref:e.measureElement,className:xe("flex items-start gap-3 px-2",j_(r.kind)),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${n.start}px)`},children:[i.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.oldLineNumber??""}),i.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.newLineNumber??""}),i.jsx("span",{className:xe("select-none w-3 text-right font-bold",r.kind==="added"&&"text-green-600 dark:text-green-400",r.kind==="removed"&&"text-red-600 dark:text-red-400"),children:S_(r.kind)}),i.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:r.text})]},n.key)})})}function T_(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r===void 0)break;if(r.kind==="context"){t.push({left:{text:r.text,lineNumber:r.oldLineNumber},right:{text:r.text,lineNumber:r.newLineNumber},kind:"equal"}),n+=1;continue}const s=[],o=[];for(;n<e.length&&e[n]?.kind==="removed";){const l=e[n];l!==void 0&&s.push(l),n+=1}for(;n<e.length&&e[n]?.kind==="added";){const l=e[n];l!==void 0&&o.push(l),n+=1}const a=Math.max(s.length,o.length);for(let l=0;l<a;l+=1){const c=s[l],u=o[l];c!==void 0&&u!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:{text:u.text,lineNumber:u.newLineNumber},kind:"changed"}):c!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:null,kind:"removed"}):u!==void 0&&t.push({left:null,right:{text:u.text,lineNumber:u.newLineNumber},kind:"added"})}}return t}function A_(e){switch(e){case"changed":return"bg-amber-500/10";case"removed":return"bg-red-500/10";case"added":return"bg-green-500/10";case"equal":return""}}function z_({lines:e}){const t=T_(e);return i.jsx("div",{"data-testid":"diff-split",children:t.map((n,r)=>i.jsxs("div",{className:xe("grid grid-cols-2 font-mono text-xs",A_(n.kind)),children:[i.jsxs("div",{className:"flex items-start gap-2 px-2 border-r border-border/50",children:[i.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.left?.lineNumber??""}),i.jsx("span",{className:xe("select-none w-3 text-right font-bold",(n.kind==="removed"||n.kind==="changed")&&"text-red-600 dark:text-red-400"),children:n.left!==null?"-":" "}),i.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.left?.text??""})]}),i.jsxs("div",{className:"flex items-start gap-2 px-2",children:[i.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.right?.lineNumber??""}),i.jsx("span",{className:xe("select-none w-3 text-right font-bold",(n.kind==="added"||n.kind==="changed")&&"text-green-600 dark:text-green-400"),children:n.right!==null?"+":" "}),i.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.right?.text??""})]})]},r))})}const ed=v.memo(N_),O_={success:"bg-emerald-500/15 text-emerald-400 border-emerald-500/25",client_error:"bg-amber-500/15 text-amber-400 border-amber-500/25",server_error:"bg-rose-500/15 text-rose-400 border-rose-500/25",pending:"bg-muted text-muted-foreground border-border"};function _s(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function la({trend:e}){if(e===null)return null;const t=e.direction==="up",n=t?Yg:qg,r=t?"+":"-";return i.jsxs("span",{className:"flex items-center gap-0.5 text-muted-foreground tabular-nums",children:[i.jsx(n,{className:t?"size-3 text-emerald-400":"size-3 text-rose-400"}),i.jsxs("span",{className:"font-mono",children:[r,$e(e.delta)]})]})}const I_=v.memo(function({log:e,messageCount:t=null,toolCount:n=null,expanded:r,onToggle:s,cacheTrend:o=null,activeTab:a,tabActions:l,onReplay:c,slowResponseThresholdSeconds:u=0,timeDisplayFormat:d}){const p=C1(e.responseStatus),g=e.elapsedMs!==null&&u>0&&e.elapsedMs>u*1e3,h=e.inputTokens!==null||e.outputTokens!==null;return i.jsx(Ze,{children:i.jsxs("div",{id:`log-${e.id}`,role:"button",tabIndex:0,"data-nav-id":`log-${e.id}`,"data-nav-action":r?"collapse":"expand",className:xe("flex items-center gap-2 px-3 py-1 cursor-pointer transition-colors","hover:bg-muted/50","select-none","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:s,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),s())},children:[i.jsxs("span",{className:"text-blue-400/80 font-mono text-xs font-semibold tabular-nums shrink-0",children:["#",e.id]}),i.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[i.jsx(St,{className:"size-3"}),i.jsx("span",{className:"font-mono tabular-nums",title:e.timestamp,children:Ps(e.timestamp,d)})]}),e.model!==null&&i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx("span",{className:"shrink-0",children:i.jsx(qu,{provider:Hu(e.model),className:"size-4"})})}),i.jsx(Ie,{children:e.model})]}),p!=="success"&&i.jsxs($n,{variant:"outline",className:xe("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums gap-1",O_[p]),children:[p==="server_error"?i.jsx(H0,{className:"size-3","aria-label":"Server error"}):p==="client_error"?i.jsx(_r,{className:"size-3","aria-label":"Client error"}):p==="pending"?i.jsx(Mn,{className:"size-3 animate-spin","aria-label":"Pending"}):null,e.responseStatus]}),e.elapsedMs!==null&&i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsxs("span",{className:xe("flex items-center gap-1 text-xs shrink-0",g?"text-amber-400":"text-muted-foreground"),children:[i.jsx(St,{className:"size-3"}),i.jsx("span",{className:"font-mono tabular-nums",children:_s(e.elapsedMs)}),g&&i.jsx(_r,{className:"size-3","aria-label":"Slow response"})]})}),i.jsx(Ie,{children:g?`Slow response: ${_s(e.elapsedMs)} exceeds ${_s(u*1e3)}`:"Elapsed response time"})]}),h&&i.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[i.jsx(Dn,{className:"size-3 text-muted-foreground"}),i.jsxs("span",{className:"font-mono tabular-nums",children:[i.jsxs("span",{className:e.inputTokens!==null?"text-blue-400":"text-muted-foreground",children:["IN ",e.inputTokens!==null?$e(e.inputTokens):"—"]})," / ",i.jsxs("span",{className:e.outputTokens!==null?"text-amber-400":"text-muted-foreground",children:["OUT ",e.outputTokens!==null?$e(e.outputTokens):"—"]})]})]}),e.cacheCreationInputTokens!==null&&e.cacheCreationInputTokens>0&&i.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[i.jsx(la,{trend:o?.creation??null}),i.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["KV Cache +",$e(e.cacheCreationInputTokens)]})]}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&i.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[i.jsx(la,{trend:o?.read??null}),i.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["KV Cache ~",$e(e.cacheReadInputTokens)]})]}),t!==null&&i.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[i.jsx($r,{className:"size-3"}),i.jsx("span",{className:"font-mono tabular-nums",children:t})]}),n!==null&&i.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[i.jsx(Br,{className:"size-3"}),i.jsx("span",{className:"font-mono tabular-nums",children:n})]}),e.origin!==null&&i.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:`Origin: ${e.origin}`,children:[i.jsx(M0,{className:"size-3"}),i.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",title:e.origin,children:e.origin})]}),(e.clientPid!==null||e.clientProjectFolder!==null)&&i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-purple-400/80 text-xs shrink-0",children:[i.jsx(A0,{className:"size-3"}),e.clientProjectFolder!==null?i.jsx("span",{className:"font-mono tabular-nums",children:e.clientProjectFolder}):i.jsxs("span",{className:"font-mono tabular-nums",children:["PID ",e.clientPid]})]})}),i.jsx(Ie,{children:e.clientCwd!==null?`PID: ${e.clientPid??"?"} CWD: ${e.clientCwd}`:`Process ID: ${e.clientPid??"?"}`})]}),e.streaming&&i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx(G0,{className:"size-3 text-muted-foreground/60 shrink-0"})}),i.jsx(Ie,{children:"Request used SSE streaming"})]}),i.jsx("span",{className:"flex-1 min-w-0"}),r&&i.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",onClick:x=>x.stopPropagation(),onKeyDown:x=>x.stopPropagation(),children:[l!==void 0&&a!==void 0&&(()=>{const x=l[a];return x===void 0?null:i.jsxs(i.Fragment,{children:[x.expansion!==null&&i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx(je,{variant:"outline",size:"icon",className:"size-8",onClick:x.expansion.onToggle,disabled:x.expansion.isPending,"aria-pressed":x.expansion.isExpanded,"aria-label":x.expansion.isExpanded?"Collapse all JSON":"Expand all JSON",children:x.expansion.isExpanded?i.jsx(a0,{className:"size-3.5"}):i.jsx(o0,{className:"size-3.5"})})}),i.jsx(Ie,{children:x.expansion.isExpanded?"Collapse all JSON nodes":"Expand all JSON nodes"})]}),x.diffWithRaw!==void 0&&i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx(je,{variant:"outline",size:"icon",className:xe("size-8",x.diffWithRaw.active&&"bg-accent text-accent-foreground"),onClick:x.diffWithRaw.onToggle,"aria-pressed":x.diffWithRaw.active,"aria-label":x.diffWithRaw.active?"Hide raw diff":"Diff with raw",children:i.jsx(j0,{className:"size-3.5"})})}),i.jsx(Ie,{children:x.diffWithRaw.active?"Hide diff with raw request":"Show diff between displayed and raw request body"})]}),x.diffWithPrevious!==void 0&&i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx(je,{variant:"outline",size:"icon",className:"size-8",onClick:x.diffWithPrevious,"aria-label":"Diff with previous",children:i.jsx(L0,{className:"size-3.5"})})}),i.jsx(Ie,{children:"Compare this request with the immediately preceding one"})]}),x.copyText!==null&&i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx(je,{variant:"outline",size:"icon",className:"size-8",onClick:x.onCopy,"aria-label":x.copyCopied?"Copied":x.copyLabel,children:x.copyCopied?i.jsx(tt,{className:"size-3.5 text-emerald-500"}):i.jsx(Zt,{className:"size-3.5"})})}),i.jsx(Ie,{children:x.copyCopied?"Copied to clipboard":x.copyLabel})]})]})})(),c!==void 0&&i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx(je,{variant:"outline",size:"icon",className:"size-8",onClick:c,"aria-label":"Replay request",children:i.jsx(Q0,{className:"size-3.5"})})}),i.jsx(Ie,{children:"Re-send this request to the provider"})]})]}),r?i.jsx(gn,{className:"size-4 text-muted-foreground shrink-0"}):i.jsx(Wn,{className:"size-4 text-muted-foreground shrink-0"})]})})}),R_="/v1/chat/completions",P_="/chat/completions",M_="/v1/messages";class D_{handlers=new Map;pathMap=new Map;register(t){this.handlers.set(t.format,t)}registerPath(t,n){this.pathMap.set(t,n)}get(t){return this.handlers.get(t)}getByPath(t){const n=t.split("?")[0]??"",r=this.pathMap.get(n);return r===void 0?void 0:this.handlers.get(r)}detectFormat(t){if(t===null)return"unknown";for(const n of this.handlers.values())if(n.detectFormat(t))return n.format;return"unknown"}}const _n=new D_;function L_(e){return _n.getByPath(e)??null}function F_(e){return L_(e)?.format??"unknown"}_n.registerPath(M_,"anthropic");_n.registerPath(R_,"openai");_n.registerPath(P_,"openai");function $_(e){if(e==="")return{};try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?{...t}:{}}catch{return{}}}function B_(e){switch(e.type){case"text":return{type:"text",text:e.text};case"thinking":{const t={type:"thinking",thinking:e.thinking};return e.signature!==""&&(t.signature=e.signature),t}case"think":{const t={type:"think",thinking:e.thinking};return e.signature!==""&&(t.signature=e.signature),t}case"tool_use":return{type:"tool_use",id:e.id,name:e.name,input:$_(e.inputJson)}}}function td(e,t,n,r){const s=new Map;let o="",a="",l=null,c=null,u=0,d=0;const p=1e3;let g=0,h=0;const x=[];for(const m of e.split(`
94
+ `)){const y=m.trim();if(y.startsWith("data: "))try{const w=JSON.parse(y.slice(6)),k=zg.safeParse(w);if(!k.success)continue;const C=k.data;switch(g===0&&(h=Date.now()),r===!0&&x.length<p&&x.push({index:g,timestamp:Date.now()-h,type:C.type,data:C}),g++,C.type){case"message_start":o=C.message.id,a=C.message.model,u=C.message.usage.input_tokens,t.inputTokens=u,t.cacheCreationInputTokens=C.message.usage.cache_creation_input_tokens??null,t.cacheReadInputTokens=C.message.usage.cache_read_input_tokens??null,t.model===null&&(t.model=a);break;case"content_block_start":{const S=C.content_block;switch(S.type){case"text":s.set(C.index,{type:"text",text:S.text??""});break;case"thinking":s.set(C.index,{type:"thinking",thinking:S.thinking??"",signature:S.signature??""});break;case"think":s.set(C.index,{type:"think",thinking:S.thinking??"",signature:S.signature??""});break;case"tool_use":s.set(C.index,{type:"tool_use",id:S.id,name:S.name,inputJson:""});break}break}case"content_block_delta":{const S=s.get(C.index);if(S===void 0)break;const O=C.delta;O.type==="text_delta"&&S.type==="text"?S.text+=O.text:O.type==="thinking_delta"&&(S.type==="thinking"||S.type==="think")?S.thinking+=O.thinking:O.type==="signature_delta"&&(S.type==="thinking"||S.type==="think")?S.signature+=O.signature:O.type==="input_json_delta"&&S.type==="tool_use"&&(S.inputJson+=O.partial_json);break}case"message_delta":l=C.delta.stop_reason,c=C.delta.stop_sequence??null,d=C.usage.output_tokens,t.outputTokens=d,C.usage.cache_creation_input_tokens!==void 0&&(t.cacheCreationInputTokens=C.usage.cache_creation_input_tokens),C.usage.cache_read_input_tokens!==void 0&&(t.cacheReadInputTokens=C.usage.cache_read_input_tokens);break;case"error":t.error=C.error.message;break;case"content_block_stop":case"message_stop":case"ping":break}}catch{}}r===!0&&(t.streamingChunks={chunks:x,truncated:g>p});const f=[...s.entries()].sort(([m],[y])=>m-y).map(([,m])=>B_(m));return JSON.stringify({id:o,type:"message",model:a!==""?a:n??"",role:"assistant",content:f,stop_reason:l,stop_sequence:c,usage:{input_tokens:u,output_tokens:d}})}const U_={format:"anthropic",parseRequest(e,t){try{const n=JSON.parse(e),r=ul.safeParse(n);return r.success?{model:r.data.model,sessionId:r.data.metadata?.user_id??t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){try{const t=JSON.parse(e),n=dl.safeParse(t);if(n.success)return{inputTokens:n.data.usage.input_tokens??null,outputTokens:n.data.usage.output_tokens??null,cacheCreationInputTokens:n.data.usage.cache_creation_input_tokens??null,cacheReadInputTokens:n.data.usage.cache_read_input_tokens??null}}catch{}return{inputTokens:null,outputTokens:null,cacheCreationInputTokens:null,cacheReadInputTokens:null}},extractStream(e,t,n,r){return td(e,t,n,r)},detectFormat(e){if(e===null)return!1;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=Object.keys(t);return n.includes("model")&&n.includes("messages")&&n.includes("system")}return!1}catch{return!1}}};_n.register(U_);class Z_{providers=[];register(t){this.providers.push(t)}findProvider(t){let n=null;for(const r of this.providers)if(r.matches(t)){if(r.name!=="anthropic")return r;n=r}return n}getAll(){return[...this.providers]}}const Bo=new Z_,W_="https://api.anthropic.com",V_={MiniMax:"https://api.minimaxi.com/anthropic"},H_={name:"anthropic",matches(e){const t=e.toLowerCase();if(t.startsWith("openai-"))return!1;if(t.includes("claude")||t.includes("anthropic"))return!0;for(const n of Object.keys(V_))if(t.startsWith(n.toLowerCase()))return!0;return!0},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:W_},extractStream(e,t,n,r){return td(e,t,n,r)}};Bo.register(H_);function Uo(e,t,n,r=!0){let s="",o="",a="",l="",c=null,u=0,d=0,p=!1,g=!1;const h=new Map,x=1e3;let f=0,m=0;const y=[];for(const k of e.split(`
95
+ `)){const C=k.trim();if(!C.startsWith("data: "))continue;const S=C.slice(6);if(S==="[DONE]")break;try{const O=JSON.parse(S);if(typeof O=="object"&&O!==null&&!Array.isArray(O)){const z=Object.getOwnPropertyDescriptor(O,"error");if(z!==void 0&&typeof z.value=="object"&&z.value!==null){const I=Object.getOwnPropertyDescriptor(z.value,"message");I!==void 0&&typeof I.value=="string"&&(t.error=I.value);continue}}const N=Dg.safeParse(O);if(!N.success)continue;const T=N.data;if(f===0&&(m=Date.now()),r===!0&&y.length<x&&y.push({index:f,timestamp:Date.now()-m,type:"chat.completion.chunk",data:T}),f++,g||(s=T.id,o=T.model,g=!0),!p&&T.usage!==void 0&&T.usage!==null){if(u=T.usage.prompt_tokens??0,d=T.usage.completion_tokens??0,t.inputTokens=u,typeof O=="object"&&O!==null&&!Array.isArray(O)){const z=Object.getOwnPropertyDescriptor(O,"usage");if(z!==void 0&&typeof z.value=="object"&&z.value!==null){const I=Object.getOwnPropertyDescriptor(z.value,"prompt_tokens_details");if(I!==void 0&&typeof I.value=="object"&&I.value!==null){const K=Object.getOwnPropertyDescriptor(I.value,"cached_tokens");K!==void 0&&typeof K.value=="number"&&(t.cacheReadInputTokens=K.value)}}}p=!0}for(const z of T.choices){const I=z.delta;I.content!==void 0&&I.content!==null&&(a+=I.content),I.reasoning_content!==void 0&&I.reasoning_content!==null&&(l+=I.reasoning_content),I.thinking!==void 0&&I.thinking!==null&&(l+=I.thinking);const K=I.think;if(K!=null&&(l+=K),z.finish_reason!==void 0&&z.finish_reason!==null&&(c=z.finish_reason),I.tool_calls!==void 0&&I.tool_calls!==null)for(const j of I.tool_calls){let R=h.get(j.index);R===void 0&&(R={index:j.index,type:"function",function:{name:"",arguments:""}},h.set(j.index,R)),j.id!==void 0&&(R.id=j.id),j.function?.name!==void 0&&(R.function.name+=j.function.name),j.function?.arguments!==void 0&&(R.function.arguments+=j.function.arguments)}}}catch{}}r===!0&&(t.streamingChunks={chunks:y,truncated:f>x}),p||(d=Math.ceil(a.length/4)),t.outputTokens=d;const w={role:"assistant",content:a};return l&&(w.reasoning_content=l),h.size>0&&(w.tool_calls=[...h.values()]),JSON.stringify({id:s,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:o!==""?o:n??"",choices:[{index:0,message:w,finish_reason:c}],usage:{prompt_tokens:u,completion_tokens:d,total_tokens:u+d}})}const q_={format:"openai",parseRequest(e,t){try{const n=JSON.parse(e),r=pl.safeParse(n);return r.success?{model:r.data.model,sessionId:t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){const t=gl(e);if(t){let n=null;try{const r=JSON.parse(e);if(r!==null&&typeof r=="object"&&!Array.isArray(r)){const s=Object.getOwnPropertyDescriptor(r,"usage");if(s!==void 0&&typeof s.value=="object"&&s.value!==null){const o=Object.getOwnPropertyDescriptor(s.value,"prompt_tokens_details");if(o!==void 0&&typeof o.value=="object"&&o.value!==null){const a=Object.getOwnPropertyDescriptor(o.value,"cached_tokens");a!==void 0&&typeof a.value=="number"&&(n=a.value)}}}}catch{}return{inputTokens:t.usage.prompt_tokens??null,outputTokens:t.usage.completion_tokens??null,cacheCreationInputTokens:null,cacheReadInputTokens:n}}return{inputTokens:null,outputTokens:null,cacheCreationInputTokens:null,cacheReadInputTokens:null}},extractStream(e,t,n,r){return Uo(e,t,n,r)},detectFormat(e){if(e===null)return!1;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=Object.keys(t);return n.includes("model")&&n.includes("messages")&&!n.includes("system")}return!1}catch{return!1}}};_n.register(q_);const K_="https://api.openai.com/v1",J_={name:"openai",matches(e){const t=e.toLowerCase();return!!(t.startsWith("openai-")||t.includes("gpt-")||t.includes("o1")||t.includes("o2")||t.includes("o3"))},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:K_},extractStream(e,t,n,r){return Uo(e,t,n,r)}};Bo.register(J_);const G_="https://dashscope.aliyuncs.com/compatible-mode/v1",Y_={name:"alibaba",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return!!(t.startsWith("glm-5")||t.startsWith("qwen"))},getUpstreamBase(e,t){return G_},extractStream(e,t,n){return Uo(e,t,n)}};Bo.register(Y_);function nd(e,t){for(const n of Array.from(e))t(n)}const X_=/[\u3000-\u9FFF\uAC00-\uD7FF\uF900-\uFAFF\uFF00-\uFFEF\u{1F300}-\u{1FAFF}]/u;function rd(e){if(e.length===0)return 0;let t=0,n=0;return nd(e,r=>{X_.test(r)?t+=1:n+=1}),Math.ceil(t*1)+Math.ceil(n/4)}function sd(e){if(e.length===0)return 0;let t=0;return nd(e,()=>{t+=1}),t}function Pt(e){return{parsed:null,comparisonValue:e,messageCount:null,toolCount:null}}const an={parsed:null,toolNames:null};function Q_(e){if(typeof e=="string")return e;if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const r=n;switch(r.type){case"text":typeof r.text=="string"&&t.push(r.text);break;case"thinking":case"think":typeof r.thinking=="string"&&t.push(r.thinking);break;case"tool_use":{const o=typeof r.name=="string"?r.name:"",a=r.input!==void 0?JSON.stringify(r.input):"";t.push(`${o} ${a}`.trim());break}case"tool_result":{const o=r.content;if(typeof o=="string")t.push(o);else if(Array.isArray(o)){for(const a of o)if(a!==null&&typeof a=="object"){const l=a.text;typeof l=="string"&&t.push(l)}}break}case"image":t.push("[image]");break}}return t.join(`
96
+ `)}function ek(e){if(typeof e=="string")return e;if(!Array.isArray(e))return"";const t=[];for(const n of e)if(n!==null&&typeof n=="object"){const r=n.text;n.type==="text"&&typeof r=="string"&&t.push(r)}return t.join(`
97
+ `)}function tk(e){if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const r=n;typeof r.name=="string"&&t.push(r.name),typeof r.description=="string"&&t.push(r.description),r.input_schema!==void 0&&t.push(JSON.stringify(r.input_schema))}return t.join(`
98
+ `)}function ks(e,t,n,r){return{role:e,label:t,text:n,size:rd(n),characters:sd(n),path:r}}const nk={format:"anthropic",analyzeRequest(e){if(e===null)return Pt(e);try{const t=ul.safeParse(JSON.parse(e));return t.success?{parsed:t.data,comparisonValue:t.data,messageCount:t.data.messages.length,toolCount:t.data.tools!==void 0&&t.data.tools.length>0?t.data.tools.length:null}:Pt(e)}catch{return Pt(e)}},analyzeResponse(e){if(e===null)return an;try{let t=JSON.parse(e);typeof t=="string"&&(t=JSON.parse(t));const n=dl.safeParse(t);if(!n.success)return an;const r=n.data.content.filter(s=>s.type==="tool_use").map(s=>s.name);return{parsed:n.data,toolNames:r.length>0?r:null}}catch{return an}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(t.system!==void 0){const r=ek(t.system);r.length>0&&n.push(ks("system","system",r,"/system"))}if(Array.isArray(t.messages)&&t.messages.forEach((r,s)=>{if(r===null||typeof r!="object")return;const o=r,a=o.role==="user"||o.role==="assistant"?o.role:"user",l=Q_(o.content);n.push(ks(a,`[${s}] ${a}`,l,`/messages/${s}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=tk(t.tools);n.push(ks("tools","tools",r,"/tools"))}return n.length>0?n:null}};function rk(e){if(typeof e=="string")return e;if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const r=n,s=r.type;s==="text"&&typeof r.text=="string"?t.push(r.text):s==="image_url"&&t.push("[image]")}return t.join(`
99
+ `)}function sk(e){const t=[],n=rk(e.content);n.length>0&&t.push(n);const r=typeof e.reasoning_content=="string"?e.reasoning_content:typeof e.thinking=="string"?e.thinking:typeof e.think=="string"?e.think:"";r.length>0&&t.push(r);const s=e.tool_calls;if(Array.isArray(s))for(const o of s){if(o===null||typeof o!="object")continue;const a=o.function;if(a===void 0)continue;const l=typeof a.name=="string"?a.name:"",c=typeof a.arguments=="string"?a.arguments:"";t.push(`${l} ${c}`.trim())}return t.join(`
100
+ `)}function ok(e){if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const s=n.function;s!==void 0&&(typeof s.name=="string"&&t.push(s.name),typeof s.description=="string"&&t.push(s.description),s.parameters!==void 0&&t.push(JSON.stringify(s.parameters)))}return t.join(`
101
+ `)}function ca(e,t,n,r){return{role:e,label:t,text:n,size:rd(n),characters:sd(n),path:r}}const ik={format:"openai",analyzeRequest(e){if(e===null)return Pt(e);try{const t=pl.safeParse(JSON.parse(e));return t.success?{parsed:t.data,comparisonValue:t.data,messageCount:t.data.messages.length,toolCount:t.data.tools!==void 0&&t.data.tools.length>0?t.data.tools.length:null}:Pt(e)}catch{return Pt(e)}},analyzeResponse(e){if(e===null)return an;const t=gl(e);if(t===null)return an;const n=t.choices[0]?.message?.tool_calls?.map(r=>r.function?.name??"").filter(r=>r!=="")??[];return{parsed:t,toolNames:n.length>0?n:null}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(Array.isArray(t.messages)&&t.messages.forEach((r,s)=>{if(r===null||typeof r!="object")return;const o=r,a=o.role==="user"||o.role==="assistant"||o.role==="system"||o.role==="tool"?o.role:"user",l=sk(o);n.push(ca(a,`[${s}] ${a}`,l,`/messages/${s}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=ok(t.tools);n.push(ca("tools","tools",r,"/tools"))}return n.length>0?n:null}},ak={format:"unknown",analyzeRequest(e){return Pt(e)},analyzeResponse(){return an},anatomySegments(){return null}},lk={anthropic:nk,openai:ik,unknown:ak};function ck(e){return lk[e]}function Or(e){const t=F_(e.path);return t==="unknown"?e.apiFormat:t}function ua(e,t,n){return e==="anthropic"&&t==="full"&&n}function uk(e,t){return e==="full"&&t}function dk(e,t,n,r){return e==="anthropic"&&t==="full"&&n&&r}function Xt(){return i.jsx("div",{className:"h-1","aria-hidden":"true"})}function fk({active:e,onClick:t}){return i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsxs(je,{variant:e?"default":"outline",size:"sm",className:"h-8 text-xs",onClick:t,"aria-pressed":e,children:[i.jsx(R0,{className:"size-3.5 mr-1"}),e?"Showing diff":"Diff with Raw"]})}),i.jsx(Ie,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})}const hk=v.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const r=v.useMemo(()=>l_(e,t),[e,t]);return i.jsx(ed,{result:r,emptyLabel:n})}),pk=v.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const r=v.useMemo(()=>a_(e,t),[e,t]);return i.jsx(ed,{result:r,emptyLabel:n})}),mk=v.memo(function({log:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:s,cacheTrend:o=null,onCompareWithPrevious:a}){const[l,c]=v.useState(!1),[u,d]=v.useState(!1),[p,g]=v.useState(!1),[h,x]=v.useState(!1),[f,m]=v.useState("request"),[y,w]=v.useState(null),k=v.useRef(null),C=Or(e),S=ck(C),O=v.useMemo(()=>S.analyzeRequest(e.rawRequestBody),[S,e.rawRequestBody]),T=v.useMemo(()=>!n||C!=="anthropic"||e.rawRequestBody===null?null:Zw(e.rawRequestBody).body,[e.rawRequestBody,C,n])??e.rawRequestBody,z=bs(T),I=bs(e.rawRequestBody),K=bs(e.responseText),j=v.useMemo(()=>e.headers&&Object.keys(e.headers).length>0?JSON.stringify(e.headers,null,2):null,[e.headers]),R=v.useMemo(()=>e.rawHeaders&&Object.keys(e.rawHeaders).length>0?JSON.stringify(e.rawHeaders,null,2):null,[e.rawHeaders]),_=Qt(T),F=Qt(e.rawRequestBody),Z=Qt(j),P=Qt(R),M=Qt(e.responseText),W=v.useMemo(()=>({request:{copyLabel:"Copy request body",copyText:T,copyCopied:_.copied,onCopy:_.copy,expansion:{isExpanded:z.isExpanded,isPending:z.isPending,onToggle:z.toggle},diffWithRaw:dk(C,t,n,e.rawRequestBody!==null)?{active:h,onToggle:()=>x(!h)}:void 0,diffWithPrevious:a===void 0?void 0:()=>{a(e)}},"raw-request":{copyLabel:"Copy raw request",copyText:e.rawRequestBody,copyCopied:F.copied,onCopy:F.copy,expansion:{isExpanded:I.isExpanded,isPending:I.isPending,onToggle:I.toggle}},headers:{copyLabel:"Copy headers",copyText:j,copyCopied:Z.copied,onCopy:Z.copy,expansion:null},"raw-headers":{copyLabel:"Copy raw headers",copyText:R,copyCopied:P.copied,onCopy:P.copy,expansion:null},raw:{copyLabel:"Copy response",copyText:e.responseText,copyCopied:M.copied,onCopy:M.copy,expansion:{isExpanded:K.isExpanded,isPending:K.isPending,onToggle:K.toggle}}}),[T,_,z,h,e.rawRequestBody,F,I,j,Z,R,P,e.responseText,M,K,C,t,n,a]),te=v.useMemo(()=>z.parsedData!==null?S.anatomySegments(z.parsedData):null,[S,z.parsedData]),V=v.useMemo(()=>{if(te!==null)return new Set(te.map(re=>re.path))},[te]),U=t_({containerRef:k,setExpandToPath:w,ensureTabActive:()=>{f!=="request"&&m("request")}});return i.jsxs(Ze,{children:[i.jsxs("div",{className:"border border-border rounded-lg mb-1 overflow-hidden",children:[i.jsx(I_,{log:e,messageCount:O.messageCount,toolCount:O.toolCount,expanded:l,onToggle:()=>c(!l),cacheTrend:o,slowResponseThresholdSeconds:r,timeDisplayFormat:s,activeTab:f,tabActions:W,onReplay:a===void 0?void 0:()=>{d(!0)}}),l&&i.jsx("div",{onClick:re=>re.stopPropagation(),onKeyDown:re=>re.stopPropagation(),children:i.jsxs(Ku,{value:f,onValueChange:m,children:[i.jsxs(Ju,{className:"mx-4 mt-2",children:[t==="full"&&i.jsx(it,{value:"raw-headers",children:"Raw Headers"}),t==="full"&&i.jsx(it,{value:"headers",children:"Headers"}),ua(C,t,n)&&i.jsx(it,{value:"raw-request",children:"Raw Request"}),i.jsx(it,{value:"request",children:"Request"}),te!==null&&i.jsx(it,{value:"anatomy",children:"Anatomy"}),t==="full"&&i.jsx(it,{value:"raw",children:"Raw Response"}),i.jsx(it,{value:"parsed",children:"Response"})]}),ua(C,t,n)&&i.jsx(at,{value:"raw-request",children:f==="raw-request"&&i.jsx("div",{className:"px-4 pt-1 pb-3",children:e.rawRequestBody===null?i.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):I.parsedData!==null?i.jsx(v.Suspense,{fallback:i.jsx(Xt,{}),children:i.jsx(Qi,{data:I.parsedData,bulkDepth:I.bulkDepth,bulkRevision:I.bulkRevision})}):i.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:e.rawRequestBody})})}),i.jsx(at,{value:"request",children:f==="request"&&i.jsx("div",{className:"px-4 pt-1 pb-3",children:h?i.jsx(hk,{rawBody:e.rawRequestBody,displayedBody:T,emptyLabel:"No transformation applied — raw and sent request bodies are identical."}):i.jsx("div",{ref:k,children:T===null?i.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):z.parsedData!==null?i.jsx(v.Suspense,{fallback:i.jsx(Xt,{}),children:i.jsx(Qi,{data:z.parsedData,bulkDepth:z.bulkDepth,bulkRevision:z.bulkRevision,anatomyPaths:V,expandToPath:y})}):i.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:T})})})}),te!==null&&i.jsx(at,{value:"anatomy",children:f==="anatomy"&&i.jsx(v.Suspense,{fallback:i.jsx(Xt,{}),children:i.jsx(Jw,{parsed:null,inputTokens:e.inputTokens??null,segments:te,onSegmentActivate:U})})}),t==="full"&&i.jsx(at,{value:"headers",children:f==="headers"&&i.jsxs("div",{className:"px-4 pt-1 pb-3",children:[i.jsx("div",{className:"flex justify-end gap-2 mb-2",children:uk(t,e.rawHeaders!==void 0&&Object.keys(e.rawHeaders).length>0)&&i.jsx(fk,{active:p,onClick:re=>{re.stopPropagation(),g(!p)}})}),p?i.jsx(pk,{rawHeaders:e.rawHeaders,headers:e.headers,emptyLabel:"No transformation applied — raw and processed headers are identical."}):e.headers&&Object.keys(e.headers).length>0?i.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.headers).sort(([re],[ee])=>re.localeCompare(ee)).map(([re,ee])=>i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[re,":"]}),i.jsx("span",{className:"text-muted-foreground truncate",title:ee,children:ee})]},re))}):i.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No headers captured"})]})}),t==="full"&&i.jsx(at,{value:"raw-headers",children:f==="raw-headers"&&i.jsx("div",{className:"px-4 pt-1 pb-3",children:e.rawHeaders&&Object.keys(e.rawHeaders).length>0?i.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.rawHeaders).sort(([re],[ee])=>re.localeCompare(ee)).map(([re,ee])=>i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[re,":"]}),i.jsx("span",{className:"text-muted-foreground truncate",title:ee,children:ee})]},re))}):i.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No raw headers captured"})})}),i.jsx(at,{value:"raw",children:f==="raw"&&i.jsxs("div",{className:"px-4 pt-1 pb-3 space-y-3",children:[e.error!==void 0&&e.error!==null&&i.jsxs("div",{className:"rounded border border-destructive/50 bg-destructive/10 p-3 text-xs",children:[i.jsx("div",{className:"font-semibold text-destructive mb-1",children:"SSE Error"}),i.jsx("div",{className:"text-muted-foreground font-mono",children:e.error})]}),e.responseText!==null?i.jsx(v.Suspense,{fallback:i.jsx(Xt,{}),children:i.jsx(Xw,{text:e.responseText,defaultExpandDepth:0,bulkDepth:K.bulkDepth,bulkRevision:K.bulkRevision})}):i.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No response"}),e.streaming===!0&&i.jsx(v.Suspense,{fallback:i.jsx(Xt,{}),children:i.jsx(Yw,{logId:e.id,truncated:e.streamingChunksPath!==null})})]})}),i.jsx(at,{value:"parsed",children:f==="parsed"&&i.jsx("div",{className:"px-4 pt-1 pb-3",children:i.jsx(v.Suspense,{fallback:i.jsx(Xt,{}),children:i.jsx(Gw,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:C,error:e.error})})})})]})})]}),i.jsx(v.Suspense,{fallback:null,children:i.jsx(Kw,{log:e,open:u,onOpenChange:d})})]})});function gk({stopReason:e,isPending:t,isFirst:n,isTurnStart:r,isOnlyEntry:s=!1,crabIndex:o=0,collapsible:a=!1,onToggle:l}){const c=e==="end_turn"||e==="stop",u=s&&r&&c,d=t&&!c,p=v.useMemo(()=>Ar(o),[o]),g=v.useMemo(()=>kw(o),[o]),h=a&&l?{role:"button",tabIndex:0,className:"cursor-pointer",onClick:x=>{x.stopPropagation(),l()},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),l())}}:{};return i.jsxs("div",{className:"flex flex-col items-center w-6 shrink-0 pt-0.5 pb-0.5",children:[i.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]",children:!n&&i.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),u?i.jsx("span",{title:"Start and end of turn",children:i.jsx(g,{className:xe("size-3.5 text-[#80FF00]","animate-crab-settle","drop-shadow-[0_0_4px_rgba(128,255,0,0.5)]")})}):c?i.jsx("span",{title:e==="end_turn"?"End of Turn (Anthropic)":"End of Turn (OpenAI)",...h,children:i.jsx(p,{className:xe("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})}):r?i.jsx("span",{title:"Start of turn",...h,children:i.jsx(p,{className:xe("size-3.5 text-emerald-400","animate-crab-appear","drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}):d?i.jsx("span",{title:"Processing…",children:i.jsx(p,{className:xe("size-3.5 text-amber-300/80","animate-crab-crawl")})}):i.jsx("span",{children:i.jsx(p,{className:"size-3.5 text-muted-foreground/40"})}),i.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:!c&&i.jsx("div",{className:xe("w-0.5 h-full",t?"border-dashed bg-transparent border-l-2 border-muted-foreground/20":"bg-muted-foreground/30")})})]})}function xk({event:e}){const t=Qt(e.argumentsText),n=e.argumentsText!==null;return i.jsxs("div",{className:"group/tool-trace flex min-w-0 items-center gap-2 rounded-md border border-border/70 bg-muted/20 px-2.5 py-1.5 text-xs",children:[i.jsx(Br,{className:"size-3.5 shrink-0 text-sky-400/70"}),i.jsx("span",{className:"font-mono font-semibold text-foreground/80",children:e.name}),e.argumentsPreview!==null&&i.jsxs(i.Fragment,{children:[i.jsx(Wn,{className:"size-3 shrink-0 text-muted-foreground/60"}),i.jsx("span",{className:"min-w-0 truncate font-mono text-muted-foreground",children:e.argumentsPreview})]}),n&&i.jsx("button",{type:"button",className:"ml-auto inline-flex size-6 shrink-0 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-background/80 hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/tool-trace:opacity-100 group-focus-within/tool-trace:opacity-100",onClick:t.copy,"aria-label":t.copied?"Copied tool arguments":"Copy tool arguments",title:t.copied?"Copied tool arguments":"Copy tool arguments",children:t.copied?i.jsx(tt,{className:"size-3.5"}):i.jsx(Zt,{className:"size-3.5"})})]},e.id)}function vk({events:e}){return e.length===0?null:i.jsx("div",{className:"mx-3 mb-2 grid gap-1.5",children:e.map(t=>i.jsx(xk,{event:t},t.id))})}const da=180;function yk(e,t){return e||t}function bk(e,t,n){return e>1&&t&&!n}function wk(e){const t=[];let n=[],r=0;for(const s of e){n.push({log:s,stopReason:uw(s)});const o=n[n.length-1];o!==void 0&&Zu(o.stopReason)&&(t.push({entries:n,turnIndex:r}),n=[],r+=1)}return n.length>0&&t.push({entries:n,turnIndex:r}),t}function _k(e){const t=new Map;for(const n of e)for(let r=1;r<n.logs.length;r+=1){const s=n.logs[r],o=n.logs[r-1];if(s===void 0||o===void 0)continue;const a=Or(s),l=Or(o);a==="unknown"||a!==l||t.set(s.id,o)}return t}function od(e){if(e===null)return null;try{const t=JSON.parse(e);return typeof t=="string"?JSON.parse(t):t}catch{return null}}function id(e){if(e==null)return null;const t=typeof e=="string"?e:JSON.stringify(e);if(t===void 0)return null;const n=t.replace(/\s+/g," ").trim();return n.length===0?null:n.length>da?`${n.slice(0,da-1)}...`:n}function ad(e){if(e==null)return null;if(typeof e=="string")return e.length>0?e:null;const t=JSON.stringify(e,null,2);return t===void 0||t.length===0?null:t}function kk(e){const t=od(e.responseText),n=Ye(t,"content");if(!Array.isArray(n))return[];const r=[];for(const s of n){if(Ye(s,"type")!=="tool_use")continue;const a=Ye(s,"name");if(typeof a!="string"||a.length===0)continue;const l=Ye(s,"input");r.push({id:`${String(e.id)}-anthropic-tool-${String(r.length)}`,logId:e.id,index:r.length,provider:"anthropic",name:a,argumentsText:ad(l),argumentsPreview:id(l)})}return r}function Ck(e){const t=od(e.responseText),n=Ye(t,"choices");if(!Array.isArray(n))return[];const r=[];for(const s of n){const o=Ye(s,"message"),a=Ye(o,"tool_calls");if(Array.isArray(a))for(const l of a){const c=Ye(l,"function"),u=Ye(c,"name");if(typeof u!="string"||u.length===0)continue;const d=Ye(c,"arguments");r.push({id:`${String(e.id)}-openai-tool-${String(r.length)}`,logId:e.id,index:r.length,provider:"openai",name:u,argumentsText:ad(d),argumentsPreview:id(d)})}}return r}function Zo(e){switch(Or(e)){case"anthropic":return kk(e);case"openai":return Ck(e);case"unknown":return[]}}function Sk(e,t,n=0){let r=0,s=0,o=0,a=0,l=0,c=0,u=0,d=0,p=null,g=0;for(const h of e)h.responseStatus===null?s+=1:h.responseStatus>=400&&(r+=1),h.elapsedMs!==null&&t>0&&h.elapsedMs>t*1e3&&(o+=1),h.inputTokens!==null&&(a+=h.inputTokens),h.outputTokens!==null&&(l+=h.outputTokens),h.cacheCreationInputTokens!==null&&(c+=h.cacheCreationInputTokens),h.cacheReadInputTokens!==null&&(u+=h.cacheReadInputTokens),h.elapsedMs!==null&&(d+=h.elapsedMs,p=p===null?h.elapsedMs:Math.max(p,h.elapsedMs)),g+=Zo(h).length;return{llmCallCount:e.length,toolCallCount:g,failedCallCount:r,pendingCallCount:s,slowCallCount:o,totalInputTokens:a,totalOutputTokens:l,totalCacheCreationInputTokens:c,totalCacheReadInputTokens:u,totalElapsedMs:d,maxElapsedMs:p,startedAt:e[0]?.timestamp??null,endedAt:e[e.length-1]?.timestamp??null,knowledgeCandidateCount:n}}function Cs(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const jk=v.memo(function({entries:t,viewMode:n,strip:r,slowResponseThresholdSeconds:s,cacheTrends:o,onCompareWithPrevious:a,comparisonPredecessors:l,turnIndex:c=0,timeDisplayFormat:u}){const d=t.length-1,p=t[d]?.stopReason??null,g=p!==null?Zu(p):!1,h=t[d]?.log.responseStatus===null,x=t.length===1,f=bk(t.length,g,h),[m,y]=v.useState(!1),w=v.useRef(!1);v.useEffect(()=>{f?g&&!w.current&&y(!0):y(!1),w.current=g},[f,g]);const k=v.useCallback(()=>{f&&y(Z=>!Z)},[f]),C=v.useMemo(()=>{let Z=0,P=0,M=null,W=!1;for(const te of t)te.log.inputTokens!==null&&(Z+=te.log.inputTokens,W=!0),te.log.outputTokens!==null&&(P+=te.log.outputTokens,W=!0),te.log.elapsedMs!==null&&(M=M===null?te.log.elapsedMs:Math.max(M,te.log.elapsedMs));return{totalInput:Z,totalOutput:P,hasTokens:W,maxElapsed:M}},[t,d]),S=v.useMemo(()=>{const Z=new Set;for(const P of t){const M=Hu(P.log.model);M!=="unknown"&&Z.add(M)}return[...Z]},[t]),O=v.useMemo(()=>Ar(t[0]?.log.id??0),[t]),N=v.useMemo(()=>Ar(t[d]?.log.id??0),[t,d]),T=c%2===0?"bg-muted/10":"bg-muted/25",z=C.maxElapsed!==null&&s>0&&C.maxElapsed>s*1e3,I=v.useMemo(()=>{const Z=new Map;for(const P of t){const M=Zo(P.log);M.length>0&&Z.set(P.log.id,M)}return Z},[t]),[K,j]=v.useState(0),R=v.useRef(null);v.useEffect(()=>{const Z=R.current;if(!Z)return;let P=0;const M=new ResizeObserver(()=>{window.cancelAnimationFrame(P),P=window.requestAnimationFrame(()=>j(W=>W+1))});return M.observe(Z),()=>{M.disconnect(),window.cancelAnimationFrame(P)}},[]);const _=t[0]?.log.id??c,F=`Turn ${String(c+1)}`;return i.jsx("div",{ref:R,tabIndex:m?void 0:0,role:m?void 0:"group","aria-label":m?void 0:F,"data-nav-id":m?void 0:`turn-${String(_)}`,className:xe("border rounded-lg",h?"border-amber-500/10":"border-transparent",!m&&"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),children:m?i.jsxs("div",{"data-nav-id":`turn-collapsed-${String(_)}`,"data-nav-action":"expand",role:"button",tabIndex:0,className:"flex items-stretch cursor-pointer focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none rounded-lg",onClick:k,onKeyDown:Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),k())},children:[i.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:i.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}),i.jsxs("div",{className:"w-6 shrink-0 flex flex-col items-center pt-0.5 pb-0.5",children:[i.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]"}),i.jsx("span",{role:"button",tabIndex:0,title:"Start of turn — click to expand",className:"cursor-pointer",onClick:Z=>{Z.stopPropagation(),k()},onKeyDown:Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),k())},children:i.jsx(O,{className:xe("size-3.5 text-emerald-400","animate-crab-appear drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}),i.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:i.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),i.jsx("span",{role:"button",tabIndex:0,title:"End of Turn — click to expand",className:"cursor-pointer",onClick:Z=>{Z.stopPropagation(),k()},onKeyDown:Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),k())},children:i.jsx(N,{className:xe("size-3.5 text-amber-400","animate-crab-settle drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})})]}),t.length>1&&i.jsxs("div",{className:xe("flex-1 min-w-0 mb-0.5 rounded-lg border border-border py-1 px-3 flex items-center gap-3 text-xs",T),children:[i.jsxs("span",{className:"text-blue-400/80 font-mono font-semibold tabular-nums shrink-0",children:["#",t[0]?.log.id??"?"," ~ #",t[d]?.log.id??"?"]}),i.jsxs("span",{className:"text-muted-foreground shrink-0",children:[t.length," request",t.length>1?"s":""]}),S.length>0&&i.jsx("span",{className:"flex items-center gap-0.5 shrink-0",children:S.map(Z=>i.jsx(qu,{provider:Z,className:"size-4"},Z))}),C.maxElapsed!==null&&i.jsx(Ze,{children:i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsxs("span",{className:xe("flex items-center gap-1 shrink-0",z?"text-amber-400":"text-muted-foreground"),children:[i.jsx(St,{className:"size-3"}),i.jsx("span",{className:"font-mono tabular-nums",children:Cs(C.maxElapsed)}),z&&i.jsx(_r,{className:"size-3","aria-label":"Slow response"})]})}),i.jsx(Ie,{children:z?`Slow response: ${Cs(C.maxElapsed)} exceeds ${Cs(s*1e3)}`:"Slowest request in this turn"})]})}),C.hasTokens&&i.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[i.jsx(Dn,{className:"size-3 text-muted-foreground"}),i.jsxs("span",{className:"font-mono tabular-nums",children:[i.jsxs("span",{className:"text-blue-400",children:["IN ",$e(C.totalInput)]})," / ",i.jsxs("span",{className:"text-amber-400",children:["OUT ",$e(C.totalOutput)]})]})]}),i.jsx("span",{className:"flex-1 min-w-0"}),i.jsx(Wn,{className:"size-4 text-muted-foreground shrink-0"})]})]}):t.map((Z,P)=>{const{log:M,stopReason:W}=Z,te=P===0;return i.jsxs("div",{className:"flex items-stretch",children:[te?i.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:i.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}):i.jsx("div",{className:"w-5 shrink-0"}),i.jsx(gk,{stopReason:W,isPending:M.responseStatus===null,isFirst:P===0,isTurnStart:te,isOnlyEntry:x,crabIndex:M.id%12,collapsible:f&&te,onToggle:k}),i.jsxs("div",{className:xe("flex-1 min-w-0 mb-0.5 rounded-lg",T),children:[i.jsx(mk,{log:M,viewMode:n,strip:r,slowResponseThresholdSeconds:s,timeDisplayFormat:u,cacheTrend:o?.get(M.id)??null,onCompareWithPrevious:l.has(M.id)?a:void 0}),i.jsx(vk,{events:I.get(M.id)??[]})]})]},M.id)})})}),Wo=Ue(["episode","procedure","preference","project-fact"]),Nk=Ue(["draft","promoted","failed"]),ld=ne({source:ve("agent-inspector"),sessionId:B(),logIds:_e(pe().int().positive()),project:B().nullable(),models:_e(B())}),Ek=ne({redacted:Be(),patterns:_e(B())}),Kn=ne({id:B(),type:Wo,title:B(),content:B(),tags:_e(B()),source:ve("agent-inspector"),sessionId:B(),logIds:_e(pe().int().positive()),evidence:ld,status:Nk,createdAt:B(),updatedAt:B(),openClawMemoryId:B().nullable(),error:B().nullable(),redaction:Ek});ne({idempotencyKey:B(),type:Wo,title:B(),content:B(),tags:_e(B()),source:ve("agent-inspector"),project:B().nullable(),evidence:ld});const Tk=ne({id:B(),type:Wo.or(B()),title:B(),content:B(),score:pe().nullable(),source:B().nullable(),project:B().nullable(),evidence:As().optional()});ne({results:_e(Tk),warning:B().nullable()});const Ak=ne({candidates:_e(Kn)}),zk=ne({candidate:Kn}),Ok=ne({error:B().optional(),candidate:Kn.optional()}),Ik=ne({candidate:Kn}),Rk={draft:"border-amber-500/30 bg-amber-500/10 text-amber-500",promoted:"border-emerald-500/30 bg-emerald-500/10 text-emerald-500",failed:"border-destructive/30 bg-destructive/10 text-destructive"};function Qs(e){return e===null?"-":e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`}function Pk(e,t,n){return e===null||t===null?null:go(e,t,n)}function Mk(e){return`${String(e)} candidate${e===1?"":"s"}`}function cd(e){return`log-${String(e)}`}function ud(e){const t=cd(e),n=document.getElementById(t);window.history.replaceState(null,"",`#${t}`),n instanceof HTMLElement&&(n.scrollIntoView({block:"center",behavior:"smooth"}),n.focus({preventScroll:!0}))}function Dk(e){for(const t of e)if(t.responseStatus!==null&&t.responseStatus>=400)return t;return null}function Lk(e){let t=null,n=-1;for(const r of e)r.elapsedMs!==null&&r.elapsedMs>n&&(t=r,n=r.elapsedMs);return t}function Fk(e){for(const t of e)if(Zo(t).length>0)return t;return null}function $k(e){const t=[{kind:"session",title:`${String(e.summary.llmCallCount)} LLM call${e.summary.llmCallCount===1?"":"s"}`,detail:`Scope ${e.scopeId}`,logId:e.logs[0]?.id??null}],n=Fk(e.logs);e.summary.toolCallCount>0&&n!==null&&t.push({kind:"tool",title:`${String(e.summary.toolCallCount)} tool call${e.summary.toolCallCount===1?"":"s"}`,detail:`First tool evidence at #${String(n.id)}`,logId:n.id});const r=Dk(e.logs);r!==null&&t.push({kind:"failure",title:`Failure #${String(r.responseStatus)}`,detail:`First failed request is #${String(r.id)}`,logId:r.id});const s=Lk(e.logs);if(s!==null&&e.summary.maxElapsedMs!==null&&t.push({kind:"slow",title:`Slowest ${Qs(e.summary.maxElapsedMs)}`,detail:`Max latency observed at #${String(s.id)}`,logId:s.id}),e.candidates.length>0){const o=e.candidates.filter(l=>l.status==="draft").length,a=e.candidates.filter(l=>l.status==="promoted").length;t.push({kind:"candidate",title:`${String(e.candidates.length)} memory candidate${e.candidates.length===1?"":"s"}`,detail:`${String(o)} draft / ${String(a)} promoted`,logId:e.candidates[0]?.logIds[0]??null})}return t}function Bk(e){switch(e){case"session":return i.jsx($r,{className:"size-3.5 text-blue-400"});case"tool":return i.jsx(Br,{className:"size-3.5 text-sky-400/70"});case"slow":return i.jsx(St,{className:"size-3.5 text-amber-400"});case"failure":return i.jsx(_l,{className:"size-3.5 text-destructive"});case"candidate":return i.jsx(wl,{className:"size-3.5 text-emerald-400"})}}function Uk({insights:e}){return e.length===0?null:i.jsx("div",{className:"mt-2 grid gap-1.5 border-t border-border/70 pt-2 md:grid-cols-2 xl:grid-cols-3",children:e.map(t=>i.jsxs("button",{type:"button",className:xe("flex min-w-0 items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs","text-muted-foreground transition-colors hover:bg-muted/40 hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),onClick:()=>{t.logId!==null&&ud(t.logId)},disabled:t.logId===null,children:[Bk(t.kind),i.jsxs("span",{className:"min-w-0",children:[i.jsx("span",{className:"block truncate font-medium text-foreground/90",children:t.title}),i.jsx("span",{className:"block truncate font-mono text-[10px]",children:t.detail})]})]},`${t.kind}-${t.title}`))})}function Zk(e){switch(e){case"draft":return"Draft";case"promoted":return"Promoted";case"failed":return"Failed"}}function Wk(e,t){if(t)return"Promoting";switch(e.status){case"draft":return"Promote";case"failed":return"Retry";case"promoted":return"Promoted"}}function Vk(e){return e.redaction.redacted?`Redacted ${e.redaction.patterns.join(", ")}`:"No sensitive pattern matched"}function Hk(e,t){const n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,t-3)}...`}function qk(e){const t=e[0],n=e[e.length-1];return t===void 0?"No evidence logs":n===void 0||t===n?`#${String(t)}`:`#${String(t)}-#${String(n)}`}function fa(e){return e.join(", ")}function Kk(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function Jk({candidate:e,isPromoting:t,isUpdating:n,onPromoteCandidate:r,onUpdateCandidate:s}){const[o,a]=v.useState(!1),[l,c]=v.useState(e.type),[u,d]=v.useState(e.title),[p,g]=v.useState(e.content),[h,x]=v.useState(fa(e.tags)),[f,m]=v.useState(null),y=e.status!=="promoted",w=e.status!=="promoted",k=v.useCallback(()=>{c(e.type),d(e.title),g(e.content),x(fa(e.tags)),m(null)},[e.content,e.tags,e.title,e.type]),C=v.useCallback(async()=>{const S=u.trim(),O=p.trim(),N=Kk(h);if(S.length===0){m("Title is required.");return}if(O.length===0){m("Content is required.");return}if(N.length===0){m("At least one tag is required.");return}m(null),await s(e.id,{type:l,title:S,content:O,tags:N})&&a(!1)},[e.id,p,h,u,l,s]);return o?i.jsx("div",{className:"rounded-md border border-border/80 bg-background/60 px-2.5 py-2",children:i.jsxs("div",{className:"grid gap-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsxs("select",{value:l,disabled:n,onChange:S=>{const O=Kn.shape.type.safeParse(S.currentTarget.value);O.success&&c(O.data)},className:"h-7 rounded-md border border-input bg-background px-2 text-xs","aria-label":"Candidate type",children:[i.jsx("option",{value:"episode",children:"episode"}),i.jsx("option",{value:"procedure",children:"procedure"}),i.jsx("option",{value:"preference",children:"preference"}),i.jsx("option",{value:"project-fact",children:"project-fact"})]}),i.jsx("input",{value:u,disabled:n,onChange:S=>d(S.currentTarget.value),className:"h-7 min-w-[220px] flex-1 rounded-md border border-input bg-background px-2 text-xs","aria-label":"Candidate title"})]}),i.jsx("textarea",{value:p,disabled:n,onChange:S=>g(S.currentTarget.value),className:"min-h-28 rounded-md border border-input bg-background px-2 py-1.5 font-mono text-[11px] leading-relaxed","aria-label":"Candidate content"}),i.jsx("input",{value:h,disabled:n,onChange:S=>x(S.currentTarget.value),className:"h-7 rounded-md border border-input bg-background px-2 text-xs","aria-label":"Candidate tags"}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground",children:[i.jsx(vi,{className:"size-3"}),"Saving reruns Inspector redaction before promotion."]}),i.jsx("span",{className:"flex-1"}),f!==null&&i.jsx("span",{className:"text-[10px] text-destructive",children:f}),i.jsxs(je,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:n,onClick:()=>{k(),a(!1)},children:[i.jsx(mo,{className:"size-3.5"}),"Cancel"]}),i.jsxs(je,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:n,onClick:()=>{C()},children:[n?i.jsx(xi,{className:"size-3.5 animate-spin"}):i.jsx(sx,{className:"size-3.5"}),"Save"]})]})]})}):i.jsxs("div",{className:"rounded-md border border-border/80 bg-background/60 px-2.5 py-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx($n,{variant:"outline",className:"h-5 px-1.5 text-[10px] font-mono",children:e.type}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",title:e.title,children:e.title}),i.jsx($n,{variant:"outline",className:xe("h-5 shrink-0 px-1.5 text-[10px] font-mono",Rk[e.status]),children:Zk(e.status)})]}),i.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",title:e.content,children:Hk(e.content,360)}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] text-muted-foreground",children:[i.jsxs("span",{className:"inline-flex items-center gap-1",children:[i.jsx(E0,{className:"size-3"}),qk(e.logIds)]}),i.jsxs("span",{className:"inline-flex items-center gap-1",children:[i.jsx(vi,{className:"size-3"}),Vk(e)]}),e.status==="promoted"&&i.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-500",children:[i.jsx(gi,{className:"size-3"}),e.openClawMemoryId??"OpenClaw"]}),e.status==="failed"&&e.error!==null&&i.jsxs("span",{className:"inline-flex items-center gap-1 text-destructive",children:[i.jsx(_l,{className:"size-3"}),e.error]})]}),i.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[e.logIds.map(S=>i.jsxs("a",{href:`#${cd(S)}`,onClick:O=>{O.preventDefault(),ud(S)},className:"rounded border border-blue-400/25 px-1.5 py-0.5 font-mono text-[10px] text-blue-400 underline-offset-2 transition-colors hover:bg-blue-400/10 hover:text-blue-300 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":`Jump to evidence log ${String(S)}`,children:["#",S]},S)),i.jsx("span",{className:"flex-1"}),w&&i.jsxs(je,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[10px]",disabled:n||t,onClick:()=>a(!0),children:[i.jsx(Cl,{className:"size-3"}),"Review"]}),i.jsxs(je,{type:"button",variant:y?"outline":"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[10px]",onClick:()=>r(e.id),disabled:!y||t||n,children:[t?i.jsx(xi,{className:"size-3 animate-spin"}):y?i.jsx(x0,{className:"size-3"}):i.jsx(gi,{className:"size-3"}),Wk(e,t)]})]})]})}function Gk({candidates:e,promotingCandidateIds:t,updatingCandidateIds:n,onPromoteCandidate:r,onUpdateCandidate:s}){return e.length===0?null:i.jsx("div",{className:"mt-2 grid gap-1.5",children:e.map(o=>i.jsx(Jk,{candidate:o,isPromoting:t.has(o.id),isUpdating:n.has(o.id),onPromoteCandidate:r,onUpdateCandidate:s},o.id))})}function Yk({logs:e,scopeId:t,slowResponseThresholdSeconds:n,showRollupMetrics:r,timeDisplayFormat:s}){const[o,a]=v.useState([]),[l,c]=v.useState(!0),[u,d]=v.useState({status:"idle",error:null}),[p,g]=v.useState(()=>new Set),[h,x]=v.useState(()=>new Set),f=o.length>0,m=v.useMemo(()=>Sk(e,n,o.length),[o.length,e,n]),y=v.useMemo(()=>$k({logs:e,scopeId:t,summary:m,candidates:o}),[o,e,t,m]),w=r||m.maxElapsedMs!==null,k=v.useMemo(()=>Pk(m.startedAt,m.endedAt,s),[m.endedAt,m.startedAt,s]),C=v.useCallback(()=>{e.length===0||u.status==="loading"||(d({status:"loading",error:null}),(async()=>{try{const N=await fetch(`/api/knowledge/sessions/${encodeURIComponent(t)}/candidates`,{method:"POST"});if(!N.ok){const z=await rn(N,`Candidate generation failed with ${String(N.status)}`);d({status:"failed",error:z});return}const T=await _t(N,Ak);a(T.candidates),c(T.candidates.length>0),d(T.candidates.length>0?{status:"ready",error:null}:{status:"failed",error:"No candidate was generated for this trace scope."})}catch(N){d({status:"failed",error:N instanceof Error?N.message:"Candidate response was invalid"})}})())},[u.status,e.length,t]),S=v.useCallback(N=>{g(T=>{if(T.has(N))return T;const z=new Set(T);return z.add(N),z}),(async()=>{try{const T=await fetch(`/api/knowledge/candidates/${encodeURIComponent(N)}/promote`,{method:"POST"}),z=await T.json().catch(()=>null),I=zk.safeParse(z);if(T.ok&&I.success){a(j=>j.map(R=>R.id===I.data.candidate.id?I.data.candidate:R)),d({status:"ready",error:null});return}const K=Ok.safeParse(z);K.success&&K.data.candidate!==void 0&&a(j=>j.map(R=>R.id===K.data.candidate?.id?K.data.candidate:R)),d({status:"failed",error:K.success?K.data.error??"Candidate promotion failed":`Candidate promotion failed with ${String(T.status)}`})}catch(T){d({status:"failed",error:T instanceof Error?T.message:"Candidate promotion failed"})}finally{g(T=>{const z=new Set(T);return z.delete(N),z})}})()},[]),O=v.useCallback(async(N,T)=>{x(z=>{if(z.has(N))return z;const I=new Set(z);return I.add(N),I});try{const z=await fetch(`/api/knowledge/candidates/${encodeURIComponent(N)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)});if(!z.ok){const K=await rn(z,`Candidate update failed with ${String(z.status)}`);return d({status:"failed",error:K}),!1}const I=await _t(z,Ik);return a(K=>K.map(j=>j.id===I.candidate.id?I.candidate:j)),d({status:"ready",error:null}),!0}catch(z){return d({status:"failed",error:z instanceof Error?z.message:"Candidate update failed"}),!1}finally{x(z=>{const I=new Set(z);return I.delete(N),I})}},[]);return e.length===0?null:i.jsxs("section",{className:"mb-2 rounded-lg border border-border bg-muted/10 px-3 py-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 text-xs",children:[r&&i.jsxs("span",{className:"inline-flex items-center gap-1.5 font-semibold text-foreground",children:[i.jsx($r,{className:"size-3.5 text-blue-400"}),m.llmCallCount," LLM"]}),i.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[i.jsx(Br,{className:"size-3.5 text-sky-400/70"}),m.toolCallCount," tools"]}),r&&i.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[i.jsx(Dn,{className:"size-3.5 text-emerald-400"}),i.jsxs("span",{className:"font-mono",children:[$e(m.totalInputTokens)," / ",$e(m.totalOutputTokens)]})]}),(m.totalCacheCreationInputTokens>0||m.totalCacheReadInputTokens>0)&&i.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[i.jsx(Dn,{className:"size-3.5 text-purple-400"}),i.jsxs("span",{className:"font-mono",children:["KV Cache +",$e(m.totalCacheCreationInputTokens)," / ~",$e(m.totalCacheReadInputTokens)]})]}),w&&i.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[i.jsx(St,{className:"size-3.5"}),r&&i.jsx("span",{className:"font-mono",children:Qs(m.totalElapsedMs)}),m.maxElapsedMs!==null&&i.jsxs("span",{className:"font-mono text-muted-foreground/70",children:["max ",Qs(m.maxElapsedMs)]})]}),r&&k!==null&&i.jsx("span",{className:"font-mono text-muted-foreground/70",children:k}),(m.failedCallCount>0||m.pendingCallCount>0||m.slowCallCount>0)&&i.jsxs("span",{className:"inline-flex items-center gap-1.5 text-amber-400",children:[i.jsx(_r,{className:"size-3.5"}),i.jsxs("span",{className:"font-mono",children:[m.failedCallCount," fail / ",m.pendingCallCount," pending /"," ",m.slowCallCount," slow"]})]}),i.jsx("span",{className:"flex-1"}),f&&i.jsx($n,{variant:"outline",className:"h-6 px-2 text-[10px] font-mono",children:Mk(m.knowledgeCandidateCount)}),i.jsxs(je,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:C,disabled:u.status==="loading",children:[u.status==="loading"?i.jsx(Mn,{className:"size-3.5 animate-spin"}):i.jsx(wl,{className:"size-3.5"}),"Candidate"]}),f&&i.jsx(je,{type:"button",variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",onClick:()=>c(N=>!N),"aria-expanded":l,"aria-label":l?"Collapse memory candidates":"Expand memory candidates",children:l?i.jsx(gn,{className:"size-3.5"}):i.jsx(Wn,{className:"size-3.5"})})]}),u.status==="failed"&&i.jsx("p",{className:"mt-2 text-xs text-destructive",children:u.error}),i.jsx(Uk,{insights:y}),l&&i.jsx(Gk,{candidates:o,promotingCandidateIds:p,updatingCandidateIds:h,onPromoteCandidate:S,onUpdateCandidate:O})]})}function Xk(e){let t=0,n=0;for(const r of e)r.inputTokens!==null&&(t+=r.inputTokens),r.outputTokens!==null&&(n+=r.outputTokens);return{totalInputTokens:t,totalOutputTokens:n}}const Qk=v.memo(function({group:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,cacheTrends:s,onCompareWithPrevious:o,comparisonPredecessors:a,onClearGroup:l,standalone:c=!1,hasPinnedSessionContext:u=!1,timeDisplayFormat:d}){const[p,g]=v.useState(!1),h=v.useMemo(()=>Xk(e.logs),[e.logs]),x=e.logs[0]?.timestamp??new Date().toISOString(),f=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),m=aw(e.logs),y=e.logs.some(C=>C.responseStatus===null),w=c&&!u,k=v.useMemo(()=>wk(e.logs),[e.logs]);return i.jsxs("div",{className:"mb-2",children:[!c&&i.jsx(ow,{conversationId:e.conversationId,startTime:x,endTime:f,totalCalls:e.logs.length,totalInputTokens:h.totalInputTokens,totalOutputTokens:h.totalOutputTokens,apiFormat:iw(e.logs),expanded:p,onToggle:()=>g(!p),hideApiFormat:m,isLoading:y,userAgent:e.logs[0]?.userAgent??null,timeDisplayFormat:d,onClear:()=>l(e.logs.map(C=>C.id))}),yk(c,p)&&i.jsxs("div",{children:[i.jsx(Yk,{logs:e.logs,scopeId:e.conversationId,slowResponseThresholdSeconds:r,showRollupMetrics:w,timeDisplayFormat:d}),k.map(C=>i.jsx(jk,{entries:C.entries,viewMode:t,strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:d,cacheTrends:s,onCompareWithPrevious:o,comparisonPredecessors:a,turnIndex:C.turnIndex},C.turnIndex))]})]})});function e5({className:e}){return i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:xe("inline-block size-5",e),children:[i.jsx("path",{d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z"}),i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"}),i.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),i.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),i.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),i.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),i.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"}),i.jsxs("g",{children:[i.jsx("path",{d:"M5.6 17.7 L8.4 15.4 L10.8 18 C9.1 18.9 7.2 18.8 5.6 17.7 Z",fill:"#2f6b3f",stroke:"none",opacity:"0.95"}),i.jsx("path",{d:"M6.9 17.5 L8.4 16 L9.8 17.7 C8.9 18.1 7.8 18.1 6.9 17.5 Z",fill:"#6fb36f",stroke:"none",opacity:"0.95"}),i.jsx("path",{d:"M8.4 16 L8.4 18.4",stroke:"#d6b45f",strokeWidth:"0.34"}),i.jsx("circle",{cx:"10.6",cy:"17.75",r:"0.36",fill:"#c2412d",stroke:"none"})]}),i.jsxs("g",{children:[i.jsx("path",{d:"M8 16.5 L11.9 13.6 L15.8 16.8 C13.3 18.4 10.4 18.3 8 16.5 Z",fill:"#2f6b3f",stroke:"none",opacity:"0.97"}),i.jsx("path",{d:"M9.8 16.3 L11.9 14.4 L14.3 16.5 C12.8 17.4 11.3 17.4 9.8 16.3 Z",fill:"#6fb36f",stroke:"none",opacity:"0.95"}),i.jsx("path",{d:"M11.9 14.3 L11.9 17.8",stroke:"#d6b45f",strokeWidth:"0.42"}),i.jsx("path",{d:"M9.8 16.3 C11.2 15.8 12.9 15.9 14.3 16.5",stroke:"#9fca78",strokeWidth:"0.36"}),i.jsx("circle",{cx:"15.6",cy:"16.75",r:"0.43",fill:"#c2412d",stroke:"none"})]}),i.jsxs("g",{children:[i.jsx("path",{d:"M13.6 18.1 L16.2 15.7 L18.5 18.2 C17.1 19.1 15.2 19 13.6 18.1 Z",fill:"#2f6b3f",stroke:"none",opacity:"0.95"}),i.jsx("path",{d:"M14.8 17.9 L16.2 16.3 L17.5 18 C16.6 18.4 15.7 18.4 14.8 17.9 Z",fill:"#6fb36f",stroke:"none",opacity:"0.95"}),i.jsx("path",{d:"M16.2 16.3 L16.2 18.6",stroke:"#d6b45f",strokeWidth:"0.34"}),i.jsx("circle",{cx:"18.35",cy:"18.15",r:"0.36",fill:"#c2412d",stroke:"none"})]})]})}const t5="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAQAAAAi5ZK2AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfpCxsJDCnsge2KAAAM2ElEQVR42u2de3AW1RnGnyQQDARDwiUFpHIVMHIpYgFRB2nLxQrC0FIDiCKDWNqBUqBlai8wvciIpaRTWh3QDqCDIIjKDL0IaBC5SKlysWJArgqh3BMICYFs/wgpGUi+8579dr89e/Z5zp/59j2755fn3d2z5wJQFEVRFEVRoVQSm+AG1UFrtEdT1EcjNEA5SlCMIhxDAQoJ3S4lIwf9cD+6ozXq1vKbYuzHNmxEPo6xwcKtungIS3EajkYpwLPoyqYLp3KwACe1cFcvezATmWzEMOk+rMBV18CrSjHy0IqNGQb1wMa4cV8vZfgzGrNRTVYm8nDFQ+SV5QymIIWNa6ZGaz6y6ZR/I4cNbJrSkOcb8MpyCVPYzCapKz71GXllWY5b2dhm6EGcTwhyBw52oyUbPHgNx6WEIXfg4CDuYKMHq0kevI/rlhP4Ghs+OE1ERcKRO3BwEh3Z+NFC7sDBATQngMRrcoDIHTj4iE/yUXJ5VVlhYsMkWezy+a6urgRbsAP7cRincQGpqI+maI+O6IMuSHYRbwIW0X/mJvZTeAH9ah1CATTCaKxBmWbUi7iTOMxEXoCncIsodgvM1ezo2cFPMebdy89qfyHL0vxSN5FQzHL5ajRxVU8v7NO4cWQRjCnIy/DDOOq6FcvENS0gGjMS+wUMjvvdZ5awrsv4KvEE7/Iz+Lontc4Q1vc8AQXt8rO4x7Oa54hqLOLI2aBdfrenHVyviWqdQUx2uLxS6fhMUO8ugrLD5VXqLfpmfxdh2eHyKi0S1P5b4rLF5ZVqiiJl/Z8SmD0ur9TzgnNoQWi2uLxSt+Gy8ixGEpvZLs9AN3RGqsYRa5Xn8SeCM9XlDfFT7Ll2bDnWYYRwOMZjyjP5kOjMdPkDOHpTjPX4iuDILOWL2znCMxH5IyitMc4+ZAuO3q08nyYEaFpiHxbjYWyDIMm/qDyje4kwPMgdOBihjDBNeU7fJcQwIXewTnBzUJ3Vk8Rozr18mOAtuxT1FFH6KmNMJkhTkH+7lse3G0s7RZyuygjPEGVYEntV6aSIlKOM8CvCDEtirywVyFDE6q2M8WPiDJPLJcMgBiljPEWg4XG5AwfTlfEmKWPkEml4XO7gCBooI85TRvlm8I1ax3CX68w8PYeB2KGFfEWM6Yo3qgy5uKj8VU/lLz5HG2QjHRlIA1CCIhTjBI6ggg43LbGXYYggZj3lgkYVtbwaluITvIlf4gHhNEomdheJXfpeXoX8EVHUAR4sY1CKfEyN5gibMCIHXvJsBYur2IDxSCNy05HXx1mPFy/5L2ZFZb6rGR2uusiByb6sWlOMZ5FOl5vocqAuDvm2XNExjLV5t52wuhyY7vM6Ve+jA11uksuB5glYcLgIY+hyc1yeJBj87E35q6BXkC5PAHJgdgKXI9xlzzt8eF0OjE/wypQH7Li7h9nl4wJYjPQ4utPlwSF/LKD1Z8+gC10eLeQOHHyJ1nR54pGPCniVadmcGyK3xOVVZYvWnNpqb5hBIv+L1hCJAdiuhXyVcpT6dV3GSLylhXyxy7YrxHYU4CBO4yKABmiCNuiIe9DMVbT5mMp7eWJc/rgLl1dgC6bE2NelM6Zim4uoDzOxm5nYS/GicNOuznhJc0X5k2HprIkS8gos1cTSSrgYodFbhkQ5sR/F/a7aqD8Oa9TSny43x+UblDNialcmVovr2WP2qOYoIV8V57tREuaK6/o+E7sJid2bO+00Ya0HTPV6lFy+3LNWmymsMZfIg+1w9fZ5ep6ozp3mjaKjy90rGetF9d5H5Ha4vFLZOB62zYGIPH6NEk2NqEvk4U/s1V/f8gX1DyJye5ADQC/BGfyRyO1I7Nf1rvIcPiZye1xeqaGCua6ZNiMf7sOSAolD3h+v4otrH2RewYPCo1JxWnkmQ4jcROTZNcyGWSMcN7PQ5KUJw4zc33t5G+xHzfu3S7655wqmPRG5ccgPxxjkqN7DvbnyfDYRuVmJvY1iYMQEQYxCxRkVEnlYXF5ZdguibFLEKI/6S9pQg1x+Ow4IYrZSxlmqjJFGl4fF5dLVJBcoYzQl8jDcy3XestV7tbcl8vC43IGD3spo6gEVtxF5mJCXCu7H6u6ZRlFE/nAoE7sDB8sEEd9URqkTfuT2P7FXlSuiZQb2KKKU0OXhcbmDGYKYdZWrTO8l8nDcyx04mCeKqh5IsYaJPRyJ3cEfhHFnePTPQ+ShQQ68r4z1NJEHkdj9Q95KcN7didwmlwOzBC2dTOT2uByoj5PBPcbR5UEgly0tPo3I7XE5kI1zgoVOWhO5PS4HXhHE/IDI7XE5MFIU9QdEbo/LO6NIEPWS98Mn/F04pD+R16oWOCiK+4LXyMf4irwnin1ErrtWzGtGIW+MXcJvdB4v/H87LvqIvL1yWG90XZ6J7UHNpVvoI/KGKPDxS5q/Lm/ry5e06i7/SBi5HHd5izxVI/nqIpcM6aXL1WW+1z7v6SPyJ0I7RMJvl+sgP+H9uLihviFvp5FDmNhrL096/34+2Jf3cgBYw8TuAfI3/OiHu8MXl+tsMM97ee3lKBr7AT1JuVuwG+Sp2EvkcSMvR1+/PqbO9Bw5MIn38rgTu69rP6fFeJd2hzwFn/OJPU6XO5gNX5VTy6iNk66QA4+KLqoCY5nYay0L4bs6YedN1e5EJ5fRdogu60dM7DE+/SZk+lIqxmMzrl5br2wzxrvbCA5Ad9FlraTLay2vJ3YV2DS0Rds4VzuYI7isQ1q9TNG6l79uzsK/8ldAyffhYRoRwz0qJgLIgT6CC/uHMcjpck/0c8Gl9aHLbUIO/FN5aflEbhfyOoJBfrlEbhNyydf5C0jnvdwm5MAY5eWtInK7kAOzlRc4mYndLuTAq8pL7KGMMTzUXTGGdrj6qc2KS7yq7O27E1fYxx4ufaK4yCOK41M0ofg7dYHIRVIh2xr3gyBdbpxUW8+8ozh+PV0ePqkmSK1RJPdLhrj890Qu1ynFxa6PeXRTQ76X871cS6rPqh/GPDrLiJc0ulxTqgVtj8U8OglneS8Pn9RrHjaMefwbvJeHT4vj/JY+iMjDJ/UQip8oIqyNcewyJnYT9T3lpf9NEaEJPqvlyEV0uZnqKpjVkqWIkV3DTuKlmusfE3kClYwzygaYIIiSi03XxuA7OIF5aE7kJuttZRPsQpIoUga64W601l75mF0xCZdkYdvBPtZP5AGom6Ahtvu2brnfiZ3IXfbKye7rdHmo9AtBc5zyYftIujxAtRONcduIFLrcJm3wpdmDdfm/iDy2BgqbZnpoXE7kSiUJOy8qMNWD2nJwlC43QY+Km+i5OF/fHhD0ARJ5grpjt4qbaT1auM4oU1DGxG6Oev2/71xdCpEr7Jqtro5YpwWELk+AXtZqsHz01ojdDHM1PU7kCVEznNDEko8RuEXQ0bsAJZqRiTxhGqQ5FdGBg3NYgsfRpoZoDTEIv8N/tCNGDnlSwPU/hxkujyzCPhzBOZQiBY3QFB3i6Lidp7lhZSbe0VorcyVGoZwer1JdbHHlTC8LE3vC1US8CLg/xf+XtDqEfLPa4BiRR0/dBXsGhzOxE3kMdcGXCUc+h8iDT/IFCQR+BROJ3ARlaw5DcF8uYAiRm6J6yHPRXaNb9mhvUknkPmuocuGC+MoS1Cdy89QSK3wCvg8PaZ8NkSdM/YT7hsvLRcwSfKwh8kBVB08LN/JSlxIscNUzT+QBKBlDsC1O4OeR53LkDZEHqN7Ic9VRW4a3kav92EbkxigF38BcbEO5CMBhLME45Tz3yCJPChn8dPRBF7RHB3RARrVtvC6hGIewHwUowBYcirMW/e/lubhCZybunyALmR7/6zKxR05ETuRETuRETuRsNCKniJwicorIKSKniJwicorIKSKniJyqGfnHmvsyE3nIlRJzHxi63ErlEXnUNI6JPWrKUO7rTJdbp98QedSUjWIm9qjpGSKPnrYysUdNzYRLEBO5RRrLxF6p5AhB7yz4zUqMtn+CUpSgZyt/sZpz0mzTWuXU5sbRaIgoOT1T8fdCnCZ026RC2lJzQ25CD4EKFX9PwWLUI/RoQQe+hbdcrEBFGazRovf0tdFwe1SUJVyx5u90u03aKOx7J3aLNEP8lY1J3ho10hg3Q7dbo59pjJwhdkvUAMeJPXr6jtY2Ary3W6Jfaw2CptutUJLmJgLEboXSsUkLO5O8JQ9079LtxE7sxE7sxE7sFqkhH+mIXV1WhG43DMoD7OPZZNHD/gWnPUUR+4BwX2wyeQMAijEYH4h/fS+hRw97c0K3B/tAvCf6ZRmh26OLGCpy+wE2VfQe6XLYTFHD/h6bKGrYy9CDDWQr9vwakV/FE2wce5WGl29CfgrD2TC2qy+W4/w14Hsxy5aVKvjFSN1CLVAPp1DEpqAoiqIoyiz9D9lYMumhgrvLAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI1LTExLTI3VDA5OjEyOjQxKzAwOjAwvIZCxQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNS0xMS0yN1QwOToxMjo0MSswMDowMM3b+nkAAAAASUVORK5CYII=";function n5({className:e}){return i.jsx("img",{src:t5,alt:"Model Context Protocol","aria-hidden":"true",className:xe("inline-block size-8 object-contain invert",e)})}function ha({...e}){return i.jsx(p2,{"data-slot":"select",...e})}function pa({...e}){return i.jsx(g2,{"data-slot":"select-value",...e})}function ma({className:e,size:t="default",children:n,...r}){return i.jsxs(m2,{"data-slot":"select-trigger","data-size":t,className:xe("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,i.jsx(x2,{asChild:!0,children:i.jsx(gn,{className:"size-4 opacity-50"})})]})}function ga({className:e,children:t,position:n="popper",align:r="center",...s}){return i.jsx(v2,{children:i.jsxs(y2,{"data-slot":"select-content",className:xe("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,align:r,...s,children:[i.jsx(r5,{}),i.jsx(b2,{className:xe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),i.jsx(s5,{})]})})}function ur({className:e,children:t,...n}){return i.jsxs(w2,{"data-slot":"select-item",className:xe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[i.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:i.jsx(k2,{children:i.jsx(tt,{className:"size-4"})})}),i.jsx(_2,{children:t})]})}function r5({className:e,...t}){return i.jsx(C2,{"data-slot":"select-scroll-up-button",className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(r0,{className:"size-4"})})}function s5({className:e,...t}){return i.jsx(S2,{"data-slot":"select-scroll-down-button",className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(gn,{className:"size-4"})})}function o5(){return i.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[i.jsx("title",{children:"Claude Code"}),i.jsx("path",{clipRule:"evenodd",d:"M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z"})]})}function i5(){return i.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[i.jsx("title",{children:"OpenCode"}),i.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})]})}function a5(){return i.jsxs("svg",{fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[i.jsx("title",{children:"MiMo Code"}),i.jsx("text",{x:"12",y:"18",textAnchor:"middle",fontSize:"16",fontWeight:"800",fontFamily:"system-ui, sans-serif",children:"M"})]})}const l5=ne({name:B(),apiKey:B(),format:Ue(["anthropic","openai"]),anthropicBaseUrl:B(),openaiBaseUrl:B(),models:_e(B()),sourceTool:Ue(["claude-code","opencode","mimo-code"]),alreadyExists:Be()}),c5=ne({providers:_e(l5),warnings:_e(B()).optional()}),u5=ne({success:Be().optional(),imported:pe().optional(),message:B().optional(),errors:_e(B()).optional()}),d5={"claude-code":o5,opencode:i5,"mimo-code":a5};function f5({open:e,onOpenChange:t,onImportComplete:n}){const[r,s]=v.useState(!1),[o,a]=v.useState(null),[l,c]=v.useState([]),[u,d]=v.useState([]),[p,g]=v.useState(new Set),[h,x]=v.useState(!1),[f,m]=v.useState(null),[y,w]=v.useState(null),k=v.useCallback(()=>{s(!0),a(null),d([]),c([]),g(new Set),m(null),w(null),fetch("/api/providers/scan").then(N=>N.ok?N.json().then(T=>{const z=c5.safeParse(T);if(!z.success){a(`Invalid response: ${z.error.message}`);return}c(z.data.providers),d(z.data.warnings??[]);const I=new Set;z.data.providers.forEach((K,j)=>{K.alreadyExists||I.add(j)}),g(I)}):N.text().then(T=>{a(`Scan failed (${N.status}): ${T}`)})).catch(N=>{a(N instanceof Error?N.message:String(N))}).finally(()=>{s(!1)})},[]);v.useEffect(()=>{e&&k()},[e,k]);const C=v.useCallback(N=>{g(T=>{const z=new Set(T);return z.has(N)?z.delete(N):z.add(N),z})},[]),S=v.useCallback(()=>{const N=l.filter((I,K)=>p.has(K));if(N.length===0)return;x(!0),w(null),m(null);const T=new Date().toISOString(),z=N.map(I=>({id:window.crypto.randomUUID(),name:I.name,apiKey:I.apiKey,format:I.format,anthropicBaseUrl:I.anthropicBaseUrl,openaiBaseUrl:I.openaiBaseUrl,models:I.models,createdAt:T,updatedAt:T}));fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providers:z})}).then(I=>I.json()).then(I=>{const K=u5.safeParse(I);if(!K.success){w(`Invalid response: ${K.error.message}`);return}const j=K.data;c(R=>R.map((_,F)=>p.has(F)?{..._,alreadyExists:!0}:_)),g(new Set),j.errors!==void 0&&j.errors.length>0&&j.message!==void 0?m(j.message):m(`Imported ${j.imported??N.length} provider(s)`),n()}).catch(I=>{w(I instanceof Error?I.message:String(I))}).finally(()=>{x(!1)})},[l,p,n]),O=l.some(N=>!N.alreadyExists);return i.jsx(Do,{open:e,onOpenChange:t,children:i.jsxs(Lo,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[i.jsxs(Fo,{children:[i.jsx($o,{children:"Import from External Tools"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Detect provider configurations from Claude Code, OpenCode, and MiMo Code."})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3",children:[r&&i.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-muted-foreground",children:[i.jsx(Mn,{className:"size-4 animate-spin"}),i.jsx("span",{className:"text-sm",children:"Scanning for external providers..."})]}),o!==null&&i.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm py-4",children:[i.jsx(Pn,{className:"size-4"}),o]}),!r&&o===null&&l.length===0&&i.jsxs("p",{className:"text-sm text-muted-foreground py-8 text-center",children:["No external provider configurations found.",i.jsx("br",{}),i.jsx("span",{className:"text-xs",children:"Supported tools: Claude Code (~/.claude/settings.json), OpenCode (~/.config/opencode/opencode.json), MiMo Code (~/.config/mimocode/mimocode.jsonc)"})]}),!r&&l.map((N,T)=>i.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${N.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!N.alreadyExists&&i.jsx("input",{type:"checkbox",checked:p.has(T),disabled:h,onChange:()=>C(T),className:"mt-0.5 size-4"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[(()=>{const z=d5[N.sourceTool];return z===void 0?null:i.jsx(z,{})})(),N.alreadyExists&&i.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Already added"})]}),i.jsxs("div",{className:"text-xs text-muted-foreground mt-1 truncate",children:[N.models.slice(0,4).join(", "),N.models.length>4?` +${N.models.length-4} more`:""]}),i.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:N.format==="anthropic"?N.anthropicBaseUrl:N.openaiBaseUrl}),i.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:N.apiKey.length>8?`${N.apiKey.slice(0,4)}••••${N.apiKey.slice(-4)}`:"••••"})]})]},`${N.sourceTool}-${N.name}`)),u.length>0&&i.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((N,T)=>i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(Pn,{className:"size-3"}),N]},T))}),f!==null&&i.jsx("div",{className:"text-sm text-green-500 border-t pt-2",children:f}),y!==null&&i.jsx("div",{className:"text-sm text-destructive border-t pt-2",children:y})]}),i.jsxs("div",{className:"flex items-center justify-between pt-3 border-t",children:[i.jsxs(je,{variant:"outline",size:"sm",onClick:k,disabled:r,children:[i.jsx(Mn,{className:`size-3 mr-1 ${r?"animate-spin":""}`}),"Rescan"]}),i.jsxs(je,{size:"sm",onClick:S,disabled:!O||p.size===0||h,children:[i.jsx(fo,{className:"size-3 mr-1"}),h?"Importing...":`Import Selected (${p.size})`]})]})]})})}function dd(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const h5={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function p5(e){return Object.prototype.hasOwnProperty.call(e,"success")}function m5(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function g5(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return i.jsx(St,{...t});case"network_unreachable":return i.jsx(wx,{...t});case"connection_refused":return i.jsx(kx,{...t});case"auth_failed":return i.jsx(B0,{...t});case"rate_limited":return i.jsx(O0,{...t});case"server_error":return i.jsx(lx,{...t});case"invalid_response":return i.jsx(h0,{...t});case"unknown":return i.jsx(Pn,{...t});default:return i.jsx(Pn,{...t})}}function dr({result:e}){const[t,n]=v.useState(!1);if(!p5(e))return m5(e)?i.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[i.jsx(W0,{className:"size-3"}),i.jsx("span",{children:"Not configured"})]}):i.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[i.jsx(Sl,{className:"size-3 animate-spin"}),i.jsx("span",{children:"Testing..."})]});if(e.success){const c=[];e.inputTokens!==void 0&&c.push(i.jsxs("span",{children:[e.inputTokens," in"]},"in")),e.outputTokens!==void 0&&c.push(i.jsxs("span",{children:[e.outputTokens," out"]},"out")),e.cacheCreationInputTokens!==void 0&&e.cacheCreationInputTokens>0&&c.push(i.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["KV Cache +",e.cacheCreationInputTokens]},"cache-create")),e.cacheReadInputTokens!==void 0&&e.cacheReadInputTokens>0&&c.push(i.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["KV Cache ~",e.cacheReadInputTokens]},"cache-read"));const u=[];for(let d=0;d<c.length;d++)d>0&&u.push(", "),u.push(c[d]);return i.jsx(Ze,{children:i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 shrink-0",children:[i.jsx(u0,{className:"size-3"}),i.jsx("span",{children:"Connected"}),c.length>0&&i.jsxs("span",{className:"text-muted-foreground",children:["(",u,")"]})]})}),i.jsx(Ie,{children:"Connection test passed"})]})})}const r=e.error,s=r?.message??"Connection failed",o=r?.hint,a=r?.details,l=r?.type??"unknown";return i.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600 max-w-[200px]",children:[g5(l),i.jsx(Ze,{children:i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx("span",{className:"truncate",children:s})}),i.jsx(Ie,{children:"Connection test failed"})]})}),a!==void 0&&i.jsx(Ze,{children:i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx("button",{type:"button",onClick:()=>n(!t),className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:t?i.jsx(ho,{className:"size-3"}):i.jsx(po,{className:"size-3"})})}),i.jsx(Ie,{children:t?"Hide error details":"Show detailed error information"})]})})]}),t&&a!==void 0&&i.jsxs("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded p-2 max-w-[300px]",children:[o!==void 0&&i.jsx("div",{className:"mb-1",children:o}),i.jsx("div",{className:"font-mono whitespace-pre-wrap break-all text-red-400/80",children:a})]})]})}function x5(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n,s=Math.floor(r/1e3);if(s<60)return"just now";const o=Math.floor(s/60);if(o<60)return`${o}m ago`;const a=Math.floor(o/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function v5({provider:e,testResults:t,isTesting:n,testingTimeLeft:r,isHighlighted:s,onEdit:o,onDelete:a,onTest:l}){const[c,u]=v.useState(!1),[d,p]=v.useState(!1),[g,h]=v.useState(!1);function x(){navigator.clipboard.writeText(e.apiKey).catch(()=>{}),p(!0),setTimeout(()=>p(!1),2e3)}const f=e.apiDocsUrl??Object.entries(h5).find(([m])=>e.name.toLowerCase().includes(m))?.[1];return i.jsxs("div",{className:`border rounded-lg p-4 flex flex-col gap-3 bg-card transition-all duration-500 ${s===!0?"ring-2 ring-primary shadow-md":""}`,children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx("span",{className:"font-medium truncate",children:e.name}),e.source==="company"&&i.jsx(Ze,{children:i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400 shrink-0",children:"公司"})}),i.jsx(Ie,{children:"Company-provided API key"})]})}),e.source==="personal"&&i.jsx(Ze,{children:i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 shrink-0",children:"个人"})}),i.jsx(Ie,{children:"Your personal API key"})]})})]}),f!==void 0&&i.jsxs("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1 text-xs",title:"View API documentation",children:[i.jsx(kl,{className:"size-3"}),i.jsx("span",{className:"sr-only",children:"Docs"})]})]}),e.models!==void 0&&e.models.length>0&&i.jsx("div",{className:"flex flex-wrap gap-1",children:e.models.map(m=>i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:m},m))}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("code",{className:"text-xs text-muted-foreground bg-muted px-2 py-1 rounded flex-1 truncate",children:c?e.apiKey:dd(e.apiKey)}),i.jsx("button",{type:"button",onClick:()=>u(m=>!m),className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":c?"Hide API key":"Show API key",children:c?i.jsx(ho,{className:"size-4"}):i.jsx(po,{className:"size-4"})}),i.jsx("button",{type:"button",onClick:x,className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":"Copy API key",children:d?i.jsx(tt,{className:"size-4 text-green-500"}):i.jsx(Zt,{className:"size-4"})})]}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[i.jsx("span",{className:"font-medium",children:"Anthropic:"})," ",i.jsx("span",{className:"truncate",children:e.anthropicBaseUrl})]}),t&&i.jsx(dr,{result:t.anthropic.nonStreaming})]}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[i.jsx("span",{className:"font-medium",children:"OpenAI:"})," ",i.jsx("span",{className:"truncate",children:e.openaiBaseUrl})]}),t&&i.jsx(dr,{result:t.openai.nonStreaming})]}),t?.testedAt!==void 0&&i.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[i.jsx(St,{className:"size-3"}),i.jsxs("span",{children:["Tested ",x5(t.testedAt)]})]}),t?.models!==void 0&&Object.keys(t.models).length>0&&i.jsxs("div",{className:"border-t pt-2",children:[i.jsxs("button",{type:"button",onClick:()=>h(m=>!m),className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",children:[i.jsx("span",{className:"font-mono",children:g?"▾":"▸"}),"Model Test Results (",Object.keys(t.models).length,")"]}),g&&i.jsx("div",{className:"mt-2 overflow-x-auto",children:i.jsxs("table",{className:"w-full text-xs border-collapse",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border",children:[i.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Model"}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&i.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Anthropic"}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&i.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"OpenAI"})]})}),i.jsx("tbody",{children:Object.entries(t.models).map(([m,y])=>i.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[i.jsx("td",{className:"py-1 px-2 font-medium",children:m}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&i.jsx("td",{className:"py-1 px-2",children:i.jsx(dr,{result:y.anthropic.nonStreaming})}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&i.jsx("td",{className:"py-1 px-2",children:i.jsx(dr,{result:y.openai.nonStreaming})})]},m))})]})})]}),i.jsxs("div",{className:"flex gap-2 pt-1 border-t",children:[l!==void 0&&i.jsxs(je,{variant:"outline",size:"sm",onClick:()=>l(e.id),className:"text-xs h-7 gap-1",disabled:n??!1,children:[i.jsx(Sl,{className:`size-3 ${n??!1?"animate-spin":""}`}),n??!1?r!==void 0?`Testing (${r}s)`:"Testing...":"Test"]}),i.jsxs(je,{variant:"outline",size:"sm",onClick:()=>o(e),className:"text-xs h-7 gap-1",disabled:n??!1,children:[i.jsx(Cl,{className:"size-3"}),"Edit"]}),i.jsxs(je,{variant:"outline",size:"sm",onClick:()=>a(e.id),className:"text-xs h-7 gap-1 text-destructive hover:text-destructive",disabled:n??!1,children:[i.jsx(jl,{className:"size-3"}),"Delete"]})]})]})}const y5={deepseek:{format:"openai",baseUrl:"https://api.deepseek.com"},minimax:{format:"anthropic",baseUrl:"https://api.minimaxi.com/anthropic",apiDocsUrl:"https://platform.minimaxi.com/docs/api-reference/api-overview"},alibaba:{format:"openai",baseUrl:"https://dashscope.aliyuncs.com/compatible-mode"}},xa=["MiniMax M3","MiniMax M2.7","MiniMax M2.7-highspeed","MiniMax M2.5","MiniMax M2.5-highspeed","MiniMax M2.1","MiniMax M2.1-highspeed","MiniMax M2"],va=["glm-5","glm-5.1","qwen3.6-plus","qwen3.7-max"];function b5({provider:e,onSubmit:t,onCancel:n}){const[r,s]=v.useState(e?.name??""),[o,a]=v.useState(e?.apiKey??""),[l,c]=v.useState(!1),[u,d]=v.useState(!1),p=e?.models,[g,h]=v.useState(p!==void 0&&p.length>0?p:[""]),[x,f]=v.useState("anthropic"),[m,y]=v.useState(e?.anthropicBaseUrl??""),[w,k]=v.useState(e?.openaiBaseUrl??""),[C,S]=v.useState(e?.apiDocsUrl??""),[O,N]=v.useState(e?.source),[T,z]=v.useState({}),[I,K]=v.useState(!1),[j,R]=v.useState(null),_=v.useRef([]);v.useEffect(()=>{if(j===null)return;const J=j;function ue(X){if(!(X.target instanceof Node))return;const ie=_.current[J];ie!=null&&!ie.contains(X.target)&&R(null)}return document.addEventListener("mousedown",ue),()=>document.removeEventListener("mousedown",ue)},[j]);const[F,Z]=v.useState(!1),[P,M]=v.useState(!1),W=r.toLowerCase().includes("minimax"),te=r.toLowerCase().includes("alibaba");function V(){navigator.clipboard.writeText(o).catch(()=>{}),d(!0),setTimeout(()=>d(!1),2e3)}v.useEffect(()=>{e&&(s(e.name),a(e.apiKey),h((e.models?.length??0)>0?e.models:[""]),y(e.anthropicBaseUrl??""),k(e.openaiBaseUrl??""),S(e.apiDocsUrl??""),N(e.source),Z(!1),M(!1))},[e]),v.useEffect(()=>{const J=r.toLowerCase();for(const[ue,X]of Object.entries(y5))if(J.includes(ue)){X.format==="anthropic"&&!F?y(X.baseUrl):X.format==="openai"&&!P&&k(X.baseUrl),X.apiDocsUrl!==void 0&&!C&&S(X.apiDocsUrl),ue==="minimax"&&g.length===1&&g[0]===""&&h([xa[0]??""]),ue==="alibaba"&&g.length===1&&g[0]===""&&h([va[0]??""]);break}},[r]);function U(){const J={};return r.trim()||(J.name="Name is required"),o.trim()||(J.apiKey="API key is required"),(g.length===0||g.every(ue=>!ue.trim()))&&(J.models="At least one model is required"),m.trim()&&!re(m.trim())&&(J.anthropicBaseUrl="Invalid URL format"),w.trim()&&!re(w.trim())&&(J.openaiBaseUrl="Invalid URL format"),!m.trim()&&!w.trim()&&(J.format="At least one format URL (Anthropic or OpenAI) is required"),z(J),Object.keys(J).length===0}function re(J){try{return new URL(J),!0}catch{return!1}}function ee(J){if(J.preventDefault(),!!U()){K(!0);try{t({name:r.trim(),apiKey:o.trim(),models:g.map(ue=>ue.trim()).filter(ue=>ue!==""),anthropicBaseUrl:m.trim()||void 0,openaiBaseUrl:w.trim()||void 0,apiDocsUrl:C.trim()||void 0,source:O})}finally{K(!1)}}}return i.jsxs("form",{onSubmit:ee,className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{htmlFor:"provider-name",className:"text-sm font-medium",children:["Name ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx("input",{id:"provider-name",type:"text",value:r,onChange:J=>s(J.target.value),placeholder:"Provider Name",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),T.name!==void 0&&i.jsx("p",{className:"text-xs text-destructive",children:T.name})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{htmlFor:"provider-source",className:"text-sm font-medium",children:"Token Source"}),i.jsxs("select",{id:"provider-source",value:O??"",onChange:J=>N(J.target.value==="company"||J.target.value==="personal"?J.target.value:void 0),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",children:[i.jsx("option",{value:"",children:"—"}),i.jsx("option",{value:"personal",children:"个人 (Personal)"}),i.jsx("option",{value:"company",children:"公司 (Company)"})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Label whether this API key is company-provided or personal."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{htmlFor:"provider-apikey",className:"text-sm font-medium",children:["API Key ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{id:"provider-apikey",type:"text",value:l||o.length===0?o:dd(o),onChange:J=>a(J.target.value),onFocus:()=>{!l&&o.length>0&&c(!0)},placeholder:"sk-ant-...",readOnly:!l&&o.length>0,className:"flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),i.jsx("button",{type:"button",onClick:()=>c(J=>!J),className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":l?"Hide API key":"Show API key",children:l?i.jsx(ho,{className:"size-4"}):i.jsx(po,{className:"size-4"})}),i.jsx("button",{type:"button",onClick:V,className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":"Copy API key",children:u?i.jsx(tt,{className:"size-4 text-green-500"}):i.jsx(Zt,{className:"size-4"})})]}),T.apiKey!==void 0&&i.jsx("p",{className:"text-xs text-destructive",children:T.apiKey})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{className:"text-sm font-medium",children:["Models ",i.jsx("span",{className:"text-destructive",children:"*"})]}),g.map((J,ue)=>i.jsxs("div",{ref:X=>{_.current[ue]=X},className:"flex items-center gap-2",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx("input",{type:"text",value:J,onChange:X=>{h(ie=>{const ae=[...ie];return ae[ue]=X.target.value,ae})},placeholder:W||te?"Type or select a model...":"Model name",className:"w-full rounded-md border border-input bg-background px-4 py-3 pr-8 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),(W||te)&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",onClick:()=>R(j===ue?null:ue),className:"absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors p-1 z-10","aria-label":"Show model suggestions",children:i.jsx(gn,{className:"size-4"})}),j===ue&&i.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 bg-popover border border-border rounded-md shadow-md max-h-48 overflow-y-auto",children:(W?xa:va).map(X=>i.jsx("button",{type:"button",onClick:()=>{h(ie=>{const ae=[...ie];return ae[ue]=X,ae}),R(null)},className:"w-full text-left px-3 py-2 text-sm hover:bg-muted transition-colors",children:X},X))})]})]}),g.length>1&&i.jsx("button",{type:"button",onClick:()=>h(X=>X.filter((ie,ae)=>ae!==ue)),className:"text-muted-foreground hover:text-destructive transition-colors p-1 shrink-0","aria-label":"Remove model",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M3 6h18"}),i.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),i.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]})})]},ue)),i.jsx("button",{type:"button",onClick:()=>h(J=>[...J,""]),className:"text-xs text-primary hover:underline flex items-center gap-1",children:"+ Add Model"}),T.models!==void 0&&i.jsx("p",{className:"text-xs text-destructive",children:T.models})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex gap-1 border-b border-border",children:[i.jsx(Ze,{children:i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx("button",{type:"button",onClick:()=>f("anthropic"),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${x==="anthropic"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Anthropic Format"})}),i.jsx(Ie,{children:"Anthropic Messages API protocol"})]})}),i.jsx(Ze,{children:i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx("button",{type:"button",onClick:()=>f("openai"),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${x==="openai"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"OpenAI Format"})}),i.jsx(Ie,{children:"OpenAI Chat Completions API protocol"})]})})]}),T.format!==void 0&&i.jsx("p",{className:"text-xs text-destructive",children:T.format})]}),x==="anthropic"&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{htmlFor:"provider-anthropic-base-url",className:"text-sm font-medium",children:"Anthropic Base URL"}),i.jsx("input",{id:"provider-anthropic-base-url",type:"text",value:m,onChange:J=>{Z(!0),y(J.target.value)},placeholder:"https://api.anthropic.com",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),T.anthropicBaseUrl!==void 0&&i.jsx("p",{className:"text-xs text-destructive",children:T.anthropicBaseUrl}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Anthropic-compatible endpoint URL. Leave empty if this provider does not support Anthropic format."})]}),x==="openai"&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{htmlFor:"provider-openai-base-url",className:"text-sm font-medium",children:"OpenAI Base URL"}),i.jsx("input",{id:"provider-openai-base-url",type:"text",value:w,onChange:J=>{M(!0),k(J.target.value)},placeholder:"https://api.openai.com/v1",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),T.openaiBaseUrl!==void 0&&i.jsx("p",{className:"text-xs text-destructive",children:T.openaiBaseUrl}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"OpenAI-compatible endpoint URL. Leave empty if this provider does not support OpenAI format."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{htmlFor:"provider-api-docs-url",className:"text-sm font-medium",children:"API Docs URL"}),i.jsx("input",{id:"provider-api-docs-url",type:"text",value:C,onChange:J=>S(J.target.value),placeholder:"https://api.example.com/docs",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional API documentation URL. If not set, uses known provider docs."})]}),i.jsxs("div",{className:"sticky bottom-0 bg-card border-t flex gap-2 justify-end pt-2 pb-2",children:[i.jsx(je,{type:"button",variant:"outline",onClick:n,disabled:I,children:"Cancel"}),i.jsx(je,{type:"submit",disabled:I,children:I?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const eo=ne({id:B(),name:B(),apiKey:B(),model:B().optional(),models:_e(B()).min(1),format:Ue(["anthropic","openai"]).optional(),baseUrl:B().optional(),anthropicBaseUrl:B().optional(),openaiBaseUrl:B().optional(),authHeader:Ue(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:B().optional(),source:Ue(["company","personal"]).optional(),createdAt:B(),updatedAt:B()}),w5=Ue(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),_5=ne({message:B(),type:w5,details:B().optional(),hint:B().optional()}),k5=ne({type:Ue(["text","thinking"]),text:B().optional(),thinking:B().optional()}),C5=ne({success:Be(),error:_5.optional(),model:B().optional(),inputTokens:pe().optional(),outputTokens:pe().optional(),cacheCreationInputTokens:pe().optional(),cacheReadInputTokens:pe().optional(),latencyMs:pe().optional(),content:_e(k5).optional(),rawResponse:B().optional(),streaming:Be().optional(),streamingChunks:ne({chunks:_e(xl),truncated:Be().default(!1)}).optional(),requestHeaders:gt(B(),B()).optional()}),ya=yt([C5,ne({notConfigured:ve(!0)}),ne({testing:ve(!0)})]),Ir=ne({nonStreaming:ya,streaming:ya}),S5=ne({anthropic:Ir,openai:Ir}),j5=ne({anthropic:Ir,openai:Ir,models:gt(B(),S5).optional(),testedAt:B().optional()});function N5(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function ba(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n()}}const E5=ne({providerConfig:B()}),T5=ne({success:Be().optional(),imported:pe().optional(),message:B().optional(),errors:_e(B()).optional()}),A5=30,Ss="Network error: could not reach the server. Is the proxy running?";function wa(e){return{name:e.name,apiKey:e.apiKey,models:e.models,anthropicBaseUrl:(e.anthropicBaseUrl?.length??0)>0?e.anthropicBaseUrl:void 0,openaiBaseUrl:(e.openaiBaseUrl?.length??0)>0?e.openaiBaseUrl:void 0,apiDocsUrl:(e.apiDocsUrl?.length??0)>0?e.apiDocsUrl:void 0,source:e.source}}async function z5(e,t){if(t.models!==void 0)try{await fetch(`/api/providers/${e}/test/log`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{}}function O5({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:r,externalTestingTimeLeft:s,onProvidersMutate:o,onTestResultsChange:a,onTestingProvidersChange:l,onTestingTimeLeftChange:c}){const[u,d]=v.useState(!1),[p,g]=v.useState(),[h,x]=v.useState(null),[f,m]=v.useState({}),[y,w]=v.useState(new Set),[k,C]=v.useState({}),[S,O]=v.useState(null),[N,T]=v.useState(!1),[z,I]=v.useState(null),[K,j]=v.useState(!1),[R,_]=v.useState(!1),[F,Z]=v.useState(null),[P,M]=v.useState("all"),W=v.useRef(null),te=v.useRef(null),V=e??[],U=v.useMemo(()=>{const $=P==="all"?V:V.filter(H=>H.source===P);return P==="all"?[...$].sort((H,D)=>{const Q={personal:0,company:1};return(Q[H.source??""]??2)-(Q[D.source??""]??2)}):$},[V,P]),re=n??f,ee=r??y,J=s??k,ue=c?($,H)=>c($,H):($,H)=>{C(H===void 0?D=>{const Q={...D};return delete Q[$],Q}:D=>({...D,[$]:H}))};v.useEffect(()=>{(async()=>{try{const $=await fetch("/api/config/paths");if($.ok){const H=await _t($,E5);O(H.providerConfig)}}catch{}})()},[]);const X=v.useCallback($=>{te.current!==null&&clearTimeout(te.current),I($),W.current?.scrollTo({top:W.current.scrollHeight,behavior:"smooth"}),te.current=setTimeout(()=>{I(null),te.current=null},2e3)},[]);v.useEffect(()=>()=>{te.current!==null&&clearTimeout(te.current)},[]);const ie=v.useCallback(()=>{o?.().catch(()=>{})},[o]),ae=v.useCallback(($,H)=>{a?a($,H):m(D=>({...D,[$]:H}))},[a]),me=v.useCallback(($,H)=>{if(l){l($,H);return}w(D=>{const Q=new Set(D);return H?Q.add($):Q.delete($),Q})},[l]),he=v.useCallback(async $=>{ae($,N5()),me($,!0);const H=new AbortController;let D=A5;ue($,D);const Q=setInterval(()=>{D--,ue($,D),D<=0&&(clearInterval(Q),H.abort())},1e3);try{const oe=await fetch(`/api/providers/${$}/test`,{method:"POST",signal:H.signal});if(oe.ok){const se=await _t(oe,j5);ae($,se),await z5($,se)}else ae($,ba(`HTTP ${oe.status}: ${oe.statusText}`,"server_error"))}catch(oe){oe instanceof Error&&oe.name==="AbortError"&&ae($,ba("Request timed out","timeout"))}finally{clearInterval(Q),ue($,void 0),me($,!1)}},[ue,ae,me]);function we($){(async()=>{try{const H=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(wa($))});if(!H.ok){x(await rn(H,"Failed to add provider"));return}const D=await _t(H,eo);d(!1),X(D.id),ie(),await he(D.id)}catch{x(Ss)}})()}function Ne($){p&&(async()=>{try{const H=await fetch(`/api/providers/${p.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(wa($))});if(!H.ok){x(await rn(H,"Failed to update provider"));return}const D=await _t(H,eo);g(void 0),X(D.id),ie(),(($.apiKey??"")!==(p.apiKey??"")||JSON.stringify($.models)!==JSON.stringify(p.models)||($.anthropicBaseUrl??"")!==(p.anthropicBaseUrl??"")||($.openaiBaseUrl??"")!==(p.openaiBaseUrl??""))&&await he(D.id)}catch{x(Ss)}})()}function b($){Z($),_(!0)}function Y(){const $=F;$!==null&&(async()=>{let H;try{H=await fetch(`/api/providers/${$}`,{method:"DELETE"})}catch{x(Ss);return}if(!H.ok){x(await rn(H,"Failed to delete provider"));return}ie()})()}const q=v.useRef(null);function A($){const H="/api/providers/export";(async()=>{try{const D=await fetch(H);if(!D.ok){x("Failed to export providers");return}const Q=await D.blob(),oe=URL.createObjectURL(Q),se=document.createElement("a");se.href=oe,se.download=D.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(se),se.click(),document.body.removeChild(se),URL.revokeObjectURL(oe)}catch{x("Failed to export providers")}})()}function E(){q.current?.click()}function L($){const H=$.target.files?.[0];H&&(async()=>{try{const D=await H.text(),Q=await fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)}),oe=await _t(Q,T5);Q.ok&&oe.imported!==void 0&&oe.imported>0?(ie(),x(null)):oe.errors&&oe.errors.length>0?x(oe.errors.join("; ")):x(oe.message??"Import failed")}catch{x("Failed to import providers")}$.target.value=""})()}return t?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading providers..."})}):u||p?i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"flex items-center justify-between sticky top-0 bg-background z-10 pb-2",children:i.jsx("h3",{className:"text-lg font-medium",children:p?"Edit Provider":"Add New Provider"})}),i.jsx(b5,{provider:p,onSubmit:p?Ne:we,onCancel:()=>{d(!1),g(void 0)}})]}):i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between sticky top-0 z-10 bg-background pb-2",children:[i.jsx("h3",{className:"text-lg font-medium",children:"Providers"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ze,{children:i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsxs(je,{variant:"outline",size:"sm",onClick:()=>A(),className:"gap-1 hover:bg-muted",children:[i.jsx(fo,{className:"size-3"}),"Export"]})}),i.jsx(Ie,{children:"Download providers as JSON for backup or sharing"})]})}),i.jsx(Ze,{children:i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsxs(je,{variant:"outline",size:"sm",onClick:E,className:"gap-1 hover:bg-muted",children:[i.jsx(xx,{className:"size-3"}),"Import"]})}),i.jsx(Ie,{children:"Import providers from an exported JSON file"})]})}),i.jsx("input",{type:"file",ref:q,accept:".json",onChange:L,style:{display:"none"}}),i.jsx(Ze,{children:i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsxs(je,{variant:"outline",size:"sm",onClick:()=>j(!0),className:"gap-1",children:[i.jsx(ix,{className:"size-3"}),"Scan"]})}),i.jsx(Ie,{children:"Detect and import provider configs from Claude Code and OpenCode"})]})}),i.jsxs(je,{onClick:()=>d(!0),size:"sm",className:"gap-1",children:[i.jsx(Is,{className:"size-4"}),"Add Provider"]})]})]}),S!==null&&i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/30 rounded-md px-3 py-2",children:[i.jsx("span",{className:"shrink-0",children:"Config:"}),i.jsx("span",{className:"font-mono truncate",title:S,children:S}),i.jsx(Ze,{children:i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx("button",{type:"button",onClick:()=>{window.navigator.clipboard.writeText(S).then(()=>{T(!0),setTimeout(()=>T(!1),2e3)})},className:"shrink-0 ml-auto text-muted-foreground hover:text-foreground transition-colors",children:N?i.jsx(tt,{className:"size-3 text-green-500"}):i.jsx(Zt,{className:"size-3"})})}),i.jsx(Ie,{children:"Copy config file path to clipboard"})]})})]}),h!==null&&i.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive bg-destructive/10 rounded-md px-3 py-2",children:[i.jsx(Pn,{className:"size-4 shrink-0"}),h]}),V.length===0?i.jsxs("div",{className:"text-center py-12 space-y-3",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"No providers configured yet."}),i.jsxs(je,{onClick:()=>d(!0),variant:"outline",size:"sm",children:[i.jsx(Is,{className:"size-4"}),"Add Your First Provider"]})]}):i.jsxs("div",{className:"space-y-3",children:[i.jsx("div",{className:"flex gap-1 border-b border-border",children:["all","personal","company"].map($=>i.jsx(Ze,{children:i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx("button",{type:"button",onClick:()=>M($),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${P===$?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:$==="all"?"All":$==="personal"?"Personal":"Company"})}),i.jsx(Ie,{children:$==="all"?"Show all providers":$==="personal"?"Providers you configured yourself":"Providers set by your organization"})]})},$))}),i.jsx("div",{ref:W,className:"space-y-3",children:U.map($=>i.jsx(v5,{provider:$,testResults:re[$.id],isTesting:ee.has($.id),testingTimeLeft:J[$.id],isHighlighted:$.id===z,onEdit:H=>g(H),onDelete:b,onTest:H=>{he(H)}},$.id))})]}),i.jsx(f5,{open:K,onOpenChange:j,onImportComplete:()=>{o!==void 0&&o()}}),i.jsx(Uu,{open:R,onOpenChange:_,title:"Delete Provider",description:"Are you sure you want to delete this provider? This action cannot be undone.",confirmLabel:"Delete",variant:"destructive",onConfirm:Y})]})}async function I5(e){return Zn(e,eo.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function R5(){const e=to("/api/providers",I5,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}function P5(){const[e,t]=v.useState(!1),[n,r]=v.useState("providers"),{providers:s,isLoading:o,mutate:a}=R5(),[l,c]=v.useState({}),[u,d]=v.useState(new Set),[p,g]=v.useState({}),h=v.useCallback((m,y)=>{c(w=>({...w,[m]:y}))},[]),x=v.useCallback((m,y)=>{d(w=>{const k=new Set(w);return y?k.add(m):k.delete(m),k})},[]),f=v.useCallback((m,y)=>{g(w=>{if(y===void 0){const k={...w};return delete k[m],k}return{...w,[m]:y}})},[]);return i.jsxs(Do,{open:e,onOpenChange:t,children:[i.jsx(ew,{asChild:!0,children:i.jsxs(je,{variant:"ghost",size:"icon",className:"size-8",children:[i.jsx(ux,{className:"size-4"}),i.jsx("span",{className:"sr-only",children:"Settings"})]})}),i.jsxs(Lo,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[i.jsx(Fo,{children:i.jsx($o,{children:"Settings"})}),i.jsxs(Ku,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[i.jsxs(Ju,{children:[i.jsx(it,{value:"providers",children:"Providers"}),i.jsx(it,{value:"proxy",children:"Proxy"}),i.jsx(it,{value:"onboarding",children:"Onboarding"})]}),i.jsxs("div",{className:"mt-4 overflow-y-auto flex-1 pr-3",children:[i.jsx(at,{value:"providers",children:i.jsx(O5,{externalProviders:s,isLoading:o,externalTestResults:l,externalTestingProviders:u,externalTestingTimeLeft:p,onProvidersMutate:()=>a(),onTestResultsChange:h,onTestingProvidersChange:x,onTestingTimeLeftChange:f})}),i.jsx(at,{value:"proxy",children:i.jsx(L5,{})}),i.jsx(at,{value:"onboarding",children:i.jsx(D5,{})})]})]})]})]})}function M5({id:e,label:t,value:n,copiedId:r,onCopy:s}){const o=r===e;return i.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[i.jsx("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:t}),i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:n}),i.jsx(je,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0",onClick:()=>s(e,n),"aria-label":o?`Copied ${t}`:`Copy ${t}`,children:o?i.jsx(tt,{className:"size-3.5 text-emerald-500"}):i.jsx(Zt,{className:"size-3.5"})})]})]})}function D5(){const[e,t]=v.useState(null),n=v.useMemo(()=>typeof window>"u"?"http://localhost:25947":window.location.origin,[]),r=v.useMemo(()=>[{id:"skill",label:"Codex skill",value:"agent-inspector onboard --force"},{id:"mcp",label:"MCP URL",value:`${n}/api/mcp`},{id:"proxy",label:"Proxy URL",value:`${n}/proxy`},{id:"anthropic",label:"Anthropic base",value:`ANTHROPIC_BASE_URL=${n}/proxy`}],[n]),s=v.useCallback((o,a)=>{window.navigator.clipboard.writeText(a).then(()=>{t(o),setTimeout(()=>t(null),1600)})},[]);return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(hx,{className:"size-4 text-muted-foreground"}),i.jsx("h3",{className:"text-sm font-semibold",children:"Agent onboarding"})]}),i.jsx("div",{className:"grid gap-2",children:r.map(o=>i.jsx(M5,{id:o.id,label:o.label,value:o.value,copiedId:e,onCopy:s},o.id))}),i.jsxs("div",{className:"grid gap-2 rounded-md border border-border bg-background px-3 py-2 text-xs text-muted-foreground",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(tt,{className:"size-3.5 text-emerald-500"}),i.jsx("span",{children:"Provider test creates a traceable memory probe session."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(tt,{className:"size-3.5 text-emerald-500"}),i.jsx("span",{children:"Captured sessions can produce reviewable memory candidates."})]})]})]})}function L5(){const{strip:e,slowResponseThresholdSeconds:t,timeDisplayFormat:n,isLoading:r,setStrip:s,setSlowResponseThresholdSeconds:o,setTimeDisplayFormat:a}=yl(),[l,c]=v.useState(null),[u,d]=v.useState(!1),p=v.useCallback(async x=>{c(null),d(!0);try{await s(x)}catch(f){c(f instanceof Error?f.message:String(f))}finally{d(!1)}},[s]),g=v.useCallback(async x=>{c(null),d(!0);try{await o(x)}catch(f){c(f instanceof Error?f.message:String(f))}finally{d(!1)}},[o]),h=v.useCallback(async x=>{c(null),d(!0);try{await a(x)}catch(f){c(f instanceof Error?f.message:String(f))}finally{d(!1)}},[a]);return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("h3",{className:"text-sm font-semibold",children:"Claude Code billing header"}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["When enabled, the proxy strips the synthetic ",i.jsx("code",{children:"x-anthropic-billing-header"})," text block that Claude Code prepends to the system prompt before forwarding to upstream. Improves prefix-cache hit rates against third-party upstreams. The default at startup is controlled by the ",i.jsx("code",{children:"AGENT_INSPECTOR_STRIP_CLAUDE_CODE_BILLING_HEADER"})," ","environment variable; your choice is persisted to ",i.jsx("code",{children:"config.json"})," and overrides the env var for subsequent requests."]})]}),i.jsxs("label",{className:"flex items-center gap-3",children:[i.jsx("input",{type:"checkbox",role:"switch",checked:e,disabled:r||u,onChange:x=>{p(x.currentTarget.checked)},className:"size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"}),i.jsx("span",{className:"text-sm",children:r?"Loading…":e?"Stripping enabled":"Stripping disabled"})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{htmlFor:"slow-response-threshold",className:"text-sm font-semibold",children:"Slow response threshold"}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Logs whose elapsed time exceeds this many seconds show a warning icon next to the duration. Set to ",i.jsx("code",{children:"0"})," to disable the indicator."]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{id:"slow-response-threshold",type:"number",min:0,max:Os,step:1,value:t,disabled:r||u,onChange:x=>{const f=Number(x.currentTarget.value);Number.isInteger(f)&&(f<0||f>Os||g(f))},className:"h-8 w-24 rounded-md border border-input bg-transparent px-2 text-sm font-mono disabled:cursor-not-allowed disabled:opacity-50"}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds"})]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{htmlFor:"time-display-format",className:"text-sm font-semibold",children:"Time display"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Controls timestamps in session summaries, conversation headers, and log rows."}),i.jsxs("select",{id:"time-display-format",value:n,disabled:r||u,onChange:x=>{const f=vl.safeParse(x.currentTarget.value);f.success&&h(f.data)},className:"h-8 rounded-md border border-input bg-background px-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:[i.jsx("option",{value:"time",children:"Time only"}),i.jsx("option",{value:"full",children:"Full ISO"})]})]}),l!==null&&i.jsxs("p",{className:"text-xs text-destructive",children:["Failed to save: ",l]})]})}function F5(e){const t=new Map;for(const n of e){const r=n.logs;for(let s=1;s<r.length;s++){const o=r[s-1],a=r[s];o===void 0||a===void 0||t.set(a.id,{creation:_a(o.cacheCreationInputTokens,a.cacheCreationInputTokens),read:_a(o.cacheReadInputTokens,a.cacheReadInputTokens)})}}return t}function _a(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const Rr="data-nav-id",$5="data-nav-action";function ka(e){return Array.from(e.querySelectorAll(`[${Rr}]`))}function Ca(e){return e instanceof HTMLElement}function B5(e,t){let n=e;for(;n!==null&&n!==t;){if(n.hasAttribute(Rr))return n;n=n.parentElement}return e.hasAttribute(Rr)?e:null}function js(e){const t=e.getAttribute($5);return t==="toggle"||t==="expand"||t==="collapse"?t:null}function En(e){e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",behavior:"smooth"})}function Tn(e,t){return e[t]??null}function fd(e){const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}function Sa(e){const t=e.tagName;return t==="BUTTON"||t==="A"||fd(e)?!0:e.closest("[role='button'],[role='menuitem'],[role='option']")!==null}function U5(e){return e.closest("[role='dialog'],[role='menu'],[role='listbox']")!==null?!0:document.querySelector("[role='dialog'],[role='menu'],[role='listbox']")!==null}function Z5(){const e=window.getSelection();return e===null?!1:e.type==="Range"&&e.toString().length>0}function fr(e,t){return e.key===t&&e.shiftKey}function W5(e,t,n={}){const r=t??e,s=n.pageWide===!0,o=v.useCallback(a=>{const l=e.current,c=r.current;if(!l||!c)return;const u=a.target;if(!Ca(u)||u!==c)return;const d=ka(l),p=Tn(d,0);p!==null&&En(p)},[e,r]);v.useEffect(()=>{const a=l=>{if(l.altKey||l.ctrlKey||l.metaKey)return;const c=e.current;if(!c)return;const u=l.target;if(!Ca(u)||fd(u)||Z5())return;const d=c.contains(u);if(d&&Sa(u)&&!u.hasAttribute(Rr)||!d&&(!s||Sa(u)||U5(u)))return;const p=ka(c);if(p.length===0)return;const g=B5(u,c),h=g!==null?p.indexOf(g):-1;let x=!1;switch(l.key){case"ArrowUp":case"W":{if(l.shiftKey&&l.key==="ArrowUp"||l.key==="W"&&!fr(l,"W"))break;l.preventDefault();const f=h>0?h-1:h===-1?p.length-1:-1;if(f!==-1){const m=Tn(p,f);m!==null&&En(m)}x=!0;break}case"ArrowDown":case"S":{if(l.shiftKey&&l.key==="ArrowDown"||l.key==="S"&&!fr(l,"S"))break;l.preventDefault();const f=h<p.length-1?h+1:h===-1?0:-1;if(f!==-1){const m=Tn(p,f);m!==null&&En(m)}x=!0;break}case"ArrowLeft":case"A":{if(l.shiftKey&&l.key==="ArrowLeft"||l.key==="A"&&!fr(l,"A")||g===null)break;if(l.preventDefault(),js(g)==="collapse")g.click();else if(h>0){const m=Tn(p,h-1);m!==null&&En(m)}x=!0;break}case"ArrowRight":case"D":{if(l.shiftKey&&l.key==="ArrowRight"||l.key==="D"&&!fr(l,"D")||g===null)break;if(l.preventDefault(),js(g)==="expand")g.click();else if(h<p.length-1){const m=Tn(p,h+1);m!==null&&En(m)}x=!0;break}case" ":{if(g===null)break;l.preventDefault(),js(g)!==null&&g.click(),x=!0;break}}x&&l.stopPropagation()};return document.addEventListener("keydown",a,{capture:!0}),()=>document.removeEventListener("keydown",a,{capture:!0})},[e,s,r]),v.useEffect(()=>(document.addEventListener("focusin",o),()=>document.removeEventListener("focusin",o)),[o])}function gr(e){return e.length<=30?e:e.slice(0,12)+"…"+e.slice(-12)}function V5(e){let t=0,n=0;for(const r of e)r.inputTokens!==null&&(t+=r.inputTokens),r.outputTokens!==null&&(n+=r.outputTokens);return{totalIn:t,totalOut:n}}function H5(e,t){const n=e[0],r=e[e.length-1];return n===void 0||r===void 0?null:go(n.timestamp,r.timestamp,t)}function q5(e){for(const t of e)if(t.userAgent!==null&&t.userAgent!==void 0&&t.userAgent!=="")return t.userAgent;return null}function K5({command:e}){const[t,n]=v.useState(!1),r=v.useCallback(()=>{window.navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},[e]);return i.jsxs("div",{className:"inline-flex items-center gap-2 bg-muted rounded-md px-3 py-2",children:[i.jsx("pre",{className:"text-blue-500 font-mono text-sm m-0",children:e}),i.jsx("button",{type:"button",onClick:r,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 cursor-pointer","aria-label":"Copy command",children:t?i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M20 6 9 17l-5-5"})}):i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),i.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})]})}function J5(){return i.jsx(Ze,{children:i.jsxs(ze,{children:[i.jsx(Oe,{asChild:!0,children:i.jsxs("span",{className:"inline-flex h-7 items-center gap-2 rounded-md border border-cyan-400/30 bg-cyan-500/10 px-2.5 font-mono text-[11px] font-medium text-cyan-300 shadow-[0_0_16px_rgba(34,211,238,0.08)]",children:[i.jsx("span",{className:"size-1.5 rounded-full bg-emerald-300 shadow-[0_0_8px_rgba(110,231,183,0.8)]"}),"MCP Ready",i.jsx("span",{className:"hidden text-cyan-200/70 sm:inline",children:"/api/mcp"})]})}),i.jsx(Ie,{sideOffset:8,className:"max-w-[320px] text-left leading-relaxed",children:"Coding agents can inspect logs, replay requests, test providers, and debug sessions through MCP at /api/mcp."})]})})}function G5({sessionId:e,logs:t,totalIn:n,totalOut:r,timeDisplayFormat:s}){const[o,a]=v.useState(!1),l=v.useMemo(()=>H5(t,s),[t,s]),c=v.useMemo(()=>q5(t),[t]),u=v.useCallback(()=>{window.navigator.clipboard.writeText(window.location.href).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)})},[]);return i.jsxs("div",{className:"mb-4 flex items-center gap-3 border border-border rounded-md bg-muted/20 px-3 py-2 text-xs",children:[i.jsx("a",{href:"/",className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":"Back to all sessions",title:"Back to all sessions",children:i.jsx(Jg,{className:"size-3.5"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("span",{className:"font-mono font-semibold text-purple-400/90 truncate",title:e,children:gr(e)}),c!==null&&i.jsx("span",{className:"font-mono text-muted-foreground truncate max-w-[220px]",title:c,children:c})]}),i.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[i.jsxs("span",{children:[t.length," request",t.length!==1?"s":""]}),l!==null&&i.jsx("span",{children:l}),(n>0||r>0)&&i.jsxs("span",{className:"font-mono",children:[$e(n)," in / ",$e(r)," out"]})]})]}),i.jsx("button",{type:"button",onClick:u,className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":o?"Copied session link":"Copy session link",title:o?"Copied session link":"Copy session link",children:o?i.jsx(tt,{className:"size-3.5"}):i.jsx(Zt,{className:"size-3.5"})})]})}function Y5({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:s,onSessionChange:o,onModelChange:a,onClearAll:l,onClearGroup:c,viewMode:u,onViewModeChange:d,strip:p,slowResponseThresholdSeconds:g,timeDisplayFormat:h,hideSessionFilter:x=!1,pinnedSessionId:f}){const{totalIn:m,totalOut:y}=v.useMemo(()=>V5(e),[e]),[w,k]=v.useState(!1),[C,S]=v.useState(null),[O,N]=v.useState("hidden"),T=v.useRef(null),z=v.useRef(null);W5(T,z,{pageWide:!0}),v.useEffect(()=>{const W=50+Bn.length*400,te=setTimeout(()=>N("playing"),50),V=setTimeout(()=>N("done"),W);return()=>{clearTimeout(te),clearTimeout(V)}},[]),v.useEffect(()=>{if(f===void 0){document.title="Agent Inspector";return}const P=e.length===1?"1 req":`${e.length} req`;document.title=`${gr(f)} - ${P} - Agent Inspector`},[e.length,f]);const I=v.useCallback(async()=>{k(!0);try{await Px(e)}finally{k(!1)}},[e]);v.useEffect(()=>{S(null)},[r,s]);const K=v.useCallback(()=>{S(null)},[]),j=v.useMemo(()=>cw(e),[e]),R=f!==void 0,_=v.useMemo(()=>F5(j),[j]),F=v.useMemo(()=>_k(j),[j]),Z=v.useCallback(P=>{const M=F.get(P.id);M!==void 0&&S([M,P])},[F]);return i.jsxs("div",{className:"max-w-[1400px] xl:max-w-[1600px] 2xl:max-w-[1800px] mx-auto px-6 pb-6",children:[i.jsxs("div",{className:"sticky top-0 z-30 bg-background pt-6",children:[i.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-start gap-3 pb-8",children:[i.jsx("div",{}),i.jsxs("h1",{className:"flex min-w-0 flex-col items-center gap-2 text-center",children:[i.jsxs("span",{className:"flex max-w-[calc(100vw-7rem)] items-end gap-2 whitespace-nowrap",children:[i.jsxs("span",{className:"flex shrink-0 items-end gap-1 group cursor-default","aria-hidden":"true",children:[i.jsx(e5,{className:"size-10 text-amber-500 transition-all duration-300 group-hover:scale-125 group-hover:-translate-y-1.5"}),i.jsx("span",{className:"hidden items-end gap-0.5 sm:flex",children:Bn.map((P,M)=>{const W=["text-amber-500","text-rose-500","text-sky-500","text-emerald-500","text-violet-500","text-orange-500","text-cyan-500","text-pink-500","text-lime-500","text-blue-500","text-yellow-500","text-fuchsia-500"][M],te=O==="hidden"?"opacity-0 scale-0":O==="playing"?"animate-crab-piano-pop":"";return i.jsx(P,{className:`size-5 ${W} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${te}`,style:{transitionDelay:`${M*50}ms`,...O==="playing"?{animationDelay:`${M*400}ms`}:{}}},M)})})]}),i.jsxs("span",{className:"flex min-w-0 items-baseline gap-2 pl-1",children:[i.jsx("span",{className:"truncate text-lg font-bold",children:"Agent Inspector"}),i.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold text-muted-foreground",children:["v",j1.version]})]}),i.jsx(Is,{className:"size-4 shrink-0 text-muted-foreground/70","aria-hidden":"true"}),i.jsx(n5,{className:"size-10 shrink-0"})]}),i.jsx(J5,{})]}),i.jsx("div",{className:"justify-self-end",children:i.jsx(P5,{})})]}),f!==void 0&&i.jsx(G5,{sessionId:f,logs:e,totalIn:m,totalOut:y,timeDisplayFormat:h}),i.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[!x&&i.jsxs(ha,{value:r,onValueChange:o,children:[i.jsx(ma,{className:"flex-1 max-w-[350px] text-xs",children:i.jsx(pa,{placeholder:"All sessions"})}),i.jsxs(ga,{children:[i.jsx(ur,{value:"__all__",children:"All sessions"}),t.map(P=>i.jsx(ur,{value:P,children:gr(P)},P))]})]}),i.jsxs(ha,{value:s,onValueChange:a,children:[i.jsx(ma,{className:"flex-1 max-w-[250px] text-xs",children:i.jsx(pa,{placeholder:"All models"})}),i.jsxs(ga,{children:[i.jsx(ur,{value:"__all__",children:"All models"}),n.map(P=>i.jsx(ur,{value:P,children:P},P))]})]}),i.jsxs("div",{className:"flex items-center border border-border rounded-md overflow-hidden",children:[i.jsx("button",{type:"button",onClick:()=>d("simple"),className:`h-8 px-3 cursor-pointer transition-colors text-xs ${u==="simple"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Simple"}),i.jsx("button",{type:"button",onClick:()=>d("full"),className:`h-8 px-3 cursor-pointer transition-colors text-xs ${u==="full"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Full"})]}),i.jsx("div",{className:"flex-1"}),!R&&i.jsxs("span",{className:"text-muted-foreground text-xs font-mono",children:[e.length," request",e.length!==1?"s":"",m>0||y>0?` · ${$e(m)} in / ${$e(y)} out`:""]}),e.length>0&&i.jsx("button",{type:"button",onClick:()=>{I()},disabled:w,className:"h-8 px-3 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center gap-1.5 rounded-md hover:bg-muted",title:"Export all logs as JSON ZIP",children:w?i.jsx("span",{children:"Exporting..."}):i.jsxs(i.Fragment,{children:[i.jsx(fo,{className:"size-3.5"}),i.jsx("span",{children:"Export"})]})}),i.jsx("button",{type:"button",onClick:l,className:"h-8 px-3 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer rounded-md hover:bg-muted",title:"Clear all logs",children:"Clear"})]})]}),i.jsx("div",{children:e.length===0?r!=="__all__"?i.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[i.jsx("p",{className:"text-sm font-medium",children:"Session not found"}),i.jsx("p",{className:"text-xs font-mono bg-muted px-3 py-1 rounded inline-block max-w-[500px] break-all",children:gr(r)}),i.jsxs("p",{className:"text-xs",children:["This session may have been cleared or never existed."," ",x?i.jsx("a",{href:"/",className:"underline hover:text-foreground transition-colors",children:"Back to all sessions"}):i.jsx("button",{type:"button",onClick:()=>o("__all__"),className:"underline hover:text-foreground transition-colors",children:"Show all sessions"})]})]}):i.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[i.jsx("p",{className:"text-sm",children:"No requests captured yet."}),i.jsx("p",{className:"text-xs",children:"Route AI coding tools through the proxy:"}),i.jsx(K5,{command:"LLM_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}):i.jsx("div",{ref:z,tabIndex:0,className:"flex flex-col gap-2 focus:outline-none",children:i.jsx("div",{ref:T,children:j.map(P=>i.jsx(Qk,{group:P,viewMode:u,strip:p,slowResponseThresholdSeconds:g,cacheTrends:_,onCompareWithPrevious:Z,comparisonPredecessors:F,onClearGroup:c,standalone:j.length===1,hasPinnedSessionContext:R,timeDisplayFormat:h},P.id))})})}),C!==null&&i.jsx(v.Suspense,{fallback:null,children:i.jsx(qw,{left:C[0],right:C[1],onClose:K})})]})}const X5=yt([ne({type:ve("init"),logs:_e(pi)}),ne({type:ve("update"),log:pi})]);function Q5(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function eC(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function tC(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(r=>!(t!=="__all__"&&r.sessionId!==t||n!=="__all__"&&r.model!==n))}const nC=50,rC=12,sC=1800;function oC(e){return e===void 0?"/api/logs/stream":`/api/logs/stream?${new URLSearchParams({sessionId:e}).toString()}`}function lC({initialSessionId:e}={}){const[t,n]=v.useState([]),[r,s]=v.useState(e??"__all__"),[o,a]=v.useState("__all__"),[l,c]=v.useState("simple"),[u,d]=v.useState(null),p=v.useRef(null),g=v.useRef(null),h=v.useRef(null),x=v.useRef(new Map),f=v.useRef([]),m=v.useRef(null),y=v.useMemo(()=>tC(t,r,o),[t,r,o]),w=v.useMemo(()=>Q5(t),[t]),k=v.useMemo(()=>eC(t),[t]),C=v.useCallback(()=>{m.current=null;const j=f.current;f.current=[],j.length!==0&&n(R=>{let _=R;for(const F of j){const Z=x.current.get(F.id);Z!==void 0?_=[..._.slice(0,Z),F,..._.slice(Z+1)]:(x.current.set(F.id,_.length),_=[..._,F])}return _})},[]),S=v.useCallback(j=>{f.current.push(j),m.current===null&&(m.current=setTimeout(C,nC))},[C]),O=v.useCallback(()=>{p.current&&p.current.close();const j=new EventSource(oC(e));p.current=j,j.onmessage=R=>{try{const _=String(R.data),F=JSON.parse(_),Z=X5.safeParse(F);if(!Z.success){d("Failed to parse SSE data");return}const P=Z.data;if(P.type==="init"){m.current!==null&&(clearTimeout(m.current),m.current=null),f.current=[];const M=new Map;for(let W=0;W<P.logs.length;W++){const te=P.logs[W];te!==void 0&&M.set(te.id,W)}x.current=M,n(P.logs),d(null)}else P.type==="update"&&S(P.log)}catch{d("Failed to parse SSE data")}},j.onerror=()=>{d("SSE connection lost, reconnecting..."),j.close(),g.current!==null&&clearTimeout(g.current),g.current=setTimeout(O,3e3)}},[e,S]);v.useEffect(()=>(O(),()=>{p.current&&(p.current.close(),p.current=null),g.current!==null&&(clearTimeout(g.current),g.current=null),m.current!==null&&(clearTimeout(m.current),m.current=null)}),[O]),v.useEffect(()=>{const j=window.location.hash;if(!j.startsWith("#log-")||h.current===j)return;const R=j.slice(1);let _=!1,F=0,Z=null,P=null;const M=()=>{if(_)return;const W=document.getElementById(R);if(W!==null){h.current=j,W.scrollIntoView({block:"center",behavior:"smooth"}),W instanceof HTMLElement&&(Z=W,W.setAttribute("data-deep-link-highlight","true"),P=window.setTimeout(()=>{W.removeAttribute("data-deep-link-highlight")},sC),W.focus({preventScroll:!0}),W.getAttribute("data-nav-action")==="expand"&&W.click());return}F+=1,F<rC&&window.setTimeout(M,100)};return M(),()=>{_=!0,P!==null&&window.clearTimeout(P),Z!==null&&Z.removeAttribute("data-deep-link-highlight")}},[y.length]);const N=v.useCallback(()=>{e!==void 0&&t.length===0||(async()=>{try{const j=e===void 0?void 0:JSON.stringify({ids:t.map(_=>_.id)});if(!(await fetch("/api/logs",{method:"DELETE",...j===void 0?{}:{headers:{"Content-Type":"application/json"},body:j}})).ok){d("Failed to clear logs");return}x.current.clear(),n([]),d(null)}catch(j){d(j instanceof Error?j.message:"Unknown error clearing logs")}})()},[t,e]),T=v.useCallback(j=>{j.length!==0&&(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:j})})).ok){d("Failed to clear group");return}const _=new Set(j);n(F=>{const Z=F.filter(M=>!_.has(M.id)),P=new Map;for(let M=0;M<Z.length;M++){const W=Z[M];W!==void 0&&P.set(W.id,M)}return x.current=P,Z}),d(null)}catch(R){d(R instanceof Error?R.message:"Unknown error clearing group")}})()},[]),{strip:z,slowResponseThresholdSeconds:I,timeDisplayFormat:K}=yl();return i.jsxs(i.Fragment,{children:[u!==null&&i.jsx("div",{className:"fixed top-4 right-4 bg-destructive text-destructive-foreground px-4 py-2 rounded-md text-sm z-50",children:u}),i.jsx(Ax,{}),i.jsx(Y5,{logs:y,sessions:w,models:k,selectedSession:r,selectedModel:o,onSessionChange:s,onModelChange:a,onClearAll:N,onClearGroup:T,viewMode:l,onViewModeChange:c,strip:z,slowResponseThresholdSeconds:I,timeDisplayFormat:K,hideSessionFilter:e!==void 0,pinnedSessionId:e})]})}export{C1 as $,pe as A,$n as B,y0 as C,Do as D,B as E,fn as F,Se as G,mt as H,ye as I,Vt as J,Re as K,We as L,W0 as M,Wt as N,yo as O,lC as P,jt as Q,nx as R,Yi as S,Ku as T,wl as U,gn as V,hx as W,mo as X,Gs as Y,Dn as Z,_r as _,lw as a,Mn as a0,Vw as a1,o0 as a2,xe as b,fe as c,Is as d,Cl as e,$e as f,ck as g,Wn as h,tt as i,Zt as j,Lo as k,Fo as l,$o as m,Q0 as n,Ju as o,it as p,at as q,Or as r,Ze as s,ze as t,R5 as u,Oe as v,Ie as w,je as x,ne as y,Be as z};