@muxcodecli/cli 1.15.18 → 1.15.19

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.
@@ -0,0 +1,228 @@
1
+ // @bun
2
+ import{il as Ue,jl as T,nl as E}from"./chunk-sjd8mzvx.js";import{om as S}from"./chunk-an9wvc2n.js";import{Dn as qe,En as je}from"./chunk-8cm9znxk.js";import{$o as se,Ar as J,Bq as xe,Ep as ee,Gr as Ae,Hr as ve,Jp as F,Op as W,Rp as O,Xr as Z,_r as l,dp as De,gq as D,no as Q,po as I,up as ie,uq as me,wp as be,xp as B,xq as ke,zq as fe}from"./chunk-a0srn4ak.js";import{xs as C}from"./chunk-8jy0dvcn.js";import{wv as we}from"./chunk-ng3vbpmy.js";import{AF as e,Aw as ye,Dw as _,Fx as V,Rx as G,Yz as v,eC as t,fz as oe,gA as re}from"./chunk-1mqsg5s7.js";import{SF as ne}from"./chunk-8j3aw4qg.js";var U={};ne(U,{layer:()=>ae,defaultLayer:()=>Me,Truncate:()=>U,Service:()=>K,MAX_LINES:()=>M,MAX_BYTES:()=>X,GLOB:()=>Ze,DIR:()=>Ie});import L from"path";var Ne=e.String.check(e.isStartsWith("tool")).pipe(e.brand("ToolID")),te=Ne.pipe(ee((n)=>({ascending:(r)=>n.make(F.ascending("tool",r))})));import Qe from"path";var H=Qe.join(C.Path.data,"tool-output");var Ve=se({service:"truncation"}),Te=G.days(7),M=2000,X=51200,Ie=H,Ze=L.join(H,"*");function Le(n){if(!n?.permission)return!1;return Z("task","*",n.permission).action!=="deny"}class K extends V.Service()("@muxcode/Truncate"){}var ae=v.effect(K,t.gen(function*(){let n=yield*B.Service,r=t.fn("Truncate.cleanup")(function*(){let p=F.timestamp(F.create("tool","ascending",Date.now()-G.toMillis(Te))),g=yield*n.readDirectory(H).pipe(t.map((u)=>u.filter((w)=>w.startsWith("tool_"))),t.catch(()=>t.succeed([])));for(let u of g){if(F.timestamp(u)>=p)continue;yield*n.remove(L.join(H,u)).pipe(t.catch(()=>t.void))}}),o=t.fn("Truncate.write")(function*(p){let g=L.join(H,te.ascending());return yield*n.ensureDir(H).pipe(t.orDie),yield*n.writeFileString(g,p).pipe(t.orDie),g}),c=t.fn("Truncate.limits")(function*(){let p=yield*t.serviceOption(J.Service);if(_.isNone(p))return{maxLines:M,maxBytes:X};let g=yield*p.value.get().pipe(t.catch(()=>t.succeed(void 0)));return{maxLines:g?.tool_output?.max_lines??M,maxBytes:g?.tool_output?.max_bytes??X}}),a=t.fn("Truncate.output")(function*(p,g={},u){let w=yield*c(),f=g.maxLines??w.maxLines,A=g.maxBytes??w.maxBytes,x=g.direction??"head",y=p.split(`
3
+ `),b=Buffer.byteLength(p,"utf-8");if(y.length<=f&&b<=A)return{content:p,truncated:!1};let d=[],m=0,q=0,j=!1;if(x==="head")for(m=0;m<y.length&&m<f;m++){let R=Buffer.byteLength(y[m],"utf-8")+(m>0?1:0);if(q+R>A){j=!0;break}d.push(y[m]),q+=R}else for(m=y.length-1;m>=0&&d.length<f;m--){let R=Buffer.byteLength(y[m],"utf-8")+(d.length>0?1:0);if(q+R>A){j=!0;break}d.unshift(y[m]),q+=R}let k=j?b-q:y.length-d.length,i=j?"bytes":"lines",h=d.join(`
4
+ `),s=yield*o(p),z=Le(u)?`The tool call succeeded but the output was truncated. Full output saved to: ${s}
5
+ Use the Task tool to have explore agent process this file with Grep and Read (with offset/limit). Do NOT read the full file yourself - delegate to save context.`:`The tool call succeeded but the output was truncated. Full output saved to: ${s}
6
+ Use Grep to search the full content or Read with offset/limit to view specific sections.`;return{content:x==="head"?`${h}
7
+
8
+ ...${k} ${i} truncated...
9
+
10
+ ${z}`:`...${k} ${i} truncated...
11
+
12
+ ${z}
13
+
14
+ ${h}`,truncated:!0,outputPath:s}});return yield*r().pipe(t.catchCause((p)=>{return Ve.error("truncation cleanup failed",{cause:oe.pretty(p)}),t.void}),t.repeat(re.spaced(G.hours(1))),t.delay(G.minutes(1)),t.forkScoped),K.of({cleanup:r,write:o,output:a,limits:c})})),Me=ae.pipe(v.provide(B.defaultLayer),v.provide(ie.layer));var N={};ne(N,{use:()=>et,layer:()=>Ye,defaultLayer:()=>tt,Service:()=>$,Info:()=>Pe,Agent:()=>N});var he=`You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.
15
+
16
+ **Important Context**: You may have access to project-specific instructions from CLAUDE.md files and other context that may include coding standards, project structure, and custom requirements. Consider this context when creating agents to ensure they align with the project's established patterns and practices.
17
+
18
+ When a user describes what they want an agent to do, you will:
19
+
20
+ 1. **Extract Core Intent**: Identify the fundamental purpose, key responsibilities, and success criteria for the agent. Look for both explicit requirements and implicit needs. Consider any project-specific context from CLAUDE.md files. For agents that are meant to review code, you should assume that the user is asking to review recently written code and not the whole codebase, unless the user has explicitly instructed you otherwise.
21
+
22
+ 2. **Design Expert Persona**: Create a compelling expert identity that embodies deep domain knowledge relevant to the task. The persona should inspire confidence and guide the agent's decision-making approach.
23
+
24
+ 3. **Architect Comprehensive Instructions**: Develop a system prompt that:
25
+
26
+ - Establishes clear behavioral boundaries and operational parameters
27
+ - Provides specific methodologies and best practices for task execution
28
+ - Anticipates edge cases and provides guidance for handling them
29
+ - Incorporates any specific requirements or preferences mentioned by the user
30
+ - Defines output format expectations when relevant
31
+ - Aligns with project-specific coding standards and patterns from CLAUDE.md
32
+
33
+ 4. **Optimize for Performance**: Include:
34
+
35
+ - Decision-making frameworks appropriate to the domain
36
+ - Quality control mechanisms and self-verification steps
37
+ - Efficient workflow patterns
38
+ - Clear escalation or fallback strategies
39
+
40
+ 5. **Create Identifier**: Design a concise, descriptive identifier that:
41
+ - Uses lowercase letters, numbers, and hyphens only
42
+ - Is typically 2-4 words joined by hyphens
43
+ - Clearly indicates the agent's primary function
44
+ - Is memorable and easy to type
45
+ - Avoids generic terms like "helper" or "assistant"
46
+
47
+ 6 **Example agent descriptions**:
48
+
49
+ - in the 'whenToUse' field of the JSON object, you should include examples of when this agent should be used.
50
+ - examples should be of the form:
51
+ - <example>
52
+ Context: The user is creating a code-review agent that should be called after a logical chunk of code is written.
53
+ user: "Please write a function that checks if a number is prime"
54
+ assistant: "Here is the relevant function: "
55
+ <function call omitted for brevity only for this example>
56
+ <commentary>
57
+ Since the user is greeting, use the Task tool to launch the greeting-responder agent to respond with a friendly joke.
58
+ </commentary>
59
+ assistant: "Now let me use the code-reviewer agent to review the code"
60
+ </example>
61
+ - <example>
62
+ Context: User is creating an agent to respond to the word "hello" with a friendly jok.
63
+ user: "Hello"
64
+ assistant: "I'm going to use the Task tool to launch the greeting-responder agent to respond with a friendly joke"
65
+ <commentary>
66
+ Since the user is greeting, use the greeting-responder agent to respond with a friendly joke.
67
+ </commentary>
68
+ </example>
69
+ - If the user mentioned or implied that the agent should be used proactively, you should include examples of this.
70
+ - NOTE: Ensure that in the examples, you are making the assistant use the Agent tool and not simply respond directly to the task.
71
+
72
+ Your output must be a valid JSON object with exactly these fields:
73
+ {
74
+ "identifier": "A unique, descriptive identifier using lowercase letters, numbers, and hyphens (e.g., 'code-reviewer', 'api-docs-writer', 'test-generator')",
75
+ "whenToUse": "A precise, actionable description starting with 'Use this agent when...' that clearly defines the triggering conditions and use cases. Ensure you include examples as described above.",
76
+ "systemPrompt": "The complete system prompt that will govern the agent's behavior, written in second person ('You are...', 'You will...') and structured for maximum clarity and effectiveness"
77
+ }
78
+
79
+ Key principles for your system prompts:
80
+
81
+ - Be specific rather than generic - avoid vague instructions
82
+ - Include concrete examples when they would clarify behavior
83
+ - Balance comprehensiveness with clarity - every instruction should add value
84
+ - Ensure the agent has enough context to handle variations of the core task
85
+ - Make the agent proactive in seeking clarification when needed
86
+ - Build in quality assurance and self-correction mechanisms
87
+
88
+ Remember: The agents you create should be autonomous experts capable of handling their designated tasks with minimal additional guidance. Your system prompts are their complete operational manual.
89
+ `;var ce=`You are an anchored context summarization assistant for coding sessions.
90
+
91
+ Summarize only the conversation history you are given. The newest turns may be kept verbatim outside your summary, so focus on the older context that still matters for continuing the work.
92
+
93
+ If the prompt includes a <previous-summary> block, treat it as the current anchored summary. Update it with the new history by preserving still-true details, removing stale details, and merging in new facts.
94
+
95
+ Always follow the exact output structure requested by the user prompt. Keep every section, preserve exact file paths and identifiers when known, and prefer terse bullets over paragraphs.
96
+
97
+ Do not answer the conversation itself. Do not mention that you are summarizing, compacting, or merging context. Respond in the same language as the conversation.
98
+ `;var le=`You are a file search specialist. You excel at thoroughly navigating and exploring codebases.
99
+
100
+ Your strengths:
101
+ - Rapidly finding files using glob patterns
102
+ - Searching code and text with powerful regex patterns
103
+ - Reading and analyzing file contents
104
+
105
+ Guidelines:
106
+ - Use Glob for broad file pattern matching
107
+ - Use Grep for searching file contents with regex
108
+ - Use Read when you know the specific file path you need to read
109
+ - Use Bash for file operations like copying, moving, or listing directory contents
110
+ - Adapt your search approach based on the thoroughness level specified by the caller
111
+ - Return file paths as absolute paths in your final response
112
+ - For clear communication, avoid using emojis
113
+ - Do not create any files, or run bash commands that modify the user's system state in any way
114
+
115
+ Complete the user's search request efficiently and report your findings clearly.
116
+ `;var ue=`You are \`scout\`, a read-only research agent for external libraries, dependency source, and documentation.
117
+
118
+ Your purpose is to investigate code outside the local workspace and return evidence-backed findings without modifying the user's workspace.
119
+
120
+ Use this agent when asked to:
121
+ - inspect dependency repositories or library source
122
+ - compare local code against upstream implementations
123
+ - research public GitHub repositories the environment can clone
124
+ - explain how a library or framework works by reading its source and docs
125
+ - investigate third-party APIs, workflows, or behavior outside the current workspace
126
+
127
+ Working style:
128
+ 1. When the task involves a GitHub repository or dependency source, use \`repo_clone\` first.
129
+ 2. After cloning, use \`Glob\`, \`Grep\`, and \`Read\` to inspect the cloned repository.
130
+ 3. Use \`WebFetch\` for official documentation pages when source alone is not enough.
131
+ 4. Prefer direct code and documentation evidence over assumptions.
132
+ 5. If multiple external repositories are relevant, inspect each one before drawing conclusions.
133
+
134
+ Research standards:
135
+ - cite exact absolute file paths and line references whenever possible
136
+ - separate what is verified from what is inferred
137
+ - if the answer depends on branch state, note that you are reading the repository's current default clone state unless the caller specifies otherwise
138
+ - if a repository cannot be cloned or accessed, say so explicitly and continue with whatever evidence is still available
139
+ - call out uncertainty clearly instead of smoothing over gaps
140
+
141
+ Output expectations:
142
+ - start with the direct answer
143
+ - then explain the evidence repository by repository or source by source
144
+ - include file references when relevant
145
+ - keep the explanation organized and easy to scan
146
+
147
+ Constraints:
148
+ - do not modify files or run tools that change the user's workspace
149
+ - return absolute file paths for cloned-repo findings in your final response
150
+
151
+ Complete the user's research request efficiently and report your findings clearly.
152
+ `;var de=`Summarize what was done in this conversation. Write like a pull request description.
153
+
154
+ Rules:
155
+ - 2-3 sentences max
156
+ - Describe the changes made, not the process
157
+ - Do not mention running tests, builds, or other validation steps
158
+ - Do not explain what the user asked for
159
+ - Write in first person (I added..., I fixed...)
160
+ - Never ask questions or add new questions
161
+ - If the conversation ends with an unanswered question to the user, preserve that exact question
162
+ - If the conversation ends with an imperative statement or request to the user (e.g. "Now please run the command and paste the console output"), always include that exact request in the summary
163
+ `;var pe=`You are a title generator. You output ONLY a thread title. Nothing else.
164
+
165
+ <task>
166
+ Generate a brief title that would help the user find this conversation later.
167
+
168
+ Follow all rules in <rules>
169
+ Use the <examples> so you know what a good title looks like.
170
+ Your output must be:
171
+ - A single line
172
+ - \u226450 characters
173
+ - No explanations
174
+ </task>
175
+
176
+ <rules>
177
+ - you MUST use the same language as the user message you are summarizing
178
+ - Title must be grammatically correct and read naturally - no word salad
179
+ - Never include tool names in the title (e.g. "read tool", "bash tool", "edit tool")
180
+ - Focus on the main topic or question the user needs to retrieve
181
+ - Vary your phrasing - avoid repetitive patterns like always starting with "Analyzing"
182
+ - When a file is mentioned, focus on WHAT the user wants to do WITH the file, not just that they shared it
183
+ - Keep exact: technical terms, numbers, filenames, HTTP codes
184
+ - Remove: the, this, my, a, an
185
+ - Never assume tech stack
186
+ - Never use tools
187
+ - NEVER respond to questions, just generate a title for the conversation
188
+ - The title should NEVER include "summarizing" or "generating" when generating a title
189
+ - DO NOT SAY YOU CANNOT GENERATE A TITLE OR COMPLAIN ABOUT THE INPUT
190
+ - Always output something meaningful, even if the input is minimal.
191
+ - If the user message is short or conversational (e.g. "hello", "lol", "what's up", "hey"):
192
+ \u2192 create a title that reflects the user's tone or intent (such as Greeting, Quick check-in, Light chat, Intro message, etc.)
193
+ </rules>
194
+
195
+ <examples>
196
+ "debug 500 errors in production" \u2192 Debugging production 500 errors
197
+ "refactor user service" \u2192 Refactoring user service
198
+ "why is app.js failing" \u2192 app.js failure investigation
199
+ "implement rate limiting" \u2192 Rate limiting implementation
200
+ "how do I connect postgres to my API" \u2192 Postgres API connection
201
+ "best practices for React hooks" \u2192 React hooks best practices
202
+ "@src/auth.ts can you add refresh token support" \u2192 Auth refresh token support
203
+ "@utils/parser.ts this is broken" \u2192 Parser bug fix
204
+ "look at @config.json" \u2192 Config review
205
+ "@App.tsx add dark mode toggle" \u2192 Dark mode toggle in App
206
+ </examples>
207
+ `;import Y from"path";var Pe=e.Struct({name:e.String,description:e.optional(e.String),mode:e.Literals(["subagent","primary","all"]),native:e.optional(e.Boolean),hidden:e.optional(e.Boolean),topP:e.optional(e.Finite),temperature:e.optional(e.Finite),color:e.optional(e.String),permission:l.Ruleset,model:e.optional(e.Struct({modelID:je,providerID:qe})),variant:e.optional(e.String),prompt:e.optional(e.String),options:e.Record(e.String,e.Unknown),steps:e.optional(e.Finite)}).annotate({identifier:"Agent"}),ge=e.Struct({identifier:e.String,whenToUse:e.String,systemPrompt:e.String});class $ extends V.Service()("@muxcode/Agent"){}var et=be($),Ye=v.effect($,t.gen(function*(){let n=yield*J.Service,r=yield*O.Service,o=yield*E.Service,c=yield*S.Service,a=yield*T.Service,p=yield*D.Service,g=yield*W.make(t.fn("Agent.state")(function*(u){let w=yield*n.get(),f=yield*c.dirs(),A=[U.GLOB,Y.join(C.Path.tmp,"*"),...f.map((i)=>Y.join(i,"*"))],x={"*":"ask",...Object.fromEntries(A.map((i)=>[i,"allow"]))},y=l.fromConfig({"*":"allow",doom_loop:"ask",external_directory:{"*":"ask",...Object.fromEntries(A.map((i)=>[i,"allow"]))},question:"deny",plan_enter:"deny",plan_exit:"deny",repo_clone:"deny",repo_overview:"deny",read:{"*":"allow","*.env":"ask","*.env.*":"ask","*.env.example":"allow"}}),b=l.fromConfig(w.permission??{}),d={build:{name:"build",description:"The default agent. Executes tools based on configured permissions.",options:{},permission:l.merge(y,l.fromConfig({question:"allow",plan_enter:"allow"}),b),mode:"primary",native:!0},plan:{name:"plan",description:"Plan mode. Disallows all edit tools.",options:{},permission:l.merge(y,l.fromConfig({question:"allow",plan_exit:"allow",external_directory:{[Y.join(C.Path.data,"plans","*")]:"allow"},edit:{"*":"deny",[Y.join(".muxcode","plans","*.md")]:"allow",[Y.relative(u.worktree,Y.join(C.Path.data,Y.join("plans","*.md")))]:"allow"}}),b),mode:"primary",native:!0},general:{name:"general",description:"General-purpose agent for researching complex questions and executing multi-step tasks. Use this agent to execute multiple units of work in parallel.",permission:l.merge(y,l.fromConfig({todowrite:"deny"}),b),options:{},mode:"subagent",native:!0},explore:{name:"explore",permission:l.merge(y,l.fromConfig({"*":"deny",grep:"allow",glob:"allow",list:"allow",bash:"allow",webfetch:"allow",websearch:"allow",read:"allow",external_directory:x}),b),description:'Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns (eg. "src/components/**/*.tsx"), search code for keywords (eg. "API endpoints"), or answer questions about the codebase (eg. "how do API endpoints work?"). When calling this agent, specify the desired thoroughness level: "quick" for basic searches, "medium" for moderate exploration, or "very thorough" for comprehensive analysis across multiple locations and naming conventions.',prompt:le,options:{},mode:"subagent",native:!0},...p.experimentalScout?{scout:{name:"scout",permission:l.merge(y,l.fromConfig({"*":"deny",grep:"allow",glob:"allow",webfetch:"allow",websearch:"allow",read:"allow",repo_clone:"allow",repo_overview:"allow",external_directory:{...x,[Y.join(C.Path.repos,"*")]:"allow"}}),b),description:"Docs and dependency-source specialist. Use this when you need to inspect external documentation, clone dependency repositories into the managed cache, and research library implementation details without modifying the user's workspace.",prompt:ue,options:{},mode:"subagent",native:!0}}:{},compaction:{name:"compaction",mode:"primary",native:!0,hidden:!0,prompt:ce,permission:l.merge(y,l.fromConfig({"*":"deny"}),b),options:{}},title:{name:"title",mode:"primary",options:{},native:!0,hidden:!0,temperature:0.5,permission:l.merge(y,l.fromConfig({"*":"deny"}),b),prompt:pe},summary:{name:"summary",mode:"primary",options:{},native:!0,hidden:!0,permission:l.merge(y,l.fromConfig({"*":"deny"}),b),prompt:de}};for(let[i,h]of Object.entries(w.agent??{})){if(h.disable){delete d[i];continue}let s=d[i];if(!s)s=d[i]={name:i,mode:"all",permission:l.merge(y,b),options:{},native:!1};if(h.model)s.model=T.parseModel(h.model);s.variant=h.variant??s.variant,s.prompt=h.prompt??s.prompt,s.description=h.description??s.description,s.temperature=h.temperature??s.temperature,s.topP=h.top_p??s.topP,s.mode=h.mode??s.mode,s.color=h.color??s.color,s.hidden=h.hidden??s.hidden,s.name=h.name??s.name,s.steps=h.steps??s.steps,s.options=xe(s.options,h.options??{}),s.permission=l.merge(s.permission,l.fromConfig(h.permission??{}))}for(let i in d){if(d[i].permission.some((z)=>{if(z.permission!=="external_directory")return!1;if(z.action!=="deny")return!1;return z.pattern===U.GLOB}))continue;d[i].permission=l.merge(d[i].permission,l.fromConfig({external_directory:{[U.GLOB]:"allow"}}))}let m=t.fnUntraced(function*(i){return d[i]}),q=t.fnUntraced(function*(){let i=yield*n.get();return me(d,ke(),fe([(h)=>i.default_agent?h.name===i.default_agent:h.name==="build","desc"],[(h)=>h.name,"asc"]))}),j=t.fnUntraced(function*(){let i=yield*n.get();if(i.default_agent){let s=d[i.default_agent];if(!s)throw Error(`default agent "${i.default_agent}" not found`);if(s.mode==="subagent")throw Error(`default agent "${i.default_agent}" is a subagent`);if(s.hidden===!0)throw Error(`default agent "${i.default_agent}" is hidden`);return s}let h=Object.values(d).find((s)=>s.mode!=="subagent"&&s.hidden!==!0);if(!h)throw Error("no primary visible agent found");return h}),k=t.fnUntraced(function*(){return(yield*j()).name});return{get:m,list:q,defaultInfo:j,defaultAgent:k}}));return $.of({get:t.fn("Agent.get")(function*(u){return yield*W.useEffect(g,(w)=>w.get(u))}),list:t.fn("Agent.list")(function*(){return yield*W.useEffect(g,(u)=>u.list())}),defaultInfo:t.fn("Agent.defaultInfo")(function*(){return yield*W.useEffect(g,(u)=>u.defaultInfo())}),defaultAgent:t.fn("Agent.defaultAgent")(function*(){return yield*W.useEffect(g,(u)=>u.defaultAgent())}),generate:t.fn("Agent.generate")(function*(u){let w=yield*n.get(),f=u.model??(yield*a.defaultModel()),A=yield*a.getModel(f.providerID,f.modelID),x=yield*a.getLanguage(A),y=w.experimental?.openTelemetry?ye(yield*t.serviceOption(we)):void 0,b=[he];yield*o.trigger("experimental.chat.system.transform",{model:A},{system:b});let d=yield*W.useEffect(g,(k)=>k.list()),m=yield*r.get(f.providerID).pipe(t.orDie),q=f.providerID==="openai"&&m?.type==="oauth",j={experimental_telemetry:{isEnabled:w.experimental?.openTelemetry,tracer:y,metadata:{userId:w.username??"unknown"}},temperature:0.3,messages:[...q?[]:b.map((k)=>({role:"system",content:k})),{role:"user",content:`Create an agent configuration based on this request: "${u.description}".
208
+
209
+ IMPORTANT: The following identifiers already exist and must NOT be used: ${d.map((k)=>k.name).join(", ")}
210
+ Return ONLY the JSON object, no other text, do not wrap in backticks`}],model:x,schema:Object.assign(e.toStandardSchemaV1(ge),e.toStandardJSONSchemaV1(ge))};if(q)return yield*t.promise(async()=>{let k=ve({...j,providerOptions:Ue.providerOptions(A,{instructions:b.join(`
211
+ `),store:!1}),onError:()=>{}});for await(let i of k.fullStream)if(i.type==="error")throw i.error;return k.object});return yield*t.promise(()=>Ae(j).then((k)=>k.object))})})})),tt=Ye.pipe(v.provide(E.defaultLayer),v.provide(T.defaultLayer),v.provide(O.defaultLayer),v.provide(J.defaultLayer),v.provide(S.defaultLayer),v.provide(D.defaultLayer));class Ce extends e.TaggedErrorClass()("ToolInvalidArgumentsError",{tool:e.String,detail:e.String}){get message(){return`The ${this.tool} tool was called with invalid arguments: ${this.detail}.
212
+ Please rewrite the input so it satisfies the expected schema.`}}function nt(n,r,o,c){return()=>t.gen(function*(){let a=typeof r==="function"?{...yield*r()}:{...r},p=e.decodeUnknownEffect(a.parameters),g=a.execute;return a.execute=(u,w)=>{let f={"tool.name":n,"session.id":w.sessionID,"message.id":w.messageID,...w.callID?{"tool.call_id":w.callID}:{}};return t.gen(function*(){let A=yield*p(u).pipe(t.mapError((d)=>new Ce({tool:n,detail:a.formatValidationError?a.formatValidationError(d):String(d)}))),x=yield*g(A,w);if(x.metadata.truncated!==void 0)return x;let y=yield*c.get(w.agent),b=yield*o.output(x.output,{},y);return{...x,output:b.content,metadata:{...x.metadata,truncated:b.truncated,...b.truncated&&{outputPath:b.outputPath}}}}).pipe(t.orDie,t.withSpan("Tool.execute",{attributes:f}))},a})}function He(n,r){return Object.assign(t.gen(function*(){let o=yield*r,c=yield*K,a=yield*N.Service;return{id:n,init:nt(n,o,c,a)}}),{id:n})}function pn(n){return t.gen(function*(){return{...yield*n.init(),id:n.id}})}var Fe=process.env.EXA_API_KEY?`https://mcp.exa.ai/mcp?exaApiKey=${encodeURIComponent(process.env.EXA_API_KEY)}`:"https://mcp.exa.ai/mcp",Ke="https://search.parallel.ai/mcp",ot=e.Struct({result:e.Struct({content:e.Array(e.Struct({type:e.String,text:e.String}))})}),rt=e.decodeUnknownEffect(e.fromJsonString(ot)),ze=(n)=>t.gen(function*(){let r=n.trim();if(!r.startsWith("{"))return;return(yield*rt(r)).result.content.find((c)=>c.text)?.text}),st=t.fn("McpWebSearch.parseResponse")(function*(n){let r=n.trim(),o=r?yield*ze(r):void 0;if(o)return o;for(let c of n.split(`
213
+ `)){if(!c.startsWith("data: "))continue;let a=yield*ze(c.substring(6));if(a)return a}return}),Re=e.Struct({query:e.String,type:e.String,numResults:e.Number,livecrawl:e.String,contextMaxCharacters:e.optional(e.Number)}),Ge=e.Struct({objective:e.String,search_queries:e.Array(e.String),session_id:e.optional(e.String),model_name:e.optional(e.String)}),it=(n)=>e.Struct({jsonrpc:e.Literal("2.0"),id:e.Literal(1),method:e.Literal("tools/call"),params:e.Struct({name:e.String,arguments:n})}),P=(n,r,o,c,a,p,g)=>t.gen(function*(){let u=yield*Q.post(r).pipe(Q.accept("application/json, text/event-stream"),Q.setHeaders(g??{}),Q.schemaBodyJson(it(c))({jsonrpc:"2.0",id:1,method:"tools/call",params:{name:o,arguments:a}})),f=yield*(yield*I.filterStatusOk(n).execute(u).pipe(t.timeoutOrElse({duration:p,orElse:()=>t.die(Error(`${o} request timed out`))}))).text;return yield*st(f)});var Je=`- Search the web using the session's web search provider - performs real-time web searches and can scrape content from specific URLs
214
+ - Provides up-to-date information for current events and recent data
215
+ - Supports configurable result counts and returns the content from the most relevant websites
216
+ - Use this tool for accessing information beyond knowledge cutoff
217
+ - Searches are performed automatically within a single API call
218
+
219
+ Usage notes:
220
+ - Supports live crawling modes when available: 'fallback' (backup if cached unavailable) or 'preferred' (prioritize live crawling)
221
+ - Search types when available: 'auto' (balanced), 'fast' (quick results), 'deep' (comprehensive search)
222
+ - Configurable context length for optimal LLM integration
223
+ - Domain filtering and advanced search options available
224
+
225
+ The current year is {{year}}. You MUST use this year when searching for recent information or current events
226
+ - Example: If the current year is 2026 and the user asks for "latest AI news", search for "AI news 2026", NOT "AI news 2025"
227
+ `;function $e(n){if(!n)return;let r=2166136261;for(let o=0;o<n.length;o++)r^=n.charCodeAt(o),r=Math.imul(r,16777619);return(r>>>0).toString(36)}var ct=e.Struct({query:e.String.annotate({description:"Websearch query"}),numResults:e.optional(e.Number).annotate({description:"Number of search results to return (default: 8)"}),livecrawl:e.optional(e.Literals(["fallback","preferred"])).annotate({description:"Live crawl mode - 'fallback': use live crawling as backup if cached content unavailable, 'preferred': prioritize live crawling (default: 'fallback')"}),type:e.optional(e.Literals(["auto","fast","deep"])).annotate({description:"Search type - 'auto': balanced search (default), 'fast': quick results, 'deep': comprehensive search"}),contextMaxCharacters:e.optional(e.Number).annotate({description:"Maximum characters for context string optimized for LLMs (default: 10000)"})}),jn=e.Literals(["exa","parallel"]);function lt(n,r={exa:!1,parallel:!1}){let o=process.env.MUXCODE_WEBSEARCH_PROVIDER;if(o==="exa"||o==="parallel")return o;if(r.parallel)return"parallel";if(r.exa)return"exa";return Number.parseInt($e(n)??"0",36)%2===0?"exa":"parallel"}function ut(n){if(n==="parallel")return"Parallel Web Search";if(n==="exa")return"Exa Web Search";return"Web Search"}function dt(n){let r=n?.model;if(!r||typeof r!=="object")return;let o="api"in r&&r.api&&typeof r.api==="object"?r.api:void 0,c=o&&"id"in o&&typeof o.id==="string"?o.id:void 0,a="id"in r&&typeof r.id==="string"?r.id:void 0;return(c??a)?.slice(0,100)}function pt(){let n={"User-Agent":`muxcode/${De}`};if(!process.env.PARALLEL_API_KEY)return n;return{...n,Authorization:`Bearer ${process.env.PARALLEL_API_KEY}`}}function gt(n,r,o,c){if(r==="parallel")return P(n,Ke,"web_search",Ge,{objective:o.query,search_queries:[o.query],session_id:c.sessionID,model_name:dt(c.extra)},"25 seconds",pt());return P(n,Fe,"web_search_exa",Re,{query:o.query,type:o.type||"auto",numResults:o.numResults||8,livecrawl:o.livecrawl||"fallback",contextMaxCharacters:o.contextMaxCharacters},"25 seconds")}var Un=He("websearch",t.gen(function*(){let n=yield*I.HttpClient,r=yield*D.Service;return{get description(){return Je.replace("{{year}}",new Date().getFullYear().toString())},parameters:ct,execute:(o,c)=>t.gen(function*(){let a=lt(c.sessionID,{exa:r.enableExa,parallel:r.enableParallel}),p=ut(a);return yield*c.metadata({title:`${p} "${o.query}"`,metadata:{provider:a}}),yield*c.ask({permission:"websearch",patterns:[o.query],always:["*"],metadata:{query:o.query,numResults:o.numResults,livecrawl:o.livecrawl,type:o.type,contextMaxCharacters:o.contextMaxCharacters,provider:a}}),{output:(yield*gt(n,a,o,c))??"No search results found. Please try a different query.",title:`${p}: ${o.query}`,metadata:{provider:a}}}).pipe(t.orDie)}}));
228
+ export{K as wk,Me as xk,U as yk,N as zk,He as Ak,pn as Bk,ut as Ck,Un as Dk};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Al as k,Bl as l,Cl as m,Dl as n,El as o,Fl as p,Gl as q,ql as a,rl as b,sl as c,tl as d,ul as e,vl as f,wl as g,xl as h,yl as i,zl as j}from"./chunk-sftkw30q.js";import"./chunk-kr1vbd82.js";import"./chunk-fk9bmtwr.js";import"./chunk-an9wvc2n.js";import"./chunk-a0srn4ak.js";import"./chunk-ygpen625.js";import"./chunk-jfz77m78.js";import"./chunk-my9cfmvt.js";import"./chunk-8jy0dvcn.js";import"./chunk-frbht418.js";import"./chunk-1pv2317e.js";import"./chunk-21x3anp4.js";import"./chunk-ntvr3177.js";import"./chunk-9h1pwxb2.js";import"./chunk-fkmzj0qt.js";import"./chunk-q9yddd1r.js";import"./chunk-k19y2psf.js";import"./chunk-ppg6zhae.js";import"./chunk-1mqsg5s7.js";import"./chunk-9g64kggy.js";import"./chunk-8j3aw4qg.js";export{n as layer,p as defaultLayer,o as appLayer,q as Worktree,i as StartCommandFailedError,m as Service,e as ResetInput,k as ResetFailedError,d as RemoveInput,j as RemoveFailedError,f as NotGitError,g as NameGenerationFailedError,l as ListFailedError,b as Info,a as Event,c as CreateInput,h as CreateFailedError};
@@ -0,0 +1,38 @@
1
+ // @bun
2
+ import{Yk as AJ,bl as R$}from"./chunk-638270xn.js";import{cl as j6,jl as H$,nl as I$}from"./chunk-sjd8mzvx.js";import{Hl as j0,Rl as iJ,Sl as nJ}from"./chunk-kr1vbd82.js";import{Dn as mJ,En as rJ,Fn as O$,fo as m1,mn as _0,nn as D0,rn as _$,zn as D$}from"./chunk-8cm9znxk.js";import{$o as V1,Ar as W1,Bq as E$,Br as $2,Cp as p,Cr as d0,Dr as q1,Ip as b1,Lr as vJ,Op as x,Pp as X1,Qq as n0,Up as y$,Vq as k$,Zq as q0,br as F0,gq as v0,jq as K0,kp as e$,kq as bJ,no as Y1,oo as lJ,oq as uJ,po as S1,pq as fJ,qo as H0,rp as t$,tp as i1,tq as L$,wp as P1,xp as H1,yp as RJ}from"./chunk-a0srn4ak.js";import{$r as d}from"./chunk-ygpen625.js";import{bs as j$,gs as s}from"./chunk-my9cfmvt.js";import{vs as B$,xs as L1}from"./chunk-8jy0dvcn.js";import{AF as N,Dw as N$,Fx as U1,Hz as _1,TC as p0,Yz as b,eC as X,fD as L0,fz as s1,hE as z2,pE as v,tz as hJ}from"./chunk-1mqsg5s7.js";import{QF as Q2,RF as a,SF as j1,UF as N1}from"./chunk-8j3aw4qg.js";var c$=a((X9,y0)=>{function b$($){return Array.isArray($)?$:[$]}var RZ=void 0,l0="",S$=" ",h0="\\",AZ=/^\s+$/,IZ=/(?:[^\\]|^)\\$/,TZ=/^\\!/,EZ=/^\\#/,kZ=/\r?\n/g,xZ=/^\.{0,2}\/|^\.{1,2}$/,SZ=/\/$/,k1="/",f$="node-ignore";if(typeof Symbol<"u")f$=Symbol.for("node-ignore");var v$=f$,x1=($,J,Z)=>{return Object.defineProperty($,J,{value:Z}),Z},gZ=/([0-z])-([0-z])/g,d$=()=>!1,bZ=($)=>$.replace(gZ,(J,Z,U)=>Z.charCodeAt(0)<=U.charCodeAt(0)?J:l0),fZ=($)=>{let{length:J}=$;return $.slice(0,J-J%2)},vZ=[[/^\uFEFF/,()=>l0],[/((?:\\\\)*?)(\\?\s+)$/,($,J,Z)=>J+(Z.indexOf("\\")===0?S$:l0)],[/(\\+?)\s/g,($,J)=>{let{length:Z}=J;return J.slice(0,Z-Z%2)+S$}],[/[\\$.|*+(){^]/g,($)=>`\\${$}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return!/\/(?!$)/.test(this)?"(?:^|\\/)":"^"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,($,J,Z)=>J+6<Z.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,($,J,Z)=>{let U=Z.replace(/\\\*/g,"[^\\/]*");return J+U}],[/\\\\\\(?=[$.|*+(){^])/g,()=>h0],[/\\\\/g,()=>h0],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,($,J,Z,U,V)=>J===h0?`\\[${Z}${fZ(U)}${V}`:V==="]"?U.length%2===0?`[${bZ(Z)}${U}]`:"[]":"[]"],[/(?:[^*])$/,($)=>/\/$/.test($)?`${$}$`:`${$}(?=$|\\/$)`]],dZ=/(^|\\\/)?\\\*$/,n1="regex",P0="checkRegex",g$="_",hZ={[n1]($,J){return`${J?`${J}[^/]+`:"[^/]*"}(?=$|\\/$)`},[P0]($,J){return`${J?`${J}[^/]*`:"[^/]*"}(?=$|\\/$)`}},lZ=($)=>vZ.reduce((J,[Z,U])=>J.replace(Z,U.bind($)),$),N0=($)=>typeof $==="string",uZ=($)=>$&&N0($)&&!AZ.test($)&&!IZ.test($)&&$.indexOf("#")!==0,mZ=($)=>$.split(kZ).filter(Boolean);class h${constructor($,J,Z,U,V,W){this.pattern=$,this.mark=J,this.negative=V,x1(this,"body",Z),x1(this,"ignoreCase",U),x1(this,"regexPrefix",W)}get regex(){let $=g$+n1;if(this[$])return this[$];return this._make(n1,$)}get checkRegex(){let $=g$+P0;if(this[$])return this[$];return this._make(P0,$)}_make($,J){let Z=this.regexPrefix.replace(dZ,hZ[$]),U=this.ignoreCase?new RegExp(Z,"i"):new RegExp(Z);return x1(this,J,U)}}var rZ=({pattern:$,mark:J},Z)=>{let U=!1,V=$;if(V.indexOf("!")===0)U=!0,V=V.substr(1);V=V.replace(TZ,"!").replace(EZ,"#");let W=lZ(V);return new h$($,J,V,Z,U,W)};class l${constructor($){this._ignoreCase=$,this._rules=[]}_add($){if($&&$[v$]){this._rules=this._rules.concat($._rules._rules),this._added=!0;return}if(N0($))$={pattern:$};if(uZ($.pattern)){let J=rZ($,this._ignoreCase);this._added=!0,this._rules.push(J)}}add($){return this._added=!1,b$(N0($)?mZ($):$).forEach(this._add,this),this._added}test($,J,Z){let U=!1,V=!1,W;this._rules.forEach((Q)=>{let{negative:j}=Q;if(V===j&&U!==V||j&&!U&&!V&&!J)return;if(!Q[Z].test($))return;U=!j,V=j,W=j?RZ:Q});let Y={ignored:U,unignored:V};if(W)Y.rule=W;return Y}}var cZ=($,J)=>{throw new J($)},w1=($,J,Z)=>{if(!N0($))return Z(`path must be a string, but got \`${J}\``,TypeError);if(!$)return Z("path must not be empty",TypeError);if(w1.isNotRelative($))return Z(`path should be a \`path.relative()\`d string, but got "${J}"`,RangeError);return!0},u$=($)=>xZ.test($);w1.isNotRelative=u$;w1.convert=($)=>$;class m${constructor({ignorecase:$=!0,ignoreCase:J=$,allowRelativePaths:Z=!1}={}){x1(this,v$,!0),this._rules=new l$(J),this._strictPathCheck=!Z,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add($){if(this._rules.add($))this._initCache();return this}addPattern($){return this.add($)}_test($,J,Z,U){let V=$&&w1.convert($);return w1(V,$,this._strictPathCheck?cZ:d$),this._t(V,J,Z,U)}checkIgnore($){if(!SZ.test($))return this.test($);let J=$.split(k1).filter(Boolean);if(J.pop(),J.length){let Z=this._t(J.join(k1)+k1,this._testCache,!0,J);if(Z.ignored)return Z}return this._rules.test($,!1,P0)}_t($,J,Z,U){if($ in J)return J[$];if(!U)U=$.split(k1).filter(Boolean);if(U.pop(),!U.length)return J[$]=this._rules.test($,Z,n1);let V=this._t(U.join(k1)+k1,J,Z,U);return J[$]=V.ignored?V:this._rules.test($,Z,n1)}ignores($){return this._test($,this._ignoreCache,!1).ignored}createFilter(){return($)=>!this.ignores($)}filter($){return b$($).filter(this.createFilter())}test($){return this._test($,this._testCache,!0)}}var u0=($)=>new m$($),pZ=($)=>w1($&&w1.convert($),$,d$),r$=()=>{let $=(Z)=>/^\\\\\?\\/.test(Z)||/["<>|\u0000-\u001F]+/u.test(Z)?Z:Z.replace(/\\/g,"/");w1.convert=$;let J=/^[a-z]:\//i;w1.isNotRelative=(Z)=>J.test(Z)||u$(Z)};if(typeof process<"u"&&process.platform==="win32")r$();y0.exports=u0;u0.default=u0;y0.exports.isPathValid=pZ;x1(y0.exports,Symbol.for("setupWindows"),r$)});var R0=a((g6)=>{g6.isInteger=($)=>{if(typeof $==="number")return Number.isInteger($);if(typeof $==="string"&&$.trim()!=="")return Number.isInteger(Number($));return!1};g6.find=($,J)=>$.nodes.find((Z)=>Z.type===J);g6.exceedsLimit=($,J,Z=1,U)=>{if(U===!1)return!1;if(!g6.isInteger($)||!g6.isInteger(J))return!1;return(Number(J)-Number($))/Number(Z)>=U};g6.escapeNode=($,J=0,Z)=>{let U=$.nodes[J];if(!U)return;if(Z&&U.type===Z||U.type==="open"||U.type==="close"){if(U.escaped!==!0)U.value="\\"+U.value,U.escaped=!0}};g6.encloseBrace=($)=>{if($.type!=="brace")return!1;if($.commas>>0+$.ranges>>0===0)return $.invalid=!0,!0;return!1};g6.isInvalidBrace=($)=>{if($.type!=="brace")return!1;if($.invalid===!0||$.dollar)return!0;if($.commas>>0+$.ranges>>0===0)return $.invalid=!0,!0;if($.open!==!0||$.close!==!0)return $.invalid=!0,!0;return!1};g6.isOpenOrClose=($)=>{if($.type==="open"||$.type==="close")return!0;return $.open===!0||$.close===!0};g6.reduce=($)=>$.reduce((J,Z)=>{if(Z.type==="text")J.push(Z.value);if(Z.type==="range")Z.type="text";return J},[]);g6.flatten=(...$)=>{let J=[],Z=(U)=>{for(let V=0;V<U.length;V++){let W=U[V];if(Array.isArray(W)){Z(W);continue}if(W!==void 0)J.push(W)}return J};return Z($),J}});var A0=a((b9,G2)=>{var B2=R0();G2.exports=($,J={})=>{let Z=(U,V={})=>{let W=J.escapeInvalid&&B2.isInvalidBrace(V),Y=U.invalid===!0&&J.escapeInvalid===!0,Q="";if(U.value){if((W||Y)&&B2.isOpenOrClose(U))return"\\"+U.value;return U.value}if(U.value)return U.value;if(U.nodes)for(let j of U.nodes)Q+=Z(j);return Q};return Z($)}});var q2=a((f9,w2)=>{/*!
3
+ * is-number <https://github.com/jonschlinkert/is-number>
4
+ *
5
+ * Copyright (c) 2014-present, Jon Schlinkert.
6
+ * Released under the MIT License.
7
+ */w2.exports=function($){if(typeof $==="number")return $-$===0;if(typeof $==="string"&&$.trim()!=="")return Number.isFinite?Number.isFinite(+$):isFinite(+$);return!1}});var _2=a((v9,H2)=>{/*!
8
+ * to-regex-range <https://github.com/micromatch/to-regex-range>
9
+ *
10
+ * Copyright (c) 2015-present, Jon Schlinkert.
11
+ * Released under the MIT License.
12
+ */var F2=q2(),D1=($,J,Z)=>{if(F2($)===!1)throw TypeError("toRegexRange: expected the first argument to be a number");if(J===void 0||$===J)return String($);if(F2(J)===!1)throw TypeError("toRegexRange: expected the second argument to be a number.");let U={relaxZeros:!0,...Z};if(typeof U.strictZeros==="boolean")U.relaxZeros=U.strictZeros===!1;let V=String(U.relaxZeros),W=String(U.shorthand),Y=String(U.capture),Q=String(U.wrap),j=$+":"+J+"="+V+W+Y+Q;if(D1.cache.hasOwnProperty(j))return D1.cache[j].result;let q=Math.min($,J),C=Math.max($,J);if(Math.abs(q-C)===1){let M=$+"|"+J;if(U.capture)return`(${M})`;if(U.wrap===!1)return M;return`(?:${M})`}let P=L2($)||L2(J),K={min:$,max:J,a:q,b:C},A=[],z=[];if(P)K.isPadded=P,K.maxLen=String(K.max).length;if(q<0){let M=C<0?Math.abs(C):1;z=C2(M,Math.abs(q),K,U),q=K.a=0}if(C>=0)A=C2(q,C,K,U);if(K.negatives=z,K.positives=A,K.result=r6(z,A,U),U.capture===!0)K.result=`(${K.result})`;else if(U.wrap!==!1&&A.length+z.length>1)K.result=`(?:${K.result})`;return D1.cache[j]=K,K.result};function r6($,J,Z){let U=a0($,J,"-",!1,Z)||[],V=a0(J,$,"",!1,Z)||[],W=a0($,J,"-?",!0,Z)||[];return U.concat(W).concat(V).join("|")}function c6($,J){let Z=1,U=1,V=N2($,Z),W=new Set([J]);while($<=V&&V<=J)W.add(V),Z+=1,V=N2($,Z);V=y2(J+1,U)-1;while($<V&&V<=J)W.add(V),U+=1,V=y2(J+1,U)-1;return W=[...W],W.sort(n6),W}function p6($,J,Z){if($===J)return{pattern:$,count:[],digits:0};let U=i6($,J),V=U.length,W="",Y=0;for(let Q=0;Q<V;Q++){let[j,q]=U[Q];if(j===q)W+=j;else if(j!=="0"||q!=="9")W+=o6(j,q,Z);else Y++}if(Y)W+=Z.shorthand===!0?"\\d":"[0-9]";return{pattern:W,count:[Y],digits:V}}function C2($,J,Z,U){let V=c6($,J),W=[],Y=$,Q;for(let j=0;j<V.length;j++){let q=V[j],C=p6(String(Y),String(q),U),P="";if(!Z.isPadded&&Q&&Q.pattern===C.pattern){if(Q.count.length>1)Q.count.pop();Q.count.push(C.count[0]),Q.string=Q.pattern+O2(Q.count),Y=q+1;continue}if(Z.isPadded)P=a6(q,Z,U);C.string=P+C.pattern+O2(C.count),W.push(C),Y=q+1,Q=C}return W}function a0($,J,Z,U,V){let W=[];for(let Y of $){let{string:Q}=Y;if(!U&&!P2(J,"string",Q))W.push(Z+Q);if(U&&P2(J,"string",Q))W.push(Z+Q)}return W}function i6($,J){let Z=[];for(let U=0;U<$.length;U++)Z.push([$[U],J[U]]);return Z}function n6($,J){return $>J?1:J>$?-1:0}function P2($,J,Z){return $.some((U)=>U[J]===Z)}function N2($,J){return Number(String($).slice(0,-J)+"9".repeat(J))}function y2($,J){return $-$%Math.pow(10,J)}function O2($){let[J=0,Z=""]=$;if(Z||J>1)return`{${J+(Z?","+Z:"")}}`;return""}function o6($,J,Z){return`[${$}${J-$===1?"":"-"}${J}]`}function L2($){return/^-?(0+)\d/.test($)}function a6($,J,Z){if(!J.isPadded)return $;let U=Math.abs(J.maxLen-String($).length),V=Z.relaxZeros!==!1;switch(U){case 0:return"";case 1:return V?"0?":"0";case 2:return V?"0{0,2}":"00";default:return V?`0{0,${U}}`:`0{${U}}`}}D1.cache={};D1.clearCache=()=>D1.cache={};H2.exports=D1});var t0=a((d9,k2)=>{/*!
13
+ * fill-range <https://github.com/jonschlinkert/fill-range>
14
+ *
15
+ * Copyright (c) 2014-present, Jon Schlinkert.
16
+ * Licensed under the MIT License.
17
+ */var s6=N1("util"),R2=_2(),D2=($)=>$!==null&&typeof $==="object"&&!Array.isArray($),e6=($)=>{return(J)=>$===!0?Number(J):String(J)},s0=($)=>{return typeof $==="number"||typeof $==="string"&&$!==""},J0=($)=>Number.isInteger(+$),e0=($)=>{let J=`${$}`,Z=-1;if(J[0]==="-")J=J.slice(1);if(J==="0")return!1;while(J[++Z]==="0");return Z>0},t6=($,J,Z)=>{if(typeof $==="string"||typeof J==="string")return!0;return Z.stringify===!0},$5=($,J,Z)=>{if(J>0){let U=$[0]==="-"?"-":"";if(U)$=$.slice(1);$=U+$.padStart(U?J-1:J,"0")}if(Z===!1)return String($);return $},T0=($,J)=>{let Z=$[0]==="-"?"-":"";if(Z)$=$.slice(1),J--;while($.length<J)$="0"+$;return Z?"-"+$:$},J5=($,J,Z)=>{$.negatives.sort((Q,j)=>Q<j?-1:Q>j?1:0),$.positives.sort((Q,j)=>Q<j?-1:Q>j?1:0);let U=J.capture?"":"?:",V="",W="",Y;if($.positives.length)V=$.positives.map((Q)=>T0(String(Q),Z)).join("|");if($.negatives.length)W=`-(${U}${$.negatives.map((Q)=>T0(String(Q),Z)).join("|")})`;if(V&&W)Y=`${V}|${W}`;else Y=V||W;if(J.wrap)return`(${U}${Y})`;return Y},A2=($,J,Z,U)=>{if(Z)return R2($,J,{wrap:!1,...U});let V=String.fromCharCode($);if($===J)return V;let W=String.fromCharCode(J);return`[${V}-${W}]`},I2=($,J,Z)=>{if(Array.isArray($)){let U=Z.wrap===!0,V=Z.capture?"":"?:";return U?`(${V}${$.join("|")})`:$.join("|")}return R2($,J,Z)},T2=(...$)=>{return RangeError("Invalid range arguments: "+s6.inspect(...$))},E2=($,J,Z)=>{if(Z.strictRanges===!0)throw T2([$,J]);return[]},Z5=($,J)=>{if(J.strictRanges===!0)throw TypeError(`Expected step "${$}" to be a number`);return[]},U5=($,J,Z=1,U={})=>{let V=Number($),W=Number(J);if(!Number.isInteger(V)||!Number.isInteger(W)){if(U.strictRanges===!0)throw T2([$,J]);return[]}if(V===0)V=0;if(W===0)W=0;let Y=V>W,Q=String($),j=String(J),q=String(Z);Z=Math.max(Math.abs(Z),1);let C=e0(Q)||e0(j)||e0(q),P=C?Math.max(Q.length,j.length,q.length):0,K=C===!1&&t6($,J,U)===!1,A=U.transform||e6(K);if(U.toRegex&&Z===1)return A2(T0($,P),T0(J,P),!0,U);let z={negatives:[],positives:[]},M=(F)=>z[F<0?"negatives":"positives"].push(Math.abs(F)),L=[],D=0;while(Y?V>=W:V<=W){if(U.toRegex===!0&&Z>1)M(V);else L.push($5(A(V,D),P,K));V=Y?V-Z:V+Z,D++}if(U.toRegex===!0)return Z>1?J5(z,U,P):I2(L,null,{wrap:!1,...U});return L},V5=($,J,Z=1,U={})=>{if(!J0($)&&$.length>1||!J0(J)&&J.length>1)return E2($,J,U);let V=U.transform||((K)=>String.fromCharCode(K)),W=`${$}`.charCodeAt(0),Y=`${J}`.charCodeAt(0),Q=W>Y,j=Math.min(W,Y),q=Math.max(W,Y);if(U.toRegex&&Z===1)return A2(j,q,!1,U);let C=[],P=0;while(Q?W>=Y:W<=Y)C.push(V(W,P)),W=Q?W-Z:W+Z,P++;if(U.toRegex===!0)return I2(C,null,{wrap:!1,options:U});return C},I0=($,J,Z,U={})=>{if(J==null&&s0($))return[$];if(!s0($)||!s0(J))return E2($,J,U);if(typeof Z==="function")return I0($,J,1,{transform:Z});if(D2(Z))return I0($,J,0,Z);let V={...U};if(V.capture===!0)V.wrap=!0;if(Z=Z||V.step||1,!J0(Z)){if(Z!=null&&!D2(Z))return Z5(Z,V);return I0($,J,1,Z)}if(J0($)&&J0(J))return U5($,J,Z,V);return V5($,J,Math.max(Math.abs(Z),1),V)};k2.exports=I0});var g2=a((h9,S2)=>{var W5=t0(),x2=R0(),Y5=($,J={})=>{let Z=(U,V={})=>{let W=x2.isInvalidBrace(V),Y=U.invalid===!0&&J.escapeInvalid===!0,Q=W===!0||Y===!0,j=J.escapeInvalid===!0?"\\":"",q="";if(U.isOpen===!0)return j+U.value;if(U.isClose===!0)return console.log("node.isClose",j,U.value),j+U.value;if(U.type==="open")return Q?j+U.value:"(";if(U.type==="close")return Q?j+U.value:")";if(U.type==="comma")return U.prev.type==="comma"?"":Q?U.value:"|";if(U.value)return U.value;if(U.nodes&&U.ranges>0){let C=x2.reduce(U.nodes),P=W5(...C,{...J,wrap:!1,toRegex:!0,strictZeros:!0});if(P.length!==0)return C.length>1&&P.length>1?`(${P})`:P}if(U.nodes)for(let C of U.nodes)q+=Z(C,U);return q};return Z($)};S2.exports=Y5});var v2=a((l9,f2)=>{var X5=t0(),b2=A0(),v1=R0(),R1=($="",J="",Z=!1)=>{let U=[];if($=[].concat($),J=[].concat(J),!J.length)return $;if(!$.length)return Z?v1.flatten(J).map((V)=>`{${V}}`):J;for(let V of $)if(Array.isArray(V))for(let W of V)U.push(R1(W,J,Z));else for(let W of J){if(Z===!0&&typeof W==="string")W=`{${W}}`;U.push(Array.isArray(W)?R1(V,W,Z):V+W)}return v1.flatten(U)},Q5=($,J={})=>{let Z=J.rangeLimit===void 0?1000:J.rangeLimit,U=(V,W={})=>{V.queue=[];let Y=W,Q=W.queue;while(Y.type!=="brace"&&Y.type!=="root"&&Y.parent)Y=Y.parent,Q=Y.queue;if(V.invalid||V.dollar){Q.push(R1(Q.pop(),b2(V,J)));return}if(V.type==="brace"&&V.invalid!==!0&&V.nodes.length===2){Q.push(R1(Q.pop(),["{}"]));return}if(V.nodes&&V.ranges>0){let P=v1.reduce(V.nodes);if(v1.exceedsLimit(...P,J.step,Z))throw RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let K=X5(...P,J);if(K.length===0)K=b2(V,J);Q.push(R1(Q.pop(),K)),V.nodes=[];return}let j=v1.encloseBrace(V),q=V.queue,C=V;while(C.type!=="brace"&&C.type!=="root"&&C.parent)C=C.parent,q=C.queue;for(let P=0;P<V.nodes.length;P++){let K=V.nodes[P];if(K.type==="comma"&&V.type==="brace"){if(P===1)q.push("");q.push("");continue}if(K.type==="close"){Q.push(R1(Q.pop(),q,j));continue}if(K.value&&K.type!=="open"){q.push(R1(q.pop(),K.value));continue}if(K.nodes)U(K,V)}return q};return v1.flatten(U($))};f2.exports=Q5});var h2=a((u9,d2)=>{d2.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
18
+ `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var c2=a((m9,r2)=>{var z5=A0(),{MAX_LENGTH:l2,CHAR_BACKSLASH:$$,CHAR_BACKTICK:K5,CHAR_COMMA:M5,CHAR_DOT:j5,CHAR_LEFT_PARENTHESES:B5,CHAR_RIGHT_PARENTHESES:G5,CHAR_LEFT_CURLY_BRACE:w5,CHAR_RIGHT_CURLY_BRACE:q5,CHAR_LEFT_SQUARE_BRACKET:u2,CHAR_RIGHT_SQUARE_BRACKET:m2,CHAR_DOUBLE_QUOTE:F5,CHAR_SINGLE_QUOTE:C5,CHAR_NO_BREAK_SPACE:P5,CHAR_ZERO_WIDTH_NOBREAK_SPACE:N5}=h2(),y5=($,J={})=>{if(typeof $!=="string")throw TypeError("Expected a string");let Z=J||{},U=typeof Z.maxLength==="number"?Math.min(l2,Z.maxLength):l2;if($.length>U)throw SyntaxError(`Input length (${$.length}), exceeds max characters (${U})`);let V={type:"root",input:$,nodes:[]},W=[V],Y=V,Q=V,j=0,q=$.length,C=0,P=0,K,A=()=>$[C++],z=(M)=>{if(M.type==="text"&&Q.type==="dot")Q.type="text";if(Q&&Q.type==="text"&&M.type==="text"){Q.value+=M.value;return}return Y.nodes.push(M),M.parent=Y,M.prev=Q,Q=M,M};z({type:"bos"});while(C<q){if(Y=W[W.length-1],K=A(),K===N5||K===P5)continue;if(K===$$){z({type:"text",value:(J.keepEscaping?K:"")+A()});continue}if(K===m2){z({type:"text",value:"\\"+K});continue}if(K===u2){j++;let M;while(C<q&&(M=A())){if(K+=M,M===u2){j++;continue}if(M===$$){K+=A();continue}if(M===m2){if(j--,j===0)break}}z({type:"text",value:K});continue}if(K===B5){Y=z({type:"paren",nodes:[]}),W.push(Y),z({type:"text",value:K});continue}if(K===G5){if(Y.type!=="paren"){z({type:"text",value:K});continue}Y=W.pop(),z({type:"text",value:K}),Y=W[W.length-1];continue}if(K===F5||K===C5||K===K5){let M=K,L;if(J.keepQuotes!==!0)K="";while(C<q&&(L=A())){if(L===$$){K+=L+A();continue}if(L===M){if(J.keepQuotes===!0)K+=L;break}K+=L}z({type:"text",value:K});continue}if(K===w5){P++;let L={type:"brace",open:!0,close:!1,dollar:Q.value&&Q.value.slice(-1)==="$"||Y.dollar===!0,depth:P,commas:0,ranges:0,nodes:[]};Y=z(L),W.push(Y),z({type:"open",value:K});continue}if(K===q5){if(Y.type!=="brace"){z({type:"text",value:K});continue}let M="close";Y=W.pop(),Y.close=!0,z({type:M,value:K}),P--,Y=W[W.length-1];continue}if(K===M5&&P>0){if(Y.ranges>0){Y.ranges=0;let M=Y.nodes.shift();Y.nodes=[M,{type:"text",value:z5(Y)}]}z({type:"comma",value:K}),Y.commas++;continue}if(K===j5&&P>0&&Y.commas===0){let M=Y.nodes;if(P===0||M.length===0){z({type:"text",value:K});continue}if(Q.type==="dot"){if(Y.range=[],Q.value+=K,Q.type="range",Y.nodes.length!==3&&Y.nodes.length!==5){Y.invalid=!0,Y.ranges=0,Q.type="text";continue}Y.ranges++,Y.args=[];continue}if(Q.type==="range"){M.pop();let L=M[M.length-1];L.value+=Q.value+K,Q=L,Y.ranges--;continue}z({type:"dot",value:K});continue}z({type:"text",value:K})}do if(Y=W.pop(),Y.type!=="root"){Y.nodes.forEach((D)=>{if(!D.nodes){if(D.type==="open")D.isOpen=!0;if(D.type==="close")D.isClose=!0;if(!D.nodes)D.type="text";D.invalid=!0}});let M=W[W.length-1],L=M.nodes.indexOf(Y);M.nodes.splice(L,1,...Y.nodes)}while(W.length>0);return z({type:"eos"}),V};r2.exports=y5});var n2=a((r9,i2)=>{var p2=A0(),O5=g2(),L5=v2(),H5=c2(),Z1=($,J={})=>{let Z=[];if(Array.isArray($))for(let U of $){let V=Z1.create(U,J);if(Array.isArray(V))Z.push(...V);else Z.push(V)}else Z=[].concat(Z1.create($,J));if(J&&J.expand===!0&&J.nodupes===!0)Z=[...new Set(Z)];return Z};Z1.parse=($,J={})=>H5($,J);Z1.stringify=($,J={})=>{if(typeof $==="string")return p2(Z1.parse($,J),J);return p2($,J)};Z1.compile=($,J={})=>{if(typeof $==="string")$=Z1.parse($,J);return O5($,J)};Z1.expand=($,J={})=>{if(typeof $==="string")$=Z1.parse($,J);let Z=L5($,J);if(J.noempty===!0)Z=Z.filter(Boolean);if(J.nodupes===!0)Z=[...new Set(Z)];return Z};Z1.create=($,J={})=>{if($===""||$.length<3)return[$];return J.expand!==!0?Z1.compile($,J):Z1.expand($,J)};i2.exports=Z1});var Z0=a((c9,a2)=>{var _5=N1("path"),o2={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:"[^/]",END_ANCHOR:"(?:\\/|$)",DOTS_SLASH:"\\.{1,2}(?:\\/|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|\\/)\\.{1,2}(?:\\/|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:\\/|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:\\/|$))",QMARK_NO_DOT:"[^.\\/]",STAR:"[^/]*?",START_ANCHOR:"(?:^|\\/)"},D5={...o2,SLASH_LITERAL:"[\\\\/]",QMARK:"[^\\\\/]",STAR:"[^\\\\/]*?",DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)"},R5={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};a2.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:65536,POSIX_REGEX_SOURCE:R5,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:_5.sep,extglobChars($){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${$.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars($){return $===!0?D5:o2}}});var U0=a((S5)=>{var A5=N1("path"),I5=process.platform==="win32",{REGEX_BACKSLASH:T5,REGEX_REMOVE_BACKSLASH:E5,REGEX_SPECIAL_CHARS:k5,REGEX_SPECIAL_CHARS_GLOBAL:x5}=Z0();S5.isObject=($)=>$!==null&&typeof $==="object"&&!Array.isArray($);S5.hasRegexChars=($)=>k5.test($);S5.isRegexChar=($)=>$.length===1&&S5.hasRegexChars($);S5.escapeRegex=($)=>$.replace(x5,"\\$1");S5.toPosixSlashes=($)=>$.replace(T5,"/");S5.removeBackslashes=($)=>{return $.replace(E5,(J)=>{return J==="\\"?"":J})};S5.supportsLookbehinds=()=>{let $=process.version.slice(1).split(".").map(Number);if($.length===3&&$[0]>=9||$[0]===8&&$[1]>=10)return!0;return!1};S5.isWindows=($)=>{if($&&typeof $.windows==="boolean")return $.windows;return I5===!0||A5.sep==="\\"};S5.escapeLast=($,J,Z)=>{let U=$.lastIndexOf(J,Z);if(U===-1)return $;if($[U-1]==="\\")return S5.escapeLast($,J,U-1);return`${$.slice(0,U)}\\${$.slice(U)}`};S5.removePrefix=($,J={})=>{let Z=$;if(Z.startsWith("./"))Z=Z.slice(2),J.prefix="./";return Z};S5.wrapOutput=($,J={},Z={})=>{let U=Z.contains?"":"^",V=Z.contains?"":"$",W=`${U}(?:${$})${V}`;if(J.negated===!0)W=`(?:^(?!${W}).*$)`;return W}});var YJ=a((i9,WJ)=>{var t2=U0(),{CHAR_ASTERISK:J$,CHAR_AT:r5,CHAR_BACKWARD_SLASH:V0,CHAR_COMMA:c5,CHAR_DOT:Z$,CHAR_EXCLAMATION_MARK:U$,CHAR_FORWARD_SLASH:VJ,CHAR_LEFT_CURLY_BRACE:V$,CHAR_LEFT_PARENTHESES:W$,CHAR_LEFT_SQUARE_BRACKET:p5,CHAR_PLUS:i5,CHAR_QUESTION_MARK:$J,CHAR_RIGHT_CURLY_BRACE:n5,CHAR_RIGHT_PARENTHESES:JJ,CHAR_RIGHT_SQUARE_BRACKET:o5}=Z0(),ZJ=($)=>{return $===VJ||$===V0},UJ=($)=>{if($.isPrefix!==!0)$.depth=$.isGlobstar?1/0:1},a5=($,J)=>{let Z=J||{},U=$.length-1,V=Z.parts===!0||Z.scanToEnd===!0,W=[],Y=[],Q=[],j=$,q=-1,C=0,P=0,K=!1,A=!1,z=!1,M=!1,L=!1,D=!1,F=!1,O=!1,T=!1,y=!1,_=0,E,H,k={value:"",depth:0,isGlob:!1},n=()=>q>=U,w=()=>j.charCodeAt(q+1),r=()=>{return E=H,j.charCodeAt(++q)};while(q<U){H=r();let t;if(H===V0){if(F=k.backslashes=!0,H=r(),H===V$)D=!0;continue}if(D===!0||H===V$){_++;while(n()!==!0&&(H=r())){if(H===V0){F=k.backslashes=!0,r();continue}if(H===V$){_++;continue}if(D!==!0&&H===Z$&&(H=r())===Z$){if(K=k.isBrace=!0,z=k.isGlob=!0,y=!0,V===!0)continue;break}if(D!==!0&&H===c5){if(K=k.isBrace=!0,z=k.isGlob=!0,y=!0,V===!0)continue;break}if(H===n5){if(_--,_===0){D=!1,K=k.isBrace=!0,y=!0;break}}}if(V===!0)continue;break}if(H===VJ){if(W.push(q),Y.push(k),k={value:"",depth:0,isGlob:!1},y===!0)continue;if(E===Z$&&q===C+1){C+=2;continue}P=q+1;continue}if(Z.noext!==!0){if((H===i5||H===r5||H===J$||H===$J||H===U$)===!0&&w()===W$){if(z=k.isGlob=!0,M=k.isExtglob=!0,y=!0,H===U$&&q===C)T=!0;if(V===!0){while(n()!==!0&&(H=r())){if(H===V0){F=k.backslashes=!0,H=r();continue}if(H===JJ){z=k.isGlob=!0,y=!0;break}}continue}break}}if(H===J$){if(E===J$)L=k.isGlobstar=!0;if(z=k.isGlob=!0,y=!0,V===!0)continue;break}if(H===$J){if(z=k.isGlob=!0,y=!0,V===!0)continue;break}if(H===p5){while(n()!==!0&&(t=r())){if(t===V0){F=k.backslashes=!0,r();continue}if(t===o5){A=k.isBracket=!0,z=k.isGlob=!0,y=!0;break}}if(V===!0)continue;break}if(Z.nonegate!==!0&&H===U$&&q===C){O=k.negated=!0,C++;continue}if(Z.noparen!==!0&&H===W$){if(z=k.isGlob=!0,V===!0){while(n()!==!0&&(H=r())){if(H===W$){F=k.backslashes=!0,H=r();continue}if(H===JJ){y=!0;break}}continue}break}if(z===!0){if(y=!0,V===!0)continue;break}}if(Z.noext===!0)M=!1,z=!1;let l=j,F1="",B="";if(C>0)F1=j.slice(0,C),j=j.slice(C),P-=C;if(l&&z===!0&&P>0)l=j.slice(0,P),B=j.slice(P);else if(z===!0)l="",B=j;else l=j;if(l&&l!==""&&l!=="/"&&l!==j){if(ZJ(l.charCodeAt(l.length-1)))l=l.slice(0,-1)}if(Z.unescape===!0){if(B)B=t2.removeBackslashes(B);if(l&&F===!0)l=t2.removeBackslashes(l)}let G={prefix:F1,input:$,start:C,base:l,glob:B,isBrace:K,isBracket:A,isGlob:z,isExtglob:M,isGlobstar:L,negated:O,negatedExtglob:T};if(Z.tokens===!0){if(G.maxDepth=0,!ZJ(H))Y.push(k);G.tokens=Y}if(Z.parts===!0||Z.tokens===!0){let t;for(let f=0;f<W.length;f++){let Q1=t?t+1:C,z1=W[f],J1=$.slice(Q1,z1);if(Z.tokens){if(f===0&&C!==0)Y[f].isPrefix=!0,Y[f].value=F1;else Y[f].value=J1;UJ(Y[f]),G.maxDepth+=Y[f].depth}if(f!==0||J1!=="")Q.push(J1);t=z1}if(t&&t+1<$.length){let f=$.slice(t+1);if(Q.push(f),Z.tokens)Y[Y.length-1].value=f,UJ(Y[Y.length-1]),G.maxDepth+=Y[Y.length-1].depth}G.slashes=W,G.parts=Q}return G};WJ.exports=a5});var MJ=a((n9,KJ)=>{var W0=Z0(),e=U0(),{MAX_LENGTH:E0,POSIX_REGEX_SOURCE:s5,REGEX_NON_SPECIAL_CHARS:e5,REGEX_SPECIAL_CHARS_BACKREF:t5,REPLACEMENTS:XJ}=W0,$7=($,J)=>{if(typeof J.expandRange==="function")return J.expandRange(...$,J);$.sort();let Z=`[${$.join("-")}]`;try{new RegExp(Z)}catch(U){return $.map((V)=>e.escapeRegex(V)).join("..")}return Z},d1=($,J)=>{return`Missing ${$}: "${J}" - use "\\\\${J}" to match literal characters`},QJ=($)=>{let J=[],Z=0,U=0,V=0,W="",Y=!1;for(let Q of $){if(Y===!0){W+=Q,Y=!1;continue}if(Q==="\\"){W+=Q,Y=!0;continue}if(Q==='"'){V=V===1?0:1,W+=Q;continue}if(V===0){if(Q==="[")Z++;else if(Q==="]"&&Z>0)Z--;else if(Z===0){if(Q==="(")U++;else if(Q===")"&&U>0)U--;else if(Q==="|"&&U===0){J.push(W),W="";continue}}}W+=Q}return J.push(W),J},J7=($)=>{let J=!1;for(let Z of $){if(J===!0){J=!1;continue}if(Z==="\\"){J=!0;continue}if(/[?*+@!()[\]{}]/.test(Z))return!1}return!0},zJ=($)=>{let J=$.trim(),Z=!0;while(Z===!0)if(Z=!1,/^@\([^\\()[\]{}|]+\)$/.test(J))J=J.slice(2,-1),Z=!0;if(!J7(J))return;return J.replace(/\\(.)/g,"$1")},Z7=($)=>{let J=$.map(zJ).filter(Boolean);for(let Z=0;Z<J.length;Z++)for(let U=Z+1;U<J.length;U++){let V=J[Z],W=J[U],Y=V[0];if(!Y||V!==Y.repeat(V.length)||W!==Y.repeat(W.length))continue;if(V===W||V.startsWith(W)||W.startsWith(V))return!0}return!1},Y$=($,J=!0)=>{if($[0]!=="+"&&$[0]!=="*"||$[1]!=="(")return;let Z=0,U=0,V=0,W=!1;for(let Y=1;Y<$.length;Y++){let Q=$[Y];if(W===!0){W=!1;continue}if(Q==="\\"){W=!0;continue}if(Q==='"'){V=V===1?0:1;continue}if(V===1)continue;if(Q==="["){Z++;continue}if(Q==="]"&&Z>0){Z--;continue}if(Z>0)continue;if(Q==="("){U++;continue}if(Q===")"){if(U--,U===0){if(J===!0&&Y!==$.length-1)return;return{type:$[0],body:$.slice(2,Y),end:Y}}}}},U7=($)=>{let J=0,Z=[];while(J<$.length){let V=Y$($.slice(J),!1);if(!V||V.type!=="*")return;let W=QJ(V.body).map((Q)=>Q.trim());if(W.length!==1)return;let Y=zJ(W[0]);if(!Y||Y.length!==1)return;Z.push(Y),J+=V.end+1}if(Z.length<1)return;return`${Z.length===1?e.escapeRegex(Z[0]):`[${Z.map((V)=>e.escapeRegex(V)).join("")}]`}*`},V7=($)=>{let J=0,Z=$.trim(),U=Y$(Z);while(U)J++,Z=U.body.trim(),U=Y$(Z);return J},W7=($,J)=>{if(J.maxExtglobRecursion===!1)return{risky:!1};let Z=typeof J.maxExtglobRecursion==="number"?J.maxExtglobRecursion:W0.DEFAULT_MAX_EXTGLOB_RECURSION,U=QJ($).map((V)=>V.trim());if(U.length>1){if(U.some((V)=>V==="")||U.some((V)=>/^[*?]+$/.test(V))||Z7(U))return{risky:!0}}for(let V of U){let W=U7(V);if(W)return{risky:!0,safeOutput:W};if(V7(V)>Z)return{risky:!0}}return{risky:!1}},X$=($,J)=>{if(typeof $!=="string")throw TypeError("Expected a string");$=XJ[$]||$;let Z={...J},U=typeof Z.maxLength==="number"?Math.min(E0,Z.maxLength):E0,V=$.length;if(V>U)throw SyntaxError(`Input length: ${V}, exceeds maximum allowed length: ${U}`);let W={type:"bos",value:"",output:Z.prepend||""},Y=[W],Q=Z.capture?"":"?:",j=e.isWindows(J),q=W0.globChars(j),C=W0.extglobChars(q),{DOT_LITERAL:P,PLUS_LITERAL:K,SLASH_LITERAL:A,ONE_CHAR:z,DOTS_SLASH:M,NO_DOT:L,NO_DOT_SLASH:D,NO_DOTS_SLASH:F,QMARK:O,QMARK_NO_DOT:T,STAR:y,START_ANCHOR:_}=q,E=(I)=>{return`(${Q}(?:(?!${_}${I.dot?M:P}).)*?)`},H=Z.dot?"":L,k=Z.dot?O:T,n=Z.bash===!0?E(Z):y;if(Z.capture)n=`(${n})`;if(typeof Z.noext==="boolean")Z.noextglob=Z.noext;let w={input:$,index:-1,start:0,dot:Z.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:Y};$=e.removePrefix($,w),V=$.length;let r=[],l=[],F1=[],B=W,G,t=()=>w.index===V-1,f=w.peek=(I=1)=>$[w.index+I],Q1=w.advance=()=>$[++w.index]||"",z1=()=>$.slice(w.index+1),J1=(I="",c=0)=>{w.consumed+=I,w.index+=c},B0=(I)=>{w.output+=I.output!=null?I.output:I.value,J1(I.value)},aJ=()=>{let I=1;while(f()==="!"&&(f(2)!=="("||f(3)==="?"))Q1(),w.start++,I++;if(I%2===0)return!1;return w.negated=!0,w.start++,!0},G0=(I)=>{w[I]++,F1.push(I)},C1=(I)=>{w[I]--,F1.pop()},g=(I)=>{if(B.type==="globstar"){let c=w.braces>0&&(I.type==="comma"||I.type==="brace"),R=I.extglob===!0||r.length&&(I.type==="pipe"||I.type==="paren");if(I.type!=="slash"&&I.type!=="paren"&&!c&&!R)w.output=w.output.slice(0,-B.output.length),B.type="star",B.value="*",B.output=n,w.output+=B.output}if(r.length&&I.type!=="paren")r[r.length-1].inner+=I.value;if(I.value||I.output)B0(I);if(B&&B.type==="text"&&I.type==="text"){B.value+=I.value,B.output=(B.output||"")+I.value;return}I.prev=B,Y.push(I),B=I},w0=(I,c)=>{let R={...C[c],conditions:1,inner:""};R.prev=B,R.parens=w.parens,R.output=w.output,R.startIndex=w.index,R.tokensIndex=Y.length;let S=(Z.capture?"(":"")+R.open;G0("parens"),g({type:I,value:c,output:w.output?"":z}),g({type:"paren",extglob:!0,value:Q1(),output:S}),r.push(R)},sJ=(I)=>{let c=$.slice(I.startIndex,w.index+1),R=$.slice(I.startIndex+2,w.index),S=W7(R,Z);if((I.type==="plus"||I.type==="star")&&S.risky){let h=S.safeOutput?(I.output?"":z)+(Z.capture?`(${S.safeOutput})`:S.safeOutput):void 0,K1=Y[I.tokensIndex];K1.type="text",K1.value=c,K1.output=h||e.escapeRegex(c);for(let M1=I.tokensIndex+1;M1<Y.length;M1++)Y[M1].value="",Y[M1].output="",delete Y[M1].suffix;w.output=I.output+K1.output,w.backtrack=!0,g({type:"paren",extglob:!0,value:G,output:""}),C1("parens");return}let u=I.close+(Z.capture?")":""),o;if(I.type==="negate"){let h=n;if(I.inner&&I.inner.length>1&&I.inner.includes("/"))h=E(Z);if(h!==n||t()||/^\)+$/.test(z1()))u=I.close=`)$))${h}`;if(I.inner.includes("*")&&(o=z1())&&/^\.[^\\/.]+$/.test(o)){let K1=X$(o,{...J,fastpaths:!1}).output;u=I.close=`)${K1})${h})`}if(I.prev.type==="bos")w.negatedExtglob=!0}g({type:"paren",extglob:!0,value:G,output:u}),C1("parens")};if(Z.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test($)){let I=!1,c=$.replace(t5,(R,S,u,o,h,K1)=>{if(o==="\\")return I=!0,R;if(o==="?"){if(S)return S+o+(h?O.repeat(h.length):"");if(K1===0)return k+(h?O.repeat(h.length):"");return O.repeat(u.length)}if(o===".")return P.repeat(u.length);if(o==="*"){if(S)return S+o+(h?n:"");return n}return S?R:`\\${R}`});if(I===!0)if(Z.unescape===!0)c=c.replace(/\\/g,"");else c=c.replace(/\\+/g,(R)=>{return R.length%2===0?"\\\\":R?"\\":""});if(c===$&&Z.contains===!0)return w.output=$,w;return w.output=e.wrapOutput(c,w,J),w}while(!t()){if(G=Q1(),G==="\x00")continue;if(G==="\\"){let R=f();if(R==="/"&&Z.bash!==!0)continue;if(R==="."||R===";")continue;if(!R){G+="\\",g({type:"text",value:G});continue}let S=/^\\+/.exec(z1()),u=0;if(S&&S[0].length>2){if(u=S[0].length,w.index+=u,u%2!==0)G+="\\"}if(Z.unescape===!0)G=Q1();else G+=Q1();if(w.brackets===0){g({type:"text",value:G});continue}}if(w.brackets>0&&(G!=="]"||B.value==="["||B.value==="[^")){if(Z.posix!==!1&&G===":"){let R=B.value.slice(1);if(R.includes("[")){if(B.posix=!0,R.includes(":")){let S=B.value.lastIndexOf("["),u=B.value.slice(0,S),o=B.value.slice(S+2),h=s5[o];if(h){if(B.value=u+h,w.backtrack=!0,Q1(),!W.output&&Y.indexOf(B)===1)W.output=z;continue}}}}if(G==="["&&f()!==":"||G==="-"&&f()==="]")G=`\\${G}`;if(G==="]"&&(B.value==="["||B.value==="[^"))G=`\\${G}`;if(Z.posix===!0&&G==="!"&&B.value==="[")G="^";B.value+=G,B0({value:G});continue}if(w.quotes===1&&G!=='"'){G=e.escapeRegex(G),B.value+=G,B0({value:G});continue}if(G==='"'){if(w.quotes=w.quotes===1?0:1,Z.keepQuotes===!0)g({type:"text",value:G});continue}if(G==="("){G0("parens"),g({type:"paren",value:G});continue}if(G===")"){if(w.parens===0&&Z.strictBrackets===!0)throw SyntaxError(d1("opening","("));let R=r[r.length-1];if(R&&w.parens===R.parens+1){sJ(r.pop());continue}g({type:"paren",value:G,output:w.parens?")":"\\)"}),C1("parens");continue}if(G==="["){if(Z.nobracket===!0||!z1().includes("]")){if(Z.nobracket!==!0&&Z.strictBrackets===!0)throw SyntaxError(d1("closing","]"));G=`\\${G}`}else G0("brackets");g({type:"bracket",value:G});continue}if(G==="]"){if(Z.nobracket===!0||B&&B.type==="bracket"&&B.value.length===1){g({type:"text",value:G,output:`\\${G}`});continue}if(w.brackets===0){if(Z.strictBrackets===!0)throw SyntaxError(d1("opening","["));g({type:"text",value:G,output:`\\${G}`});continue}C1("brackets");let R=B.value.slice(1);if(B.posix!==!0&&R[0]==="^"&&!R.includes("/"))G=`/${G}`;if(B.value+=G,B0({value:G}),Z.literalBrackets===!1||e.hasRegexChars(R))continue;let S=e.escapeRegex(B.value);if(w.output=w.output.slice(0,-B.value.length),Z.literalBrackets===!0){w.output+=S,B.value=S;continue}B.value=`(${Q}${S}|${B.value})`,w.output+=B.value;continue}if(G==="{"&&Z.nobrace!==!0){G0("braces");let R={type:"brace",value:G,output:"(",outputIndex:w.output.length,tokensIndex:w.tokens.length};l.push(R),g(R);continue}if(G==="}"){let R=l[l.length-1];if(Z.nobrace===!0||!R){g({type:"text",value:G,output:G});continue}let S=")";if(R.dots===!0){let u=Y.slice(),o=[];for(let h=u.length-1;h>=0;h--){if(Y.pop(),u[h].type==="brace")break;if(u[h].type!=="dots")o.unshift(u[h].value)}S=$7(o,Z),w.backtrack=!0}if(R.comma!==!0&&R.dots!==!0){let u=w.output.slice(0,R.outputIndex),o=w.tokens.slice(R.tokensIndex);R.value=R.output="\\{",G=S="\\}",w.output=u;for(let h of o)w.output+=h.output||h.value}g({type:"brace",value:G,output:S}),C1("braces"),l.pop();continue}if(G==="|"){if(r.length>0)r[r.length-1].conditions++;g({type:"text",value:G});continue}if(G===","){let R=G,S=l[l.length-1];if(S&&F1[F1.length-1]==="braces")S.comma=!0,R="|";g({type:"comma",value:G,output:R});continue}if(G==="/"){if(B.type==="dot"&&w.index===w.start+1){w.start=w.index+1,w.consumed="",w.output="",Y.pop(),B=W;continue}g({type:"slash",value:G,output:A});continue}if(G==="."){if(w.braces>0&&B.type==="dot"){if(B.value===".")B.output=P;let R=l[l.length-1];B.type="dots",B.output+=G,B.value+=G,R.dots=!0;continue}if(w.braces+w.parens===0&&B.type!=="bos"&&B.type!=="slash"){g({type:"text",value:G,output:P});continue}g({type:"dot",value:G,output:P});continue}if(G==="?"){if(!(B&&B.value==="(")&&Z.noextglob!==!0&&f()==="("&&f(2)!=="?"){w0("qmark",G);continue}if(B&&B.type==="paren"){let S=f(),u=G;if(S==="<"&&!e.supportsLookbehinds())throw Error("Node.js v10 or higher is required for regex lookbehinds");if(B.value==="("&&!/[!=<:]/.test(S)||S==="<"&&!/<([!=]|\w+>)/.test(z1()))u=`\\${G}`;g({type:"text",value:G,output:u});continue}if(Z.dot!==!0&&(B.type==="slash"||B.type==="bos")){g({type:"qmark",value:G,output:T});continue}g({type:"qmark",value:G,output:O});continue}if(G==="!"){if(Z.noextglob!==!0&&f()==="("){if(f(2)!=="?"||!/[!=<:]/.test(f(3))){w0("negate",G);continue}}if(Z.nonegate!==!0&&w.index===0){aJ();continue}}if(G==="+"){if(Z.noextglob!==!0&&f()==="("&&f(2)!=="?"){w0("plus",G);continue}if(B&&B.value==="("||Z.regex===!1){g({type:"plus",value:G,output:K});continue}if(B&&(B.type==="bracket"||B.type==="paren"||B.type==="brace")||w.parens>0){g({type:"plus",value:G});continue}g({type:"plus",value:K});continue}if(G==="@"){if(Z.noextglob!==!0&&f()==="("&&f(2)!=="?"){g({type:"at",extglob:!0,value:G,output:""});continue}g({type:"text",value:G});continue}if(G!=="*"){if(G==="$"||G==="^")G=`\\${G}`;let R=e5.exec(z1());if(R)G+=R[0],w.index+=R[0].length;g({type:"text",value:G});continue}if(B&&(B.type==="globstar"||B.star===!0)){B.type="star",B.star=!0,B.value+=G,B.output=n,w.backtrack=!0,w.globstar=!0,J1(G);continue}let I=z1();if(Z.noextglob!==!0&&/^\([^?]/.test(I)){w0("star",G);continue}if(B.type==="star"){if(Z.noglobstar===!0){J1(G);continue}let R=B.prev,S=R.prev,u=R.type==="slash"||R.type==="bos",o=S&&(S.type==="star"||S.type==="globstar");if(Z.bash===!0&&(!u||I[0]&&I[0]!=="/")){g({type:"star",value:G,output:""});continue}let h=w.braces>0&&(R.type==="comma"||R.type==="brace"),K1=r.length&&(R.type==="pipe"||R.type==="paren");if(!u&&R.type!=="paren"&&!h&&!K1){g({type:"star",value:G,output:""});continue}while(I.slice(0,3)==="/**"){let M1=$[w.index+4];if(M1&&M1!=="/")break;I=I.slice(3),J1("/**",3)}if(R.type==="bos"&&t()){B.type="globstar",B.value+=G,B.output=E(Z),w.output=B.output,w.globstar=!0,J1(G);continue}if(R.type==="slash"&&R.prev.type!=="bos"&&!o&&t()){w.output=w.output.slice(0,-(R.output+B.output).length),R.output=`(?:${R.output}`,B.type="globstar",B.output=E(Z)+(Z.strictSlashes?")":"|$)"),B.value+=G,w.globstar=!0,w.output+=R.output+B.output,J1(G);continue}if(R.type==="slash"&&R.prev.type!=="bos"&&I[0]==="/"){let M1=I[1]!==void 0?"|$":"";w.output=w.output.slice(0,-(R.output+B.output).length),R.output=`(?:${R.output}`,B.type="globstar",B.output=`${E(Z)}${A}|${A}${M1})`,B.value+=G,w.output+=R.output+B.output,w.globstar=!0,J1(G+Q1()),g({type:"slash",value:"/",output:""});continue}if(R.type==="bos"&&I[0]==="/"){B.type="globstar",B.value+=G,B.output=`(?:^|${A}|${E(Z)}${A})`,w.output=B.output,w.globstar=!0,J1(G+Q1()),g({type:"slash",value:"/",output:""});continue}w.output=w.output.slice(0,-B.output.length),B.type="globstar",B.output=E(Z),B.value+=G,w.output+=B.output,w.globstar=!0,J1(G);continue}let c={type:"star",value:G,output:n};if(Z.bash===!0){if(c.output=".*?",B.type==="bos"||B.type==="slash")c.output=H+c.output;g(c);continue}if(B&&(B.type==="bracket"||B.type==="paren")&&Z.regex===!0){c.output=G,g(c);continue}if(w.index===w.start||B.type==="slash"||B.type==="dot"){if(B.type==="dot")w.output+=D,B.output+=D;else if(Z.dot===!0)w.output+=F,B.output+=F;else w.output+=H,B.output+=H;if(f()!=="*")w.output+=z,B.output+=z}g(c)}while(w.brackets>0){if(Z.strictBrackets===!0)throw SyntaxError(d1("closing","]"));w.output=e.escapeLast(w.output,"["),C1("brackets")}while(w.parens>0){if(Z.strictBrackets===!0)throw SyntaxError(d1("closing",")"));w.output=e.escapeLast(w.output,"("),C1("parens")}while(w.braces>0){if(Z.strictBrackets===!0)throw SyntaxError(d1("closing","}"));w.output=e.escapeLast(w.output,"{"),C1("braces")}if(Z.strictSlashes!==!0&&(B.type==="star"||B.type==="bracket"))g({type:"maybe_slash",value:"",output:`${A}?`});if(w.backtrack===!0){w.output="";for(let I of w.tokens)if(w.output+=I.output!=null?I.output:I.value,I.suffix)w.output+=I.suffix}return w};X$.fastpaths=($,J)=>{let Z={...J},U=typeof Z.maxLength==="number"?Math.min(E0,Z.maxLength):E0,V=$.length;if(V>U)throw SyntaxError(`Input length: ${V}, exceeds maximum allowed length: ${U}`);$=XJ[$]||$;let W=e.isWindows(J),{DOT_LITERAL:Y,SLASH_LITERAL:Q,ONE_CHAR:j,DOTS_SLASH:q,NO_DOT:C,NO_DOTS:P,NO_DOTS_SLASH:K,STAR:A,START_ANCHOR:z}=W0.globChars(W),M=Z.dot?P:C,L=Z.dot?K:C,D=Z.capture?"":"?:",F={negated:!1,prefix:""},O=Z.bash===!0?".*?":A;if(Z.capture)O=`(${O})`;let T=(H)=>{if(H.noglobstar===!0)return O;return`(${D}(?:(?!${z}${H.dot?q:Y}).)*?)`},y=(H)=>{switch(H){case"*":return`${M}${j}${O}`;case".*":return`${Y}${j}${O}`;case"*.*":return`${M}${O}${Y}${j}${O}`;case"*/*":return`${M}${O}${Q}${j}${L}${O}`;case"**":return M+T(Z);case"**/*":return`(?:${M}${T(Z)}${Q})?${L}${j}${O}`;case"**/*.*":return`(?:${M}${T(Z)}${Q})?${L}${O}${Y}${j}${O}`;case"**/.*":return`(?:${M}${T(Z)}${Q})?${Y}${j}${O}`;default:{let k=/^(.*?)\.(\w+)$/.exec(H);if(!k)return;let n=y(k[1]);if(!n)return;return n+Y+k[2]}}},_=e.removePrefix($,F),E=y(_);if(E&&Z.strictSlashes!==!0)E+=`${Q}?`;return E};KJ.exports=X$});var BJ=a((o9,jJ)=>{var Y7=N1("path"),X7=YJ(),Q$=MJ(),z$=U0(),Q7=Z0(),z7=($)=>$&&typeof $==="object"&&!Array.isArray($),i=($,J,Z=!1)=>{if(Array.isArray($)){let C=$.map((K)=>i(K,J,Z));return(K)=>{for(let A of C){let z=A(K);if(z)return z}return!1}}let U=z7($)&&$.tokens&&$.input;if($===""||typeof $!=="string"&&!U)throw TypeError("Expected pattern to be a non-empty string");let V=J||{},W=z$.isWindows(J),Y=U?i.compileRe($,J):i.makeRe($,J,!1,!0),Q=Y.state;delete Y.state;let j=()=>!1;if(V.ignore){let C={...J,ignore:null,onMatch:null,onResult:null};j=i(V.ignore,C,Z)}let q=(C,P=!1)=>{let{isMatch:K,match:A,output:z}=i.test(C,Y,J,{glob:$,posix:W}),M={glob:$,state:Q,regex:Y,posix:W,input:C,output:z,match:A,isMatch:K};if(typeof V.onResult==="function")V.onResult(M);if(K===!1)return M.isMatch=!1,P?M:!1;if(j(C)){if(typeof V.onIgnore==="function")V.onIgnore(M);return M.isMatch=!1,P?M:!1}if(typeof V.onMatch==="function")V.onMatch(M);return P?M:!0};if(Z)q.state=Q;return q};i.test=($,J,Z,{glob:U,posix:V}={})=>{if(typeof $!=="string")throw TypeError("Expected input to be a string");if($==="")return{isMatch:!1,output:""};let W=Z||{},Y=W.format||(V?z$.toPosixSlashes:null),Q=$===U,j=Q&&Y?Y($):$;if(Q===!1)j=Y?Y($):$,Q=j===U;if(Q===!1||W.capture===!0)if(W.matchBase===!0||W.basename===!0)Q=i.matchBase($,J,Z,V);else Q=J.exec(j);return{isMatch:Boolean(Q),match:Q,output:j}};i.matchBase=($,J,Z,U=z$.isWindows(Z))=>{return(J instanceof RegExp?J:i.makeRe(J,Z)).test(Y7.basename($))};i.isMatch=($,J,Z)=>i(J,Z)($);i.parse=($,J)=>{if(Array.isArray($))return $.map((Z)=>i.parse(Z,J));return Q$($,{...J,fastpaths:!1})};i.scan=($,J)=>X7($,J);i.compileRe=($,J,Z=!1,U=!1)=>{if(Z===!0)return $.output;let V=J||{},W=V.contains?"":"^",Y=V.contains?"":"$",Q=`${W}(?:${$.output})${Y}`;if($&&$.negated===!0)Q=`^(?!${Q}).*$`;let j=i.toRegex(Q,J);if(U===!0)j.state=$;return j};i.makeRe=($,J={},Z=!1,U=!1)=>{if(!$||typeof $!=="string")throw TypeError("Expected a non-empty string");let V={negated:!1,fastpaths:!0};if(J.fastpaths!==!1&&($[0]==="."||$[0]==="*"))V.output=Q$.fastpaths($,J);if(!V.output)V=Q$($,J);return i.compileRe(V,J,Z,U)};i.toRegex=($,J)=>{try{let Z=J||{};return new RegExp($,Z.flags||(Z.nocase?"i":""))}catch(Z){if(J&&J.debug===!0)throw Z;return/$^/}};i.constants=Q7;jJ.exports=i});var PJ=a((a9,CJ)=>{var wJ=N1("util"),qJ=n2(),B1=BJ(),K$=U0(),GJ=($)=>$===""||$==="./",FJ=($)=>{let J=$.indexOf("{");return J>-1&&$.indexOf("}",J)>-1},m=($,J,Z)=>{J=[].concat(J),$=[].concat($);let U=new Set,V=new Set,W=new Set,Y=0,Q=(C)=>{if(W.add(C.output),Z&&Z.onResult)Z.onResult(C)};for(let C=0;C<J.length;C++){let P=B1(String(J[C]),{...Z,onResult:Q},!0),K=P.state.negated||P.state.negatedExtglob;if(K)Y++;for(let A of $){let z=P(A,!0);if(!(K?!z.isMatch:z.isMatch))continue;if(K)U.add(z.output);else U.delete(z.output),V.add(z.output)}}let q=(Y===J.length?[...W]:[...V]).filter((C)=>!U.has(C));if(Z&&q.length===0){if(Z.failglob===!0)throw Error(`No matches found for "${J.join(", ")}"`);if(Z.nonull===!0||Z.nullglob===!0)return Z.unescape?J.map((C)=>C.replace(/\\/g,"")):J}return q};m.match=m;m.matcher=($,J)=>B1($,J);m.isMatch=($,J,Z)=>B1(J,Z)($);m.any=m.isMatch;m.not=($,J,Z={})=>{J=[].concat(J).map(String);let U=new Set,V=[],Y=new Set(m($,J,{...Z,onResult:(Q)=>{if(Z.onResult)Z.onResult(Q);V.push(Q.output)}}));for(let Q of V)if(!Y.has(Q))U.add(Q);return[...U]};m.contains=($,J,Z)=>{if(typeof $!=="string")throw TypeError(`Expected a string: "${wJ.inspect($)}"`);if(Array.isArray(J))return J.some((U)=>m.contains($,U,Z));if(typeof J==="string"){if(GJ($)||GJ(J))return!1;if($.includes(J)||$.startsWith("./")&&$.slice(2).includes(J))return!0}return m.isMatch($,J,{...Z,contains:!0})};m.matchKeys=($,J,Z)=>{if(!K$.isObject($))throw TypeError("Expected the first argument to be an object");let U=m(Object.keys($),J,Z),V={};for(let W of U)V[W]=$[W];return V};m.some=($,J,Z)=>{let U=[].concat($);for(let V of[].concat(J)){let W=B1(String(V),Z);if(U.some((Y)=>W(Y)))return!0}return!1};m.every=($,J,Z)=>{let U=[].concat($);for(let V of[].concat(J)){let W=B1(String(V),Z);if(!U.every((Y)=>W(Y)))return!1}return!0};m.all=($,J,Z)=>{if(typeof $!=="string")throw TypeError(`Expected a string: "${wJ.inspect($)}"`);return[].concat(J).every((U)=>B1(U,Z)($))};m.capture=($,J,Z)=>{let U=K$.isWindows(Z),W=B1.makeRe(String($),{...Z,capture:!0}).exec(U?K$.toPosixSlashes(J):J);if(W)return W.slice(1).map((Y)=>Y===void 0?"":Y)};m.makeRe=(...$)=>B1.makeRe(...$);m.scan=(...$)=>B1.scan(...$);m.parse=($,J)=>{let Z=[];for(let U of[].concat($||[]))for(let V of qJ(String(U),J))Z.push(B1.parse(V,J));return Z};m.braces=($,J)=>{if(typeof $!=="string")throw TypeError("Expected a string");if(J&&J.nobrace===!0||!FJ($))return[$];return qJ($,J)};m.braceExpand=($,J)=>{if(typeof $!=="string")throw TypeError("Expected a string");return m.braces($,{...J,expand:!0})};m.hasBraces=FJ;CJ.exports=m});var yJ=a((s9,NJ)=>{/*!
19
+ * is-extglob <https://github.com/jonschlinkert/is-extglob>
20
+ *
21
+ * Copyright (c) 2014-2016, Jon Schlinkert.
22
+ * Licensed under the MIT License.
23
+ */NJ.exports=function(J){if(typeof J!=="string"||J==="")return!1;var Z;while(Z=/(\\).|([@?!+*]\(.*\))/g.exec(J)){if(Z[2])return!0;J=J.slice(Z.index+Z[0].length)}return!1}});var HJ=a((e9,LJ)=>{/*!
24
+ * is-glob <https://github.com/jonschlinkert/is-glob>
25
+ *
26
+ * Copyright (c) 2014-2017, Jon Schlinkert.
27
+ * Released under the MIT License.
28
+ */var K7=yJ(),OJ={"{":"}","(":")","[":"]"},M7=function($){if($[0]==="!")return!0;var J=0,Z=-2,U=-2,V=-2,W=-2,Y=-2;while(J<$.length){if($[J]==="*")return!0;if($[J+1]==="?"&&/[\].+)]/.test($[J]))return!0;if(U!==-1&&$[J]==="["&&$[J+1]!=="]"){if(U<J)U=$.indexOf("]",J);if(U>J){if(Y===-1||Y>U)return!0;if(Y=$.indexOf("\\",J),Y===-1||Y>U)return!0}}if(V!==-1&&$[J]==="{"&&$[J+1]!=="}"){if(V=$.indexOf("}",J),V>J){if(Y=$.indexOf("\\",J),Y===-1||Y>V)return!0}}if(W!==-1&&$[J]==="("&&$[J+1]==="?"&&/[:!=]/.test($[J+2])&&$[J+3]!==")"){if(W=$.indexOf(")",J),W>J){if(Y=$.indexOf("\\",J),Y===-1||Y>W)return!0}}if(Z!==-1&&$[J]==="("&&$[J+1]!=="|"){if(Z<J)Z=$.indexOf("|",J);if(Z!==-1&&$[Z+1]!==")"){if(W=$.indexOf(")",Z),W>Z){if(Y=$.indexOf("\\",Z),Y===-1||Y>W)return!0}}}if($[J]==="\\"){var Q=$[J+1];J+=2;var j=OJ[Q];if(j){var q=$.indexOf(j,J);if(q!==-1)J=q+1}if($[J]==="!")return!0}else J++}return!1},j7=function($){if($[0]==="!")return!0;var J=0;while(J<$.length){if(/[*?{}()[\]]/.test($[J]))return!0;if($[J]==="\\"){var Z=$[J+1];J+=2;var U=OJ[Z];if(U){var V=$.indexOf(U,J);if(V!==-1)J=V+1}if($[J]==="!")return!0}else J++}return!1};LJ.exports=function(J,Z){if(typeof J!=="string"||J==="")return!1;if(K7(J))return!0;var U=M7;if(Z&&Z.strict===!1)U=j7;return U(J)}});var A$={};j1(A$,{layer:()=>oJ,defaultLayer:()=>p7,Service:()=>j0,InstanceBootstrap:()=>A$});var E1={};j1(E1,{use:()=>_Z,layer:()=>x$,defaultLayer:()=>DZ,Status:()=>HZ,Service:()=>c1,Format:()=>E1});import LZ from"path";var C0={};j1(C0,{zig:()=>UZ,uvformat:()=>XZ,terraform:()=>BZ,standardrb:()=>zZ,shfmt:()=>qZ,rustfmt:()=>CZ,ruff:()=>T$,rubocop:()=>QZ,rlang:()=>YZ,prettier:()=>$Z,pint:()=>PZ,oxfmt:()=>JZ,ormolu:()=>NZ,ocamlformat:()=>jZ,nixfmt:()=>FZ,mix:()=>tJ,latexindent:()=>GZ,ktlint:()=>WZ,htmlbeautifier:()=>KZ,gofmt:()=>eJ,gleam:()=>wZ,dfmt:()=>OZ,dart:()=>MZ,cljfmt:()=>yZ,clang:()=>VZ,biome:()=>ZZ});var eJ={name:"gofmt",extensions:[".go"],async enabled(){let $=d("gofmt");if(!$)return!1;return[$,"-w","$FILE"]}},tJ={name:"mix",extensions:[".ex",".exs",".eex",".heex",".leex",".neex",".sface"],async enabled(){let $=d("mix");if(!$)return!1;return[$,"format","$FILE"]}},$Z={name:"prettier",environment:{BUN_BE_BUN:"1"},extensions:[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".html",".htm",".css",".scss",".sass",".less",".vue",".svelte",".json",".jsonc",".yaml",".yml",".toml",".xml",".md",".mdx",".graphql",".gql"],async enabled($){let J=await s.findUp("package.json",$.directory,$.worktree);for(let Z of J){let U=await s.readJson(Z);if(U.dependencies?.prettier||U.devDependencies?.prettier){let V=await F0.which("prettier");if(V)return[V,"--write","$FILE"]}}return!1}},JZ={name:"oxfmt",environment:{BUN_BE_BUN:"1"},extensions:[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts"],async enabled($){if(!$.experimentalOxfmt)return!1;let J=await s.findUp("package.json",$.directory,$.worktree);for(let Z of J){let U=await s.readJson(Z);if(U.dependencies?.oxfmt||U.devDependencies?.oxfmt){let V=await F0.which("oxfmt");if(V)return[V,"$FILE"]}}return!1}},ZZ={name:"biome",environment:{BUN_BE_BUN:"1"},extensions:[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".html",".htm",".css",".scss",".sass",".less",".vue",".svelte",".json",".jsonc",".yaml",".yml",".toml",".xml",".md",".mdx",".graphql",".gql"],async enabled($){let J=["biome.json","biome.jsonc"];for(let Z of J)if((await s.findUp(Z,$.directory,$.worktree)).length>0){let V=await F0.which("@biomejs/biome");if(V)return[V,"format","--write","$FILE"]}return!1}},UZ={name:"zig",extensions:[".zig",".zon"],async enabled(){let $=d("zig");if(!$)return!1;return[$,"fmt","$FILE"]}},VZ={name:"clang-format",extensions:[".c",".cc",".cpp",".cxx",".c++",".h",".hh",".hpp",".hxx",".h++",".ino",".C",".H"],async enabled($){if((await s.findUp(".clang-format",$.directory,$.worktree)).length>0){let Z=d("clang-format");if(Z)return[Z,"-i","$FILE"]}return!1}},WZ={name:"ktlint",extensions:[".kt",".kts"],async enabled(){let $=d("ktlint");if(!$)return!1;return[$,"-F","$FILE"]}},T$={name:"ruff",extensions:[".py",".pyi"],async enabled($){if(!d("ruff"))return!1;let J=["pyproject.toml","ruff.toml",".ruff.toml"];for(let U of J){let V=await s.findUp(U,$.directory,$.worktree);if(V.length>0)if(U==="pyproject.toml"){if((await s.readText(V[0])).includes("[tool.ruff]"))return["ruff","format","$FILE"]}else return["ruff","format","$FILE"]}let Z=["requirements.txt","pyproject.toml","Pipfile"];for(let U of Z){let V=await s.findUp(U,$.directory,$.worktree);if(V.length>0){if((await s.readText(V[0])).includes("ruff"))return["ruff","format","$FILE"]}}return!1}},YZ={name:"air",extensions:[".R"],async enabled(){let $=d("air");if($==null)return!1;let J=await q0.text([$,"--help"],{nothrow:!0}),Z=J.text.split(`
29
+ `)[0],U=Z.includes("R language"),V=Z.includes("formatter");if(J.code===0&&U&&V)return[$,"format","$FILE"];return!1}},XZ={name:"uv",extensions:[".py",".pyi"],async enabled($){if(await T$.enabled($))return!1;let J=d("uv");if(J==null)return!1;if((await q0.run([J,"format","--help"],{nothrow:!0})).code===0)return[J,"format","--","$FILE"];return!1}},QZ={name:"rubocop",extensions:[".rb",".rake",".gemspec",".ru"],async enabled(){let $=d("rubocop");if(!$)return!1;return[$,"--autocorrect","$FILE"]}},zZ={name:"standardrb",extensions:[".rb",".rake",".gemspec",".ru"],async enabled(){let $=d("standardrb");if(!$)return!1;return[$,"--fix","$FILE"]}},KZ={name:"htmlbeautifier",extensions:[".erb",".html.erb"],async enabled(){let $=d("htmlbeautifier");if(!$)return!1;return[$,"$FILE"]}},MZ={name:"dart",extensions:[".dart"],async enabled(){let $=d("dart");if(!$)return!1;return[$,"format","$FILE"]}},jZ={name:"ocamlformat",extensions:[".ml",".mli"],async enabled($){if(!d("ocamlformat"))return!1;if((await s.findUp(".ocamlformat",$.directory,$.worktree)).length>0)return["ocamlformat","-i","$FILE"];return!1}},BZ={name:"terraform",extensions:[".tf",".tfvars"],async enabled(){let $=d("terraform");if(!$)return!1;return[$,"fmt","$FILE"]}},GZ={name:"latexindent",extensions:[".tex"],async enabled(){let $=d("latexindent");if(!$)return!1;return[$,"-w","-s","$FILE"]}},wZ={name:"gleam",extensions:[".gleam"],async enabled(){let $=d("gleam");if(!$)return!1;return[$,"format","$FILE"]}},qZ={name:"shfmt",extensions:[".sh",".bash"],async enabled(){let $=d("shfmt");if(!$)return!1;return[$,"-w","$FILE"]}},FZ={name:"nixfmt",extensions:[".nix"],async enabled(){let $=d("nixfmt");if(!$)return!1;return[$,"$FILE"]}},CZ={name:"rustfmt",extensions:[".rs"],async enabled(){let $=d("rustfmt");if(!$)return!1;return[$,"$FILE"]}},PZ={name:"pint",extensions:[".php"],async enabled($){let J=await s.findUp("composer.json",$.directory,$.worktree);for(let Z of J){let U=await s.readJson(Z);if(U.require?.["laravel/pint"]||U["require-dev"]?.["laravel/pint"])return["./vendor/bin/pint","$FILE"]}return!1}},NZ={name:"ormolu",extensions:[".hs"],async enabled(){let $=d("ormolu");if(!$)return!1;return[$,"-i","$FILE"]}},yZ={name:"cljfmt",extensions:[".clj",".cljs",".cljc",".edn"],async enabled(){let $=d("cljfmt");if(!$)return!1;return[$,"fix","--quiet","$FILE"]}},OZ={name:"dfmt",extensions:[".d"],async enabled(){let $=d("dfmt");if(!$)return!1;return[$,"-i","$FILE"]}};var G1=V1({service:"format"}),HZ=N.Struct({name:N.String,extensions:N.Array(N.String),enabled:N.Boolean}).annotate({identifier:"FormatterStatus"});class c1 extends U1.Service()("@muxcode/Format"){}var _Z=P1(c1),x$=b.effect(c1,X.gen(function*(){let $=yield*W1.Service,J=yield*d0.Service,Z=yield*v0.Service,U=yield*x.make(X.fn("Format.state")(function*(Q){let j={},q={};async function C(M){let L=j[M.name];if(L===!1||L===void 0)L=await M.enabled({...Q,experimentalOxfmt:Z.experimentalOxfmt}),j[M.name]=L;return L}async function P(M){return await C(M)!==!1}async function K(M){let L=Object.values(q).filter((F)=>F.extensions.includes(M));return(await Promise.all(L.map(async(F)=>{G1.info("checking",{name:F.name,ext:M});let O=await C(F);if(O)G1.info("enabled",{name:F.name,ext:M});return{item:F,cmd:O}}))).filter((F)=>F.cmd!==!1).map((F)=>({item:F.item,cmd:F.cmd}))}function A(M){return X.gen(function*(){G1.info("formatting",{file:M});let L=yield*X.promise(()=>K(LZ.extname(M)));if(!L.length)return!1;for(let{item:D,cmd:F}of L){G1.info("running",{command:F});let O=F.map((_)=>_.replace("$FILE",M)),T=yield*x.directory,y=yield*J.run(i1.make(O[0],O.slice(1),{cwd:T,env:D.environment,extendEnv:!0,stdin:"ignore",stdout:"ignore",stderr:"ignore"})).pipe(X.catch((_)=>X.sync(()=>{G1.error("failed to format file",{error:"spawn failed",command:F,...D.environment,file:M,cause:k$(_.cause??_)});return})));if(y&&y.exitCode!==0)G1.error("failed",{command:F,...D.environment})}return!0})}let z=yield*$.get();if(!z.formatter)return G1.info("all formatters are disabled"),G1.info("init"),{formatters:q,isEnabled:P,formatFile:A};for(let M of Object.values(C0))q[M.name]=M;if(z.formatter!==!0)for(let[M,L]of Object.entries(z.formatter)){let D=C0[M];if(["ruff","uv"].includes(M)&&(z.formatter.ruff?.disabled||z.formatter.uv?.disabled)){delete q.ruff,delete q.uv;continue}if(L.disabled){delete q[M];continue}let F=E$(D??{extensions:[]},L);q[M]={...F,name:M,extensions:F.extensions??[],enabled:D&&!F.command?D.enabled:async(O)=>F.command??!1}}return G1.info("init"),{formatters:q,isEnabled:P,formatFile:A}})),V=X.fn("Format.init")(function*(){yield*x.get(U)}),W=X.fn("Format.status")(function*(){let{formatters:Q,isEnabled:j}=yield*x.get(U),q=[];for(let C of Object.values(Q)){let P=yield*X.promise(()=>j(C));q.push({name:C.name,extensions:C.extensions,enabled:P})}return q}),Y=X.fn("Format.file")(function*(Q){let{formatFile:j}=yield*x.get(U);return yield*j(Q)});return c1.of({init:V,status:W,file:Y})})),DZ=x$.pipe(b.provide(W1.defaultLayer),b.provide(d0.defaultLayer),b.provide(v0.defaultLayer));var f1={};j1(f1,{use:()=>x6,layer:()=>j2,defaultLayer:()=>S6,Service:()=>$0,Node:()=>G6,Info:()=>B6,File:()=>f1,Event:()=>C6,Content:()=>F6});var K2=Q2(j6(),1),M2=Q2(c$(),1);import $1 from"path";var O1={};j1(O1,{paths:()=>sZ,names:()=>aZ,Protected:()=>O1});import m0 from"path";import iZ from"os";var r0=iZ.homedir(),p$=["Music","Pictures","Movies","Downloads","Desktop","Documents","Public","Applications","Library"],nZ=["Application Support/AddressBook","Calendars","Mail","Messages","Safari","Cookies","Application Support/com.apple.TCC","PersonalizationPortrait","Metadata/CoreSpotlight","Suggestions"],oZ=["/.DocumentRevisions-V100","/.Spotlight-V100","/.Trashes","/.fseventsd"],i$=["AppData","Downloads","Desktop","Documents","Pictures","Music","Videos","OneDrive"];function aZ(){if(process.platform==="darwin")return new Set(p$);if(process.platform==="win32")return new Set(i$);return new Set}function sZ(){if(process.platform==="darwin")return[...p$.map(($)=>m0.join(r0,$)),...nZ.map(($)=>m0.join(r0,"Library",$)),...oZ];if(process.platform==="win32")return i$.map(($)=>m0.join(r0,$));return[]}var g1={};j1(g1,{use:()=>V6,layer:()=>Y2,defaultLayer:()=>M6,Service:()=>a1,SearchMatch:()=>U2,Ripgrep:()=>g1,Match:()=>V2});import o1 from"path";var n$=V1({service:"ripgrep"}),c0="15.1.0",eZ={"arm64-darwin":{platform:"aarch64-apple-darwin",extension:"tar.gz"},"arm64-linux":{platform:"aarch64-unknown-linux-gnu",extension:"tar.gz"},"x64-darwin":{platform:"x86_64-apple-darwin",extension:"tar.gz"},"x64-linux":{platform:"x86_64-unknown-linux-musl",extension:"tar.gz"},"arm64-win32":{platform:"aarch64-pc-windows-msvc",extension:"zip"},"ia32-win32":{platform:"i686-pc-windows-msvc",extension:"zip"},"x64-win32":{platform:"x86_64-pc-windows-msvc",extension:"zip"}},J2=N.Struct({secs:p,nanos:p,human:N.String}),Z2=N.Struct({elapsed:J2,searches:p,searches_with_match:p,bytes_searched:p,bytes_printed:p,matched_lines:p,matches:p}),i0=N.Struct({text:N.String}),tZ=N.Struct({type:N.Literal("begin"),data:N.Struct({path:i0})}),U2=N.Struct({path:i0,lines:N.Struct({text:N.String}),line_number:p,absolute_offset:p,submatches:N.Array(N.Struct({match:N.Struct({text:N.String}),start:p,end:p}))}),V2=N.Struct({type:N.Literal("match"),data:U2}),$6=N.Struct({type:N.Literal("end"),data:N.Struct({path:i0,binary_offset:N.NullOr(p),stats:Z2})}),J6=N.Struct({type:N.Literal("summary"),data:N.Struct({elapsed_total:J2,stats:Z2})}),Z6=N.Union([tZ,V2,$6,J6]),U6=N.decodeUnknownEffect(N.fromJsonString(Z6));class a1 extends U1.Service()("@muxcode/Ripgrep"){}var V6=P1(a1);function W6(){let $=e$();return delete $.RIPGREP_CONFIG_PATH,$}function o$($){let J=$?.reason;if(J instanceof Error)return J;let Z=Error("Aborted");return Z.name="AbortError",Z}function Y6($){if(!$)return X.never;if($.aborted)return X.fail(o$($));return X.callback((J)=>{let Z=()=>J(X.fail(o$($)));return $.addEventListener("abort",Z,{once:!0}),X.sync(()=>$.removeEventListener("abort",Z))})}function O0($,J){let Z=Error($.trim()||`ripgrep failed with code ${J}`);return Z.name="RipgrepError",Z}function W2($){return o1.normalize($.replace(/^\.[\\/]/,""))}function X6($){return{...$,path:{...$.path,text:W2($.path.text)}}}function Q6($){return U6($).pipe(X.mapError((J)=>Error("invalid ripgrep output",{cause:J})))}function a$($,J){L0.failCauseUnsafe($,s1.fail(J))}function z6($){let J=["--no-config","--files","--glob=!.git/*"];if($.follow)J.push("--follow");if($.hidden!==!1)J.push("--hidden");if($.hidden===!1)J.push("--glob=!.*");if($.maxDepth!==void 0)J.push(`--max-depth=${$.maxDepth}`);if($.glob)for(let Z of $.glob)J.push(`--glob=${Z}`);return J.push("."),J}function K6($){let J=["--no-config","--json","--hidden","--glob=!.git/*","--no-messages"];if($.follow)J.push("--follow");if($.glob)for(let Z of $.glob)J.push(`--glob=${Z}`);if($.limit)J.push(`--max-count=${$.limit}`);return J.push("--",$.pattern,...$.file??["."]),J}function s$($,J){return J?$.pipe(X.raceFirst(Y6(J))):$}var Y2=b.effect(a1,X.gen(function*(){let $=yield*H1.Service,J=S1.filterStatusOk(yield*S1.HttpClient),Z=yield*t$,U=X.fnUntraced(function*(P,K,A){let z=yield*Z.spawn(i1.make(P,K,{cwd:A?.cwd,extendEnv:!0,stdin:"ignore"})),[M,L,D]=yield*X.all([v.mkString(v.decodeText(z.stdout)),v.mkString(v.decodeText(z.stderr)),z.exitCode],{concurrency:"unbounded"});return{stdout:M,stderr:L,code:D}},X.scoped),V=X.fnUntraced(function*(P,K,A){let z=yield*$.makeTempDirectoryScoped({directory:L1.Path.bin,prefix:"ripgrep-"});if(K.extension==="zip"){let L=(yield*X.sync(()=>d("powershell.exe")??d("pwsh.exe")))??"powershell.exe",D=yield*U(L,["-NoProfile","-NonInteractive","-Command",`$global:ProgressPreference = 'SilentlyContinue'; Expand-Archive -LiteralPath '${P.replaceAll("'","''")}' -DestinationPath '${z.replaceAll("'","''")}' -Force`]);if(D.code!==0)return yield*X.fail(O0(D.stderr||D.stdout,D.code))}if(K.extension==="tar.gz"){let L=yield*U("tar",["-xzf",P,"-C",z]);if(L.code!==0)return yield*X.fail(O0(L.stderr||L.stdout,L.code))}let M=o1.join(z,`ripgrep-${c0}-${K.platform}`,process.platform==="win32"?"rg.exe":"rg");if(!(yield*$.isFile(M)))return yield*X.fail(Error(`ripgrep archive did not contain executable: ${M}`));if(yield*$.copyFile(M,A),process.platform==="win32")return;yield*$.chmod(A,493)},X.scoped),W=yield*X.cached(X.gen(function*(){let P=yield*X.sync(()=>d(process.platform==="win32"?"rg.exe":"rg"));if(P&&(yield*$.isFile(P).pipe(X.orDie)))return P;let K=o1.join(L1.Path.bin,`rg${process.platform==="win32"?".exe":""}`);if(yield*$.isFile(K).pipe(X.orDie))return K;let A=`${process.arch}-${process.platform}`,z=eZ[A];if(!z)return yield*X.fail(Error(`unsupported platform for ripgrep: ${A}`));let M=`ripgrep-${c0}-${z.platform}.${z.extension}`,L=`https://github.com/BurntSushi/ripgrep/releases/download/${c0}/${M}`,D=o1.join(L1.Path.bin,M);n$.info("downloading ripgrep",{url:L}),yield*$.ensureDir(L1.Path.bin).pipe(X.orDie);let F=yield*Y1.get(L).pipe(J.execute,X.flatMap((O)=>O.arrayBuffer),X.mapError((O)=>O instanceof Error?O:Error(String(O))));if(F.byteLength===0)return yield*X.fail(Error(`failed to download ripgrep from ${L}`));return yield*$.writeWithDirs(D,new Uint8Array(F)),yield*V(D,z,K),yield*$.remove(D,{force:!0}).pipe(X.ignore),K})),Y=X.fnUntraced(function*(P){if(yield*$.isDir(P).pipe(X.orDie))return;return yield*X.fail(Object.assign(Error(`No such file or directory: '${P}'`),{code:"ENOENT",errno:-2,path:P}))}),Q=X.fnUntraced(function*(P,K){let A=yield*W;return i1.make(A,K,{cwd:P,env:W6(),extendEnv:!0,stdin:"ignore"})}),j=(P)=>v.callback((K)=>X.gen(function*(){yield*X.forkScoped(X.gen(function*(){yield*Y(P.cwd);let A=yield*Z.spawn(yield*Q(P.cwd,z6(P))),z=yield*v.mkString(v.decodeText(A.stderr)).pipe(X.forkScoped),M=yield*v.decodeText(A.stdout).pipe(v.splitLines,v.filter((D)=>D.length>0),v.runForEach((D)=>X.sync(()=>L0.offerUnsafe(K,W2(D)))),X.forkScoped),L=yield*s$(A.exitCode,P.signal);if(yield*p0.join(M),L===0||L===1){L0.endUnsafe(K);return}a$(K,O0(yield*p0.join(z),L))}).pipe(X.catch((A)=>X.sync(()=>{a$(K,A)}))))})),q=X.fn("Ripgrep.search")(function*(P){yield*Y(P.cwd);let K=X.scoped(X.gen(function*(){let A=yield*Z.spawn(yield*Q(P.cwd,K6(P))),[z,M,L]=yield*X.all([v.decodeText(A.stdout).pipe(v.splitLines,v.filter((D)=>D.length>0),v.mapEffect(Q6),v.filter((D)=>D.type==="match"),v.map((D)=>X6(D.data)),v.runCollect,X.map((D)=>[...D])),v.mkString(v.decodeText(A.stderr)),A.exitCode],{concurrency:"unbounded"});if(L!==0&&L!==1&&L!==2)return yield*X.fail(O0(M,L));return{items:L===1?[]:z,partial:L===2}}));return yield*s$(K,P.signal)}),C=X.fn("Ripgrep.tree")(function*(P){n$.info("tree",P);let K=Array.from(yield*j({cwd:P.cwd,signal:P.signal}).pipe(v.runCollect));function A(y,_){let E=y.children.get(_);if(E)return E;let H={name:_,children:new Map};return y.children.set(_,H),H}function z(y){return Array.from(y.children.values()).reduce((_,E)=>_+1+z(E),0)}let M={name:"",children:new Map};for(let y of K){if(y.includes(".muxcode"))continue;let _=y.split(o1.sep);if(_.length<2)continue;let E=M;for(let H of _.slice(0,-1))E=A(E,H)}let L=z(M),D=P.limit??L,F=[],O=Array.from(M.children.values()).sort((y,_)=>y.name.localeCompare(_.name)).map((y)=>({node:y,path:y.name})),T=0;for(let y=0;y<O.length&&T<D;y++){let _=O[y];F.push(_.path),T++,O.push(...Array.from(_.node.children.values()).sort((E,H)=>E.name.localeCompare(H.name)).map((E)=>({node:E,path:`${_.path}/${E.name}`})))}if(L>T)F.push(`[${L-T} truncated]`);return F.join(`
30
+ `)});return a1.of({files:j,tree:C,search:q})})),M6=Y2.pipe(b.provide(H0.layer),b.provide(H1.defaultLayer),b.provide($2.defaultLayer));var B6=N.Struct({path:N.String,added:p,removed:p,status:N.Literals(["added","deleted","modified"])}).annotate({identifier:"File"}),G6=N.Struct({name:N.String,path:N.String,absolute:N.String,type:N.Literals(["file","directory"]),ignored:N.Boolean}).annotate({identifier:"FileNode"}),w6=N.Struct({oldStart:p,oldLines:p,newStart:p,newLines:p,lines:N.Array(N.String)}),q6=N.Struct({oldFileName:N.String,newFileName:N.String,oldHeader:N.optional(N.String),newHeader:N.optional(N.String),hunks:N.Array(w6),index:N.optional(N.String)}),F6=N.Struct({type:N.Literals(["text","binary"]),content:N.String,diff:N.optional(N.String),patch:N.optional(q6),encoding:N.optional(N.Literal("base64")),mimeType:N.optional(N.String)}).annotate({identifier:"FileContent"}),C6={Edited:b1.define("file.edited",N.Struct({file:N.String}))},e1=V1({service:"file"}),P6=new Set(["exe","dll","pdb","bin","so","dylib","o","a","lib","wav","mp3","ogg","oga","ogv","ogx","flac","aac","wma","m4a","weba","mp4","avi","mov","wmv","flv","webm","mkv","zip","tar","gz","gzip","bz","bz2","bzip","bzip2","7z","rar","xz","lz","z","pdf","doc","docx","ppt","pptx","xls","xlsx","dmg","iso","img","vmdk","ttf","otf","woff","woff2","eot","sqlite","db","mdb","apk","ipa","aab","xapk","app","pkg","deb","rpm","snap","flatpak","appimage","msi","msp","jar","war","ear","class","kotlin_module","dex","vdex","odex","oat","art","wasm","wat","bc","ll","s","ko","sys","drv","efi","rom","com"]),N6=new Set(["png","jpg","jpeg","gif","bmp","webp","ico","tif","tiff","svg","svgz","avif","apng","jxl","heic","heif","raw","cr2","nef","arw","dng","orf","raf","pef","x3f"]),y6=new Set(["ts","tsx","mts","cts","mtsx","ctsx","js","jsx","mjs","cjs","sh","bash","zsh","fish","ps1","psm1","cmd","bat","json","jsonc","json5","yaml","yml","toml","md","mdx","txt","xml","html","htm","css","scss","sass","less","graphql","gql","sql","ini","cfg","conf","env"]),O6=new Set(["dockerfile","makefile",".gitignore",".gitattributes",".editorconfig",".npmrc",".nvmrc",".prettierrc",".eslintrc"]),L6={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",webp:"image/webp",ico:"image/x-icon",tif:"image/tiff",tiff:"image/tiff",svg:"image/svg+xml",svgz:"image/svg+xml",avif:"image/avif",apng:"image/apng",jxl:"image/jxl",heic:"image/heic",heif:"image/heif"},t1=($)=>$1.extname($).toLowerCase().slice(1),H6=($)=>$1.basename($).toLowerCase(),_6=($)=>N6.has(t1($)),D6=($)=>y6.has(t1($)),R6=($)=>O6.has(H6($)),A6=($)=>P6.has(t1($)),I6=($)=>$.startsWith("image/"),T6=($)=>L6[t1($)]||"image/"+t1($);function E6($){let J=$.toLowerCase();if(e1.debug("shouldEncode",{type:J}),!J)return!1;if(J.startsWith("text/"))return!1;if(J.includes("charset="))return!1;let Z=J.split("/",2)[0];return["image","audio","video","font","model","multipart"].includes(Z)}var k6=($)=>{return $.replaceAll("\\","/").replace(/\/+$/,"").split("/").some((Z)=>Z.startsWith(".")&&Z.length>1)},X2=($,J)=>{if(J)return $;let Z=[],U=[];for(let V of $)if(k6(V))U.push(V);else Z.push(V);return[...Z,...U]};class $0 extends U1.Service()("@muxcode/File"){}var x6=P1($0),j2=b.effect($0,X.gen(function*(){let $=yield*H1.Service,J=yield*g1.Service,Z=yield*q1.Service,U=yield*_1.Scope,V=yield*x.make(X.fn("File.state")(()=>X.succeed({cache:{files:[],dirs:[]}}))),W=X.fn("File.scan")(function*(){let z=yield*x.context;if(z.directory===$1.parse(z.directory).root)return;let M=z.directory===L1.Path.home&&z.project.id==="global",L={files:[],dirs:[]};if(M){let F=new Set,O=O1.names(),T=new Set(["node_modules","dist","build","target","vendor"]),y=(H)=>H.startsWith(".")||O.has(H),_=(H)=>H.startsWith(".")||T.has(H),E=yield*$.readDirectoryEntries(z.directory).pipe(X.orElseSucceed(()=>[]));for(let H of E){if(H.type!=="directory")continue;if(y(H.name))continue;F.add(H.name+"/");let k=$1.join(z.directory,H.name),n=yield*$.readDirectoryEntries(k).pipe(X.orElseSucceed(()=>[]));for(let w of n){if(w.type!=="directory")continue;if(_(w.name))continue;F.add(H.name+"/"+w.name+"/")}}L.dirs=Array.from(F).toSorted()}else{let F=yield*J.files({cwd:z.directory}).pipe(z2,X.map((T)=>[...T])),O=new Set;for(let T of F){L.files.push(T);let y=T;while(!0){let _=$1.dirname(y);if(_===".")break;if(_===y)break;if(y=_,O.has(_))continue;O.add(_),L.dirs.push(_+"/")}}}let D=yield*x.get(V);D.cache=L}),Y=yield*X.cached(W().pipe(X.catchCause(()=>X.void))),Q=X.fn("File.ensure")(function*(){yield*Y,Y=yield*X.cached(W().pipe(X.catchCause(()=>X.void)))}),j=X.fnUntraced(function*(z){return(yield*Z.run(z,{cwd:(yield*x.context).directory})).text()}),q=X.fn("File.init")(function*(){yield*Q().pipe(X.forkIn(U))}),C=X.fn("File.status")(function*(){let z=yield*x.context;if(z.project.vcs!=="git")return[];let M=yield*j(["-c","core.fsmonitor=false","-c","core.quotepath=false","diff","--numstat","HEAD"]),L=[];if(M.trim())for(let O of M.trim().split(`
31
+ `)){let[T,y,_]=O.split("\t");L.push({path:_,added:T==="-"?0:parseInt(T,10),removed:y==="-"?0:parseInt(y,10),status:"modified"})}let D=yield*j(["-c","core.fsmonitor=false","-c","core.quotepath=false","ls-files","--others","--exclude-standard"]);if(D.trim())for(let O of D.trim().split(`
32
+ `)){let T=yield*$.readFileString($1.join(z.directory,O)).pipe(X.catch(()=>X.succeed(void 0)));if(T===void 0)continue;L.push({path:O,added:T.split(`
33
+ `).length,removed:0,status:"added"})}let F=yield*j(["-c","core.fsmonitor=false","-c","core.quotepath=false","diff","--name-only","--diff-filter=D","HEAD"]);if(F.trim())for(let O of F.trim().split(`
34
+ `))L.push({path:O,added:0,removed:0,status:"deleted"});return L.map((O)=>{let T=$1.isAbsolute(O.path)?O.path:$1.join(z.directory,O.path);return{...O,path:$1.relative(z.directory,T)}})}),P=X.fn("File.read")(function*(z){using M=e1.time("read",{file:z});let L=yield*x.context,D=$1.join(L.directory,z);if(!n0(D,L))throw Error("Access denied: path escapes project directory");if(_6(z)){if(yield*$.existsSafe(D)){let H=yield*$.readFile(D).pipe(X.catch(()=>X.succeed(new Uint8Array)));return{type:"text",content:Buffer.from(H).toString("base64"),mimeType:T6(z),encoding:"base64"}}return{type:"text",content:""}}let F=D6(z)||R6(z);if(A6(z)&&!F)return{type:"binary",content:""};if(!(yield*$.existsSafe(D)))return{type:"text",content:""};let T=H1.mimeType(D),y=F?!1:E6(T);if(y&&!I6(T))return{type:"binary",content:"",mimeType:T};if(y){let E=yield*$.readFile(D).pipe(X.catch(()=>X.succeed(new Uint8Array)));return{type:"text",content:Buffer.from(E).toString("base64"),mimeType:T,encoding:"base64"}}let _=yield*$.readFileString(D).pipe(X.map((E)=>E.trim()),X.catch(()=>X.succeed("")));if(L.project.vcs==="git"){let E=yield*j(["-c","core.fsmonitor=false","diff","--",z]);if(!E.trim())E=yield*j(["-c","core.fsmonitor=false","diff","--staged","--",z]);if(E.trim()){let H=yield*Z.show(L.directory,"HEAD",z),k=_0(z,z,H,_,"old","new",{context:1/0,ignoreWhitespace:!0});return{type:"text",content:_,patch:k,diff:D0(k)}}return{type:"text",content:_}}return{type:"text",content:_}}),K=X.fn("File.list")(function*(z){let M=yield*x.context,L=[".git",".DS_Store"],D=(y)=>!1;if(M.project.vcs==="git"){let y=M2.default(),_=$1.join(M.worktree,".gitignore"),E=yield*$.readFileString(_).pipe(X.catch(()=>X.succeed("")));if(E)y.add(E);let H=$1.join(M.worktree,".ignore"),k=yield*$.readFileString(H).pipe(X.catch(()=>X.succeed("")));if(k)y.add(k);D=y.ignores.bind(y)}let F=z?$1.join(M.directory,z):M.directory;if(!n0(F,M))throw Error("Access denied: path escapes project directory");let O=yield*$.readDirectoryEntries(F).pipe(X.orElseSucceed(()=>[])),T=[];for(let y of O){if(L.includes(y.name))continue;let _=$1.join(F,y.name),E=$1.relative(M.directory,_),H=y.type==="directory"?"directory":"file";T.push({name:y.name,path:E,absolute:_,type:H,ignored:D(H==="directory"?E+"/":E)})}return T.sort((y,_)=>{if(y.type!==_.type)return y.type==="directory"?-1:1;return y.name.localeCompare(_.name)})}),A=X.fn("File.search")(function*(z){yield*Q();let{cache:M}=yield*x.get(V),L=z.query.trim(),D=z.limit??100,F=z.type??(z.dirs===!1?"file":"all");e1.info("search",{query:L,kind:F});let O=L.startsWith(".")||L.includes("/.");if(!L){if(F==="file")return M.files.slice(0,D);return X2(M.dirs.toSorted(),O).slice(0,D)}let T=F==="file"?M.files:F==="directory"?M.dirs:[...M.files,...M.dirs],y=F==="directory"&&!O?D*20:D,_=K2.default.go(L,T,{limit:y}).map((H)=>H.target),E=F==="directory"?X2(_,O).slice(0,D):_;return e1.info("search",{query:L,kind:F,results:E.length}),E});return e1.info("init"),$0.of({init:q,status:C,read:P,list:K,search:A})})),S6=j2.pipe(b.provide(g1.defaultLayer),b.provide(H1.defaultLayer),b.provide(q1.defaultLayer));var f0={};j1(f0,{layer:()=>gJ,defaultLayer:()=>C$,Vcs:()=>f0,Service:()=>l1,PatchApplyError:()=>b0,Mode:()=>g7,Info:()=>b7,FileStatus:()=>v7,FileDiff:()=>f7,Event:()=>SJ,ApplyResult:()=>h7,ApplyInput:()=>d7});var y1={};j1(y1,{layer:()=>TJ,hasNativeBinding:()=>O7,defaultLayer:()=>L7,Service:()=>S0,FileWatcher:()=>y1,Event:()=>x0});var A1=N1("path"),B7=PJ(),G7=HJ();function k0($,J={}){let{ignore:Z,...U}=J;if(Array.isArray(Z)){J={...U};for(let V of Z)if(G7(V)){if(!J.ignoreGlobs)J.ignoreGlobs=[];let W=B7.makeRe(V,{dot:!0,lookbehinds:!1});J.ignoreGlobs.push(W.source)}else{if(!J.ignorePaths)J.ignorePaths=[];J.ignorePaths.push(A1.resolve($,V))}}return J}var M$=($)=>{return{writeSnapshot(J,Z,U){return $.writeSnapshot(A1.resolve(J),A1.resolve(Z),k0(J,U))},getEventsSince(J,Z,U){return $.getEventsSince(A1.resolve(J),A1.resolve(Z),k0(J,U))},async subscribe(J,Z,U){return J=A1.resolve(J),U=k0(J,U),await $.subscribe(J,Z,U),{unsubscribe(){return $.unsubscribe(J,Z,U)}}},unsubscribe(J,Z,U){return $.unsubscribe(A1.resolve(J),Z,k0(J,U))}}};import{readdir as F7,realpath as C7}from"fs/promises";import G$ from"path";var Y0={};j1(Y0,{match:()=>q7,PATTERNS:()=>w7,FileIgnore:()=>Y0});var _J=new Set(["node_modules","bower_components",".pnpm-store","vendor",".npm","dist","build","out",".next","target","bin","obj",".git",".svn",".hg",".vscode",".idea",".turbo",".output","desktop",".sst",".cache",".webkit-cache","__pycache__",".pytest_cache","mypy_cache",".history",".gradle"]),DJ=["**/*.swp","**/*.swo","**/*.pyc","**/.DS_Store","**/Thumbs.db","**/logs/**","**/tmp/**","**/temp/**","**/*.log","**/coverage/**","**/.nyc_output/**"],w7=[...DJ,..._J];function q7($,J){for(let V of J?.whitelist||[])if(j$.match(V,$))return!1;let Z=$.split(/[/\\]/);for(let V=0;V<Z.length;V++)if(_J.has(Z[V]))return!0;let U=J?.extra||[];for(let V of[...DJ,...U])if(j$.match(V,$))return!0;return!1}var h1=V1({service:"file.watcher"}),P7=1e4,x0={Updated:b1.define("file.watcher.updated",N.Struct({file:N.String,event:N.Literals(["add","change","unlink"])}))},IJ=AJ(()=>{try{let $=N1(`@parcel/watcher-${process.platform}-${process.arch}${process.platform==="linux"?"-glibc":""}`);return M$($)}catch($){h1.error("failed to load watcher binding",{error:$});return}});function N7(){if(process.platform==="win32")return"windows";if(process.platform==="darwin")return"fs-events";if(process.platform==="linux")return"inotify"}function y7($){return O1.paths().filter((J)=>{let Z=G$.relative($,J);return Z!==""&&!Z.startsWith("..")&&!G$.isAbsolute(Z)})}var O7=()=>!!IJ();class S0 extends U1.Service()("@muxcode/FileWatcher"){}var TJ=b.effect(S0,X.gen(function*(){let $=yield*W1.Service,J=yield*q1.Service,Z=yield*x.make(X.fn("FileWatcher.state")(function*(){if(yield*B$.MUXCODE_EXPERIMENTAL_DISABLE_FILEWATCHER)return;let U=yield*x.context;h1.info("init",{directory:U.directory});let V=N7();if(!V){h1.error("watcher backend not supported",{directory:U.directory,platform:process.platform});return}let W=IJ();if(!W)return;h1.info("watcher backend",{directory:U.directory,platform:process.platform,backend:V});let Y=yield*RJ.make(),Q=[];yield*X.addFinalizer(()=>X.promise(()=>Promise.allSettled(Q.map((K)=>K.unsubscribe()))));let j=Y.bind((K,A)=>{for(let z of A){if(z.type==="create")X1.publish(U,x0.Updated,{file:z.path,event:"add"});if(z.type==="update")X1.publish(U,x0.Updated,{file:z.path,event:"change"});if(z.type==="delete")X1.publish(U,x0.Updated,{file:z.path,event:"unlink"})}}),q=(K,A)=>{let z=W.subscribe(K,j,{ignore:A,backend:V});return X.gen(function*(){let M=yield*X.promise(()=>z);Q.push(M)}).pipe(X.timeout(P7),X.catchCause((M)=>{return h1.error("failed to subscribe",{dir:K,cause:s1.pretty(M)}),z.then((L)=>L.unsubscribe()).catch(()=>{}),X.void}))},P=(yield*$.get()).watcher?.ignore??[];if(yield*B$.MUXCODE_EXPERIMENTAL_FILEWATCHER)yield*X.forkScoped(q(U.directory,[...Y0.PATTERNS,...P,...y7(U.directory)]));if(U.project.vcs==="git"){let K=yield*J.run(["rev-parse","--git-dir"],{cwd:U.worktree}),A=K.exitCode===0?G$.resolve(U.worktree,K.text().trim()):void 0,z=A?yield*X.promise(()=>C7(A).catch(()=>A)):void 0;if(z&&!P.includes(".git")&&!P.includes(z)&&(!A||!P.includes(A))){let M=(yield*X.promise(()=>F7(z).catch(()=>[]))).filter((L)=>L!=="HEAD");yield*X.forkScoped(q(z,M))}}},X.catchCause((U)=>{return h1.error("failed to init watcher service",{cause:s1.pretty(U)}),X.void})));return S0.of({init:X.fn("FileWatcher.init")(function*(){yield*x.get(Z)})})})),L7=TJ.pipe(b.provide(W1.defaultLayer),b.provide(q1.defaultLayer));var Q0=V1({service:"vcs"}),q$=2147483647,w$=1e7,z0=1e7,g0=($)=>D0(_0($,$,"","","","",{context:0})),EJ=($)=>new Map($.map((J)=>[J.file,{additions:J.additions,deletions:J.deletions}])),H7=(...$)=>{let J=new Map;return $.flat().forEach((Z)=>{if(!J.has(Z.file))J.set(Z.file,Z)}),[...J.values()]},_7=()=>({patches:new Map,capped:!1}),F$=($)=>{let J="";for(let Z=1;Z<$.length;Z++){let U=$[Z];if(U==='"')return{value:J,end:Z+1};if(U!=="\\"){J+=U;continue}let V=$[++Z];if(V==="t")J+="\t";else if(V==="n")J+=`
35
+ `;else if(V==="r")J+="\r";else if(V==='"'||V==="\\")J+=V;else J+=V??""}},D7=($)=>{if(!$.startsWith('"'))return $.split("\t")[0];return F$($)?.value??$},X0=($)=>{if(!$||$==="/dev/null")return;let J=D7($);if(J.startsWith("a/")||J.startsWith("b/"))return J.slice(2);return J},R7=($)=>{if($.startsWith('"')){let Z=F$($),U=Z?$.slice(Z.end).trimStart():void 0;if(!U)return;if(!U.startsWith('"'))return X0(U);return X0(F$(U)?.value)}let J=$.indexOf(" b/");if(J===-1)return;return X0($.slice(J+1))},A7=($)=>{let J=/^\+\+\+ (.+)$/m.exec($)?.[1],Z=/^--- (.+)$/m.exec($)?.[1],U=X0(J)??X0(Z);if(U)return U;let V=/^diff --git (.+)$/m.exec($)?.[1];return R7(V??"")},I7=($)=>{let J=[...$.text.matchAll(/(?:^|\n)diff --git /g)].map((U)=>U[0].startsWith(`
36
+ `)?U.index+1:U.index),Z=J.map((U,V)=>$.text.slice(U,J[V+1]??$.text.length));if(!$.truncated)return Z;return Z.slice(0,-1)},T7=X.fnUntraced(function*($,J,Z,U,V){if(U.length===0)return{patches:new Map,capped:!1};let W=yield*$.patchAll(J,Z,{context:V?.context??q$,maxOutputBytes:z0});if(W.truncated)Q0.warn("batched patch exceeded byte limit",{max:z0});return{patches:I7(W).reduce((Y,Q,j)=>{let q=A7(Q)??U[j]?.file;if(!q)return Y;return Y.set(q,(Y.get(q)??"")+Q),Y},new Map),capped:W.truncated}}),E7=X.fnUntraced(function*($,J,Z,U,V){let W=U.code==="??"||!Z?yield*$.patchUntracked(J,U.file,{context:V?.context??q$,maxOutputBytes:w$}):yield*$.patch(J,Z,U.file,{context:V?.context??q$,maxOutputBytes:w$});if(!W.truncated&&W.text)return W.text;if(W.truncated)Q0.warn("patch exceeded byte limit",{file:U.file,max:w$});return g0(U.file)}),k7=($,J,Z)=>{if(Z+Buffer.byteLength(J)<=z0)return{patch:J,capped:!1};return Q0.warn("total patch budget exceeded",{file:$,max:z0}),{patch:g0($),capped:!0}},x7=X.fnUntraced(function*($,J,Z,U,V,W,Y){if(W)return g0(U.file);let Q=V.patches.get(U.file);if(Q!==void 0)return Q;if(U.code!=="??"&&V.capped)return g0(U.file);return yield*E7($,J,Z,U,Y)}),kJ=X.fnUntraced(function*($,J,Z,U,V,W,Y){let Q=[],j=0,q=!1;for(let C of U.toSorted((P,K)=>P.file.localeCompare(K.file))){let P=V.get(C.file)??(C.status==="added"?yield*$.statUntracked(J,C.file):void 0),K=yield*x7($,J,Z,C,W,q,Y),A=q?{patch:K,capped:!0}:k7(C.file,K,j);if(q=q||A.capped,!q)j+=Buffer.byteLength(A.patch),q=j>=z0;Q.push({file:C.file,patch:A.patch,additions:P?.additions??0,deletions:P?.deletions??0,status:C.status})}return Q}),xJ=X.fnUntraced(function*($,J,Z,U){let[V,W,Y]=yield*X.all([$.diff(J,Z),$.stats(J,Z),$.status(J)],{concurrency:3});return yield*kJ($,J,Z,H7(V,Y.filter((Q)=>Q.code==="??")),EJ(W),yield*T7($,J,Z,V,U),U)}),S7=X.fnUntraced(function*($,J,Z,U){if(!Z)return yield*kJ($,J,Z,yield*$.status(J),new Map,_7(),U);return yield*xJ($,J,Z,U)}),g7=N.Literals(["git","branch"]),SJ={BranchUpdated:b1.define("vcs.branch.updated",N.Struct({branch:N.optional(N.String)}))},b7=N.Struct({branch:N.optional(N.String),default_branch:N.optional(N.String)}).annotate({identifier:"VcsInfo"}),f7=N.Struct({file:N.String,patch:N.optional(N.String),additions:N.Finite,deletions:N.Finite,status:N.optional(N.Literals(["added","deleted","modified"]))}).annotate({identifier:"VcsFileDiff"}),v7=N.Struct({file:N.String,additions:N.Finite,deletions:N.Finite,status:N.Literals(["added","deleted","modified"])}).annotate({identifier:"VcsFileStatus"}),d7=N.Struct({patch:N.String}),h7=N.Struct({applied:N.Boolean});class b0 extends N.TaggedErrorClass()("VcsPatchApplyError",{message:N.String,reason:N.Literals(["non-git","not-clean"])}){}class l1 extends U1.Service()("@muxcode/Vcs"){}var gJ=b.effect(l1,X.gen(function*(){let $=yield*q1.Service,J=yield*X1.Service,Z=yield*_1.Scope,U=yield*x.make(X.fn("Vcs.state")(function*(V){if(V.project.vcs!=="git")return{current:void 0,root:void 0};let W=X.fnUntraced(function*(){return yield*$.branch(V.directory)}),[Y,Q]=yield*X.all([$.branch(V.directory),$.defaultBranch(V.directory)],{concurrency:2}),j={current:Y,root:Q};return Q0.info("initialized",{branch:j.current,default_branch:j.root?.name}),yield*(yield*J.subscribe(y1.Event.Updated)).pipe(v.filter((q)=>q.properties.file.endsWith("HEAD")),v.runForEach((q)=>X.gen(function*(){let C=yield*W();if(C!==j.current)Q0.info("branch changed",{from:j.current,to:C}),j.current=C,yield*J.publish(SJ.BranchUpdated,{branch:C})})),X.forkScoped),j}));return l1.of({init:X.fn("Vcs.init")(function*(){yield*x.get(U).pipe(X.forkIn(Z))}),branch:X.fn("Vcs.branch")(function*(){return yield*x.use(U,(V)=>V.current)}),defaultBranch:X.fn("Vcs.defaultBranch")(function*(){return yield*x.use(U,(V)=>V.root?.name)}),status:X.fn("Vcs.status")(function*(){let V=yield*x.context;if(V.project.vcs!=="git")return[];let W=(yield*$.hasHead(V.directory))?"HEAD":void 0,[Y,Q]=yield*X.all([$.status(V.directory),W?$.stats(V.directory,W):X.succeed([])],{concurrency:2}),j=EJ(Q);return yield*X.forEach(Y.toSorted((q,C)=>q.file.localeCompare(C.file)),(q)=>X.gen(function*(){let C=j.get(q.file)??(q.status==="added"?yield*$.statUntracked(V.worktree,q.file):void 0);return{file:q.file,additions:C?.additions??0,deletions:C?.deletions??0,status:q.status}}))}),diff:X.fn("Vcs.diff")(function*(V,W){let Y=yield*x.get(U),Q=yield*x.context;if(Q.project.vcs!=="git")return[];if(V==="git")return yield*S7($,Q.directory,(yield*$.hasHead(Q.directory))?"HEAD":void 0,W);if(!Y.root)return[];if(Y.current&&Y.current===Y.root.name)return[];let j=yield*$.mergeBase(Q.directory,Y.root.ref);if(!j)return[];return yield*xJ($,Q.directory,j,W)}),diffRaw:X.fn("Vcs.diffRaw")(function*(){let V=yield*x.context;if(V.project.vcs!=="git")return"";let[W,Y]=yield*X.all([$.hasHead(V.directory),$.status(V.directory)],{concurrency:2}),Q=W?(yield*$.patchAll(V.directory,"HEAD")).text:"",j=yield*X.forEach(Y.filter((q)=>q.code==="??"),(q)=>$.patchUntracked(V.directory,q.file).pipe(X.map((C)=>C.text)));return[Q,...j].filter(Boolean).join(`
37
+ `)}),apply:X.fn("Vcs.apply")(function*(V){let W=yield*x.context;if(W.project.vcs!=="git")return yield*new b0({message:"Patch can't be applied because the project is not git-based",reason:"non-git"});if((yield*$.applyPatch(W.directory,V.patch)).exitCode!==0)return yield*new b0({message:"Patch can't be applied",reason:"not-clean"});return{applied:!0}})})})),C$=gJ.pipe(b.provide(q1.defaultLayer),b.provide(X1.layer));var r1={};j1(r1,{use:()=>u7,layer:()=>pJ,defaultLayer:()=>c7,ShareNext:()=>r1,Service:()=>M0});var I1=bJ("session_share",{session_id:K0().primaryKey().references(()=>vJ.id,{onDelete:"cascade"}),id:K0().notNull(),secret:K0().notNull(),url:K0().notNull(),...fJ});var T1=V1({service:"share-next"}),u1=process.env.MUXCODE_DISABLE_SHARE==="true"||process.env.MUXCODE_DISABLE_SHARE==="1",l7=N.Struct({id:N.String,url:N.String,secret:N.String});class M0 extends U1.Service()("@muxcode/ShareNext"){}var u7=P1(M0),P$=($)=>X.sync(()=>uJ.use($));function cJ($){return{create:`/api/${$}`,sync:(J)=>`/api/${$}/${J}/sync`,remove:(J)=>`/api/${$}/${J}`,data:(J)=>`/api/${$}/${J}/data`}}var m7=cJ("share"),r7=cJ("shares");function dJ($){switch($.type){case"session":return"session";case"message":return`message/${$.data.id}`;case"part":return`part/${$.data.messageID}/${$.data.id}`;case"session_diff":return"session_diff";case"model":return"model"}}var pJ=b.effect(M0,X.gen(function*(){let $=yield*L$.Service,J=yield*X1.Service,Z=yield*W1.Service,U=yield*S1.HttpClient,V=S1.filterStatusOk(U),W=yield*H$.Service,Y=yield*m1.Service;function Q(F,O){return X.gen(function*(){if(u1)return;if(!(yield*P(F)))return;let y=yield*x.get(j),_=y.queue.get(F);if(_){for(let H of O)_.set(dJ(H),H);return}let E=new Map(O.map((H)=>[dJ(H),H]));y.queue.set(F,E),yield*K(F).pipe(X.delay(1000),X.catchCause((H)=>X.sync(()=>{T1.error("share flush failed",{sessionID:F,cause:H})})),X.forkIn(y.scope))})}let j=yield*x.make(X.fn("ShareNext.state")(function*(F){let O={queue:new Map,scope:yield*_1.make(),shared:new Map};if(yield*X.addFinalizer(()=>_1.close(O.scope,hJ.void).pipe(X.andThen(X.sync(()=>{O.queue.clear(),O.shared.clear()})))),u1)return O;let T=(y,_)=>J.subscribe(y).pipe(X.flatMap((E)=>E.pipe(v.runForEach((H)=>_(H).pipe(X.catchCause((k)=>X.sync(()=>{T1.error("share subscriber failed",{type:y.type,cause:k})})))),X.forkScoped)));return yield*T(m1.Event.Updated,(y)=>X.gen(function*(){let _=y.properties.info;yield*Q(_.id,[{type:"session",data:_}])})),yield*T(O$.Event.Updated,(y)=>X.gen(function*(){let _=y.properties.info;if(yield*Q(_.sessionID,[{type:"message",data:_}]),_.role!=="user")return;let E=yield*W.getModel(_.model.providerID,_.model.modelID);yield*Q(_.sessionID,[{type:"model",data:[E]}])})),yield*T(O$.Event.PartUpdated,(y)=>Q(y.properties.part.sessionID,[{type:"part",data:y.properties.part}])),yield*T(m1.Event.Diff,(y)=>Q(y.properties.sessionID,[{type:"session_diff",data:y.properties.diff}])),yield*T(m1.Event.Deleted,(y)=>D(y.properties.sessionID)),O})),q=X.fn("ShareNext.request")(function*(){let F={},O=yield*$.active();if(N$.isNone(O)||!O.value.active_org_id){let y=(yield*Z.get()).enterprise?.url??"https://opncd.ai";return{headers:F,api:m7,baseUrl:y}}let T=yield*$.token(O.value.id);if(N$.isNone(T))throw Error("No active account token available for sharing");return F.authorization=`Bearer ${T.value}`,F["x-org-id"]=O.value.active_org_id,{headers:F,api:r7,baseUrl:O.value.url}}),C=X.fnUntraced(function*(F){let O=yield*P$((T)=>T.select().from(I1).where(y$(I1.session_id,F)).get());if(!O)return;return{id:O.id,secret:O.secret,url:O.url}}),P=X.fnUntraced(function*(F){let O=yield*x.get(j);if(O.shared.has(F)){let y=O.shared.get(F);return y===null?void 0:y}let T=yield*C(F);return O.shared.set(F,T??null),T}),K=X.fn("ShareNext.flush")(function*(F){if(u1)return;let O=yield*x.get(j),T=O.queue.get(F);if(!T)return;O.queue.delete(F);let y=yield*P(F);if(!y)return;let _=yield*q(),E=yield*Y1.post(`${_.baseUrl}${_.api.sync(y.id)}`).pipe(Y1.setHeaders(_.headers),Y1.bodyJson({secret:y.secret,data:Array.from(T.values())}),X.flatMap((H)=>U.execute(H)));if(E.status>=400)T1.warn("failed to sync share",{sessionID:F,shareID:y.id,status:E.status})}),A=X.fn("ShareNext.full")(function*(F){T1.info("full sync",{sessionID:F});let O=yield*Y.get(F),T=yield*Y.diff(F),y=yield*Y.messages({sessionID:F}),_=yield*X.forEach(Array.from(new Map(y.filter((E)=>E.info.role==="user").map((E)=>E.info.model).map((E)=>[`${E.providerID}/${E.modelID}`,E])).values()),(E)=>W.getModel(mJ.make(E.providerID),rJ.make(E.modelID)),{concurrency:8});yield*Q(F,[{type:"session",data:O},...y.map((E)=>({type:"message",data:E.info})),...y.flatMap((E)=>E.parts.map((H)=>({type:"part",data:H}))),{type:"session_diff",data:T},{type:"model",data:_}])}),z=X.fn("ShareNext.init")(function*(){if(u1)return;yield*x.get(j)}),M=X.fn("ShareNext.url")(function*(){return(yield*q()).baseUrl}),L=X.fn("ShareNext.create")(function*(F){if(u1)return{id:"",url:"",secret:""};T1.info("creating share",{sessionID:F});let O=yield*q(),T=yield*Y1.post(`${O.baseUrl}${O.api.create}`).pipe(Y1.setHeaders(O.headers),Y1.bodyJson({sessionID:F}),X.flatMap((_)=>V.execute(_)),X.flatMap(lJ.schemaBodyJson(l7)));yield*P$((_)=>_.insert(I1).values({session_id:F,id:T.id,secret:T.secret,url:T.url}).onConflictDoUpdate({target:I1.session_id,set:{id:T.id,secret:T.secret,url:T.url}}).run());let y=yield*x.get(j);return y.shared.set(F,T),yield*A(F).pipe(X.catchCause((_)=>X.sync(()=>{T1.error("share full sync failed",{sessionID:F,cause:_})})),X.forkIn(y.scope)),T}),D=X.fn("ShareNext.remove")(function*(F){if(u1)return;T1.info("removing share",{sessionID:F});let O=yield*x.get(j),T=yield*P(F);if(!T){O.shared.delete(F),O.queue.delete(F);return}let y=yield*q();yield*Y1.delete(`${y.baseUrl}${y.api.remove(T.id)}`).pipe(Y1.setHeaders(y.headers),Y1.bodyJson({secret:T.secret}),X.flatMap((_)=>V.execute(_))),yield*P$((_)=>_.delete(I1).where(y$(I1.session_id,F)).run()),O.shared.delete(F),O.queue.delete(F)});return M0.of({init:z,url:M,request:q,create:L,remove:D})})),c7=pJ.pipe(b.provide(X1.layer),b.provide(L$.defaultLayer),b.provide(W1.defaultLayer),b.provide(H0.layer),b.provide(H$.defaultLayer),b.provide(m1.defaultLayer));var oJ=b.effect(j0,X.gen(function*(){let $=yield*W1.Service,J=yield*f1.Service,Z=yield*y1.Service,U=yield*E1.Service,V=yield*D$.Service,W=yield*I$.Service,Y=yield*iJ,Q=yield*R$.Service,j=yield*r1.Service,q=yield*_$.Service,C=yield*l1,P=X.gen(function*(){let K=yield*x.context;yield*X.logInfo("bootstrapping").pipe(X.annotateLogs("directory",K.directory)),yield*$.get(),yield*W.init(),yield*X.forEach([Q,V,j,U,J,Z,C,q,Y],(A)=>A.init().pipe(X.catchCause((z)=>X.logWarning("init failed",{cause:z}))),{concurrency:"unbounded",discard:!0}).pipe(X.withSpan("InstanceBootstrap.init"))}).pipe(X.withSpan("InstanceBootstrap"));return j0.of({run:P})})),p7=oJ.pipe(b.provide([X1.layer,W1.defaultLayer,f1.defaultLayer,y1.defaultLayer,E1.defaultLayer,D$.defaultLayer,I$.defaultLayer,nJ,R$.defaultLayer,r1.defaultLayer,_$.defaultLayer,C$]));
38
+ export{g1 as Ok,f1 as Pk,y1 as Qk,E1 as Rk,f0 as Sk,I1 as Tk,r1 as Uk,oJ as Vk,p7 as Wk,A$ as Xk};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{Nj as d}from"./chunk-hx718zrz.js";import{ol as i}from"./chunk-sftkw30q.js";import{$o as w}from"./chunk-a0srn4ak.js";import{vs as M,xs as v}from"./chunk-8jy0dvcn.js";import{SF as l}from"./chunk-8j3aw4qg.js";var f={};l(f,{listen:()=>T,emit:()=>O,client:()=>S,Rpc:()=>f});function T(t){onmessage=async(e)=>{let r=JSON.parse(e.data);if(r.type==="rpc.request"){let n=await t[r.method](r.input);postMessage(JSON.stringify({type:"rpc.result",result:n,id:r.id}))}}}function O(t,e){postMessage(JSON.stringify({type:"rpc.event",event:t,data:e}))}function S(t){let e=new Map,r=new Map,n=0;return t.onmessage=async(o)=>{let a=JSON.parse(o.data);if(a.type==="rpc.result"){let s=e.get(a.id);if(s)s(a.result),e.delete(a.id)}if(a.type==="rpc.event"){let s=r.get(a.event);if(s)for(let p of s)p(a.data)}},{call(o,a){let s=n++;return new Promise((p)=>{e.set(s,p),t.postMessage(JSON.stringify({type:"rpc.request",method:o,input:a,id:s}))})},on(o,a){let s=r.get(o);if(!s)s=new Set,r.set(o,s);return s.add(a),()=>{s.delete(a)}}}}var c={};l(c,{reloadInstance:()=>P,load:()=>x,disposeInstance:()=>D,disposeAllInstances:()=>N,InstanceRuntime:()=>c});var x=(t)=>d.runPromise(i.Service.use((e)=>e.load(t))),D=(t)=>d.runPromise(i.Service.use((e)=>e.dispose(t))),N=()=>d.runPromise(i.Service.use((t)=>t.disposeAll())),P=(t)=>d.runPromise(i.Service.use((e)=>e.reload(t)));var h={};l(h,{start:()=>H,Heap:()=>h});import E from"path";import{writeHeapSnapshot as J}from"v8";var y=w({service:"heap"}),U=60000,k=2147483648,g,m=!1,u=!0;function H(){if(!M.MUXCODE_AUTO_HEAP_SNAPSHOT)return;if(g)return;let t=async()=>{if(m)return;let e=process.memoryUsage();if(e.rss<=k){u=!0;return}if(!u)return;m=!0,u=!1;let r=E.join(v.Path.log,`heap-${process.pid}-${new Date().toISOString().replace(/[:.]/g,"")}.heapsnapshot`);y.warn("heap usage exceeded limit",{rss:e.rss,heap:e.heapUsed,file:r}),await Promise.resolve().then(()=>J(r)).catch((n)=>{y.error("failed to write heap snapshot",{error:n instanceof Error?n.message:String(n),file:r})}),m=!1};g=setInterval(()=>{t()},U),g.unref?.()}
3
+ export{f as Bj,c as Cj,h as Dj};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Vk as b,Wk as c,Xk as d}from"./chunk-4k6px3aw.js";import"./chunk-638270xn.js";import"./chunk-sjd8mzvx.js";import{Hl as a}from"./chunk-kr1vbd82.js";import"./chunk-fk9bmtwr.js";import"./chunk-an9wvc2n.js";import"./chunk-cbz8b7g5.js";import"./chunk-5jn2z3nf.js";import"./chunk-8cm9znxk.js";import"./chunk-a0srn4ak.js";import"./chunk-ygpen625.js";import"./chunk-jfz77m78.js";import"./chunk-my9cfmvt.js";import"./chunk-8jy0dvcn.js";import"./chunk-frbht418.js";import"./chunk-1pv2317e.js";import"./chunk-21x3anp4.js";import"./chunk-ntvr3177.js";import"./chunk-9h1pwxb2.js";import"./chunk-fkmzj0qt.js";import"./chunk-q9yddd1r.js";import"./chunk-eskw1cj2.js";import"./chunk-k19y2psf.js";import"./chunk-ppg6zhae.js";import"./chunk-1mqsg5s7.js";import"./chunk-9g64kggy.js";import"./chunk-8j3aw4qg.js";export{b as layer,c as defaultLayer,a as Service,d as InstanceBootstrap};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{$n as u,Hn as a,In as b,Jn as c,Kn as d,Ln as e,Mn as f,Nn as g,On as h,Pn as i,Qn as j,Rn as k,Sn as l,Tn as m,Un as n,Vn as o,Wn as p,Xn as q,Yn as r,Zn as s,_n as t,ao as v,bo as w,co as x,do as y,eo as z,fo as A}from"./chunk-8cm9znxk.js";import"./chunk-a0srn4ak.js";import"./chunk-ygpen625.js";import"./chunk-jfz77m78.js";import"./chunk-my9cfmvt.js";import"./chunk-8jy0dvcn.js";import"./chunk-frbht418.js";import"./chunk-1pv2317e.js";import"./chunk-21x3anp4.js";import"./chunk-ntvr3177.js";import"./chunk-9h1pwxb2.js";import"./chunk-fkmzj0qt.js";import"./chunk-q9yddd1r.js";import"./chunk-1mqsg5s7.js";import"./chunk-9g64kggy.js";import"./chunk-8j3aw4qg.js";export{w as use,c as toRow,s as plan,z as listGlobal,x as layer,a as isDefaultTitle,t as getUsage,b as fromRow,y as defaultLayer,m as SetTitleInput,p as SetRevertInput,o as SetPermissionInput,n as SetArchivedInput,A as Session,v as Service,l as RemoveInput,f as ProjectInfo,q as MessagesInput,e as Info,g as GlobalInfo,j as GetInput,i as ForkInput,r as Event,h as CreateInput,k as ChildrenInput,u as BusyError,d as ArchivedTimestamp};