@sourcegraph/amp 0.0.1759392119-g5695f1 → 0.0.1759406505-gba06ab

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +10 -10
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -42,7 +42,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
42
42
  `+Object.keys(X).map((Y)=>`${Y}: ${X[Y]}`).join(`\r
43
43
  `)+`\r
44
44
  \r
45
- `+Z)}function AN(J,Q,Z,X,Y,K){if(J.listenerCount("wsClientError")){let q=Error(Y);Error.captureStackTrace(q,AN),J.emit("wsClientError",q,Z,Q)}else yS(Z,X,Y,K)}});var GG1={};L6(GG1,{default:()=>SO6,createWebSocketStream:()=>Gr1.default,WebSocketServer:()=>Wr1.default,WebSocket:()=>fS.default,Sender:()=>Ur1.default,Receiver:()=>zr1.default});var Gr1,zr1,Ur1,fS,Wr1,SO6;var zG1=u(()=>{Gr1=p6(ea1(),1),zr1=p6(tq1(),1),Ur1=p6(JG1(),1),fS=p6(zc(),1),Wr1=p6(qr1(),1),SO6=fS.default});class Hr1{_status={};statusSubject=new I4(this._status);messageSubject=new I4(null);appendToPromptSubject=new I4(null);projectConfig;ws;id=1;reconnectTimeoutId;reconnectDelay=UG1;isReconnecting=!1;pendingRequests=new Map;diagnosticsCache=new Map;DIAGNOSTICS_TTL_MS=300000;get status(){return new Z0((J)=>{J.next(this._status);let Q=this.statusSubject.subscribe(J);return()=>Q.unsubscribe()})}sendStatus(J){this._status={...this._status,...J},this.statusSubject.next(this._status)}get messages(){return new Z0((J)=>{let Q=this.messageSubject.subscribe((Z)=>{if(Z!==null)J.next(Z)});return()=>Q.unsubscribe()})}get appendToPrompt(){return new Z0((J)=>{let Q=this.appendToPromptSubject.subscribe((Z)=>{if(Z!==null)J.next(Z)});return()=>Q.unsubscribe()})}emitMessage(J){this.messageSubject.next(J)}emitAppendToPrompt(J){this.appendToPromptSubject.next(J)}async start(J){this.projectConfig=J,this.sendStatus({enabled:!0}),await this.tryConnect(this.projectConfig)}sendRequest=(J,Q)=>{let Z=this.ws;if(!Z)return Promise.resolve(void 0);if(!this.isWsOpen())return Promise.reject(Error("WebSocket is not open"));return new Promise((X,Y)=>{let K=`${this.id++}`,q={clientRequest:{id:K,[J]:Q}},G=setTimeout(()=>{this.pendingRequests.delete(K),Y(Error(`Timeout after ${Fr1}ms for request ${JSON.stringify(q,null,2)}`))},Fr1);this.pendingRequests.set(K,{resolve:X,reject:Y,timeout:G,method:J}),Z.send(JSON.stringify(q))})};clearPendingRequests(){for(let[J,Q]of this.pendingRequests.entries())clearTimeout(Q.timeout),Q.reject(Error("WebSocket connection closed"));this.pendingRequests.clear()}handleResponse(J){if(!J?.id)return;let Q=this.pendingRequests.get(J.id);if(!Q)return;if(n.debug("Received response for request",{type:"response_received",source:"jetbrains",responseId:J?.id,hasError:!!J?.error}),clearTimeout(Q.timeout),this.pendingRequests.delete(J.id),J.error){Q.reject(Error(JSON.stringify(J.error)));return}let Z=J[Q.method];if(Z)Q.resolve(Z);else Q.reject(Error(`Invalid response for method ${Q.method}. Got ${JSON.stringify(J,null,2)}`))}async tryConnect(J){if(await this.isConnected()){n.debug("Already connected to JetBrains IDE",{type:"already_connected",source:"jetbrains"});return}if(this.clearReconnectTimeout(),this.ws?.close(),this.clearPendingRequests(),n.debug("ide-client",{config:J}),!J){this.sendStatus({connected:!1,authenticated:!1,openFile:void 0,selections:void 0,errorMessage:"IDE Not Connected"});return}n.info("Establishing connection to JetBrains IDE",{type:"establishing_connection",source:"jetbrains",ideName:J.ideName,port:J.port}),this.sendStatus({ideName:J.ideName});let Z=new(await _O6())(`ws://localhost:${J.port}?auth=${encodeURIComponent(J.authToken)}`);this.ws=Z,this.id=1,Z.onopen=async()=>{try{n.info("Connected to JetBrains IDE",{type:"connected",source:"jetbrains",ideName:J.ideName,port:J.port}),this.sendStatus({connected:!0,authenticated:!0,errorMessage:void 0}),this.reconnectDelay=UG1,this.isReconnecting=!1}catch(X){n.error("Error connecting to JetBrains IDE",X),this.sendStatus({connected:!1,authenticated:!1,openFile:void 0,selections:void 0,errorMessage:"IDE Not Connected"})}},Z.onclose=(X)=>{try{if(this.clearPendingRequests(),X.code===1000&&X.reason==="Authentication failed")this.sendStatus({connected:!1,authenticated:!1,openFile:void 0,selections:void 0,errorMessage:"IDE authentication failed - try restarting your IDE"});else n.warn("Disconnected from JetBrains IDE",{code:X.code,reason:X.reason}),this.sendStatus({connected:!1,authenticated:!1,openFile:void 0,selections:void 0,errorMessage:"IDE Not Connected"});this.ws=void 0,this.scheduleReconnect()}catch(Y){n.error("Error handling disconnect",Y)}},Z.onerror=(X)=>{n.error("WebSocket error from JetBrains IDE",X),this.clearPendingRequests()},Z.onmessage=async(X)=>{let Y=X.data.toString();try{let K=xn1.safeParse(JSON.parse(Y));if(K.error){n.error("Failed to parse server message",C0.prettifyError(K.error));return}if(K.data?.serverResponse)this.handleResponse(K.data.serverResponse);this.handleNotification(K.data?.serverNotification)}catch(K){n.error("Error handling server message",{error:K,data:Y})}}}clearReconnectTimeout(){if(this.reconnectTimeoutId)clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=void 0}scheduleReconnect(){if(this.isReconnecting)return;this.isReconnecting=!0,n.info("Scheduling reconnect",{delayMs:this.reconnectDelay,type:"reconnect_scheduled",source:"jetbrains"}),this.reconnectTimeoutId=setTimeout(()=>{this.executeReconnectAttempt().catch((J)=>{n.error("Reconnect timer task failed",J)})},this.reconnectDelay)}async executeReconnectAttempt(){let J=!1;try{let Q=this.projectConfig;if(Q){try{await this.tryConnect(Q)}catch(Z){n.error("Reconnection attempt failed",Z)}J=await this.isConnected()}else n.debug("No project config available during reconnect; will retry")}catch(Q){n.error("Reconnect loop error",Q)}finally{if(this.isReconnecting=!1,!J)this.reconnectDelay=Math.min(this.reconnectDelay*kO6,vO6),this.scheduleReconnect();else this.reconnectDelay=UG1}}isWsOpen(){return this.ws?.readyState===1}async isConnected(){if(!this._status.authenticated)return!1;if(!this.isWsOpen())return!1;try{return(await this.sendRequest("ping",{message:"beepboop"}))?.message==="beepboop"}catch(J){return n.debug("JetBrains isConnected ping failed",{error:J}),!1}}getDiagnosticsForPath(J){this.cleanupExpiredDiagnostics();let Q=K8(P0.file(J)),Z=this.diagnosticsCache.get(Q);if(Z)return Z.diagnostics;let X=[],Y=P0.file(J);for(let[K,q]of this.diagnosticsCache.entries()){let G=P0.parse(K);if(p0.hasPrefix(G,Y))X.push(...q.diagnostics)}return X}convertJetBrainsDiagnostics(J,Q){return J.map((Z)=>({message:Z.description,severity:this.convertJetBrainsSeverity(Z.severity),source:"JetBrains",uri:Q,range:{type:"full",start:{line:Z.range.startLine,character:Z.range.startCharacter},end:{line:Z.range.endLine,character:Z.range.endCharacter}}}))}convertJetBrainsSeverity(J){switch(J.toLowerCase()){case"error":return"error";case"warning":return"warning";case"information":case"info":return"info";case"hint":return"hint";default:return"info"}}cleanupExpiredDiagnostics(){let J=Date.now(),Q=[];for(let[Z,X]of this.diagnosticsCache.entries())if(J-X.timestamp>this.DIAGNOSTICS_TTL_MS)Q.push(Z);for(let Z of Q)this.diagnosticsCache.delete(Z);if(Q.length>0)n.debug("Cleaned up expired diagnostics cache",{expired:Q.length})}handleNotification(J){if(!J)return;if(J.selectionDidChange)this.sendStatus({selections:J.selectionDidChange.selections,openFile:J.selectionDidChange.uri});else if(J.visibleFilesDidChange)this.sendStatus({visibleFiles:J.visibleFilesDidChange.uris});else if(J.pluginMetadata)this.sendStatus({pluginVersion:J.pluginMetadata.version,pluginDirectory:J.pluginMetadata.pluginDirectory});else if(J.diagnosticsDidChange){let Q=J.diagnosticsDidChange.uri,Z=J.diagnosticsDidChange.diagnostics,X=this.convertJetBrainsDiagnostics(Z,Q);this.diagnosticsCache.set(Q,{diagnostics:X,timestamp:Date.now()});let Y=Z.slice(0,2).map((K)=>`L${K.range.startLine+1}: ${K.description.slice(0,40)}...`);n.debug("[<-] DIAGNOSTICS RECEIVED FROM JETBRAINS",{type:"diagnostics_received",source:"jetbrains",file:Q.split("/").pop()||Q,count:Z.length,samples:Y})}else if(J.userSentMessage)this.handleMessageFromIDE(J.userSentMessage.message);else if(J.appendToPrompt)this.handleAppendToPrompt(J.appendToPrompt.message)}async handleMessageFromIDE(J){n.debug("Received message from IDE",{message:J.slice(0,100)}),this.emitMessage(J)}handleAppendToPrompt(J){n.debug("Received appendToPrompt from IDE",{text:J.slice(0,100)}),this.emitAppendToPrompt(J)}selectConfig(J){this.projectConfig=J}getSelectedConfig(){return this.projectConfig}}async function _O6(){if(typeof WebSocket<"u")return WebSocket;let{default:J}=await Promise.resolve().then(() => (zG1(),GG1));return J}var Fr1=2000,UG1=1000,vO6=30000,kO6=2,SJ;var ZR=u(()=>{a6();b0();aj();D0();yq1();SJ=new Hr1});import{homedir as WG1}from"node:os";import XR from"node:path";var Br1,bO6,Dr1,xO6,Mr1,yO6,YR,FG1;var hS=u(()=>{nV();Br1=XR.join(WG1(),".local/share"),bO6=process.platform==="win32"||process.platform==="darwin"?Br1:dH??Br1,Dr1=XR.join(WG1(),".config"),xO6=process.platform==="win32"||process.platform==="darwin"?Dr1:cH??Dr1,Mr1=XR.join(bO6,"amp"),yO6=XR.join(xO6,"amp"),YR=XR.join(yO6,"tools"),FG1=XR.join(WG1(),".cache","amp")});import Wc from"node:fs";import Vr1 from"node:path";async function Fc(){let J=await Ar1(),Q=await Promise.all(J.map((q)=>Or1(q))),Z=[];for(let q of Q){if(!q)continue;if(Nr1(q.pid))Z.push(q)}let X=process.platform==="win32"?process.cwd().replaceAll("\\","/"):process.cwd(),Y=fO6(Z,X),K=Y.exact.length>0?Y.exact:Y.prefix;if(K.length===1)return K;return[...Y.exact,...Y.prefix,...Y.other]}function Nr1(J){if(J<=0)return!1;try{return process.kill(J,0),!0}catch(Q){let Z=Q?.code;if(Z==="ESRCH")return!1;if(Z==="EPERM"||Z==="EACCES")return!0;return n.debug("PID check error",{pid:J,code:Z}),!1}}async function Lr1(){let J=await Ar1();for(let Q of J){let Z=await Or1(Q);if(!Z||!Nr1(Z.pid))try{await Wc.promises.unlink(Q)}catch(X){n.debug("Failed to remove orphaned lockfile",{path:Q,error:X instanceof Error?X.message:String(X)})}}}async function Ar1(){await Wc.promises.mkdir(HG1,{recursive:!0});let J=[];for(let Q of await Wc.promises.readdir(HG1,{withFileTypes:!0}))if(Q.isFile()&&Q.name.endsWith(".json")){let Z=Vr1.join(HG1,Q.name);J.push(Z)}return J}async function Or1(J){try{let Q=await Wc.promises.readFile(J,"utf-8"),Z=yn1.safeParse(JSON.parse(Q));if(Z.success)return Z.data;else n.debug("Invalid IDE config file",{file:J,errors:Z.error.issues})}catch(Q){n.debug("Unreadable IDE config file",{file:J,error:Q instanceof Error?Q.message:String(Q)})}return}function fO6(J,Q){let Z=[],X=[],Y=[];for(let K of J)if(K.workspaceFolders.includes(Q))Z.push(K);else if(K.workspaceFolders.some((q)=>Q.startsWith(q)))X.push(K);else Y.push(K);return{exact:Z,prefix:X,other:Y}}var HG1;var BG1=u(()=>{hS();D0();yq1();HG1=Vr1.join(Mr1,"ide")});var jr1=100;var Rr1=()=>{};var KR="2025-06-18",wr1,Hc="2.0",Ir1,Er1,hO6,OY,FZ,gS,iG,jY,Bc,$r1,Dc=(J)=>$r1.safeParse(J).success,Pr1,Tr1=(J)=>Pr1.safeParse(J).success,Cr1,mS=(J)=>Cr1.safeParse(J).success,AY,Sr1,vr1=(J)=>Sr1.safeParse(J).success,zB,ON,Mc,uS,kr1,gO6,mO6,uO6,DG1,_r1,br1=(J)=>_r1.safeParse(J).success,Vc,pO6,Nc,Lc,Ac,xr1,yr1,MG1,fr1,hr1,dO6,cO6,VG1,lO6,NG1,iO6,LG1,AG1,nO6,aO6,rO6,sO6,oO6,tO6,OG1,eO6,jG1,RG1,wG1,Jj6,Qj6,gr1,Zj6,IG1,EG1,Xj6,Yj6,Kj6,$G1,Oc,_B9,qj6,PG1,mr1,Gj6,zj6,Uj6,Wj6,Fj6,TG1,Hj6,Bj6,Dj6,Mj6,Vj6,Nj6,Lj6,Aj6,Oj6,jj6,Rj6,CG1,wj6,Ij6,Ej6,$j6,bB9,xB9,yB9,fB9,hB9,gB9,rK;var KW=u(()=>{fG();wr1=[KR,"2025-03-26","2024-11-05","2024-10-07"],Ir1=J1.union([J1.string(),J1.number().int()]),Er1=J1.string(),hO6=J1.object({progressToken:J1.optional(Ir1)}).passthrough(),OY=J1.object({_meta:J1.optional(hO6)}).passthrough(),FZ=J1.object({method:J1.string(),params:J1.optional(OY)}),gS=J1.object({_meta:J1.optional(J1.object({}).passthrough())}).passthrough(),iG=J1.object({method:J1.string(),params:J1.optional(gS)}),jY=J1.object({_meta:J1.optional(J1.object({}).passthrough())}).passthrough(),Bc=J1.union([J1.string(),J1.number().int()]),$r1=J1.object({jsonrpc:J1.literal(Hc),id:Bc}).merge(FZ).strict(),Pr1=J1.object({jsonrpc:J1.literal(Hc)}).merge(iG).strict(),Cr1=J1.object({jsonrpc:J1.literal(Hc),id:Bc,result:jY}).strict();(function(J){J[J.ConnectionClosed=-32000]="ConnectionClosed",J[J.RequestTimeout=-32001]="RequestTimeout",J[J.ParseError=-32700]="ParseError",J[J.InvalidRequest=-32600]="InvalidRequest",J[J.MethodNotFound=-32601]="MethodNotFound",J[J.InvalidParams=-32602]="InvalidParams",J[J.InternalError=-32603]="InternalError"})(AY||(AY={}));Sr1=J1.object({jsonrpc:J1.literal(Hc),id:Bc,error:J1.object({code:J1.number().int(),message:J1.string(),data:J1.optional(J1.unknown())})}).strict(),zB=J1.union([$r1,Pr1,Cr1,Sr1]),ON=jY.strict(),Mc=iG.extend({method:J1.literal("notifications/cancelled"),params:gS.extend({requestId:Bc,reason:J1.string().optional()})}),uS=J1.object({name:J1.string(),title:J1.optional(J1.string())}).passthrough(),kr1=uS.extend({version:J1.string()}),gO6=J1.object({experimental:J1.optional(J1.object({}).passthrough()),sampling:J1.optional(J1.object({}).passthrough()),elicitation:J1.optional(J1.object({}).passthrough()),roots:J1.optional(J1.object({listChanged:J1.optional(J1.boolean())}).passthrough())}).passthrough(),mO6=FZ.extend({method:J1.literal("initialize"),params:OY.extend({protocolVersion:J1.string(),capabilities:gO6,clientInfo:kr1})}),uO6=J1.object({experimental:J1.optional(J1.object({}).passthrough()),logging:J1.optional(J1.object({}).passthrough()),completions:J1.optional(J1.object({}).passthrough()),prompts:J1.optional(J1.object({listChanged:J1.optional(J1.boolean())}).passthrough()),resources:J1.optional(J1.object({subscribe:J1.optional(J1.boolean()),listChanged:J1.optional(J1.boolean())}).passthrough()),tools:J1.optional(J1.object({listChanged:J1.optional(J1.boolean())}).passthrough())}).passthrough(),DG1=jY.extend({protocolVersion:J1.string(),capabilities:uO6,serverInfo:kr1,instructions:J1.optional(J1.string())}),_r1=iG.extend({method:J1.literal("notifications/initialized")}),Vc=FZ.extend({method:J1.literal("ping")}),pO6=J1.object({progress:J1.number(),total:J1.optional(J1.number()),message:J1.optional(J1.string())}).passthrough(),Nc=iG.extend({method:J1.literal("notifications/progress"),params:gS.merge(pO6).extend({progressToken:Ir1})}),Lc=FZ.extend({params:OY.extend({cursor:J1.optional(Er1)}).optional()}),Ac=jY.extend({nextCursor:J1.optional(Er1)}),xr1=J1.object({uri:J1.string(),mimeType:J1.optional(J1.string()),_meta:J1.optional(J1.object({}).passthrough())}).passthrough(),yr1=xr1.extend({text:J1.string()}),MG1=J1.string().refine((J)=>{try{return atob(J),!0}catch(Q){return!1}},{message:"Invalid Base64 string"}),fr1=xr1.extend({blob:MG1}),hr1=uS.extend({uri:J1.string(),description:J1.optional(J1.string()),mimeType:J1.optional(J1.string()),_meta:J1.optional(J1.object({}).passthrough())}),dO6=uS.extend({uriTemplate:J1.string(),description:J1.optional(J1.string()),mimeType:J1.optional(J1.string()),_meta:J1.optional(J1.object({}).passthrough())}),cO6=Lc.extend({method:J1.literal("resources/list")}),VG1=Ac.extend({resources:J1.array(hr1)}),lO6=Lc.extend({method:J1.literal("resources/templates/list")}),NG1=Ac.extend({resourceTemplates:J1.array(dO6)}),iO6=FZ.extend({method:J1.literal("resources/read"),params:OY.extend({uri:J1.string()})}),LG1=jY.extend({contents:J1.array(J1.union([yr1,fr1]))}),AG1=iG.extend({method:J1.literal("notifications/resources/list_changed")}),nO6=FZ.extend({method:J1.literal("resources/subscribe"),params:OY.extend({uri:J1.string()})}),aO6=FZ.extend({method:J1.literal("resources/unsubscribe"),params:OY.extend({uri:J1.string()})}),rO6=iG.extend({method:J1.literal("notifications/resources/updated"),params:gS.extend({uri:J1.string()})}),sO6=J1.object({name:J1.string(),description:J1.optional(J1.string()),required:J1.optional(J1.boolean())}).passthrough(),oO6=uS.extend({description:J1.optional(J1.string()),arguments:J1.optional(J1.array(sO6)),_meta:J1.optional(J1.object({}).passthrough())}),tO6=Lc.extend({method:J1.literal("prompts/list")}),OG1=Ac.extend({prompts:J1.array(oO6)}),eO6=FZ.extend({method:J1.literal("prompts/get"),params:OY.extend({name:J1.string(),arguments:J1.optional(J1.record(J1.string()))})}),jG1=J1.object({type:J1.literal("text"),text:J1.string(),_meta:J1.optional(J1.object({}).passthrough())}).passthrough(),RG1=J1.object({type:J1.literal("image"),data:MG1,mimeType:J1.string(),_meta:J1.optional(J1.object({}).passthrough())}).passthrough(),wG1=J1.object({type:J1.literal("audio"),data:MG1,mimeType:J1.string(),_meta:J1.optional(J1.object({}).passthrough())}).passthrough(),Jj6=J1.object({type:J1.literal("resource"),resource:J1.union([yr1,fr1]),_meta:J1.optional(J1.object({}).passthrough())}).passthrough(),Qj6=hr1.extend({type:J1.literal("resource_link")}),gr1=J1.union([jG1,RG1,wG1,Qj6,Jj6]),Zj6=J1.object({role:J1.enum(["user","assistant"]),content:gr1}).passthrough(),IG1=jY.extend({description:J1.optional(J1.string()),messages:J1.array(Zj6)}),EG1=iG.extend({method:J1.literal("notifications/prompts/list_changed")}),Xj6=J1.object({title:J1.optional(J1.string()),readOnlyHint:J1.optional(J1.boolean()),destructiveHint:J1.optional(J1.boolean()),idempotentHint:J1.optional(J1.boolean()),openWorldHint:J1.optional(J1.boolean())}).passthrough(),Yj6=uS.extend({description:J1.optional(J1.string()),inputSchema:J1.object({type:J1.literal("object"),properties:J1.optional(J1.object({}).passthrough()),required:J1.optional(J1.array(J1.string()))}).passthrough(),outputSchema:J1.optional(J1.object({type:J1.literal("object"),properties:J1.optional(J1.object({}).passthrough()),required:J1.optional(J1.array(J1.string()))}).passthrough()),annotations:J1.optional(Xj6),_meta:J1.optional(J1.object({}).passthrough())}),Kj6=Lc.extend({method:J1.literal("tools/list")}),$G1=Ac.extend({tools:J1.array(Yj6)}),Oc=jY.extend({content:J1.array(gr1).default([]),structuredContent:J1.object({}).passthrough().optional(),isError:J1.optional(J1.boolean())}),_B9=Oc.or(jY.extend({toolResult:J1.unknown()})),qj6=FZ.extend({method:J1.literal("tools/call"),params:OY.extend({name:J1.string(),arguments:J1.optional(J1.record(J1.unknown()))})}),PG1=iG.extend({method:J1.literal("notifications/tools/list_changed")}),mr1=J1.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Gj6=FZ.extend({method:J1.literal("logging/setLevel"),params:OY.extend({level:mr1})}),zj6=iG.extend({method:J1.literal("notifications/message"),params:gS.extend({level:mr1,logger:J1.optional(J1.string()),data:J1.unknown()})}),Uj6=J1.object({name:J1.string().optional()}).passthrough(),Wj6=J1.object({hints:J1.optional(J1.array(Uj6)),costPriority:J1.optional(J1.number().min(0).max(1)),speedPriority:J1.optional(J1.number().min(0).max(1)),intelligencePriority:J1.optional(J1.number().min(0).max(1))}).passthrough(),Fj6=J1.object({role:J1.enum(["user","assistant"]),content:J1.union([jG1,RG1,wG1])}).passthrough(),TG1=FZ.extend({method:J1.literal("sampling/createMessage"),params:OY.extend({messages:J1.array(Fj6),systemPrompt:J1.optional(J1.string()),includeContext:J1.optional(J1.enum(["none","thisServer","allServers"])),temperature:J1.optional(J1.number()),maxTokens:J1.number().int(),stopSequences:J1.optional(J1.array(J1.string())),metadata:J1.optional(J1.object({}).passthrough()),modelPreferences:J1.optional(Wj6)})}),Hj6=jY.extend({model:J1.string(),stopReason:J1.optional(J1.enum(["endTurn","stopSequence","maxTokens"]).or(J1.string())),role:J1.enum(["user","assistant"]),content:J1.discriminatedUnion("type",[jG1,RG1,wG1])}),Bj6=J1.object({type:J1.literal("boolean"),title:J1.optional(J1.string()),description:J1.optional(J1.string()),default:J1.optional(J1.boolean())}).passthrough(),Dj6=J1.object({type:J1.literal("string"),title:J1.optional(J1.string()),description:J1.optional(J1.string()),minLength:J1.optional(J1.number()),maxLength:J1.optional(J1.number()),format:J1.optional(J1.enum(["email","uri","date","date-time"]))}).passthrough(),Mj6=J1.object({type:J1.enum(["number","integer"]),title:J1.optional(J1.string()),description:J1.optional(J1.string()),minimum:J1.optional(J1.number()),maximum:J1.optional(J1.number())}).passthrough(),Vj6=J1.object({type:J1.literal("string"),title:J1.optional(J1.string()),description:J1.optional(J1.string()),enum:J1.array(J1.string()),enumNames:J1.optional(J1.array(J1.string()))}).passthrough(),Nj6=J1.union([Bj6,Dj6,Mj6,Vj6]),Lj6=FZ.extend({method:J1.literal("elicitation/create"),params:OY.extend({message:J1.string(),requestedSchema:J1.object({type:J1.literal("object"),properties:J1.record(J1.string(),Nj6),required:J1.optional(J1.array(J1.string()))}).passthrough()})}),Aj6=jY.extend({action:J1.enum(["accept","decline","cancel"]),content:J1.optional(J1.record(J1.string(),J1.unknown()))}),Oj6=J1.object({type:J1.literal("ref/resource"),uri:J1.string()}).passthrough(),jj6=J1.object({type:J1.literal("ref/prompt"),name:J1.string()}).passthrough(),Rj6=FZ.extend({method:J1.literal("completion/complete"),params:OY.extend({ref:J1.union([jj6,Oj6]),argument:J1.object({name:J1.string(),value:J1.string()}).passthrough(),context:J1.optional(J1.object({arguments:J1.optional(J1.record(J1.string(),J1.string()))}))})}),CG1=jY.extend({completion:J1.object({values:J1.array(J1.string()).max(100),total:J1.optional(J1.number().int()),hasMore:J1.optional(J1.boolean())}).passthrough()}),wj6=J1.object({uri:J1.string().startsWith("file://"),name:J1.optional(J1.string()),_meta:J1.optional(J1.object({}).passthrough())}).passthrough(),Ij6=FZ.extend({method:J1.literal("roots/list")}),Ej6=jY.extend({roots:J1.array(wj6)}),$j6=iG.extend({method:J1.literal("notifications/roots/list_changed")}),bB9=J1.union([Vc,mO6,Rj6,Gj6,eO6,tO6,cO6,lO6,iO6,nO6,aO6,qj6,Kj6]),xB9=J1.union([Mc,Nc,_r1,$j6]),yB9=J1.union([ON,Hj6,Aj6,Ej6]),fB9=J1.union([Vc,TG1,Lj6,Ij6]),hB9=J1.union([Mc,Nc,zj6,rO6,AG1,PG1,EG1]),gB9=J1.union([ON,DG1,CG1,IG1,OG1,VG1,NG1,LG1,Oc,$G1]);rK=class rK extends Error{constructor(J,Q,Z){super(`MCP error ${J}: ${Q}`);this.code=J,this.data=Z,this.name="McpError"}}});class SG1{constructor(J){this._options=J,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(Mc,(Q)=>{let Z=this._requestHandlerAbortControllers.get(Q.params.requestId);Z===null||Z===void 0||Z.abort(Q.params.reason)}),this.setNotificationHandler(Nc,(Q)=>{this._onprogress(Q)}),this.setRequestHandler(Vc,(Q)=>({}))}_setupTimeout(J,Q,Z,X,Y=!1){this._timeoutInfo.set(J,{timeoutId:setTimeout(X,Q),startTime:Date.now(),timeout:Q,maxTotalTimeout:Z,resetTimeoutOnProgress:Y,onTimeout:X})}_resetTimeout(J){let Q=this._timeoutInfo.get(J);if(!Q)return!1;let Z=Date.now()-Q.startTime;if(Q.maxTotalTimeout&&Z>=Q.maxTotalTimeout)throw this._timeoutInfo.delete(J),new rK(AY.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:Q.maxTotalTimeout,totalElapsed:Z});return clearTimeout(Q.timeoutId),Q.timeoutId=setTimeout(Q.onTimeout,Q.timeout),!0}_cleanupTimeout(J){let Q=this._timeoutInfo.get(J);if(Q)clearTimeout(Q.timeoutId),this._timeoutInfo.delete(J)}async connect(J){var Q,Z,X;this._transport=J;let Y=(Q=this.transport)===null||Q===void 0?void 0:Q.onclose;this._transport.onclose=()=>{Y===null||Y===void 0||Y(),this._onclose()};let K=(Z=this.transport)===null||Z===void 0?void 0:Z.onerror;this._transport.onerror=(G)=>{K===null||K===void 0||K(G),this._onerror(G)};let q=(X=this._transport)===null||X===void 0?void 0:X.onmessage;this._transport.onmessage=(G,z)=>{if(q===null||q===void 0||q(G,z),mS(G)||vr1(G))this._onresponse(G);else if(Dc(G))this._onrequest(G,z);else if(Tr1(G))this._onnotification(G);else this._onerror(Error(`Unknown message type: ${JSON.stringify(G)}`))},await this._transport.start()}_onclose(){var J;let Q=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(J=this.onclose)===null||J===void 0||J.call(this);let Z=new rK(AY.ConnectionClosed,"Connection closed");for(let X of Q.values())X(Z)}_onerror(J){var Q;(Q=this.onerror)===null||Q===void 0||Q.call(this,J)}_onnotification(J){var Q;let Z=(Q=this._notificationHandlers.get(J.method))!==null&&Q!==void 0?Q:this.fallbackNotificationHandler;if(Z===void 0)return;Promise.resolve().then(()=>Z(J)).catch((X)=>this._onerror(Error(`Uncaught error in notification handler: ${X}`)))}_onrequest(J,Q){var Z,X;let Y=(Z=this._requestHandlers.get(J.method))!==null&&Z!==void 0?Z:this.fallbackRequestHandler,K=this._transport;if(Y===void 0){K===null||K===void 0||K.send({jsonrpc:"2.0",id:J.id,error:{code:AY.MethodNotFound,message:"Method not found"}}).catch((z)=>this._onerror(Error(`Failed to send an error response: ${z}`)));return}let q=new AbortController;this._requestHandlerAbortControllers.set(J.id,q);let G={signal:q.signal,sessionId:K===null||K===void 0?void 0:K.sessionId,_meta:(X=J.params)===null||X===void 0?void 0:X._meta,sendNotification:(z)=>this.notification(z,{relatedRequestId:J.id}),sendRequest:(z,U,W)=>this.request(z,U,{...W,relatedRequestId:J.id}),authInfo:Q===null||Q===void 0?void 0:Q.authInfo,requestId:J.id,requestInfo:Q===null||Q===void 0?void 0:Q.requestInfo};Promise.resolve().then(()=>Y(J,G)).then((z)=>{if(q.signal.aborted)return;return K===null||K===void 0?void 0:K.send({result:z,jsonrpc:"2.0",id:J.id})},(z)=>{var U;if(q.signal.aborted)return;return K===null||K===void 0?void 0:K.send({jsonrpc:"2.0",id:J.id,error:{code:Number.isSafeInteger(z.code)?z.code:AY.InternalError,message:(U=z.message)!==null&&U!==void 0?U:"Internal error"}})}).catch((z)=>this._onerror(Error(`Failed to send response: ${z}`))).finally(()=>{this._requestHandlerAbortControllers.delete(J.id)})}_onprogress(J){let{progressToken:Q,...Z}=J.params,X=Number(Q),Y=this._progressHandlers.get(X);if(!Y){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(J)}`));return}let K=this._responseHandlers.get(X),q=this._timeoutInfo.get(X);if(q&&K&&q.resetTimeoutOnProgress)try{this._resetTimeout(X)}catch(G){K(G);return}Y(Z)}_onresponse(J){let Q=Number(J.id),Z=this._responseHandlers.get(Q);if(Z===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(J)}`));return}if(this._responseHandlers.delete(Q),this._progressHandlers.delete(Q),this._cleanupTimeout(Q),mS(J))Z(J);else{let X=new rK(J.error.code,J.error.message,J.error.data);Z(X)}}get transport(){return this._transport}async close(){var J;await((J=this._transport)===null||J===void 0?void 0:J.close())}request(J,Q,Z){let{relatedRequestId:X,resumptionToken:Y,onresumptiontoken:K}=Z!==null&&Z!==void 0?Z:{};return new Promise((q,G)=>{var z,U,W,F,H,B;if(!this._transport){G(Error("Not connected"));return}if(((z=this._options)===null||z===void 0?void 0:z.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod(J.method);(U=Z===null||Z===void 0?void 0:Z.signal)===null||U===void 0||U.throwIfAborted();let M=this._requestMessageId++,V={...J,jsonrpc:"2.0",id:M};if(Z===null||Z===void 0?void 0:Z.onprogress)this._progressHandlers.set(M,Z.onprogress),V.params={...J.params,_meta:{...((W=J.params)===null||W===void 0?void 0:W._meta)||{},progressToken:M}};let N=(O)=>{var j;this._responseHandlers.delete(M),this._progressHandlers.delete(M),this._cleanupTimeout(M),(j=this._transport)===null||j===void 0||j.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:M,reason:String(O)}},{relatedRequestId:X,resumptionToken:Y,onresumptiontoken:K}).catch((R)=>this._onerror(Error(`Failed to send cancellation: ${R}`))),G(O)};this._responseHandlers.set(M,(O)=>{var j;if((j=Z===null||Z===void 0?void 0:Z.signal)===null||j===void 0?void 0:j.aborted)return;if(O instanceof Error)return G(O);try{let R=Q.parse(O.result);q(R)}catch(R){G(R)}}),(F=Z===null||Z===void 0?void 0:Z.signal)===null||F===void 0||F.addEventListener("abort",()=>{var O;N((O=Z===null||Z===void 0?void 0:Z.signal)===null||O===void 0?void 0:O.reason)});let L=(H=Z===null||Z===void 0?void 0:Z.timeout)!==null&&H!==void 0?H:Pj6,A=()=>N(new rK(AY.RequestTimeout,"Request timed out",{timeout:L}));this._setupTimeout(M,L,Z===null||Z===void 0?void 0:Z.maxTotalTimeout,A,(B=Z===null||Z===void 0?void 0:Z.resetTimeoutOnProgress)!==null&&B!==void 0?B:!1),this._transport.send(V,{relatedRequestId:X,resumptionToken:Y,onresumptiontoken:K}).catch((O)=>{this._cleanupTimeout(M),G(O)})})}async notification(J,Q){var Z,X;if(!this._transport)throw Error("Not connected");if(this.assertNotificationCapability(J.method),((X=(Z=this._options)===null||Z===void 0?void 0:Z.debouncedNotificationMethods)!==null&&X!==void 0?X:[]).includes(J.method)&&!J.params&&!(Q===null||Q===void 0?void 0:Q.relatedRequestId)){if(this._pendingDebouncedNotifications.has(J.method))return;this._pendingDebouncedNotifications.add(J.method),Promise.resolve().then(()=>{var G;if(this._pendingDebouncedNotifications.delete(J.method),!this._transport)return;let z={...J,jsonrpc:"2.0"};(G=this._transport)===null||G===void 0||G.send(z,Q).catch((U)=>this._onerror(U))});return}let q={...J,jsonrpc:"2.0"};await this._transport.send(q,Q)}setRequestHandler(J,Q){let Z=J.shape.method.value;this.assertRequestHandlerCapability(Z),this._requestHandlers.set(Z,(X,Y)=>{return Promise.resolve(Q(J.parse(X),Y))})}removeRequestHandler(J){this._requestHandlers.delete(J)}assertCanSetRequestHandler(J){if(this._requestHandlers.has(J))throw Error(`A request handler for ${J} already exists, which would be overridden`)}setNotificationHandler(J,Q){this._notificationHandlers.set(J.shape.method.value,(Z)=>Promise.resolve(Q(J.parse(Z))))}removeNotificationHandler(J){this._notificationHandlers.delete(J)}}function ur1(J,Q){return Object.entries(Q).reduce((Z,[X,Y])=>{if(Y&&typeof Y==="object")Z[X]=Z[X]?{...Z[X],...Y}:Y;else Z[X]=Y;return Z},{...J})}var Pj6=60000;var pr1=u(()=>{KW()});var cr1=e((jc,dr1)=>{(function(J,Q){typeof jc==="object"&&typeof dr1<"u"?Q(jc):typeof define==="function"&&define.amd?define(["exports"],Q):Q(J.URI=J.URI||{})})(jc,function(J){function Q(){for(var S1=arguments.length,A1=Array(S1),P1=0;P1<S1;P1++)A1[P1]=arguments[P1];if(A1.length>1){A1[0]=A1[0].slice(0,-1);var c1=A1.length-1;for(var b1=1;b1<c1;++b1)A1[b1]=A1[b1].slice(1,-1);return A1[c1]=A1[c1].slice(1),A1.join("")}else return A1[0]}function Z(S1){return"(?:"+S1+")"}function X(S1){return S1===void 0?"undefined":S1===null?"null":Object.prototype.toString.call(S1).split(" ").pop().split("]").shift().toLowerCase()}function Y(S1){return S1.toUpperCase()}function K(S1){return S1!==void 0&&S1!==null?S1 instanceof Array?S1:typeof S1.length!=="number"||S1.split||S1.setInterval||S1.call?[S1]:Array.prototype.slice.call(S1):[]}function q(S1,A1){var P1=S1;if(A1)for(var c1 in A1)P1[c1]=A1[c1];return P1}function G(S1){var A1="[A-Za-z]",P1="[\\x0D]",c1="[0-9]",b1="[\\x22]",A0=Q(c1,"[A-Fa-f]"),F0="[\\x0A]",h6="[\\x20]",w6=Z(Z("%[EFef]"+A0+"%"+A0+A0+"%"+A0+A0)+"|"+Z("%[89A-Fa-f]"+A0+"%"+A0+A0)+"|"+Z("%"+A0+A0)),g6="[\\:\\/\\?\\#\\[\\]\\@]",W6="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Y8=Q(g6,W6),k0=S1?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",y1=S1?"[\\uE000-\\uF8FF]":"[]",q0=Q(A1,c1,"[\\-\\.\\_\\~]",k0),$0=Z(A1+Q(A1,c1,"[\\+\\-\\.]")+"*"),F6=Z(Z(w6+"|"+Q(q0,W6,"[\\:]"))+"*"),o8=Z(Z("25[0-5]")+"|"+Z("2[0-4]"+c1)+"|"+Z("1"+c1+c1)+"|"+Z("[1-9]"+c1)+"|"+c1),c8=Z(Z("25[0-5]")+"|"+Z("2[0-4]"+c1)+"|"+Z("1"+c1+c1)+"|"+Z("0?[1-9]"+c1)+"|0?0?"+c1),k8=Z(c8+"\\."+c8+"\\."+c8+"\\."+c8),H8=Z(A0+"{1,4}"),A9=Z(Z(H8+"\\:"+H8)+"|"+k8),n8=Z(Z(H8+"\\:")+"{6}"+A9),V2=Z("\\:\\:"+Z(H8+"\\:")+"{5}"+A9),X6=Z(Z(H8)+"?\\:\\:"+Z(H8+"\\:")+"{4}"+A9),u0=Z(Z(Z(H8+"\\:")+"{0,1}"+H8)+"?\\:\\:"+Z(H8+"\\:")+"{3}"+A9),f0=Z(Z(Z(H8+"\\:")+"{0,2}"+H8)+"?\\:\\:"+Z(H8+"\\:")+"{2}"+A9),B0=Z(Z(Z(H8+"\\:")+"{0,3}"+H8)+"?\\:\\:"+H8+"\\:"+A9),a8=Z(Z(Z(H8+"\\:")+"{0,4}"+H8)+"?\\:\\:"+A9),$1=Z(Z(Z(H8+"\\:")+"{0,5}"+H8)+"?\\:\\:"+H8),XZ=Z(Z(Z(H8+"\\:")+"{0,6}"+H8)+"?\\:\\:"),v1=Z([n8,V2,X6,u0,f0,B0,a8,$1,XZ].join("|")),P2=Z(Z(q0+"|"+w6)+"+"),sO=Z(v1+"\\%25"+P2),CG=Z(v1+Z("\\%25|\\%(?!"+A0+"{2})")+P2),t51=Z("[vV]"+A0+"+\\."+Q(q0,W6,"[\\:]")+"+"),iu=Z("\\["+Z(CG+"|"+v1+"|"+t51)+"\\]"),nu=Z(Z(w6+"|"+Q(q0,W6))+"*"),B4=Z(iu+"|"+k8+"(?!"+nu+")|"+nu),zX=Z(c1+"*"),oO=Z(Z(F6+"@")+"?"+B4+Z("\\:"+zX)+"?"),gU=Z(w6+"|"+Q(q0,W6,"[\\:\\@]")),e51=Z(gU+"*"),au=Z(gU+"+"),ru=Z(Z(w6+"|"+Q(q0,W6,"[\\@]"))+"+"),e2=Z(Z("\\/"+e51)+"*"),SG=Z("\\/"+Z(au+e2)+"?"),hK=Z(ru+e2),r5=Z(au+e2),xV="(?!"+gU+")",su=Z(e2+"|"+SG+"|"+hK+"|"+r5+"|"+xV),UX=Z(Z(gU+"|"+Q("[\\/\\?]",y1))+"*"),vG=Z(Z(gU+"|[\\/\\?]")+"*"),BY=Z(Z("\\/\\/"+oO+e2)+"|"+SG+"|"+r5+"|"+xV),ou=Z($0+"\\:"+BY+Z("\\?"+UX)+"?"+Z("\\#"+vG)+"?"),tO=Z(Z("\\/\\/"+oO+e2)+"|"+SG+"|"+hK+"|"+xV),XC=Z(tO+Z("\\?"+UX)+"?"+Z("\\#"+vG)+"?"),WX=Z(ou+"|"+XC),sK9=Z($0+"\\:"+BY+Z("\\?"+UX)+"?"),oK9="^("+$0+")\\:"+Z(Z("\\/\\/("+Z("("+F6+")@")+"?("+B4+")"+Z("\\:("+zX+")")+"?)")+"?("+e2+"|"+SG+"|"+r5+"|"+xV+")")+Z("\\?("+UX+")")+"?"+Z("\\#("+vG+")")+"?$",tK9="^(){0}"+Z(Z("\\/\\/("+Z("("+F6+")@")+"?("+B4+")"+Z("\\:("+zX+")")+"?)")+"?("+e2+"|"+SG+"|"+hK+"|"+xV+")")+Z("\\?("+UX+")")+"?"+Z("\\#("+vG+")")+"?$",eK9="^("+$0+")\\:"+Z(Z("\\/\\/("+Z("("+F6+")@")+"?("+B4+")"+Z("\\:("+zX+")")+"?)")+"?("+e2+"|"+SG+"|"+r5+"|"+xV+")")+Z("\\?("+UX+")")+"?$",Jq9="^"+Z("\\#("+vG+")")+"?$",Qq9="^"+Z("("+F6+")@")+"?("+B4+")"+Z("\\:("+zX+")")+"?$";return{NOT_SCHEME:new RegExp(Q("[^]",A1,c1,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(Q("[^\\%\\:]",q0,W6),"g"),NOT_HOST:new RegExp(Q("[^\\%\\[\\]\\:]",q0,W6),"g"),NOT_PATH:new RegExp(Q("[^\\%\\/\\:\\@]",q0,W6),"g"),NOT_PATH_NOSCHEME:new RegExp(Q("[^\\%\\/\\@]",q0,W6),"g"),NOT_QUERY:new RegExp(Q("[^\\%]",q0,W6,"[\\:\\@\\/\\?]",y1),"g"),NOT_FRAGMENT:new RegExp(Q("[^\\%]",q0,W6,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(Q("[^]",q0,W6),"g"),UNRESERVED:new RegExp(q0,"g"),OTHER_CHARS:new RegExp(Q("[^\\%]",q0,Y8),"g"),PCT_ENCODED:new RegExp(w6,"g"),IPV4ADDRESS:new RegExp("^("+k8+")$"),IPV6ADDRESS:new RegExp("^\\[?("+v1+")"+Z(Z("\\%25|\\%(?!"+A0+"{2})")+"("+P2+")")+"?\\]?$")}}var z=G(!1),U=G(!0),W=function(){function S1(A1,P1){var c1=[],b1=!0,A0=!1,F0=void 0;try{for(var h6=A1[Symbol.iterator](),w6;!(b1=(w6=h6.next()).done);b1=!0)if(c1.push(w6.value),P1&&c1.length===P1)break}catch(g6){A0=!0,F0=g6}finally{try{if(!b1&&h6.return)h6.return()}finally{if(A0)throw F0}}return c1}return function(A1,P1){if(Array.isArray(A1))return A1;else if(Symbol.iterator in Object(A1))return S1(A1,P1);else throw TypeError("Invalid attempt to destructure non-iterable instance")}}(),F=function(S1){if(Array.isArray(S1)){for(var A1=0,P1=Array(S1.length);A1<S1.length;A1++)P1[A1]=S1[A1];return P1}else return Array.from(S1)},H=2147483647,B=36,M=1,V=26,N=38,L=700,A=72,O=128,j="-",R=/^xn--/,I=/[^\0-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,E={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$=B-M,P=Math.floor,C=String.fromCharCode;function k(S1){throw RangeError(E[S1])}function g(S1,A1){var P1=[],c1=S1.length;while(c1--)P1[c1]=A1(S1[c1]);return P1}function T(S1,A1){var P1=S1.split("@"),c1="";if(P1.length>1)c1=P1[0]+"@",S1=P1[1];S1=S1.replace(w,".");var b1=S1.split("."),A0=g(b1,A1).join(".");return c1+A0}function v(S1){var A1=[],P1=0,c1=S1.length;while(P1<c1){var b1=S1.charCodeAt(P1++);if(b1>=55296&&b1<=56319&&P1<c1){var A0=S1.charCodeAt(P1++);if((A0&64512)==56320)A1.push(((b1&1023)<<10)+(A0&1023)+65536);else A1.push(b1),P1--}else A1.push(b1)}return A1}var f=function(A1){return String.fromCodePoint.apply(String,F(A1))},h=function(A1){if(A1-48<10)return A1-22;if(A1-65<26)return A1-65;if(A1-97<26)return A1-97;return B},S=function(A1,P1){return A1+22+75*(A1<26)-((P1!=0)<<5)},x=function(A1,P1,c1){var b1=0;A1=c1?P(A1/L):A1>>1,A1+=P(A1/P1);for(;A1>$*V>>1;b1+=B)A1=P(A1/$);return P(b1+($+1)*A1/(A1+N))},b=function(A1){var P1=[],c1=A1.length,b1=0,A0=O,F0=A,h6=A1.lastIndexOf(j);if(h6<0)h6=0;for(var w6=0;w6<h6;++w6){if(A1.charCodeAt(w6)>=128)k("not-basic");P1.push(A1.charCodeAt(w6))}for(var g6=h6>0?h6+1:0;g6<c1;){var W6=b1;for(var Y8=1,k0=B;;k0+=B){if(g6>=c1)k("invalid-input");var y1=h(A1.charCodeAt(g6++));if(y1>=B||y1>P((H-b1)/Y8))k("overflow");b1+=y1*Y8;var q0=k0<=F0?M:k0>=F0+V?V:k0-F0;if(y1<q0)break;var $0=B-q0;if(Y8>P(H/$0))k("overflow");Y8*=$0}var F6=P1.length+1;if(F0=x(b1-W6,F6,W6==0),P(b1/F6)>H-A0)k("overflow");A0+=P(b1/F6),b1%=F6,P1.splice(b1++,0,A0)}return String.fromCodePoint.apply(String,P1)},m=function(A1){var P1=[];A1=v(A1);var c1=A1.length,b1=O,A0=0,F0=A,h6=!0,w6=!1,g6=void 0;try{for(var W6=A1[Symbol.iterator](),Y8;!(h6=(Y8=W6.next()).done);h6=!0){var k0=Y8.value;if(k0<128)P1.push(C(k0))}}catch(CG){w6=!0,g6=CG}finally{try{if(!h6&&W6.return)W6.return()}finally{if(w6)throw g6}}var y1=P1.length,q0=y1;if(y1)P1.push(j);while(q0<c1){var $0=H,F6=!0,o8=!1,c8=void 0;try{for(var k8=A1[Symbol.iterator](),H8;!(F6=(H8=k8.next()).done);F6=!0){var A9=H8.value;if(A9>=b1&&A9<$0)$0=A9}}catch(CG){o8=!0,c8=CG}finally{try{if(!F6&&k8.return)k8.return()}finally{if(o8)throw c8}}var n8=q0+1;if($0-b1>P((H-A0)/n8))k("overflow");A0+=($0-b1)*n8,b1=$0;var V2=!0,X6=!1,u0=void 0;try{for(var f0=A1[Symbol.iterator](),B0;!(V2=(B0=f0.next()).done);V2=!0){var a8=B0.value;if(a8<b1&&++A0>H)k("overflow");if(a8==b1){var $1=A0;for(var XZ=B;;XZ+=B){var v1=XZ<=F0?M:XZ>=F0+V?V:XZ-F0;if($1<v1)break;var P2=$1-v1,sO=B-v1;P1.push(C(S(v1+P2%sO,0))),$1=P(P2/sO)}P1.push(C(S($1,0))),F0=x(A0,n8,q0==y1),A0=0,++q0}}}catch(CG){X6=!0,u0=CG}finally{try{if(!V2&&f0.return)f0.return()}finally{if(X6)throw u0}}++A0,++b1}return P1.join("")},a=function(A1){return T(A1,function(P1){return R.test(P1)?b(P1.slice(4).toLowerCase()):P1})},p=function(A1){return T(A1,function(P1){return I.test(P1)?"xn--"+m(P1):P1})},Q1={version:"2.1.0",ucs2:{decode:v,encode:f},decode:b,encode:m,toASCII:p,toUnicode:a},z1={};function F1(S1){var A1=S1.charCodeAt(0),P1=void 0;if(A1<16)P1="%0"+A1.toString(16).toUpperCase();else if(A1<128)P1="%"+A1.toString(16).toUpperCase();else if(A1<2048)P1="%"+(A1>>6|192).toString(16).toUpperCase()+"%"+(A1&63|128).toString(16).toUpperCase();else P1="%"+(A1>>12|224).toString(16).toUpperCase()+"%"+(A1>>6&63|128).toString(16).toUpperCase()+"%"+(A1&63|128).toString(16).toUpperCase();return P1}function X1(S1){var A1="",P1=0,c1=S1.length;while(P1<c1){var b1=parseInt(S1.substr(P1+1,2),16);if(b1<128)A1+=String.fromCharCode(b1),P1+=3;else if(b1>=194&&b1<224){if(c1-P1>=6){var A0=parseInt(S1.substr(P1+4,2),16);A1+=String.fromCharCode((b1&31)<<6|A0&63)}else A1+=S1.substr(P1,6);P1+=6}else if(b1>=224){if(c1-P1>=9){var F0=parseInt(S1.substr(P1+4,2),16),h6=parseInt(S1.substr(P1+7,2),16);A1+=String.fromCharCode((b1&15)<<12|(F0&63)<<6|h6&63)}else A1+=S1.substr(P1,9);P1+=9}else A1+=S1.substr(P1,3),P1+=3}return A1}function H1(S1,A1){function P1(c1){var b1=X1(c1);return!b1.match(A1.UNRESERVED)?c1:b1}if(S1.scheme)S1.scheme=String(S1.scheme).replace(A1.PCT_ENCODED,P1).toLowerCase().replace(A1.NOT_SCHEME,"");if(S1.userinfo!==void 0)S1.userinfo=String(S1.userinfo).replace(A1.PCT_ENCODED,P1).replace(A1.NOT_USERINFO,F1).replace(A1.PCT_ENCODED,Y);if(S1.host!==void 0)S1.host=String(S1.host).replace(A1.PCT_ENCODED,P1).toLowerCase().replace(A1.NOT_HOST,F1).replace(A1.PCT_ENCODED,Y);if(S1.path!==void 0)S1.path=String(S1.path).replace(A1.PCT_ENCODED,P1).replace(S1.scheme?A1.NOT_PATH:A1.NOT_PATH_NOSCHEME,F1).replace(A1.PCT_ENCODED,Y);if(S1.query!==void 0)S1.query=String(S1.query).replace(A1.PCT_ENCODED,P1).replace(A1.NOT_QUERY,F1).replace(A1.PCT_ENCODED,Y);if(S1.fragment!==void 0)S1.fragment=String(S1.fragment).replace(A1.PCT_ENCODED,P1).replace(A1.NOT_FRAGMENT,F1).replace(A1.PCT_ENCODED,Y);return S1}function l(S1){return S1.replace(/^0*(.*)/,"$1")||"0"}function d(S1,A1){var P1=S1.match(A1.IPV4ADDRESS)||[],c1=W(P1,2),b1=c1[1];if(b1)return b1.split(".").map(l).join(".");else return S1}function i(S1,A1){var P1=S1.match(A1.IPV6ADDRESS)||[],c1=W(P1,3),b1=c1[1],A0=c1[2];if(b1){var F0=b1.toLowerCase().split("::").reverse(),h6=W(F0,2),w6=h6[0],g6=h6[1],W6=g6?g6.split(":").map(l):[],Y8=w6.split(":").map(l),k0=A1.IPV4ADDRESS.test(Y8[Y8.length-1]),y1=k0?7:8,q0=Y8.length-y1,$0=Array(y1);for(var F6=0;F6<y1;++F6)$0[F6]=W6[F6]||Y8[q0+F6]||"";if(k0)$0[y1-1]=d($0[y1-1],A1);var o8=$0.reduce(function(n8,V2,X6){if(!V2||V2==="0"){var u0=n8[n8.length-1];if(u0&&u0.index+u0.length===X6)u0.length++;else n8.push({index:X6,length:1})}return n8},[]),c8=o8.sort(function(n8,V2){return V2.length-n8.length})[0],k8=void 0;if(c8&&c8.length>1){var H8=$0.slice(0,c8.index),A9=$0.slice(c8.index+c8.length);k8=H8.join(":")+"::"+A9.join(":")}else k8=$0.join(":");if(A0)k8+="%"+A0;return k8}else return S1}var r=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,o="".match(/(){0}/)[1]===void 0;function K1(S1){var A1=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P1={},c1=A1.iri!==!1?U:z;if(A1.reference==="suffix")S1=(A1.scheme?A1.scheme+":":"")+"//"+S1;var b1=S1.match(r);if(b1){if(o){if(P1.scheme=b1[1],P1.userinfo=b1[3],P1.host=b1[4],P1.port=parseInt(b1[5],10),P1.path=b1[6]||"",P1.query=b1[7],P1.fragment=b1[8],isNaN(P1.port))P1.port=b1[5]}else if(P1.scheme=b1[1]||void 0,P1.userinfo=S1.indexOf("@")!==-1?b1[3]:void 0,P1.host=S1.indexOf("//")!==-1?b1[4]:void 0,P1.port=parseInt(b1[5],10),P1.path=b1[6]||"",P1.query=S1.indexOf("?")!==-1?b1[7]:void 0,P1.fragment=S1.indexOf("#")!==-1?b1[8]:void 0,isNaN(P1.port))P1.port=S1.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?b1[4]:void 0;if(P1.host)P1.host=i(d(P1.host,c1),c1);if(P1.scheme===void 0&&P1.userinfo===void 0&&P1.host===void 0&&P1.port===void 0&&!P1.path&&P1.query===void 0)P1.reference="same-document";else if(P1.scheme===void 0)P1.reference="relative";else if(P1.fragment===void 0)P1.reference="absolute";else P1.reference="uri";if(A1.reference&&A1.reference!=="suffix"&&A1.reference!==P1.reference)P1.error=P1.error||"URI is not a "+A1.reference+" reference.";var A0=z1[(A1.scheme||P1.scheme||"").toLowerCase()];if(!A1.unicodeSupport&&(!A0||!A0.unicodeSupport)){if(P1.host&&(A1.domainHost||A0&&A0.domainHost))try{P1.host=Q1.toASCII(P1.host.replace(c1.PCT_ENCODED,X1).toLowerCase())}catch(F0){P1.error=P1.error||"Host's domain name can not be converted to ASCII via punycode: "+F0}H1(P1,z)}else H1(P1,c1);if(A0&&A0.parse)A0.parse(P1,A1)}else P1.error=P1.error||"URI can not be parsed.";return P1}function Z1(S1,A1){var P1=A1.iri!==!1?U:z,c1=[];if(S1.userinfo!==void 0)c1.push(S1.userinfo),c1.push("@");if(S1.host!==void 0)c1.push(i(d(String(S1.host),P1),P1).replace(P1.IPV6ADDRESS,function(b1,A0,F0){return"["+A0+(F0?"%25"+F0:"")+"]"}));if(typeof S1.port==="number"||typeof S1.port==="string")c1.push(":"),c1.push(String(S1.port));return c1.length?c1.join(""):void 0}var B1=/^\.\.?\//,U1=/^\/\.(\/|$)/,W1=/^\/\.\.(\/|$)/,j1=/^\/?(?:.|\n)*?(?=\/|$)/;function D1(S1){var A1=[];while(S1.length)if(S1.match(B1))S1=S1.replace(B1,"");else if(S1.match(U1))S1=S1.replace(U1,"/");else if(S1.match(W1))S1=S1.replace(W1,"/"),A1.pop();else if(S1==="."||S1==="..")S1="";else{var P1=S1.match(j1);if(P1){var c1=P1[0];S1=S1.slice(c1.length),A1.push(c1)}else throw Error("Unexpected dot segment condition")}return A1.join("")}function d1(S1){var A1=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P1=A1.iri?U:z,c1=[],b1=z1[(A1.scheme||S1.scheme||"").toLowerCase()];if(b1&&b1.serialize)b1.serialize(S1,A1);if(S1.host){if(P1.IPV6ADDRESS.test(S1.host));else if(A1.domainHost||b1&&b1.domainHost)try{S1.host=!A1.iri?Q1.toASCII(S1.host.replace(P1.PCT_ENCODED,X1).toLowerCase()):Q1.toUnicode(S1.host)}catch(h6){S1.error=S1.error||"Host's domain name can not be converted to "+(!A1.iri?"ASCII":"Unicode")+" via punycode: "+h6}}if(H1(S1,P1),A1.reference!=="suffix"&&S1.scheme)c1.push(S1.scheme),c1.push(":");var A0=Z1(S1,A1);if(A0!==void 0){if(A1.reference!=="suffix")c1.push("//");if(c1.push(A0),S1.path&&S1.path.charAt(0)!=="/")c1.push("/")}if(S1.path!==void 0){var F0=S1.path;if(!A1.absolutePath&&(!b1||!b1.absolutePath))F0=D1(F0);if(A0===void 0)F0=F0.replace(/^\/\//,"/%2F");c1.push(F0)}if(S1.query!==void 0)c1.push("?"),c1.push(S1.query);if(S1.fragment!==void 0)c1.push("#"),c1.push(S1.fragment);return c1.join("")}function n1(S1,A1){var P1=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},c1=arguments[3],b1={};if(!c1)S1=K1(d1(S1,P1),P1),A1=K1(d1(A1,P1),P1);if(P1=P1||{},!P1.tolerant&&A1.scheme)b1.scheme=A1.scheme,b1.userinfo=A1.userinfo,b1.host=A1.host,b1.port=A1.port,b1.path=D1(A1.path||""),b1.query=A1.query;else{if(A1.userinfo!==void 0||A1.host!==void 0||A1.port!==void 0)b1.userinfo=A1.userinfo,b1.host=A1.host,b1.port=A1.port,b1.path=D1(A1.path||""),b1.query=A1.query;else{if(!A1.path)if(b1.path=S1.path,A1.query!==void 0)b1.query=A1.query;else b1.query=S1.query;else{if(A1.path.charAt(0)==="/")b1.path=D1(A1.path);else{if((S1.userinfo!==void 0||S1.host!==void 0||S1.port!==void 0)&&!S1.path)b1.path="/"+A1.path;else if(!S1.path)b1.path=A1.path;else b1.path=S1.path.slice(0,S1.path.lastIndexOf("/")+1)+A1.path;b1.path=D1(b1.path)}b1.query=A1.query}b1.userinfo=S1.userinfo,b1.host=S1.host,b1.port=S1.port}b1.scheme=S1.scheme}return b1.fragment=A1.fragment,b1}function r1(S1,A1,P1){var c1=q({scheme:"null"},P1);return d1(n1(K1(S1,c1),K1(A1,c1),c1,!0),c1)}function u1(S1,A1){if(typeof S1==="string")S1=d1(K1(S1,A1),A1);else if(X(S1)==="object")S1=K1(d1(S1,A1),A1);return S1}function a1(S1,A1,P1){if(typeof S1==="string")S1=d1(K1(S1,P1),P1);else if(X(S1)==="object")S1=d1(S1,P1);if(typeof A1==="string")A1=d1(K1(A1,P1),P1);else if(X(A1)==="object")A1=d1(A1,P1);return S1===A1}function V1(S1,A1){return S1&&S1.toString().replace(!A1||!A1.iri?z.ESCAPE:U.ESCAPE,F1)}function t(S1,A1){return S1&&S1.toString().replace(!A1||!A1.iri?z.PCT_ENCODED:U.PCT_ENCODED,X1)}var O1={scheme:"http",domainHost:!0,parse:function(A1,P1){if(!A1.host)A1.error=A1.error||"HTTP URIs must have a host.";return A1},serialize:function(A1,P1){var c1=String(A1.scheme).toLowerCase()==="https";if(A1.port===(c1?443:80)||A1.port==="")A1.port=void 0;if(!A1.path)A1.path="/";return A1}},M1={scheme:"https",domainHost:O1.domainHost,parse:O1.parse,serialize:O1.serialize};function w1(S1){return typeof S1.secure==="boolean"?S1.secure:String(S1.scheme).toLowerCase()==="wss"}var Y1={scheme:"ws",domainHost:!0,parse:function(A1,P1){var c1=A1;return c1.secure=w1(c1),c1.resourceName=(c1.path||"/")+(c1.query?"?"+c1.query:""),c1.path=void 0,c1.query=void 0,c1},serialize:function(A1,P1){if(A1.port===(w1(A1)?443:80)||A1.port==="")A1.port=void 0;if(typeof A1.secure==="boolean")A1.scheme=A1.secure?"wss":"ws",A1.secure=void 0;if(A1.resourceName){var c1=A1.resourceName.split("?"),b1=W(c1,2),A0=b1[0],F0=b1[1];A1.path=A0&&A0!=="/"?A0:void 0,A1.query=F0,A1.resourceName=void 0}return A1.fragment=void 0,A1}},T1={scheme:"wss",domainHost:Y1.domainHost,parse:Y1.parse,serialize:Y1.serialize},G1={},I1=!0,E1="[A-Za-z0-9\\-\\.\\_\\~"+(I1?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",_1="[0-9A-Fa-f]",x1=Z(Z("%[EFef]"+_1+"%"+_1+_1+"%"+_1+_1)+"|"+Z("%[89A-Fa-f]"+_1+"%"+_1+_1)+"|"+Z("%"+_1+_1)),p1="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",z0="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",m1=Q(z0,"[\\\"\\\\]"),L0="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",I0=new RegExp(E1,"g"),V0=new RegExp(x1,"g"),g0=new RegExp(Q("[^]",p1,"[\\.]","[\\\"]",m1),"g"),R0=new RegExp(Q("[^]",E1,L0),"g"),O0=R0;function U0(S1){var A1=X1(S1);return!A1.match(I0)?S1:A1}var y0={scheme:"mailto",parse:function(A1,P1){var c1=A1,b1=c1.to=c1.path?c1.path.split(","):[];if(c1.path=void 0,c1.query){var A0=!1,F0={},h6=c1.query.split("&");for(var w6=0,g6=h6.length;w6<g6;++w6){var W6=h6[w6].split("=");switch(W6[0]){case"to":var Y8=W6[1].split(",");for(var k0=0,y1=Y8.length;k0<y1;++k0)b1.push(Y8[k0]);break;case"subject":c1.subject=t(W6[1],P1);break;case"body":c1.body=t(W6[1],P1);break;default:A0=!0,F0[t(W6[0],P1)]=t(W6[1],P1);break}}if(A0)c1.headers=F0}c1.query=void 0;for(var q0=0,$0=b1.length;q0<$0;++q0){var F6=b1[q0].split("@");if(F6[0]=t(F6[0]),!P1.unicodeSupport)try{F6[1]=Q1.toASCII(t(F6[1],P1).toLowerCase())}catch(o8){c1.error=c1.error||"Email address's domain name can not be converted to ASCII via punycode: "+o8}else F6[1]=t(F6[1],P1).toLowerCase();b1[q0]=F6.join("@")}return c1},serialize:function(A1,P1){var c1=A1,b1=K(A1.to);if(b1){for(var A0=0,F0=b1.length;A0<F0;++A0){var h6=String(b1[A0]),w6=h6.lastIndexOf("@"),g6=h6.slice(0,w6).replace(V0,U0).replace(V0,Y).replace(g0,F1),W6=h6.slice(w6+1);try{W6=!P1.iri?Q1.toASCII(t(W6,P1).toLowerCase()):Q1.toUnicode(W6)}catch(q0){c1.error=c1.error||"Email address's domain name can not be converted to "+(!P1.iri?"ASCII":"Unicode")+" via punycode: "+q0}b1[A0]=g6+"@"+W6}c1.path=b1.join(",")}var Y8=A1.headers=A1.headers||{};if(A1.subject)Y8.subject=A1.subject;if(A1.body)Y8.body=A1.body;var k0=[];for(var y1 in Y8)if(Y8[y1]!==G1[y1])k0.push(y1.replace(V0,U0).replace(V0,Y).replace(R0,F1)+"="+Y8[y1].replace(V0,U0).replace(V0,Y).replace(O0,F1));if(k0.length)c1.query=k0.join("&");return c1}},m0=/^([^\:]+)\:(.*)/,N0={scheme:"urn",parse:function(A1,P1){var c1=A1.path&&A1.path.match(m0),b1=A1;if(c1){var A0=P1.scheme||b1.scheme||"urn",F0=c1[1].toLowerCase(),h6=c1[2],w6=A0+":"+(P1.nid||F0),g6=z1[w6];if(b1.nid=F0,b1.nss=h6,b1.path=void 0,g6)b1=g6.parse(b1,P1)}else b1.error=b1.error||"URN can not be parsed.";return b1},serialize:function(A1,P1){var c1=P1.scheme||A1.scheme||"urn",b1=A1.nid,A0=c1+":"+(P1.nid||b1),F0=z1[A0];if(F0)A1=F0.serialize(A1,P1);var h6=A1,w6=A1.nss;return h6.path=(b1||P1.nid)+":"+w6,h6}},e0=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,c0={scheme:"urn:uuid",parse:function(A1,P1){var c1=A1;if(c1.uuid=c1.nss,c1.nss=void 0,!P1.tolerant&&(!c1.uuid||!c1.uuid.match(e0)))c1.error=c1.error||"UUID is not valid.";return c1},serialize:function(A1,P1){var c1=A1;return c1.nss=(A1.uuid||"").toLowerCase(),c1}};z1[O1.scheme]=O1,z1[M1.scheme]=M1,z1[Y1.scheme]=Y1,z1[T1.scheme]=T1,z1[y0.scheme]=y0,z1[N0.scheme]=N0,z1[c0.scheme]=c0,J.SCHEMES=z1,J.pctEncChar=F1,J.pctDecChars=X1,J.parse=K1,J.removeDotSegments=D1,J.serialize=d1,J.resolveComponents=n1,J.resolve=r1,J.normalize=u1,J.equal=a1,J.escapeComponent=V1,J.unescapeComponent=t,Object.defineProperty(J,"__esModule",{value:!0})})});var qR=e((dB9,lr1)=>{lr1.exports=function J(Q,Z){if(Q===Z)return!0;if(Q&&Z&&typeof Q=="object"&&typeof Z=="object"){if(Q.constructor!==Z.constructor)return!1;var X,Y,K;if(Array.isArray(Q)){if(X=Q.length,X!=Z.length)return!1;for(Y=X;Y--!==0;)if(!J(Q[Y],Z[Y]))return!1;return!0}if(Q.constructor===RegExp)return Q.source===Z.source&&Q.flags===Z.flags;if(Q.valueOf!==Object.prototype.valueOf)return Q.valueOf()===Z.valueOf();if(Q.toString!==Object.prototype.toString)return Q.toString()===Z.toString();if(K=Object.keys(Q),X=K.length,X!==Object.keys(Z).length)return!1;for(Y=X;Y--!==0;)if(!Object.prototype.hasOwnProperty.call(Z,K[Y]))return!1;for(Y=X;Y--!==0;){var q=K[Y];if(!J(Q[q],Z[q]))return!1}return!0}return Q!==Q&&Z!==Z}});var nr1=e((cB9,ir1)=>{ir1.exports=function(Q){var Z=0,X=Q.length,Y=0,K;while(Y<X)if(Z++,K=Q.charCodeAt(Y++),K>=55296&&K<=56319&&Y<X){if(K=Q.charCodeAt(Y),(K&64512)==56320)Y++}return Z}});var jN=e((lB9,sr1)=>{sr1.exports={copy:Tj6,checkDataType:vG1,checkDataTypes:Cj6,coerceToTypes:Sj6,toHash:_G1,getProperty:bG1,escapeQuotes:xG1,equal:qR(),ucs2length:nr1(),varOccurences:_j6,varReplace:bj6,schemaHasRules:xj6,schemaHasRulesExcept:yj6,schemaUnknownRules:fj6,toQuotedString:kG1,getPathExpr:hj6,getPath:gj6,getData:pj6,unescapeFragment:dj6,unescapeJsonPointer:fG1,escapeFragment:cj6,escapeJsonPointer:yG1};function Tj6(J,Q){Q=Q||{};for(var Z in J)Q[Z]=J[Z];return Q}function vG1(J,Q,Z,X){var Y=X?" !== ":" === ",K=X?" || ":" && ",q=X?"!":"",G=X?"":"!";switch(J){case"null":return Q+Y+"null";case"array":return q+"Array.isArray("+Q+")";case"object":return"("+q+Q+K+"typeof "+Q+Y+'"object"'+K+G+"Array.isArray("+Q+"))";case"integer":return"(typeof "+Q+Y+'"number"'+K+G+"("+Q+" % 1)"+K+Q+Y+Q+(Z?K+q+"isFinite("+Q+")":"")+")";case"number":return"(typeof "+Q+Y+'"'+J+'"'+(Z?K+q+"isFinite("+Q+")":"")+")";default:return"typeof "+Q+Y+'"'+J+'"'}}function Cj6(J,Q,Z){switch(J.length){case 1:return vG1(J[0],Q,Z,!0);default:var X="",Y=_G1(J);if(Y.array&&Y.object)X=Y.null?"(":"(!"+Q+" || ",X+="typeof "+Q+' !== "object")',delete Y.null,delete Y.array,delete Y.object;if(Y.number)delete Y.integer;for(var K in Y)X+=(X?" && ":"")+vG1(K,Q,Z,!0);return X}}var ar1=_G1(["string","number","integer","boolean","null"]);function Sj6(J,Q){if(Array.isArray(Q)){var Z=[];for(var X=0;X<Q.length;X++){var Y=Q[X];if(ar1[Y])Z[Z.length]=Y;else if(J==="array"&&Y==="array")Z[Z.length]=Y}if(Z.length)return Z}else if(ar1[Q])return[Q];else if(J==="array"&&Q==="array")return["array"]}function _G1(J){var Q={};for(var Z=0;Z<J.length;Z++)Q[J[Z]]=!0;return Q}var vj6=/^[a-z$_][a-z$_0-9]*$/i,kj6=/'|\\/g;function bG1(J){return typeof J=="number"?"["+J+"]":vj6.test(J)?"."+J:"['"+xG1(J)+"']"}function xG1(J){return J.replace(kj6,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function _j6(J,Q){Q+="[^0-9]";var Z=J.match(new RegExp(Q,"g"));return Z?Z.length:0}function bj6(J,Q,Z){return Q+="([^0-9])",Z=Z.replace(/\$/g,"$$$$"),J.replace(new RegExp(Q,"g"),Z+"$1")}function xj6(J,Q){if(typeof J=="boolean")return!J;for(var Z in J)if(Q[Z])return!0}function yj6(J,Q,Z){if(typeof J=="boolean")return!J&&Z!="not";for(var X in J)if(X!=Z&&Q[X])return!0}function fj6(J,Q){if(typeof J=="boolean")return;for(var Z in J)if(!Q[Z])return Z}function kG1(J){return"'"+xG1(J)+"'"}function hj6(J,Q,Z,X){var Y=Z?"'/' + "+Q+(X?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):X?"'[' + "+Q+" + ']'":"'[\\'' + "+Q+" + '\\']'";return rr1(J,Y)}function gj6(J,Q,Z){var X=Z?kG1("/"+yG1(Q)):kG1(bG1(Q));return rr1(J,X)}var mj6=/^\/(?:[^~]|~0|~1)*$/,uj6=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function pj6(J,Q,Z){var X,Y,K,q;if(J==="")return"rootData";if(J[0]=="/"){if(!mj6.test(J))throw Error("Invalid JSON-pointer: "+J);Y=J,K="rootData"}else{if(q=J.match(uj6),!q)throw Error("Invalid JSON-pointer: "+J);if(X=+q[1],Y=q[2],Y=="#"){if(X>=Q)throw Error("Cannot access property/index "+X+" levels up, current level is "+Q);return Z[Q-X]}if(X>Q)throw Error("Cannot access data "+X+" levels up, current level is "+Q);if(K="data"+(Q-X||""),!Y)return K}var G=K,z=Y.split("/");for(var U=0;U<z.length;U++){var W=z[U];if(W)K+=bG1(fG1(W)),G+=" && "+K}return G}function rr1(J,Q){if(J=='""')return Q;return(J+" + "+Q).replace(/([^\\])' \+ '/g,"$1")}function dj6(J){return fG1(decodeURIComponent(J))}function cj6(J){return encodeURIComponent(yG1(J))}function yG1(J){return J.replace(/~/g,"~0").replace(/\//g,"~1")}function fG1(J){return J.replace(/~1/g,"/").replace(/~0/g,"~")}});var hG1=e((iB9,or1)=>{var lj6=jN();or1.exports=ij6;function ij6(J){lj6.copy(J,this)}});var er1=e((nB9,tr1)=>{var UB=tr1.exports=function(J,Q,Z){if(typeof Q=="function")Z=Q,Q={};Z=Q.cb||Z;var X=typeof Z=="function"?Z:Z.pre||function(){},Y=Z.post||function(){};Rc(Q,X,Y,J,"",J)};UB.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};UB.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};UB.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};UB.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Rc(J,Q,Z,X,Y,K,q,G,z,U){if(X&&typeof X=="object"&&!Array.isArray(X)){Q(X,Y,K,q,G,z,U);for(var W in X){var F=X[W];if(Array.isArray(F)){if(W in UB.arrayKeywords)for(var H=0;H<F.length;H++)Rc(J,Q,Z,F[H],Y+"/"+W+"/"+H,K,Y,W,X,H)}else if(W in UB.propsKeywords){if(F&&typeof F=="object")for(var B in F)Rc(J,Q,Z,F[B],Y+"/"+W+"/"+nj6(B),K,Y,W,X,B)}else if(W in UB.keywords||J.allKeys&&!(W in UB.skipKeywords))Rc(J,Q,Z,F,Y+"/"+W,K,Y,W,X)}Z(X,Y,K,q,G,z,U)}}function nj6(J){return J.replace(/~/g,"~0").replace(/\//g,"~1")}});var Tc=e((aB9,Xs1)=>{var pS=cr1(),Js1=qR(),$c=jN(),wc=hG1(),aj6=er1();Xs1.exports=FB;FB.normalizeId=WB;FB.fullPath=Ic;FB.url=Ec;FB.ids=ej6;FB.inlineRef=gG1;FB.schema=Pc;function FB(J,Q,Z){var X=this._refs[Z];if(typeof X=="string")if(this._refs[X])X=this._refs[X];else return FB.call(this,J,Q,X);if(X=X||this._schemas[Z],X instanceof wc)return gG1(X.schema,this._opts.inlineRefs)?X.schema:X.validate||this._compile(X);var Y=Pc.call(this,Q,Z),K,q,G;if(Y)K=Y.schema,Q=Y.root,G=Y.baseId;if(K instanceof wc)q=K.validate||J.call(this,K.schema,Q,void 0,G);else if(K!==void 0)q=gG1(K,this._opts.inlineRefs)?K:J.call(this,K,Q,void 0,G);return q}function Pc(J,Q){var Z=pS.parse(Q),X=Zs1(Z),Y=Ic(this._getId(J.schema));if(Object.keys(J.schema).length===0||X!==Y){var K=WB(X),q=this._refs[K];if(typeof q=="string")return rj6.call(this,J,q,Z);else if(q instanceof wc){if(!q.validate)this._compile(q);J=q}else if(q=this._schemas[K],q instanceof wc){if(!q.validate)this._compile(q);if(K==WB(Q))return{schema:q,root:J,baseId:Y};J=q}else return;if(!J.schema)return;Y=Ic(this._getId(J.schema))}return Qs1.call(this,Z,Y,J.schema,J)}function rj6(J,Q,Z){var X=Pc.call(this,J,Q);if(X){var{schema:Y,baseId:K}=X;J=X.root;var q=this._getId(Y);if(q)K=Ec(K,q);return Qs1.call(this,Z,K,Y,J)}}var sj6=$c.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Qs1(J,Q,Z,X){if(J.fragment=J.fragment||"",J.fragment.slice(0,1)!="/")return;var Y=J.fragment.split("/");for(var K=1;K<Y.length;K++){var q=Y[K];if(q){if(q=$c.unescapeFragment(q),Z=Z[q],Z===void 0)break;var G;if(!sj6[q]){if(G=this._getId(Z),G)Q=Ec(Q,G);if(Z.$ref){var z=Ec(Q,Z.$ref),U=Pc.call(this,X,z);if(U)Z=U.schema,X=U.root,Q=U.baseId}}}}if(Z!==void 0&&Z!==X.schema)return{schema:Z,root:X,baseId:Q}}var oj6=$c.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function gG1(J,Q){if(Q===!1)return!1;if(Q===void 0||Q===!0)return mG1(J);else if(Q)return uG1(J)<=Q}function mG1(J){var Q;if(Array.isArray(J)){for(var Z=0;Z<J.length;Z++)if(Q=J[Z],typeof Q=="object"&&!mG1(Q))return!1}else for(var X in J){if(X=="$ref")return!1;if(Q=J[X],typeof Q=="object"&&!mG1(Q))return!1}return!0}function uG1(J){var Q=0,Z;if(Array.isArray(J))for(var X=0;X<J.length;X++){if(Z=J[X],typeof Z=="object")Q+=uG1(Z);if(Q==1/0)return 1/0}else for(var Y in J){if(Y=="$ref")return 1/0;if(oj6[Y])Q++;else{if(Z=J[Y],typeof Z=="object")Q+=uG1(Z)+1;if(Q==1/0)return 1/0}}return Q}function Ic(J,Q){if(Q!==!1)J=WB(J);var Z=pS.parse(J);return Zs1(Z)}function Zs1(J){return pS.serialize(J).split("#")[0]+"#"}var tj6=/#\/?$/;function WB(J){return J?J.replace(tj6,""):""}function Ec(J,Q){return Q=WB(Q),pS.resolve(J,Q)}function ej6(J){var Q=WB(this._getId(J)),Z={"":Q},X={"":Ic(Q,!1)},Y={},K=this;return aj6(J,{allKeys:!0},function(q,G,z,U,W,F,H){if(G==="")return;var B=K._getId(q),M=Z[U],V=X[U]+"/"+W;if(H!==void 0)V+="/"+(typeof H=="number"?H:$c.escapeFragment(H));if(typeof B=="string"){B=M=WB(M?pS.resolve(M,B):B);var N=K._refs[B];if(typeof N=="string")N=K._refs[N];if(N&&N.schema){if(!Js1(q,N.schema))throw Error('id "'+B+'" resolves to more than one schema')}else if(B!=WB(V))if(B[0]=="#"){if(Y[B]&&!Js1(q,Y[B]))throw Error('id "'+B+'" resolves to more than one schema');Y[B]=q}else K._refs[B]=V}Z[G]=M,X[G]=V}),Y}});var Cc=e((rB9,Ks1)=>{var pG1=Tc();Ks1.exports={Validation:Ys1(JR6),MissingRef:Ys1(dG1)};function JR6(J){this.message="validation failed",this.errors=J,this.ajv=this.validation=!0}dG1.message=function(J,Q){return"can't resolve reference "+Q+" from id "+J};function dG1(J,Q,Z){this.message=Z||dG1.message(J,Q),this.missingRef=pG1.url(J,Q),this.missingSchema=pG1.normalizeId(pG1.fullPath(this.missingRef))}function Ys1(J){return J.prototype=Object.create(Error.prototype),J.prototype.constructor=J,J}});var cG1=e((sB9,qs1)=>{qs1.exports=function(J,Q){if(!Q)Q={};if(typeof Q==="function")Q={cmp:Q};var Z=typeof Q.cycles==="boolean"?Q.cycles:!1,X=Q.cmp&&function(K){return function(q){return function(G,z){var U={key:G,value:q[G]},W={key:z,value:q[z]};return K(U,W)}}}(Q.cmp),Y=[];return function K(q){if(q&&q.toJSON&&typeof q.toJSON==="function")q=q.toJSON();if(q===void 0)return;if(typeof q=="number")return isFinite(q)?""+q:"null";if(typeof q!=="object")return JSON.stringify(q);var G,z;if(Array.isArray(q)){z="[";for(G=0;G<q.length;G++){if(G)z+=",";z+=K(q[G])||"null"}return z+"]"}if(q===null)return"null";if(Y.indexOf(q)!==-1){if(Z)return JSON.stringify("__cycle__");throw TypeError("Converting circular structure to JSON")}var U=Y.push(q)-1,W=Object.keys(q).sort(X&&X(q));z="";for(G=0;G<W.length;G++){var F=W[G],H=K(q[F]);if(!H)continue;if(z)z+=",";z+=JSON.stringify(F)+":"+H}return Y.splice(U,1),"{"+z+"}"}(J)}});var lG1=e((oB9,Gs1)=>{Gs1.exports=function(Q,Z,X){var Y="",K=Q.schema.$async===!0,q=Q.util.schemaHasRulesExcept(Q.schema,Q.RULES.all,"$ref"),G=Q.self._getId(Q.schema);if(Q.opts.strictKeywords){var z=Q.util.schemaUnknownRules(Q.schema,Q.RULES.keywords);if(z){var U="unknown keyword: "+z;if(Q.opts.strictKeywords==="log")Q.logger.warn(U);else throw Error(U)}}if(Q.isTop){if(Y+=" var validate = ",K)Q.async=!0,Y+="async ";if(Y+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",G&&(Q.opts.sourceCode||Q.opts.processCode))Y+=" "+("/*# sourceURL="+G+" */")+" "}if(typeof Q.schema=="boolean"||!(q||Q.schema.$ref)){var Z="false schema",W=Q.level,F=Q.dataLevel,H=Q.schema[Z],B=Q.schemaPath+Q.util.getProperty(Z),M=Q.errSchemaPath+"/"+Z,R=!Q.opts.allErrors,E,V="data"+(F||""),j="valid"+W;if(Q.schema===!1){if(Q.isTop)R=!0;else Y+=" var "+j+" = false; ";var N=N||[];if(N.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(E||"false schema")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(M)+" , params: {} ",Q.opts.messages!==!1)Y+=" , message: 'boolean schema is false' ";if(Q.opts.verbose)Y+=" , schema: false , parentSchema: validate.schema"+Q.schemaPath+" , data: "+V+" ";Y+=" } "}else Y+=" {} ";var L=Y;if(Y=N.pop(),!Q.compositeRule&&R)if(Q.async)Y+=" throw new ValidationError(["+L+"]); ";else Y+=" validate.errors = ["+L+"]; return false; ";else Y+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else if(Q.isTop)if(K)Y+=" return data; ";else Y+=" validate.errors = null; return true; ";else Y+=" var "+j+" = true; ";if(Q.isTop)Y+=" }; return validate; ";return Y}if(Q.isTop){var A=Q.isTop,W=Q.level=0,F=Q.dataLevel=0,V="data";if(Q.rootId=Q.resolve.fullPath(Q.self._getId(Q.root.schema)),Q.baseId=Q.baseId||Q.rootId,delete Q.isTop,Q.dataPathArr=[""],Q.schema.default!==void 0&&Q.opts.useDefaults&&Q.opts.strictDefaults){var O="default is ignored in the schema root";if(Q.opts.strictDefaults==="log")Q.logger.warn(O);else throw Error(O)}Y+=" var vErrors = null; ",Y+=" var errors = 0; ",Y+=" if (rootData === undefined) rootData = data; "}else{var{level:W,dataLevel:F}=Q,V="data"+(F||"");if(G)Q.baseId=Q.resolve.url(Q.baseId,G);if(K&&!Q.async)throw Error("async schema in sync schema");Y+=" var errs_"+W+" = errors;"}var j="valid"+W,R=!Q.opts.allErrors,I="",w="",E,$=Q.schema.type,P=Array.isArray($);if($&&Q.opts.nullable&&Q.schema.nullable===!0){if(P){if($.indexOf("null")==-1)$=$.concat("null")}else if($!="null")$=[$,"null"],P=!0}if(P&&$.length==1)$=$[0],P=!1;if(Q.schema.$ref&&q){if(Q.opts.extendRefs=="fail")throw Error('$ref: validation keywords used in schema at path "'+Q.errSchemaPath+'" (see option extendRefs)');else if(Q.opts.extendRefs!==!0)q=!1,Q.logger.warn('$ref: keywords ignored in schema at path "'+Q.errSchemaPath+'"')}if(Q.schema.$comment&&Q.opts.$comment)Y+=" "+Q.RULES.all.$comment.code(Q,"$comment");if($){if(Q.opts.coerceTypes)var C=Q.util.coerceToTypes(Q.opts.coerceTypes,$);var k=Q.RULES.types[$];if(C||P||k===!0||k&&!j1(k)){var B=Q.schemaPath+".type",M=Q.errSchemaPath+"/type",B=Q.schemaPath+".type",M=Q.errSchemaPath+"/type",g=P?"checkDataTypes":"checkDataType";if(Y+=" if ("+Q.util[g]($,V,Q.opts.strictNumbers,!0)+") { ",C){var T="dataType"+W,v="coerced"+W;if(Y+=" var "+T+" = typeof "+V+"; var "+v+" = undefined; ",Q.opts.coerceTypes=="array")Y+=" if ("+T+" == 'object' && Array.isArray("+V+") && "+V+".length == 1) { "+V+" = "+V+"[0]; "+T+" = typeof "+V+"; if ("+Q.util.checkDataType(Q.schema.type,V,Q.opts.strictNumbers)+") "+v+" = "+V+"; } ";Y+=" if ("+v+" !== undefined) ; ";var f=C;if(f){var h,S=-1,x=f.length-1;while(S<x)if(h=f[S+=1],h=="string")Y+=" else if ("+T+" == 'number' || "+T+" == 'boolean') "+v+" = '' + "+V+"; else if ("+V+" === null) "+v+" = ''; ";else if(h=="number"||h=="integer"){if(Y+=" else if ("+T+" == 'boolean' || "+V+" === null || ("+T+" == 'string' && "+V+" && "+V+" == +"+V+" ",h=="integer")Y+=" && !("+V+" % 1)";Y+=")) "+v+" = +"+V+"; "}else if(h=="boolean")Y+=" else if ("+V+" === 'false' || "+V+" === 0 || "+V+" === null) "+v+" = false; else if ("+V+" === 'true' || "+V+" === 1) "+v+" = true; ";else if(h=="null")Y+=" else if ("+V+" === '' || "+V+" === 0 || "+V+" === false) "+v+" = null; ";else if(Q.opts.coerceTypes=="array"&&h=="array")Y+=" else if ("+T+" == 'string' || "+T+" == 'number' || "+T+" == 'boolean' || "+V+" == null) "+v+" = ["+V+"]; "}Y+=" else { ";var N=N||[];if(N.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(E||"type")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(M)+" , params: { type: '",P)Y+=""+$.join(",");else Y+=""+$;if(Y+="' } ",Q.opts.messages!==!1){if(Y+=" , message: 'should be ",P)Y+=""+$.join(",");else Y+=""+$;Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+V+" ";Y+=" } "}else Y+=" {} ";var L=Y;if(Y=N.pop(),!Q.compositeRule&&R)if(Q.async)Y+=" throw new ValidationError(["+L+"]); ";else Y+=" validate.errors = ["+L+"]; return false; ";else Y+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Y+=" } if ("+v+" !== undefined) { ";var b=F?"data"+(F-1||""):"parentData",m=F?Q.dataPathArr[F]:"parentDataProperty";if(Y+=" "+V+" = "+v+"; ",!F)Y+="if ("+b+" !== undefined)";Y+=" "+b+"["+m+"] = "+v+"; } "}else{var N=N||[];if(N.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(E||"type")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(M)+" , params: { type: '",P)Y+=""+$.join(",");else Y+=""+$;if(Y+="' } ",Q.opts.messages!==!1){if(Y+=" , message: 'should be ",P)Y+=""+$.join(",");else Y+=""+$;Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+V+" ";Y+=" } "}else Y+=" {} ";var L=Y;if(Y=N.pop(),!Q.compositeRule&&R)if(Q.async)Y+=" throw new ValidationError(["+L+"]); ";else Y+=" validate.errors = ["+L+"]; return false; ";else Y+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}Y+=" } "}}if(Q.schema.$ref&&!q){if(Y+=" "+Q.RULES.all.$ref.code(Q,"$ref")+" ",R){if(Y+=" } if (errors === ",A)Y+="0";else Y+="errs_"+W;Y+=") { ",w+="}"}}else{var a=Q.RULES;if(a){var k,p=-1,Q1=a.length-1;while(p<Q1)if(k=a[p+=1],j1(k)){if(k.type)Y+=" if ("+Q.util.checkDataType(k.type,V,Q.opts.strictNumbers)+") { ";if(Q.opts.useDefaults){if(k.type=="object"&&Q.schema.properties){var H=Q.schema.properties,z1=Object.keys(H),F1=z1;if(F1){var X1,H1=-1,l=F1.length-1;while(H1<l){X1=F1[H1+=1];var d=H[X1];if(d.default!==void 0){var i=V+Q.util.getProperty(X1);if(Q.compositeRule){if(Q.opts.strictDefaults){var O="default is ignored for: "+i;if(Q.opts.strictDefaults==="log")Q.logger.warn(O);else throw Error(O)}}else{if(Y+=" if ("+i+" === undefined ",Q.opts.useDefaults=="empty")Y+=" || "+i+" === null || "+i+" === '' ";if(Y+=" ) "+i+" = ",Q.opts.useDefaults=="shared")Y+=" "+Q.useDefault(d.default)+" ";else Y+=" "+JSON.stringify(d.default)+" ";Y+="; "}}}}}else if(k.type=="array"&&Array.isArray(Q.schema.items)){var r=Q.schema.items;if(r){var d,S=-1,o=r.length-1;while(S<o)if(d=r[S+=1],d.default!==void 0){var i=V+"["+S+"]";if(Q.compositeRule){if(Q.opts.strictDefaults){var O="default is ignored for: "+i;if(Q.opts.strictDefaults==="log")Q.logger.warn(O);else throw Error(O)}}else{if(Y+=" if ("+i+" === undefined ",Q.opts.useDefaults=="empty")Y+=" || "+i+" === null || "+i+" === '' ";if(Y+=" ) "+i+" = ",Q.opts.useDefaults=="shared")Y+=" "+Q.useDefault(d.default)+" ";else Y+=" "+JSON.stringify(d.default)+" ";Y+="; "}}}}}var K1=k.rules;if(K1){var Z1,B1=-1,U1=K1.length-1;while(B1<U1)if(Z1=K1[B1+=1],D1(Z1)){var W1=Z1.code(Q,Z1.keyword,k.type);if(W1){if(Y+=" "+W1+" ",R)I+="}"}}}if(R)Y+=" "+I+" ",I="";if(k.type){if(Y+=" } ",$&&$===k.type&&!C){Y+=" else { ";var B=Q.schemaPath+".type",M=Q.errSchemaPath+"/type",N=N||[];if(N.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(E||"type")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(M)+" , params: { type: '",P)Y+=""+$.join(",");else Y+=""+$;if(Y+="' } ",Q.opts.messages!==!1){if(Y+=" , message: 'should be ",P)Y+=""+$.join(",");else Y+=""+$;Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+V+" ";Y+=" } "}else Y+=" {} ";var L=Y;if(Y=N.pop(),!Q.compositeRule&&R)if(Q.async)Y+=" throw new ValidationError(["+L+"]); ";else Y+=" validate.errors = ["+L+"]; return false; ";else Y+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Y+=" } "}}if(R){if(Y+=" if (errors === ",A)Y+="0";else Y+="errs_"+W;Y+=") { ",w+="}"}}}}if(R)Y+=" "+w+" ";if(A){if(K)Y+=" if (errors === 0) return data; ",Y+=" else throw new ValidationError(vErrors); ";else Y+=" validate.errors = vErrors; ",Y+=" return errors === 0; ";Y+=" }; return validate;"}else Y+=" var "+j+" = errors === errs_"+W+";";function j1(n1){var r1=n1.rules;for(var u1=0;u1<r1.length;u1++)if(D1(r1[u1]))return!0}function D1(n1){return Q.schema[n1.keyword]!==void 0||n1.implements&&d1(n1)}function d1(n1){var r1=n1.implements;for(var u1=0;u1<r1.length;u1++)if(Q.schema[r1[u1]]!==void 0)return!0}return Y}});var Hs1=e((tB9,Fs1)=>{var Sc=Tc(),kc=jN(),Us1=Cc(),QR6=cG1(),zs1=lG1(),ZR6=kc.ucs2length,XR6=qR(),YR6=Us1.Validation;Fs1.exports=iG1;function iG1(J,Q,Z,X){var Y=this,K=this._opts,q=[void 0],G={},z=[],U={},W=[],F={},H=[];Q=Q||{schema:J,refVal:q,refs:G};var B=KR6.call(this,J,Q,X),M=this._compilations[B.index];if(B.compiling)return M.callValidate=O;var V=this._formats,N=this.RULES;try{var L=j(J,Q,Z,X);M.validate=L;var A=M.callValidate;if(A){if(A.schema=L.schema,A.errors=null,A.refs=L.refs,A.refVal=L.refVal,A.root=L.root,A.$async=L.$async,K.sourceCode)A.source=L.source}return L}finally{qR6.call(this,J,Q,X)}function O(){var g=M.validate,T=g.apply(this,arguments);return O.errors=g.errors,T}function j(g,T,v,f){var h=!T||T&&T.schema==g;if(T.schema!=Q.schema)return iG1.call(Y,g,T,v,f);var S=g.$async===!0,x=zs1({isTop:!0,schema:g,isRoot:h,baseId:f,root:T,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Us1.MissingRef,RULES:N,validate:zs1,util:kc,resolve:Sc,resolveRef:R,usePattern:P,useDefault:C,useCustomRule:k,opts:K,formats:V,logger:Y.logger,self:Y});if(x=vc(q,UR6)+vc(z,GR6)+vc(W,zR6)+vc(H,WR6)+x,K.processCode)x=K.processCode(x,g);var b;try{var m=Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",x);b=m(Y,N,V,Q,q,W,H,XR6,ZR6,YR6),q[0]=b}catch(a){throw Y.logger.error("Error compiling schema, function code:",x),a}if(b.schema=g,b.errors=null,b.refs=G,b.refVal=q,b.root=h?b:T,S)b.$async=!0;if(K.sourceCode===!0)b.source={code:x,patterns:z,defaults:W};return b}function R(g,T,v){T=Sc.url(g,T);var f=G[T],h,S;if(f!==void 0)return h=q[f],S="refVal["+f+"]",$(h,S);if(!v&&Q.refs){var x=Q.refs[T];if(x!==void 0)return h=Q.refVal[x],S=I(T,h),$(h,S)}S=I(T);var b=Sc.call(Y,j,Q,T);if(b===void 0){var m=Z&&Z[T];if(m)b=Sc.inlineRef(m,K.inlineRefs)?m:iG1.call(Y,m,Q,Z,g)}if(b===void 0)w(T);else return E(T,b),$(b,S)}function I(g,T){var v=q.length;return q[v]=T,G[g]=v,"refVal"+v}function w(g){delete G[g]}function E(g,T){var v=G[g];q[v]=T}function $(g,T){return typeof g=="object"||typeof g=="boolean"?{code:T,schema:g,inline:!0}:{code:T,$async:g&&!!g.$async}}function P(g){var T=U[g];if(T===void 0)T=U[g]=z.length,z[T]=g;return"pattern"+T}function C(g){switch(typeof g){case"boolean":case"number":return""+g;case"string":return kc.toQuotedString(g);case"object":if(g===null)return"null";var T=QR6(g),v=F[T];if(v===void 0)v=F[T]=W.length,W[v]=g;return"default"+v}}function k(g,T,v,f){if(Y._opts.validateSchema!==!1){var h=g.definition.dependencies;if(h&&!h.every(function(F1){return Object.prototype.hasOwnProperty.call(v,F1)}))throw Error("parent schema must have all required keywords: "+h.join(","));var S=g.definition.validateSchema;if(S){var x=S(T);if(!x){var b="keyword schema is invalid: "+Y.errorsText(S.errors);if(Y._opts.validateSchema=="log")Y.logger.error(b);else throw Error(b)}}}var m=g.definition.compile,a=g.definition.inline,p=g.definition.macro,Q1;if(m)Q1=m.call(Y,T,v,f);else if(p){if(Q1=p.call(Y,T,v,f),K.validateSchema!==!1)Y.validateSchema(Q1,!0)}else if(a)Q1=a.call(Y,f,g.keyword,T,v);else if(Q1=g.definition.validate,!Q1)return;if(Q1===void 0)throw Error('custom keyword "'+g.keyword+'"failed to compile');var z1=H.length;return H[z1]=Q1,{code:"customRule"+z1,validate:Q1}}}function KR6(J,Q,Z){var X=Ws1.call(this,J,Q,Z);if(X>=0)return{index:X,compiling:!0};return X=this._compilations.length,this._compilations[X]={schema:J,root:Q,baseId:Z},{index:X,compiling:!1}}function qR6(J,Q,Z){var X=Ws1.call(this,J,Q,Z);if(X>=0)this._compilations.splice(X,1)}function Ws1(J,Q,Z){for(var X=0;X<this._compilations.length;X++){var Y=this._compilations[X];if(Y.schema==J&&Y.root==Q&&Y.baseId==Z)return X}return-1}function GR6(J,Q){return"var pattern"+J+" = new RegExp("+kc.toQuotedString(Q[J])+");"}function zR6(J){return"var default"+J+" = defaults["+J+"];"}function UR6(J,Q){return Q[J]===void 0?"":"var refVal"+J+" = refVal["+J+"];"}function WR6(J){return"var customRule"+J+" = customRules["+J+"];"}function vc(J,Q){if(!J.length)return"";var Z="";for(var X=0;X<J.length;X++)Z+=Q(X,J);return Z}});var Ds1=e((eB9,Bs1)=>{var _c=Bs1.exports=function(){this._cache={}};_c.prototype.put=function(Q,Z){this._cache[Q]=Z};_c.prototype.get=function(Q){return this._cache[Q]};_c.prototype.del=function(Q){delete this._cache[Q]};_c.prototype.clear=function(){this._cache={}}});var $s1=e((JD9,Es1)=>{var FR6=jN(),HR6=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,BR6=[0,31,28,31,30,31,30,31,31,30,31,30,31],DR6=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Ms1=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,MR6=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,VR6=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Vs1=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Ns1=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,Ls1=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,As1=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Os1=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,js1=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Es1.exports=bc;function bc(J){return J=J=="full"?"full":"fast",FR6.copy(bc[J])}bc.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":Vs1,url:Ns1,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:Ms1,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:Is1,uuid:Ls1,"json-pointer":As1,"json-pointer-uri-fragment":Os1,"relative-json-pointer":js1};bc.full={date:Rs1,time:ws1,"date-time":AR6,uri:jR6,"uri-reference":VR6,"uri-template":Vs1,url:Ns1,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:Ms1,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:Is1,uuid:Ls1,"json-pointer":As1,"json-pointer-uri-fragment":Os1,"relative-json-pointer":js1};function NR6(J){return J%4===0&&(J%100!==0||J%400===0)}function Rs1(J){var Q=J.match(HR6);if(!Q)return!1;var Z=+Q[1],X=+Q[2],Y=+Q[3];return X>=1&&X<=12&&Y>=1&&Y<=(X==2&&NR6(Z)?29:BR6[X])}function ws1(J,Q){var Z=J.match(DR6);if(!Z)return!1;var X=Z[1],Y=Z[2],K=Z[3],q=Z[5];return(X<=23&&Y<=59&&K<=59||X==23&&Y==59&&K==60)&&(!Q||q)}var LR6=/t|\s/i;function AR6(J){var Q=J.split(LR6);return Q.length==2&&Rs1(Q[0])&&ws1(Q[1],!0)}var OR6=/\/|:/;function jR6(J){return OR6.test(J)&&MR6.test(J)}var RR6=/[^\\]\\Z/;function Is1(J){if(RR6.test(J))return!1;try{return new RegExp(J),!0}catch(Q){return!1}}});var Ts1=e((QD9,Ps1)=>{Ps1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.errSchemaPath+"/"+Z,U=!Q.opts.allErrors,W="data"+(q||""),F="valid"+K,H,B;if(G=="#"||G=="#/")if(Q.isRoot)H=Q.async,B="validate";else H=Q.root.schema.$async===!0,B="root.refVal[0]";else{var M=Q.resolveRef(Q.baseId,G,Q.isRoot);if(M===void 0){var V=Q.MissingRefError.message(Q.baseId,G);if(Q.opts.missingRefs=="fail"){Q.logger.error(V);var N=N||[];if(N.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(z)+" , params: { ref: '"+Q.util.escapeQuotes(G)+"' } ",Q.opts.messages!==!1)Y+=" , message: 'can\\'t resolve reference "+Q.util.escapeQuotes(G)+"' ";if(Q.opts.verbose)Y+=" , schema: "+Q.util.toQuotedString(G)+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+W+" ";Y+=" } "}else Y+=" {} ";var L=Y;if(Y=N.pop(),!Q.compositeRule&&U)if(Q.async)Y+=" throw new ValidationError(["+L+"]); ";else Y+=" validate.errors = ["+L+"]; return false; ";else Y+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(U)Y+=" if (false) { "}else if(Q.opts.missingRefs=="ignore"){if(Q.logger.warn(V),U)Y+=" if (true) { "}else throw new Q.MissingRefError(Q.baseId,G,V)}else if(M.inline){var A=Q.util.copy(Q);A.level++;var O="valid"+A.level;A.schema=M.schema,A.schemaPath="",A.errSchemaPath=G;var j=Q.validate(A).replace(/validate\.schema/g,M.code);if(Y+=" "+j+" ",U)Y+=" if ("+O+") { "}else H=M.$async===!0||Q.async&&M.$async!==!1,B=M.code}if(B){var N=N||[];if(N.push(Y),Y="",Q.opts.passContext)Y+=" "+B+".call(this, ";else Y+=" "+B+"( ";if(Y+=" "+W+", (dataPath || '')",Q.errorPath!='""')Y+=" + "+Q.errorPath;var R=q?"data"+(q-1||""):"parentData",I=q?Q.dataPathArr[q]:"parentDataProperty";Y+=" , "+R+" , "+I+", rootData) ";var w=Y;if(Y=N.pop(),H){if(!Q.async)throw Error("async schema referenced by sync schema");if(U)Y+=" var "+F+"; ";if(Y+=" try { await "+w+"; ",U)Y+=" "+F+" = true; ";if(Y+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",U)Y+=" "+F+" = false; ";if(Y+=" } ",U)Y+=" if ("+F+") { "}else if(Y+=" if (!"+w+") { if (vErrors === null) vErrors = "+B+".errors; else vErrors = vErrors.concat("+B+".errors); errors = vErrors.length; } ",U)Y+=" else { "}return Y}});var Ss1=e((ZD9,Cs1)=>{Cs1.exports=function(Q,Z,X){var Y=" ",K=Q.schema[Z],q=Q.schemaPath+Q.util.getProperty(Z),G=Q.errSchemaPath+"/"+Z,z=!Q.opts.allErrors,U=Q.util.copy(Q),W="";U.level++;var F="valid"+U.level,H=U.baseId,B=!0,M=K;if(M){var V,N=-1,L=M.length-1;while(N<L)if(V=M[N+=1],Q.opts.strictKeywords?typeof V=="object"&&Object.keys(V).length>0||V===!1:Q.util.schemaHasRules(V,Q.RULES.all)){if(B=!1,U.schema=V,U.schemaPath=q+"["+N+"]",U.errSchemaPath=G+"/"+N,Y+=" "+Q.validate(U)+" ",U.baseId=H,z)Y+=" if ("+F+") { ",W+="}"}}if(z)if(B)Y+=" if (true) { ";else Y+=" "+W.slice(0,-1)+" ";return Y}});var ks1=e((XD9,vs1)=>{vs1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B="errs__"+K,M=Q.util.copy(Q),V="";M.level++;var N="valid"+M.level,L=G.every(function(E){return Q.opts.strictKeywords?typeof E=="object"&&Object.keys(E).length>0||E===!1:Q.util.schemaHasRules(E,Q.RULES.all)});if(L){var A=M.baseId;Y+=" var "+B+" = errors; var "+H+" = false; ";var O=Q.compositeRule;Q.compositeRule=M.compositeRule=!0;var j=G;if(j){var R,I=-1,w=j.length-1;while(I<w)R=j[I+=1],M.schema=R,M.schemaPath=z+"["+I+"]",M.errSchemaPath=U+"/"+I,Y+=" "+Q.validate(M)+" ",M.baseId=A,Y+=" "+H+" = "+H+" || "+N+"; if (!"+H+") { ",V+="}"}if(Q.compositeRule=M.compositeRule=O,Y+=" "+V+" if (!"+H+") { var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: {} ",Q.opts.messages!==!1)Y+=" , message: 'should match some schema in anyOf' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";if(Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(vErrors); ";else Y+=" validate.errors = vErrors; return false; ";if(Y+=" } else { errors = "+B+"; if (vErrors !== null) { if ("+B+") vErrors.length = "+B+"; else vErrors = null; } ",Q.opts.allErrors)Y+=" } "}else if(W)Y+=" if (true) { ";return Y}});var bs1=e((YD9,_s1)=>{_s1.exports=function(Q,Z,X){var Y=" ",K=Q.schema[Z],q=Q.errSchemaPath+"/"+Z,G=!Q.opts.allErrors,z=Q.util.toQuotedString(K);if(Q.opts.$comment===!0)Y+=" console.log("+z+");";else if(typeof Q.opts.$comment=="function")Y+=" self._opts.$comment("+z+", "+Q.util.toQuotedString(q)+", validate.root.schema);";return Y}});var ys1=e((KD9,xs1)=>{xs1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B=Q.opts.$data&&G&&G.$data,M;if(B)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",M="schema"+K;else M=G;if(!B)Y+=" var schema"+K+" = validate.schema"+z+";";Y+="var "+H+" = equal("+F+", schema"+K+"); if (!"+H+") { ";var V=V||[];if(V.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'const' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { allowedValue: schema"+K+" } ",Q.opts.messages!==!1)Y+=" , message: 'should be equal to constant' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var N=Y;if(Y=V.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+N+"]); ";else Y+=" validate.errors = ["+N+"]; return false; ";else Y+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" }",W)Y+=" else { ";return Y}});var hs1=e((qD9,fs1)=>{fs1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B="errs__"+K,M=Q.util.copy(Q),V="";M.level++;var N="valid"+M.level,L="i"+K,A=M.dataLevel=Q.dataLevel+1,O="data"+A,j=Q.baseId,R=Q.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:Q.util.schemaHasRules(G,Q.RULES.all);if(Y+="var "+B+" = errors;var "+H+";",R){var I=Q.compositeRule;Q.compositeRule=M.compositeRule=!0,M.schema=G,M.schemaPath=z,M.errSchemaPath=U,Y+=" var "+N+" = false; for (var "+L+" = 0; "+L+" < "+F+".length; "+L+"++) { ",M.errorPath=Q.util.getPathExpr(Q.errorPath,L,Q.opts.jsonPointers,!0);var w=F+"["+L+"]";M.dataPathArr[A]=L;var E=Q.validate(M);if(M.baseId=j,Q.util.varOccurences(E,O)<2)Y+=" "+Q.util.varReplace(E,O,w)+" ";else Y+=" var "+O+" = "+w+"; "+E+" ";Y+=" if ("+N+") break; } ",Q.compositeRule=M.compositeRule=I,Y+=" "+V+" if (!"+N+") {"}else Y+=" if ("+F+".length == 0) {";var $=$||[];if($.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: {} ",Q.opts.messages!==!1)Y+=" , message: 'should contain a valid item' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var P=Y;if(Y=$.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+P+"]); ";else Y+=" validate.errors = ["+P+"]; return false; ";else Y+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" } else { ",R)Y+=" errors = "+B+"; if (vErrors !== null) { if ("+B+") vErrors.length = "+B+"; else vErrors = null; } ";if(Q.opts.allErrors)Y+=" } ";return Y}});var ms1=e((GD9,gs1)=>{gs1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="errs__"+K,B=Q.util.copy(Q),M="";B.level++;var V="valid"+B.level,N={},L={},A=Q.opts.ownProperties;for(I in G){if(I=="__proto__")continue;var O=G[I],j=Array.isArray(O)?L:N;j[I]=O}Y+="var "+H+" = errors;";var R=Q.errorPath;Y+="var missing"+K+";";for(var I in L)if(j=L[I],j.length){if(Y+=" if ( "+F+Q.util.getProperty(I)+" !== undefined ",A)Y+=" && Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(I)+"') ";if(W){Y+=" && ( ";var w=j;if(w){var E,$=-1,P=w.length-1;while($<P){if(E=w[$+=1],$)Y+=" || ";var C=Q.util.getProperty(E),k=F+C;if(Y+=" ( ( "+k+" === undefined ",A)Y+=" || ! Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(E)+"') ";Y+=") && (missing"+K+" = "+Q.util.toQuotedString(Q.opts.jsonPointers?E:C)+") ) "}}Y+=")) { ";var g="missing"+K,T="' + "+g+" + '";if(Q.opts._errorDataPathProperty)Q.errorPath=Q.opts.jsonPointers?Q.util.getPathExpr(R,g,!0):R+" + "+g;var v=v||[];if(v.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { property: '"+Q.util.escapeQuotes(I)+"', missingProperty: '"+T+"', depsCount: "+j.length+", deps: '"+Q.util.escapeQuotes(j.length==1?j[0]:j.join(", "))+"' } ",Q.opts.messages!==!1){if(Y+=" , message: 'should have ",j.length==1)Y+="property "+Q.util.escapeQuotes(j[0]);else Y+="properties "+Q.util.escapeQuotes(j.join(", "));Y+=" when property "+Q.util.escapeQuotes(I)+" is present' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var f=Y;if(Y=v.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+f+"]); ";else Y+=" validate.errors = ["+f+"]; return false; ";else Y+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{Y+=" ) { ";var h=j;if(h){var E,S=-1,x=h.length-1;while(S<x){E=h[S+=1];var C=Q.util.getProperty(E),T=Q.util.escapeQuotes(E),k=F+C;if(Q.opts._errorDataPathProperty)Q.errorPath=Q.util.getPath(R,E,Q.opts.jsonPointers);if(Y+=" if ( "+k+" === undefined ",A)Y+=" || ! Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(E)+"') ";if(Y+=") { var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { property: '"+Q.util.escapeQuotes(I)+"', missingProperty: '"+T+"', depsCount: "+j.length+", deps: '"+Q.util.escapeQuotes(j.length==1?j[0]:j.join(", "))+"' } ",Q.opts.messages!==!1){if(Y+=" , message: 'should have ",j.length==1)Y+="property "+Q.util.escapeQuotes(j[0]);else Y+="properties "+Q.util.escapeQuotes(j.join(", "));Y+=" when property "+Q.util.escapeQuotes(I)+" is present' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}if(Y+=" } ",W)M+="}",Y+=" else { "}Q.errorPath=R;var b=B.baseId;for(var I in N){var O=N[I];if(Q.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:Q.util.schemaHasRules(O,Q.RULES.all)){if(Y+=" "+V+" = true; if ( "+F+Q.util.getProperty(I)+" !== undefined ",A)Y+=" && Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(I)+"') ";if(Y+=") { ",B.schema=O,B.schemaPath=z+Q.util.getProperty(I),B.errSchemaPath=U+"/"+Q.util.escapeFragment(I),Y+=" "+Q.validate(B)+" ",B.baseId=b,Y+=" } ",W)Y+=" if ("+V+") { ",M+="}"}}if(W)Y+=" "+M+" if ("+H+" == errors) {";return Y}});var ps1=e((zD9,us1)=>{us1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B=Q.opts.$data&&G&&G.$data,M;if(B)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",M="schema"+K;else M=G;var V="i"+K,N="schema"+K;if(!B)Y+=" var "+N+" = validate.schema"+z+";";if(Y+="var "+H+";",B)Y+=" if (schema"+K+" === undefined) "+H+" = true; else if (!Array.isArray(schema"+K+")) "+H+" = false; else {";if(Y+=""+H+" = false;for (var "+V+"=0; "+V+"<"+N+".length; "+V+"++) if (equal("+F+", "+N+"["+V+"])) { "+H+" = true; break; }",B)Y+=" } ";Y+=" if (!"+H+") { ";var L=L||[];if(L.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { allowedValues: schema"+K+" } ",Q.opts.messages!==!1)Y+=" , message: 'should be equal to one of the allowed values' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var A=Y;if(Y=L.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+A+"]); ";else Y+=" validate.errors = ["+A+"]; return false; ";else Y+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" }",W)Y+=" else { ";return Y}});var cs1=e((UD9,ds1)=>{ds1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||"");if(Q.opts.format===!1){if(W)Y+=" if (true) { ";return Y}var H=Q.opts.$data&&G&&G.$data,B;if(H)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",B="schema"+K;else B=G;var M=Q.opts.unknownFormats,V=Array.isArray(M);if(H){var N="format"+K,L="isObject"+K,A="formatType"+K;if(Y+=" var "+N+" = formats["+B+"]; var "+L+" = typeof "+N+" == 'object' && !("+N+" instanceof RegExp) && "+N+".validate; var "+A+" = "+L+" && "+N+".type || 'string'; if ("+L+") { ",Q.async)Y+=" var async"+K+" = "+N+".async; ";if(Y+=" "+N+" = "+N+".validate; } if ( ",H)Y+=" ("+B+" !== undefined && typeof "+B+" != 'string') || ";if(Y+=" (",M!="ignore"){if(Y+=" ("+B+" && !"+N+" ",V)Y+=" && self._opts.unknownFormats.indexOf("+B+") == -1 ";Y+=") || "}if(Y+=" ("+N+" && "+A+" == '"+X+"' && !(typeof "+N+" == 'function' ? ",Q.async)Y+=" (async"+K+" ? await "+N+"("+F+") : "+N+"("+F+")) ";else Y+=" "+N+"("+F+") ";Y+=" : "+N+".test("+F+"))))) {"}else{var N=Q.formats[G];if(!N)if(M=="ignore"){if(Q.logger.warn('unknown format "'+G+'" ignored in schema at path "'+Q.errSchemaPath+'"'),W)Y+=" if (true) { ";return Y}else if(V&&M.indexOf(G)>=0){if(W)Y+=" if (true) { ";return Y}else throw Error('unknown format "'+G+'" is used in schema at path "'+Q.errSchemaPath+'"');var L=typeof N=="object"&&!(N instanceof RegExp)&&N.validate,A=L&&N.type||"string";if(L){var O=N.async===!0;N=N.validate}if(A!=X){if(W)Y+=" if (true) { ";return Y}if(O){if(!Q.async)throw Error("async format in sync schema");var j="formats"+Q.util.getProperty(G)+".validate";Y+=" if (!(await "+j+"("+F+"))) { "}else{Y+=" if (! ";var j="formats"+Q.util.getProperty(G);if(L)j+=".validate";if(typeof N=="function")Y+=" "+j+"("+F+") ";else Y+=" "+j+".test("+F+") ";Y+=") { "}}var R=R||[];if(R.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'format' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { format: ",H)Y+=""+B;else Y+=""+Q.util.toQuotedString(G);if(Y+=" } ",Q.opts.messages!==!1){if(Y+=` , message: 'should match format "`,H)Y+="' + "+B+" + '";else Y+=""+Q.util.escapeQuotes(G);Y+=`"' `}if(Q.opts.verbose){if(Y+=" , schema: ",H)Y+="validate.schema"+z;else Y+=""+Q.util.toQuotedString(G);Y+=" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" "}Y+=" } "}else Y+=" {} ";var I=Y;if(Y=R.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+I+"]); ";else Y+=" validate.errors = ["+I+"]; return false; ";else Y+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" } ",W)Y+=" else { ";return Y}});var is1=e((WD9,ls1)=>{ls1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B="errs__"+K,M=Q.util.copy(Q);M.level++;var V="valid"+M.level,N=Q.schema.then,L=Q.schema.else,A=N!==void 0&&(Q.opts.strictKeywords?typeof N=="object"&&Object.keys(N).length>0||N===!1:Q.util.schemaHasRules(N,Q.RULES.all)),O=L!==void 0&&(Q.opts.strictKeywords?typeof L=="object"&&Object.keys(L).length>0||L===!1:Q.util.schemaHasRules(L,Q.RULES.all)),j=M.baseId;if(A||O){var R;M.createErrors=!1,M.schema=G,M.schemaPath=z,M.errSchemaPath=U,Y+=" var "+B+" = errors; var "+H+" = true; ";var I=Q.compositeRule;if(Q.compositeRule=M.compositeRule=!0,Y+=" "+Q.validate(M)+" ",M.baseId=j,M.createErrors=!0,Y+=" errors = "+B+"; if (vErrors !== null) { if ("+B+") vErrors.length = "+B+"; else vErrors = null; } ",Q.compositeRule=M.compositeRule=I,A){if(Y+=" if ("+V+") { ",M.schema=Q.schema.then,M.schemaPath=Q.schemaPath+".then",M.errSchemaPath=Q.errSchemaPath+"/then",Y+=" "+Q.validate(M)+" ",M.baseId=j,Y+=" "+H+" = "+V+"; ",A&&O)R="ifClause"+K,Y+=" var "+R+" = 'then'; ";else R="'then'";if(Y+=" } ",O)Y+=" else { "}else Y+=" if (!"+V+") { ";if(O){if(M.schema=Q.schema.else,M.schemaPath=Q.schemaPath+".else",M.errSchemaPath=Q.errSchemaPath+"/else",Y+=" "+Q.validate(M)+" ",M.baseId=j,Y+=" "+H+" = "+V+"; ",A&&O)R="ifClause"+K,Y+=" var "+R+" = 'else'; ";else R="'else'";Y+=" } "}if(Y+=" if (!"+H+") { var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'if' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { failingKeyword: "+R+" } ",Q.opts.messages!==!1)Y+=` , message: 'should match "' + `+R+` + '" schema' `;if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";if(Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(vErrors); ";else Y+=" validate.errors = vErrors; return false; ";if(Y+=" } ",W)Y+=" else { "}else if(W)Y+=" if (true) { ";return Y}});var as1=e((FD9,ns1)=>{ns1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B="errs__"+K,M=Q.util.copy(Q),V="";M.level++;var N="valid"+M.level,L="i"+K,A=M.dataLevel=Q.dataLevel+1,O="data"+A,j=Q.baseId;if(Y+="var "+B+" = errors;var "+H+";",Array.isArray(G)){var R=Q.schema.additionalItems;if(R===!1){Y+=" "+H+" = "+F+".length <= "+G.length+"; ";var I=U;U=Q.errSchemaPath+"/additionalItems",Y+=" if (!"+H+") { ";var w=w||[];if(w.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { limit: "+G.length+" } ",Q.opts.messages!==!1)Y+=" , message: 'should NOT have more than "+G.length+" items' ";if(Q.opts.verbose)Y+=" , schema: false , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var E=Y;if(Y=w.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+E+"]); ";else Y+=" validate.errors = ["+E+"]; return false; ";else Y+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" } ",U=I,W)V+="}",Y+=" else { "}var $=G;if($){var P,C=-1,k=$.length-1;while(C<k)if(P=$[C+=1],Q.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:Q.util.schemaHasRules(P,Q.RULES.all)){Y+=" "+N+" = true; if ("+F+".length > "+C+") { ";var g=F+"["+C+"]";M.schema=P,M.schemaPath=z+"["+C+"]",M.errSchemaPath=U+"/"+C,M.errorPath=Q.util.getPathExpr(Q.errorPath,C,Q.opts.jsonPointers,!0),M.dataPathArr[A]=C;var T=Q.validate(M);if(M.baseId=j,Q.util.varOccurences(T,O)<2)Y+=" "+Q.util.varReplace(T,O,g)+" ";else Y+=" var "+O+" = "+g+"; "+T+" ";if(Y+=" } ",W)Y+=" if ("+N+") { ",V+="}"}}if(typeof R=="object"&&(Q.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:Q.util.schemaHasRules(R,Q.RULES.all))){M.schema=R,M.schemaPath=Q.schemaPath+".additionalItems",M.errSchemaPath=Q.errSchemaPath+"/additionalItems",Y+=" "+N+" = true; if ("+F+".length > "+G.length+") { for (var "+L+" = "+G.length+"; "+L+" < "+F+".length; "+L+"++) { ",M.errorPath=Q.util.getPathExpr(Q.errorPath,L,Q.opts.jsonPointers,!0);var g=F+"["+L+"]";M.dataPathArr[A]=L;var T=Q.validate(M);if(M.baseId=j,Q.util.varOccurences(T,O)<2)Y+=" "+Q.util.varReplace(T,O,g)+" ";else Y+=" var "+O+" = "+g+"; "+T+" ";if(W)Y+=" if (!"+N+") break; ";if(Y+=" } } ",W)Y+=" if ("+N+") { ",V+="}"}}else if(Q.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:Q.util.schemaHasRules(G,Q.RULES.all)){M.schema=G,M.schemaPath=z,M.errSchemaPath=U,Y+=" for (var "+L+" = 0; "+L+" < "+F+".length; "+L+"++) { ",M.errorPath=Q.util.getPathExpr(Q.errorPath,L,Q.opts.jsonPointers,!0);var g=F+"["+L+"]";M.dataPathArr[A]=L;var T=Q.validate(M);if(M.baseId=j,Q.util.varOccurences(T,O)<2)Y+=" "+Q.util.varReplace(T,O,g)+" ";else Y+=" var "+O+" = "+g+"; "+T+" ";if(W)Y+=" if (!"+N+") break; ";Y+=" }"}if(W)Y+=" "+V+" if ("+B+" == errors) {";return Y}});var nG1=e((HD9,rs1)=>{rs1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,j,F="data"+(q||""),H=Q.opts.$data&&G&&G.$data,B;if(H)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",B="schema"+K;else B=G;var M=Z=="maximum",V=M?"exclusiveMaximum":"exclusiveMinimum",N=Q.schema[V],L=Q.opts.$data&&N&&N.$data,A=M?"<":">",O=M?">":"<",j=void 0;if(!(H||typeof G=="number"||G===void 0))throw Error(Z+" must be number");if(!(L||N===void 0||typeof N=="number"||typeof N=="boolean"))throw Error(V+" must be number or boolean");if(L){var R=Q.util.getData(N.$data,q,Q.dataPathArr),I="exclusive"+K,w="exclType"+K,E="exclIsNumber"+K,$="op"+K,P="' + "+$+" + '";Y+=" var schemaExcl"+K+" = "+R+"; ",R="schemaExcl"+K,Y+=" var "+I+"; var "+w+" = typeof "+R+"; if ("+w+" != 'boolean' && "+w+" != 'undefined' && "+w+" != 'number') { ";var j=V,C=C||[];if(C.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(j||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: {} ",Q.opts.messages!==!1)Y+=" , message: '"+V+" should be boolean' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var k=Y;if(Y=C.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+k+"]); ";else Y+=" validate.errors = ["+k+"]; return false; ";else Y+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" } else if ( ",H)Y+=" ("+B+" !== undefined && typeof "+B+" != 'number') || ";if(Y+=" "+w+" == 'number' ? ( ("+I+" = "+B+" === undefined || "+R+" "+A+"= "+B+") ? "+F+" "+O+"= "+R+" : "+F+" "+O+" "+B+" ) : ( ("+I+" = "+R+" === true) ? "+F+" "+O+"= "+B+" : "+F+" "+O+" "+B+" ) || "+F+" !== "+F+") { var op"+K+" = "+I+" ? '"+A+"' : '"+A+"='; ",G===void 0)j=V,U=Q.errSchemaPath+"/"+V,B=R,H=L}else{var E=typeof N=="number",P=A;if(E&&H){var $="'"+P+"'";if(Y+=" if ( ",H)Y+=" ("+B+" !== undefined && typeof "+B+" != 'number') || ";Y+=" ( "+B+" === undefined || "+N+" "+A+"= "+B+" ? "+F+" "+O+"= "+N+" : "+F+" "+O+" "+B+" ) || "+F+" !== "+F+") { "}else{if(E&&G===void 0)I=!0,j=V,U=Q.errSchemaPath+"/"+V,B=N,O+="=";else{if(E)B=Math[M?"min":"max"](N,G);if(N===(E?B:!0))I=!0,j=V,U=Q.errSchemaPath+"/"+V,O+="=";else I=!1,P+="="}var $="'"+P+"'";if(Y+=" if ( ",H)Y+=" ("+B+" !== undefined && typeof "+B+" != 'number') || ";Y+=" "+F+" "+O+" "+B+" || "+F+" !== "+F+") { "}}j=j||Z;var C=C||[];if(C.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(j||"_limit")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { comparison: "+$+", limit: "+B+", exclusive: "+I+" } ",Q.opts.messages!==!1)if(Y+=" , message: 'should be "+P+" ",H)Y+="' + "+B;else Y+=""+B+"'";if(Q.opts.verbose){if(Y+=" , schema: ",H)Y+="validate.schema"+z;else Y+=""+G;Y+=" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" "}Y+=" } "}else Y+=" {} ";var k=Y;if(Y=C.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+k+"]); ";else Y+=" validate.errors = ["+k+"]; return false; ";else Y+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" } ",W)Y+=" else { ";return Y}});var aG1=e((BD9,ss1)=>{ss1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,V,F="data"+(q||""),H=Q.opts.$data&&G&&G.$data,B;if(H)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",B="schema"+K;else B=G;if(!(H||typeof G=="number"))throw Error(Z+" must be number");var M=Z=="maxItems"?">":"<";if(Y+="if ( ",H)Y+=" ("+B+" !== undefined && typeof "+B+" != 'number') || ";Y+=" "+F+".length "+M+" "+B+") { ";var V=Z,N=N||[];if(N.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(V||"_limitItems")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { limit: "+B+" } ",Q.opts.messages!==!1){if(Y+=" , message: 'should NOT have ",Z=="maxItems")Y+="more";else Y+="fewer";if(Y+=" than ",H)Y+="' + "+B+" + '";else Y+=""+G;Y+=" items' "}if(Q.opts.verbose){if(Y+=" , schema: ",H)Y+="validate.schema"+z;else Y+=""+G;Y+=" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" "}Y+=" } "}else Y+=" {} ";var L=Y;if(Y=N.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+L+"]); ";else Y+=" validate.errors = ["+L+"]; return false; ";else Y+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+="} ",W)Y+=" else { ";return Y}});var rG1=e((DD9,os1)=>{os1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,V,F="data"+(q||""),H=Q.opts.$data&&G&&G.$data,B;if(H)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",B="schema"+K;else B=G;if(!(H||typeof G=="number"))throw Error(Z+" must be number");var M=Z=="maxLength"?">":"<";if(Y+="if ( ",H)Y+=" ("+B+" !== undefined && typeof "+B+" != 'number') || ";if(Q.opts.unicode===!1)Y+=" "+F+".length ";else Y+=" ucs2length("+F+") ";Y+=" "+M+" "+B+") { ";var V=Z,N=N||[];if(N.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(V||"_limitLength")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { limit: "+B+" } ",Q.opts.messages!==!1){if(Y+=" , message: 'should NOT be ",Z=="maxLength")Y+="longer";else Y+="shorter";if(Y+=" than ",H)Y+="' + "+B+" + '";else Y+=""+G;Y+=" characters' "}if(Q.opts.verbose){if(Y+=" , schema: ",H)Y+="validate.schema"+z;else Y+=""+G;Y+=" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" "}Y+=" } "}else Y+=" {} ";var L=Y;if(Y=N.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+L+"]); ";else Y+=" validate.errors = ["+L+"]; return false; ";else Y+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+="} ",W)Y+=" else { ";return Y}});var sG1=e((MD9,ts1)=>{ts1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,V,F="data"+(q||""),H=Q.opts.$data&&G&&G.$data,B;if(H)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",B="schema"+K;else B=G;if(!(H||typeof G=="number"))throw Error(Z+" must be number");var M=Z=="maxProperties"?">":"<";if(Y+="if ( ",H)Y+=" ("+B+" !== undefined && typeof "+B+" != 'number') || ";Y+=" Object.keys("+F+").length "+M+" "+B+") { ";var V=Z,N=N||[];if(N.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(V||"_limitProperties")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { limit: "+B+" } ",Q.opts.messages!==!1){if(Y+=" , message: 'should NOT have ",Z=="maxProperties")Y+="more";else Y+="fewer";if(Y+=" than ",H)Y+="' + "+B+" + '";else Y+=""+G;Y+=" properties' "}if(Q.opts.verbose){if(Y+=" , schema: ",H)Y+="validate.schema"+z;else Y+=""+G;Y+=" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" "}Y+=" } "}else Y+=" {} ";var L=Y;if(Y=N.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+L+"]); ";else Y+=" validate.errors = ["+L+"]; return false; ";else Y+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+="} ",W)Y+=" else { ";return Y}});var Jo1=e((VD9,es1)=>{es1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H=Q.opts.$data&&G&&G.$data,B;if(H)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",B="schema"+K;else B=G;if(!(H||typeof G=="number"))throw Error(Z+" must be number");if(Y+="var division"+K+";if (",H)Y+=" "+B+" !== undefined && ( typeof "+B+" != 'number' || ";if(Y+=" (division"+K+" = "+F+" / "+B+", ",Q.opts.multipleOfPrecision)Y+=" Math.abs(Math.round(division"+K+") - division"+K+") > 1e-"+Q.opts.multipleOfPrecision+" ";else Y+=" division"+K+" !== parseInt(division"+K+") ";if(Y+=" ) ",H)Y+=" ) ";Y+=" ) { ";var M=M||[];if(M.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { multipleOf: "+B+" } ",Q.opts.messages!==!1)if(Y+=" , message: 'should be multiple of ",H)Y+="' + "+B;else Y+=""+B+"'";if(Q.opts.verbose){if(Y+=" , schema: ",H)Y+="validate.schema"+z;else Y+=""+G;Y+=" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" "}Y+=" } "}else Y+=" {} ";var V=Y;if(Y=M.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+V+"]); ";else Y+=" validate.errors = ["+V+"]; return false; ";else Y+=" var err = "+V+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+="} ",W)Y+=" else { ";return Y}});var Zo1=e((ND9,Qo1)=>{Qo1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="errs__"+K,B=Q.util.copy(Q);B.level++;var M="valid"+B.level;if(Q.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:Q.util.schemaHasRules(G,Q.RULES.all)){B.schema=G,B.schemaPath=z,B.errSchemaPath=U,Y+=" var "+H+" = errors; ";var V=Q.compositeRule;Q.compositeRule=B.compositeRule=!0,B.createErrors=!1;var N;if(B.opts.allErrors)N=B.opts.allErrors,B.opts.allErrors=!1;if(Y+=" "+Q.validate(B)+" ",B.createErrors=!0,N)B.opts.allErrors=N;Q.compositeRule=B.compositeRule=V,Y+=" if ("+M+") { ";var L=L||[];if(L.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'not' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: {} ",Q.opts.messages!==!1)Y+=" , message: 'should NOT be valid' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var A=Y;if(Y=L.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+A+"]); ";else Y+=" validate.errors = ["+A+"]; return false; ";else Y+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" } else { errors = "+H+"; if (vErrors !== null) { if ("+H+") vErrors.length = "+H+"; else vErrors = null; } ",Q.opts.allErrors)Y+=" } "}else{if(Y+=" var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'not' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: {} ",Q.opts.messages!==!1)Y+=" , message: 'should NOT be valid' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";if(Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",W)Y+=" if (false) { "}return Y}});var Yo1=e((LD9,Xo1)=>{Xo1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B="errs__"+K,M=Q.util.copy(Q),V="";M.level++;var N="valid"+M.level,L=M.baseId,A="prevValid"+K,O="passingSchemas"+K;Y+="var "+B+" = errors , "+A+" = false , "+H+" = false , "+O+" = null; ";var j=Q.compositeRule;Q.compositeRule=M.compositeRule=!0;var R=G;if(R){var I,w=-1,E=R.length-1;while(w<E){if(I=R[w+=1],Q.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===!1:Q.util.schemaHasRules(I,Q.RULES.all))M.schema=I,M.schemaPath=z+"["+w+"]",M.errSchemaPath=U+"/"+w,Y+=" "+Q.validate(M)+" ",M.baseId=L;else Y+=" var "+N+" = true; ";if(w)Y+=" if ("+N+" && "+A+") { "+H+" = false; "+O+" = ["+O+", "+w+"]; } else { ",V+="}";Y+=" if ("+N+") { "+H+" = "+A+" = true; "+O+" = "+w+"; }"}}if(Q.compositeRule=M.compositeRule=j,Y+=""+V+"if (!"+H+") { var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { passingSchemas: "+O+" } ",Q.opts.messages!==!1)Y+=" , message: 'should match exactly one schema in oneOf' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";if(Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(vErrors); ";else Y+=" validate.errors = vErrors; return false; ";if(Y+="} else { errors = "+B+"; if (vErrors !== null) { if ("+B+") vErrors.length = "+B+"; else vErrors = null; }",Q.opts.allErrors)Y+=" } ";return Y}});var qo1=e((AD9,Ko1)=>{Ko1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H=Q.opts.$data&&G&&G.$data,B;if(H)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",B="schema"+K;else B=G;var M=H?"(new RegExp("+B+"))":Q.usePattern(G);if(Y+="if ( ",H)Y+=" ("+B+" !== undefined && typeof "+B+" != 'string') || ";Y+=" !"+M+".test("+F+") ) { ";var V=V||[];if(V.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { pattern: ",H)Y+=""+B;else Y+=""+Q.util.toQuotedString(G);if(Y+=" } ",Q.opts.messages!==!1){if(Y+=` , message: 'should match pattern "`,H)Y+="' + "+B+" + '";else Y+=""+Q.util.escapeQuotes(G);Y+=`"' `}if(Q.opts.verbose){if(Y+=" , schema: ",H)Y+="validate.schema"+z;else Y+=""+Q.util.toQuotedString(G);Y+=" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" "}Y+=" } "}else Y+=" {} ";var N=Y;if(Y=V.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+N+"]); ";else Y+=" validate.errors = ["+N+"]; return false; ";else Y+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+="} ",W)Y+=" else { ";return Y}});var zo1=e((OD9,Go1)=>{Go1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="errs__"+K,B=Q.util.copy(Q),M="";B.level++;var V="valid"+B.level,N="key"+K,L="idx"+K,A=B.dataLevel=Q.dataLevel+1,O="data"+A,j="dataProperties"+K,R=Object.keys(G||{}).filter(S),I=Q.schema.patternProperties||{},w=Object.keys(I).filter(S),E=Q.schema.additionalProperties,$=R.length||w.length,P=E===!1,C=typeof E=="object"&&Object.keys(E).length,k=Q.opts.removeAdditional,g=P||C||k,T=Q.opts.ownProperties,v=Q.baseId,f=Q.schema.required;if(f&&!(Q.opts.$data&&f.$data)&&f.length<Q.opts.loopRequired)var h=Q.util.toHash(f);function S(t){return t!=="__proto__"}if(Y+="var "+H+" = errors;var "+V+" = true;",T)Y+=" var "+j+" = undefined;";if(g){if(T)Y+=" "+j+" = "+j+" || Object.keys("+F+"); for (var "+L+"=0; "+L+"<"+j+".length; "+L+"++) { var "+N+" = "+j+"["+L+"]; ";else Y+=" for (var "+N+" in "+F+") { ";if($){if(Y+=" var isAdditional"+K+" = !(false ",R.length)if(R.length>8)Y+=" || validate.schema"+z+".hasOwnProperty("+N+") ";else{var x=R;if(x){var b,m=-1,a=x.length-1;while(m<a)b=x[m+=1],Y+=" || "+N+" == "+Q.util.toQuotedString(b)+" "}}if(w.length){var p=w;if(p){var Q1,z1=-1,F1=p.length-1;while(z1<F1)Q1=p[z1+=1],Y+=" || "+Q.usePattern(Q1)+".test("+N+") "}}Y+=" ); if (isAdditional"+K+") { "}if(k=="all")Y+=" delete "+F+"["+N+"]; ";else{var X1=Q.errorPath,H1="' + "+N+" + '";if(Q.opts._errorDataPathProperty)Q.errorPath=Q.util.getPathExpr(Q.errorPath,N,Q.opts.jsonPointers);if(P)if(k)Y+=" delete "+F+"["+N+"]; ";else{Y+=" "+V+" = false; ";var l=U;U=Q.errSchemaPath+"/additionalProperties";var d=d||[];if(d.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { additionalProperty: '"+H1+"' } ",Q.opts.messages!==!1){if(Y+=" , message: '",Q.opts._errorDataPathProperty)Y+="is an invalid additional property";else Y+="should NOT have additional properties";Y+="' "}if(Q.opts.verbose)Y+=" , schema: false , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var i=Y;if(Y=d.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+i+"]); ";else Y+=" validate.errors = ["+i+"]; return false; ";else Y+=" var err = "+i+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(U=l,W)Y+=" break; "}else if(C)if(k=="failing"){Y+=" var "+H+" = errors; ";var r=Q.compositeRule;Q.compositeRule=B.compositeRule=!0,B.schema=E,B.schemaPath=Q.schemaPath+".additionalProperties",B.errSchemaPath=Q.errSchemaPath+"/additionalProperties",B.errorPath=Q.opts._errorDataPathProperty?Q.errorPath:Q.util.getPathExpr(Q.errorPath,N,Q.opts.jsonPointers);var o=F+"["+N+"]";B.dataPathArr[A]=N;var K1=Q.validate(B);if(B.baseId=v,Q.util.varOccurences(K1,O)<2)Y+=" "+Q.util.varReplace(K1,O,o)+" ";else Y+=" var "+O+" = "+o+"; "+K1+" ";Y+=" if (!"+V+") { errors = "+H+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+F+"["+N+"]; } ",Q.compositeRule=B.compositeRule=r}else{B.schema=E,B.schemaPath=Q.schemaPath+".additionalProperties",B.errSchemaPath=Q.errSchemaPath+"/additionalProperties",B.errorPath=Q.opts._errorDataPathProperty?Q.errorPath:Q.util.getPathExpr(Q.errorPath,N,Q.opts.jsonPointers);var o=F+"["+N+"]";B.dataPathArr[A]=N;var K1=Q.validate(B);if(B.baseId=v,Q.util.varOccurences(K1,O)<2)Y+=" "+Q.util.varReplace(K1,O,o)+" ";else Y+=" var "+O+" = "+o+"; "+K1+" ";if(W)Y+=" if (!"+V+") break; "}Q.errorPath=X1}if($)Y+=" } ";if(Y+=" } ",W)Y+=" if ("+V+") { ",M+="}"}var Z1=Q.opts.useDefaults&&!Q.compositeRule;if(R.length){var B1=R;if(B1){var b,U1=-1,W1=B1.length-1;while(U1<W1){b=B1[U1+=1];var j1=G[b];if(Q.opts.strictKeywords?typeof j1=="object"&&Object.keys(j1).length>0||j1===!1:Q.util.schemaHasRules(j1,Q.RULES.all)){var D1=Q.util.getProperty(b),o=F+D1,d1=Z1&&j1.default!==void 0;B.schema=j1,B.schemaPath=z+D1,B.errSchemaPath=U+"/"+Q.util.escapeFragment(b),B.errorPath=Q.util.getPath(Q.errorPath,b,Q.opts.jsonPointers),B.dataPathArr[A]=Q.util.toQuotedString(b);var K1=Q.validate(B);if(B.baseId=v,Q.util.varOccurences(K1,O)<2){K1=Q.util.varReplace(K1,O,o);var n1=o}else{var n1=O;Y+=" var "+O+" = "+o+"; "}if(d1)Y+=" "+K1+" ";else{if(h&&h[b]){if(Y+=" if ( "+n1+" === undefined ",T)Y+=" || ! Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(b)+"') ";Y+=") { "+V+" = false; ";var X1=Q.errorPath,l=U,r1=Q.util.escapeQuotes(b);if(Q.opts._errorDataPathProperty)Q.errorPath=Q.util.getPath(X1,b,Q.opts.jsonPointers);U=Q.errSchemaPath+"/required";var d=d||[];if(d.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'required' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { missingProperty: '"+r1+"' } ",Q.opts.messages!==!1){if(Y+=" , message: '",Q.opts._errorDataPathProperty)Y+="is a required property";else Y+="should have required property \\'"+r1+"\\'";Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var i=Y;if(Y=d.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+i+"]); ";else Y+=" validate.errors = ["+i+"]; return false; ";else Y+=" var err = "+i+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";U=l,Q.errorPath=X1,Y+=" } else { "}else if(W){if(Y+=" if ( "+n1+" === undefined ",T)Y+=" || ! Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(b)+"') ";Y+=") { "+V+" = true; } else { "}else{if(Y+=" if ("+n1+" !== undefined ",T)Y+=" && Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(b)+"') ";Y+=" ) { "}Y+=" "+K1+" } "}}if(W)Y+=" if ("+V+") { ",M+="}"}}}if(w.length){var u1=w;if(u1){var Q1,a1=-1,V1=u1.length-1;while(a1<V1){Q1=u1[a1+=1];var j1=I[Q1];if(Q.opts.strictKeywords?typeof j1=="object"&&Object.keys(j1).length>0||j1===!1:Q.util.schemaHasRules(j1,Q.RULES.all)){if(B.schema=j1,B.schemaPath=Q.schemaPath+".patternProperties"+Q.util.getProperty(Q1),B.errSchemaPath=Q.errSchemaPath+"/patternProperties/"+Q.util.escapeFragment(Q1),T)Y+=" "+j+" = "+j+" || Object.keys("+F+"); for (var "+L+"=0; "+L+"<"+j+".length; "+L+"++) { var "+N+" = "+j+"["+L+"]; ";else Y+=" for (var "+N+" in "+F+") { ";Y+=" if ("+Q.usePattern(Q1)+".test("+N+")) { ",B.errorPath=Q.util.getPathExpr(Q.errorPath,N,Q.opts.jsonPointers);var o=F+"["+N+"]";B.dataPathArr[A]=N;var K1=Q.validate(B);if(B.baseId=v,Q.util.varOccurences(K1,O)<2)Y+=" "+Q.util.varReplace(K1,O,o)+" ";else Y+=" var "+O+" = "+o+"; "+K1+" ";if(W)Y+=" if (!"+V+") break; ";if(Y+=" } ",W)Y+=" else "+V+" = true; ";if(Y+=" } ",W)Y+=" if ("+V+") { ",M+="}"}}}}if(W)Y+=" "+M+" if ("+H+" == errors) {";return Y}});var Wo1=e((jD9,Uo1)=>{Uo1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="errs__"+K,B=Q.util.copy(Q),M="";B.level++;var V="valid"+B.level;if(Y+="var "+H+" = errors;",Q.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:Q.util.schemaHasRules(G,Q.RULES.all)){B.schema=G,B.schemaPath=z,B.errSchemaPath=U;var N="key"+K,L="idx"+K,A="i"+K,O="' + "+N+" + '",j=B.dataLevel=Q.dataLevel+1,R="data"+j,I="dataProperties"+K,w=Q.opts.ownProperties,E=Q.baseId;if(w)Y+=" var "+I+" = undefined; ";if(w)Y+=" "+I+" = "+I+" || Object.keys("+F+"); for (var "+L+"=0; "+L+"<"+I+".length; "+L+"++) { var "+N+" = "+I+"["+L+"]; ";else Y+=" for (var "+N+" in "+F+") { ";Y+=" var startErrs"+K+" = errors; ";var $=N,P=Q.compositeRule;Q.compositeRule=B.compositeRule=!0;var C=Q.validate(B);if(B.baseId=E,Q.util.varOccurences(C,R)<2)Y+=" "+Q.util.varReplace(C,R,$)+" ";else Y+=" var "+R+" = "+$+"; "+C+" ";if(Q.compositeRule=B.compositeRule=P,Y+=" if (!"+V+") { for (var "+A+"=startErrs"+K+"; "+A+"<errors; "+A+"++) { vErrors["+A+"].propertyName = "+N+"; } var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { propertyName: '"+O+"' } ",Q.opts.messages!==!1)Y+=" , message: 'property name \\'"+O+"\\' is invalid' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";if(Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(vErrors); ";else Y+=" validate.errors = vErrors; return false; ";if(W)Y+=" break; ";Y+=" } }"}if(W)Y+=" "+M+" if ("+H+" == errors) {";return Y}});var Ho1=e((RD9,Fo1)=>{Fo1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B=Q.opts.$data&&G&&G.$data,M;if(B)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",M="schema"+K;else M=G;var V="schema"+K;if(!B)if(G.length<Q.opts.loopRequired&&Q.schema.properties&&Object.keys(Q.schema.properties).length){var N=[],L=G;if(L){var A,O=-1,j=L.length-1;while(O<j){A=L[O+=1];var R=Q.schema.properties[A];if(!(R&&(Q.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:Q.util.schemaHasRules(R,Q.RULES.all))))N[N.length]=A}}}else var N=G;if(B||N.length){var I=Q.errorPath,w=B||N.length>=Q.opts.loopRequired,E=Q.opts.ownProperties;if(W)if(Y+=" var missing"+K+"; ",w){if(!B)Y+=" var "+V+" = validate.schema"+z+"; ";var $="i"+K,P="schema"+K+"["+$+"]",C="' + "+P+" + '";if(Q.opts._errorDataPathProperty)Q.errorPath=Q.util.getPathExpr(I,P,Q.opts.jsonPointers);if(Y+=" var "+H+" = true; ",B)Y+=" if (schema"+K+" === undefined) "+H+" = true; else if (!Array.isArray(schema"+K+")) "+H+" = false; else {";if(Y+=" for (var "+$+" = 0; "+$+" < "+V+".length; "+$+"++) { "+H+" = "+F+"["+V+"["+$+"]] !== undefined ",E)Y+=" && Object.prototype.hasOwnProperty.call("+F+", "+V+"["+$+"]) ";if(Y+="; if (!"+H+") break; } ",B)Y+=" } ";Y+=" if (!"+H+") { ";var k=k||[];if(k.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'required' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { missingProperty: '"+C+"' } ",Q.opts.messages!==!1){if(Y+=" , message: '",Q.opts._errorDataPathProperty)Y+="is a required property";else Y+="should have required property \\'"+C+"\\'";Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var g=Y;if(Y=k.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+g+"]); ";else Y+=" validate.errors = ["+g+"]; return false; ";else Y+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Y+=" } else { "}else{Y+=" if ( ";var T=N;if(T){var v,$=-1,f=T.length-1;while($<f){if(v=T[$+=1],$)Y+=" || ";var h=Q.util.getProperty(v),S=F+h;if(Y+=" ( ( "+S+" === undefined ",E)Y+=" || ! Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(v)+"') ";Y+=") && (missing"+K+" = "+Q.util.toQuotedString(Q.opts.jsonPointers?v:h)+") ) "}}Y+=") { ";var P="missing"+K,C="' + "+P+" + '";if(Q.opts._errorDataPathProperty)Q.errorPath=Q.opts.jsonPointers?Q.util.getPathExpr(I,P,!0):I+" + "+P;var k=k||[];if(k.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'required' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { missingProperty: '"+C+"' } ",Q.opts.messages!==!1){if(Y+=" , message: '",Q.opts._errorDataPathProperty)Y+="is a required property";else Y+="should have required property \\'"+C+"\\'";Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var g=Y;if(Y=k.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+g+"]); ";else Y+=" validate.errors = ["+g+"]; return false; ";else Y+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Y+=" } else { "}else if(w){if(!B)Y+=" var "+V+" = validate.schema"+z+"; ";var $="i"+K,P="schema"+K+"["+$+"]",C="' + "+P+" + '";if(Q.opts._errorDataPathProperty)Q.errorPath=Q.util.getPathExpr(I,P,Q.opts.jsonPointers);if(B){if(Y+=" if ("+V+" && !Array.isArray("+V+")) { var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'required' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { missingProperty: '"+C+"' } ",Q.opts.messages!==!1){if(Y+=" , message: '",Q.opts._errorDataPathProperty)Y+="is a required property";else Y+="should have required property \\'"+C+"\\'";Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+V+" !== undefined) { "}if(Y+=" for (var "+$+" = 0; "+$+" < "+V+".length; "+$+"++) { if ("+F+"["+V+"["+$+"]] === undefined ",E)Y+=" || ! Object.prototype.hasOwnProperty.call("+F+", "+V+"["+$+"]) ";if(Y+=") { var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'required' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { missingProperty: '"+C+"' } ",Q.opts.messages!==!1){if(Y+=" , message: '",Q.opts._errorDataPathProperty)Y+="is a required property";else Y+="should have required property \\'"+C+"\\'";Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";if(Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",B)Y+=" } "}else{var x=N;if(x){var v,b=-1,m=x.length-1;while(b<m){v=x[b+=1];var h=Q.util.getProperty(v),C=Q.util.escapeQuotes(v),S=F+h;if(Q.opts._errorDataPathProperty)Q.errorPath=Q.util.getPath(I,v,Q.opts.jsonPointers);if(Y+=" if ( "+S+" === undefined ",E)Y+=" || ! Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(v)+"') ";if(Y+=") { var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'required' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { missingProperty: '"+C+"' } ",Q.opts.messages!==!1){if(Y+=" , message: '",Q.opts._errorDataPathProperty)Y+="is a required property";else Y+="should have required property \\'"+C+"\\'";Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}Q.errorPath=I}else if(W)Y+=" if (true) {";return Y}});var Do1=e((wD9,Bo1)=>{Bo1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B=Q.opts.$data&&G&&G.$data,M;if(B)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",M="schema"+K;else M=G;if((G||B)&&Q.opts.uniqueItems!==!1){if(B)Y+=" var "+H+"; if ("+M+" === false || "+M+" === undefined) "+H+" = true; else if (typeof "+M+" != 'boolean') "+H+" = false; else { ";Y+=" var i = "+F+".length , "+H+" = true , j; if (i > 1) { ";var V=Q.schema.items&&Q.schema.items.type,N=Array.isArray(V);if(!V||V=="object"||V=="array"||N&&(V.indexOf("object")>=0||V.indexOf("array")>=0))Y+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+F+"[i], "+F+"[j])) { "+H+" = false; break outer; } } } ";else{Y+=" var itemIndices = {}, item; for (;i--;) { var item = "+F+"[i]; ";var L="checkDataType"+(N?"s":"");if(Y+=" if ("+Q.util[L](V,"item",Q.opts.strictNumbers,!0)+") continue; ",N)Y+=` if (typeof item == 'string') item = '"' + item; `;Y+=" if (typeof itemIndices[item] == 'number') { "+H+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}if(Y+=" } ",B)Y+=" } ";Y+=" if (!"+H+") { ";var A=A||[];if(A.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { i: i, j: j } ",Q.opts.messages!==!1)Y+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' ";if(Q.opts.verbose){if(Y+=" , schema: ",B)Y+="validate.schema"+z;else Y+=""+G;Y+=" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" "}Y+=" } "}else Y+=" {} ";var O=Y;if(Y=A.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+O+"]); ";else Y+=" validate.errors = ["+O+"]; return false; ";else Y+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" } ",W)Y+=" else { "}else if(W)Y+=" if (true) { ";return Y}});var Vo1=e((ID9,Mo1)=>{Mo1.exports={$ref:Ts1(),allOf:Ss1(),anyOf:ks1(),$comment:bs1(),const:ys1(),contains:hs1(),dependencies:ms1(),enum:ps1(),format:cs1(),if:is1(),items:as1(),maximum:nG1(),minimum:nG1(),maxItems:aG1(),minItems:aG1(),maxLength:rG1(),minLength:rG1(),maxProperties:sG1(),minProperties:sG1(),multipleOf:Jo1(),not:Zo1(),oneOf:Yo1(),pattern:qo1(),properties:zo1(),propertyNames:Wo1(),required:Ho1(),uniqueItems:Do1(),validate:lG1()}});var Ao1=e((ED9,Lo1)=>{var No1=Vo1(),oG1=jN().toHash;Lo1.exports=function(){var Q=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],Z=["type","$comment"],X=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],Y=["number","integer","string","array","object","boolean","null"];return Q.all=oG1(Z),Q.types=oG1(Y),Q.forEach(function(K){if(K.rules=K.rules.map(function(q){var G;if(typeof q=="object"){var z=Object.keys(q)[0];G=q[z],q=z,G.forEach(function(W){Z.push(W),Q.all[W]=!0})}Z.push(q);var U=Q.all[q]={keyword:q,code:No1[q],implements:G};return U}),Q.all.$comment={keyword:"$comment",code:No1.$comment},K.type)Q.types[K.type]=K}),Q.keywords=oG1(Z.concat(X)),Q.custom={},Q}});var Ro1=e(($D9,jo1)=>{var Oo1=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];jo1.exports=function(J,Q){for(var Z=0;Z<Q.length;Z++){J=JSON.parse(JSON.stringify(J));var X=Q[Z].split("/"),Y=J,K;for(K=1;K<X.length;K++)Y=Y[X[K]];for(K=0;K<Oo1.length;K++){var q=Oo1[K],G=Y[q];if(G)Y[q]={anyOf:[G,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}}}return J}});var Eo1=e((PD9,Io1)=>{var wR6=Cc().MissingRef;Io1.exports=wo1;function wo1(J,Q,Z){var X=this;if(typeof this._opts.loadSchema!="function")throw Error("options.loadSchema should be a function");if(typeof Q=="function")Z=Q,Q=void 0;var Y=K(J).then(function(){var G=X._addSchema(J,void 0,Q);return G.validate||q(G)});if(Z)Y.then(function(G){Z(null,G)},Z);return Y;function K(G){var z=G.$schema;return z&&!X.getSchema(z)?wo1.call(X,{$ref:z},!0):Promise.resolve()}function q(G){try{return X._compile(G)}catch(U){if(U instanceof wR6)return z(U);throw U}function z(U){var W=U.missingSchema;if(B(W))throw Error("Schema "+W+" is loaded but "+U.missingRef+" cannot be resolved");var F=X._loadingSchemas[W];if(!F)F=X._loadingSchemas[W]=X._opts.loadSchema(W),F.then(H,H);return F.then(function(M){if(!B(W))return K(M).then(function(){if(!B(W))X.addSchema(M,W,void 0,Q)})}).then(function(){return q(G)});function H(){delete X._loadingSchemas[W]}function B(M){return X._refs[M]||X._schemas[M]}}}}});var Po1=e((TD9,$o1)=>{$o1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F,H="data"+(q||""),B="valid"+K,M="errs__"+K,V=Q.opts.$data&&G&&G.$data,N;if(V)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",N="schema"+K;else N=G;var L=this,A="definition"+K,O=L.definition,j="",R,I,w,E,$;if(V&&O.$data){$="keywordValidate"+K;var P=O.validateSchema;Y+=" var "+A+" = RULES.custom['"+Z+"'].definition; var "+$+" = "+A+".validate;"}else{if(E=Q.useCustomRule(L,G,Q.schema,Q),!E)return;N="validate.schema"+z,$=E.code,R=O.compile,I=O.inline,w=O.macro}var C=$+".errors",k="i"+K,g="ruleErr"+K,T=O.async;if(T&&!Q.async)throw Error("async keyword in sync schema");if(!(I||w))Y+=""+C+" = null;";if(Y+="var "+M+" = errors;var "+B+";",V&&O.$data){if(j+="}",Y+=" if ("+N+" === undefined) { "+B+" = true; } else { ",P)j+="}",Y+=" "+B+" = "+A+".validateSchema("+N+"); if ("+B+") { "}if(I)if(O.statements)Y+=" "+E.validate+" ";else Y+=" "+B+" = "+E.validate+"; ";else if(w){var v=Q.util.copy(Q),j="";v.level++;var f="valid"+v.level;v.schema=E.validate,v.schemaPath="";var h=Q.compositeRule;Q.compositeRule=v.compositeRule=!0;var S=Q.validate(v).replace(/validate\.schema/g,$);Q.compositeRule=v.compositeRule=h,Y+=" "+S}else{var x=x||[];if(x.push(Y),Y="",Y+=" "+$+".call( ",Q.opts.passContext)Y+="this";else Y+="self";if(R||O.schema===!1)Y+=" , "+H+" ";else Y+=" , "+N+" , "+H+" , validate.schema"+Q.schemaPath+" ";if(Y+=" , (dataPath || '')",Q.errorPath!='""')Y+=" + "+Q.errorPath;var b=q?"data"+(q-1||""):"parentData",m=q?Q.dataPathArr[q]:"parentDataProperty";Y+=" , "+b+" , "+m+" , rootData ) ";var a=Y;if(Y=x.pop(),O.errors===!1){if(Y+=" "+B+" = ",T)Y+="await ";Y+=""+a+"; "}else if(T)C="customErrors"+K,Y+=" var "+C+" = null; try { "+B+" = await "+a+"; } catch (e) { "+B+" = false; if (e instanceof ValidationError) "+C+" = e.errors; else throw e; } ";else Y+=" "+C+" = null; "+B+" = "+a+"; "}if(O.modifying)Y+=" if ("+b+") "+H+" = "+b+"["+m+"];";if(Y+=""+j,O.valid){if(W)Y+=" if (true) { "}else{if(Y+=" if ( ",O.valid===void 0)if(Y+=" !",w)Y+=""+f;else Y+=""+B;else Y+=" "+!O.valid+" ";Y+=") { ",F=L.keyword;var x=x||[];x.push(Y),Y="";var x=x||[];if(x.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(F||"custom")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { keyword: '"+L.keyword+"' } ",Q.opts.messages!==!1)Y+=` , message: 'should pass "`+L.keyword+`" keyword validation' `;if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+H+" ";Y+=" } "}else Y+=" {} ";var p=Y;if(Y=x.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+p+"]); ";else Y+=" validate.errors = ["+p+"]; return false; ";else Y+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var Q1=Y;if(Y=x.pop(),I)if(O.errors){if(O.errors!="full"){if(Y+=" for (var "+k+"="+M+"; "+k+"<errors; "+k+"++) { var "+g+" = vErrors["+k+"]; if ("+g+".dataPath === undefined) "+g+".dataPath = (dataPath || '') + "+Q.errorPath+"; if ("+g+".schemaPath === undefined) { "+g+'.schemaPath = "'+U+'"; } ',Q.opts.verbose)Y+=" "+g+".schema = "+N+"; "+g+".data = "+H+"; ";Y+=" } "}}else if(O.errors===!1)Y+=" "+Q1+" ";else{if(Y+=" if ("+M+" == errors) { "+Q1+" } else { for (var "+k+"="+M+"; "+k+"<errors; "+k+"++) { var "+g+" = vErrors["+k+"]; if ("+g+".dataPath === undefined) "+g+".dataPath = (dataPath || '') + "+Q.errorPath+"; if ("+g+".schemaPath === undefined) { "+g+'.schemaPath = "'+U+'"; } ',Q.opts.verbose)Y+=" "+g+".schema = "+N+"; "+g+".data = "+H+"; ";Y+=" } } "}else if(w){if(Y+=" var err = ",Q.createErrors!==!1){if(Y+=" { keyword: '"+(F||"custom")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { keyword: '"+L.keyword+"' } ",Q.opts.messages!==!1)Y+=` , message: 'should pass "`+L.keyword+`" keyword validation' `;if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+H+" ";Y+=" } "}else Y+=" {} ";if(Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(vErrors); ";else Y+=" validate.errors = vErrors; return false; "}else if(O.errors===!1)Y+=" "+Q1+" ";else{if(Y+=" if (Array.isArray("+C+")) { if (vErrors === null) vErrors = "+C+"; else vErrors = vErrors.concat("+C+"); errors = vErrors.length; for (var "+k+"="+M+"; "+k+"<errors; "+k+"++) { var "+g+" = vErrors["+k+"]; if ("+g+".dataPath === undefined) "+g+".dataPath = (dataPath || '') + "+Q.errorPath+"; "+g+'.schemaPath = "'+U+'"; ',Q.opts.verbose)Y+=" "+g+".schema = "+N+"; "+g+".data = "+H+"; ";Y+=" } } else { "+Q1+" } "}if(Y+=" } ",W)Y+=" else { "}return Y}});var tG1=e((CD9,IR6)=>{IR6.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var So1=e((SD9,Co1)=>{var To1=tG1();Co1.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:To1.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:To1.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var ko1=e((vD9,vo1)=>{var ER6=/^[a-z_$][a-z0-9_$-]*$/i,$R6=Po1(),PR6=So1();vo1.exports={add:TR6,get:CR6,remove:SR6,validate:eG1};function TR6(J,Q){var Z=this.RULES;if(Z.keywords[J])throw Error("Keyword "+J+" is already defined");if(!ER6.test(J))throw Error("Keyword "+J+" is not a valid identifier");if(Q){this.validateKeyword(Q,!0);var X=Q.type;if(Array.isArray(X))for(var Y=0;Y<X.length;Y++)q(J,X[Y],Q);else q(J,X,Q);var K=Q.metaSchema;if(K){if(Q.$data&&this._opts.$data)K={anyOf:[K,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]};Q.validateSchema=this.compile(K,!0)}}Z.keywords[J]=Z.all[J]=!0;function q(G,z,U){var W;for(var F=0;F<Z.length;F++){var H=Z[F];if(H.type==z){W=H;break}}if(!W)W={type:z,rules:[]},Z.push(W);var B={keyword:G,definition:U,custom:!0,code:$R6,implements:U.implements};W.rules.push(B),Z.custom[G]=B}return this}function CR6(J){var Q=this.RULES.custom[J];return Q?Q.definition:this.RULES.keywords[J]||!1}function SR6(J){var Q=this.RULES;delete Q.keywords[J],delete Q.all[J],delete Q.custom[J];for(var Z=0;Z<Q.length;Z++){var X=Q[Z].rules;for(var Y=0;Y<X.length;Y++)if(X[Y].keyword==J){X.splice(Y,1);break}}return this}function eG1(J,Q){eG1.errors=null;var Z=this._validateKeyword=this._validateKeyword||this.compile(PR6,!0);if(Z(J))return!0;if(eG1.errors=Z.errors,Q)throw Error("custom keyword definition is invalid: "+this.errorsText(Z.errors));else return!1}});var _o1=e((kD9,vR6)=>{vR6.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var do1=e((_D9,po1)=>{var xo1=Hs1(),RN=Tc(),kR6=Ds1(),yo1=hG1(),_R6=cG1(),bR6=$s1(),xR6=Ao1(),fo1=Ro1(),ho1=jN();po1.exports=u4;u4.prototype.validate=fR6;u4.prototype.compile=hR6;u4.prototype.addSchema=gR6;u4.prototype.addMetaSchema=mR6;u4.prototype.validateSchema=uR6;u4.prototype.getSchema=dR6;u4.prototype.removeSchema=lR6;u4.prototype.addFormat=eR6;u4.prototype.errorsText=tR6;u4.prototype._addSchema=iR6;u4.prototype._compile=nR6;u4.prototype.compileAsync=Eo1();var fc=ko1();u4.prototype.addKeyword=fc.add;u4.prototype.getKeyword=fc.get;u4.prototype.removeKeyword=fc.remove;u4.prototype.validateKeyword=fc.validate;var go1=Cc();u4.ValidationError=go1.Validation;u4.MissingRefError=go1.MissingRef;u4.$dataMetaSchema=fo1;var yc="http://json-schema.org/draft-07/schema",bo1=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],yR6=["/properties"];function u4(J){if(!(this instanceof u4))return new u4(J);if(J=this._opts=ho1.copy(J)||{},Kw6(this),this._schemas={},this._refs={},this._fragments={},this._formats=bR6(J.format),this._cache=J.cache||new kR6,this._loadingSchemas={},this._compilations=[],this.RULES=xR6(),this._getId=aR6(J),J.loopRequired=J.loopRequired||1/0,J.errorDataPath=="property")J._errorDataPathProperty=!0;if(J.serialize===void 0)J.serialize=_R6;if(this._metaOpts=Yw6(this),J.formats)Zw6(this);if(J.keywords)Xw6(this);if(Jw6(this),typeof J.meta=="object")this.addMetaSchema(J.meta);if(J.nullable)this.addKeyword("nullable",{metaSchema:{type:"boolean"}});Qw6(this)}function fR6(J,Q){var Z;if(typeof J=="string"){if(Z=this.getSchema(J),!Z)throw Error('no schema with key or ref "'+J+'"')}else{var X=this._addSchema(J);Z=X.validate||this._compile(X)}var Y=Z(Q);if(Z.$async!==!0)this.errors=Z.errors;return Y}function hR6(J,Q){var Z=this._addSchema(J,void 0,Q);return Z.validate||this._compile(Z)}function gR6(J,Q,Z,X){if(Array.isArray(J)){for(var Y=0;Y<J.length;Y++)this.addSchema(J[Y],void 0,Z,X);return this}var K=this._getId(J);if(K!==void 0&&typeof K!="string")throw Error("schema id must be string");return Q=RN.normalizeId(Q||K),uo1(this,Q),this._schemas[Q]=this._addSchema(J,Z,X,!0),this}function mR6(J,Q,Z){return this.addSchema(J,Q,Z,!0),this}function uR6(J,Q){var Z=J.$schema;if(Z!==void 0&&typeof Z!="string")throw Error("$schema must be a string");if(Z=Z||this._opts.defaultMeta||pR6(this),!Z)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var X=this.validate(Z,J);if(!X&&Q){var Y="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(Y);else throw Error(Y)}return X}function pR6(J){var Q=J._opts.meta;return J._opts.defaultMeta=typeof Q=="object"?J._getId(Q)||Q:J.getSchema(yc)?yc:void 0,J._opts.defaultMeta}function dR6(J){var Q=mo1(this,J);switch(typeof Q){case"object":return Q.validate||this._compile(Q);case"string":return this.getSchema(Q);case"undefined":return cR6(this,J)}}function cR6(J,Q){var Z=RN.schema.call(J,{schema:{}},Q);if(Z){var{schema:X,root:Y,baseId:K}=Z,q=xo1.call(J,X,Y,void 0,K);return J._fragments[Q]=new yo1({ref:Q,fragment:!0,schema:X,root:Y,baseId:K,validate:q}),q}}function mo1(J,Q){return Q=RN.normalizeId(Q),J._schemas[Q]||J._refs[Q]||J._fragments[Q]}function lR6(J){if(J instanceof RegExp)return xc(this,this._schemas,J),xc(this,this._refs,J),this;switch(typeof J){case"undefined":return xc(this,this._schemas),xc(this,this._refs),this._cache.clear(),this;case"string":var Q=mo1(this,J);if(Q)this._cache.del(Q.cacheKey);return delete this._schemas[J],delete this._refs[J],this;case"object":var Z=this._opts.serialize,X=Z?Z(J):J;this._cache.del(X);var Y=this._getId(J);if(Y)Y=RN.normalizeId(Y),delete this._schemas[Y],delete this._refs[Y]}return this}function xc(J,Q,Z){for(var X in Q){var Y=Q[X];if(!Y.meta&&(!Z||Z.test(X)))J._cache.del(Y.cacheKey),delete Q[X]}}function iR6(J,Q,Z,X){if(typeof J!="object"&&typeof J!="boolean")throw Error("schema should be object or boolean");var Y=this._opts.serialize,K=Y?Y(J):J,q=this._cache.get(K);if(q)return q;X=X||this._opts.addUsedSchema!==!1;var G=RN.normalizeId(this._getId(J));if(G&&X)uo1(this,G);var z=this._opts.validateSchema!==!1&&!Q,U;if(z&&!(U=G&&G==RN.normalizeId(J.$schema)))this.validateSchema(J,!0);var W=RN.ids.call(this,J),F=new yo1({id:G,schema:J,localRefs:W,cacheKey:K,meta:Z});if(G[0]!="#"&&X)this._refs[G]=F;if(this._cache.put(K,F),z&&U)this.validateSchema(J,!0);return F}function nR6(J,Q){if(J.compiling){if(J.validate=Y,Y.schema=J.schema,Y.errors=null,Y.root=Q?Q:Y,J.schema.$async===!0)Y.$async=!0;return Y}J.compiling=!0;var Z;if(J.meta)Z=this._opts,this._opts=this._metaOpts;var X;try{X=xo1.call(this,J.schema,Q,J.localRefs)}catch(K){throw delete J.validate,K}finally{if(J.compiling=!1,J.meta)this._opts=Z}return J.validate=X,J.refs=X.refs,J.refVal=X.refVal,J.root=X.root,X;function Y(){var K=J.validate,q=K.apply(this,arguments);return Y.errors=K.errors,q}}function aR6(J){switch(J.schemaId){case"auto":return oR6;case"id":return rR6;default:return sR6}}function rR6(J){if(J.$id)this.logger.warn("schema $id ignored",J.$id);return J.id}function sR6(J){if(J.id)this.logger.warn("schema id ignored",J.id);return J.$id}function oR6(J){if(J.$id&&J.id&&J.$id!=J.id)throw Error("schema $id is different from id");return J.$id||J.id}function tR6(J,Q){if(J=J||this.errors,!J)return"No errors";Q=Q||{};var Z=Q.separator===void 0?", ":Q.separator,X=Q.dataVar===void 0?"data":Q.dataVar,Y="";for(var K=0;K<J.length;K++){var q=J[K];if(q)Y+=X+q.dataPath+" "+q.message+Z}return Y.slice(0,-Z.length)}function eR6(J,Q){if(typeof Q=="string")Q=new RegExp(Q);return this._formats[J]=Q,this}function Jw6(J){var Q;if(J._opts.$data)Q=_o1(),J.addMetaSchema(Q,Q.$id,!0);if(J._opts.meta===!1)return;var Z=tG1();if(J._opts.$data)Z=fo1(Z,yR6);J.addMetaSchema(Z,yc,!0),J._refs["http://json-schema.org/schema"]=yc}function Qw6(J){var Q=J._opts.schemas;if(!Q)return;if(Array.isArray(Q))J.addSchema(Q);else for(var Z in Q)J.addSchema(Q[Z],Z)}function Zw6(J){for(var Q in J._opts.formats){var Z=J._opts.formats[Q];J.addFormat(Q,Z)}}function Xw6(J){for(var Q in J._opts.keywords){var Z=J._opts.keywords[Q];J.addKeyword(Q,Z)}}function uo1(J,Q){if(J._schemas[Q]||J._refs[Q])throw Error('schema with key or id "'+Q+'" already exists')}function Yw6(J){var Q=ho1.copy(J._opts);for(var Z=0;Z<bo1.length;Z++)delete Q[bo1[Z]];return Q}function Kw6(J){var Q=J._opts.logger;if(Q===!1)J.logger={log:Jz1,warn:Jz1,error:Jz1};else{if(Q===void 0)Q=console;if(!(typeof Q=="object"&&Q.log&&Q.warn&&Q.error))throw Error("logger must implement log, warn and error methods");J.logger=Q}}function Jz1(){}});var co1,dS;var lo1=u(()=>{pr1();KW();co1=p6(do1(),1);dS=class dS extends SG1{constructor(J,Q){var Z;super(Q);this._clientInfo=J,this._cachedToolOutputValidators=new Map,this._capabilities=(Z=Q===null||Q===void 0?void 0:Q.capabilities)!==null&&Z!==void 0?Z:{},this._ajv=new co1.default}registerCapabilities(J){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=ur1(this._capabilities,J)}assertCapability(J,Q){var Z;if(!((Z=this._serverCapabilities)===null||Z===void 0?void 0:Z[J]))throw Error(`Server does not support ${J} (required for ${Q})`)}async connect(J,Q){if(await super.connect(J),J.sessionId!==void 0)return;try{let Z=await this.request({method:"initialize",params:{protocolVersion:KR,capabilities:this._capabilities,clientInfo:this._clientInfo}},DG1,Q);if(Z===void 0)throw Error(`Server sent invalid initialize result: ${Z}`);if(!wr1.includes(Z.protocolVersion))throw Error(`Server's protocol version is not supported: ${Z.protocolVersion}`);if(this._serverCapabilities=Z.capabilities,this._serverVersion=Z.serverInfo,J.setProtocolVersion)J.setProtocolVersion(Z.protocolVersion);this._instructions=Z.instructions,await this.notification({method:"notifications/initialized"})}catch(Z){throw this.close(),Z}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(J){var Q,Z,X,Y,K;switch(J){case"logging/setLevel":if(!((Q=this._serverCapabilities)===null||Q===void 0?void 0:Q.logging))throw Error(`Server does not support logging (required for ${J})`);break;case"prompts/get":case"prompts/list":if(!((Z=this._serverCapabilities)===null||Z===void 0?void 0:Z.prompts))throw Error(`Server does not support prompts (required for ${J})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!((X=this._serverCapabilities)===null||X===void 0?void 0:X.resources))throw Error(`Server does not support resources (required for ${J})`);if(J==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${J})`);break;case"tools/call":case"tools/list":if(!((Y=this._serverCapabilities)===null||Y===void 0?void 0:Y.tools))throw Error(`Server does not support tools (required for ${J})`);break;case"completion/complete":if(!((K=this._serverCapabilities)===null||K===void 0?void 0:K.completions))throw Error(`Server does not support completions (required for ${J})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(J){var Q;switch(J){case"notifications/roots/list_changed":if(!((Q=this._capabilities.roots)===null||Q===void 0?void 0:Q.listChanged))throw Error(`Client does not support roots list changed notifications (required for ${J})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(J){switch(J){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${J})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${J})`);break;case"roots/list":if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${J})`);break;case"ping":break}}async ping(J){return this.request({method:"ping"},ON,J)}async complete(J,Q){return this.request({method:"completion/complete",params:J},CG1,Q)}async setLoggingLevel(J,Q){return this.request({method:"logging/setLevel",params:{level:J}},ON,Q)}async getPrompt(J,Q){return this.request({method:"prompts/get",params:J},IG1,Q)}async listPrompts(J,Q){return this.request({method:"prompts/list",params:J},OG1,Q)}async listResources(J,Q){return this.request({method:"resources/list",params:J},VG1,Q)}async listResourceTemplates(J,Q){return this.request({method:"resources/templates/list",params:J},NG1,Q)}async readResource(J,Q){return this.request({method:"resources/read",params:J},LG1,Q)}async subscribeResource(J,Q){return this.request({method:"resources/subscribe",params:J},ON,Q)}async unsubscribeResource(J,Q){return this.request({method:"resources/unsubscribe",params:J},ON,Q)}async callTool(J,Q=Oc,Z){let X=await this.request({method:"tools/call",params:J},Q,Z),Y=this.getToolOutputValidator(J.name);if(Y){if(!X.structuredContent&&!X.isError)throw new rK(AY.InvalidRequest,`Tool ${J.name} has an output schema but did not return structured content`);if(X.structuredContent)try{if(!Y(X.structuredContent))throw new rK(AY.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(Y.errors)}`)}catch(K){if(K instanceof rK)throw K;throw new rK(AY.InvalidParams,`Failed to validate structured content: ${K instanceof Error?K.message:String(K)}`)}}return X}cacheToolOutputSchemas(J){this._cachedToolOutputValidators.clear();for(let Q of J)if(Q.outputSchema)try{let Z=this._ajv.compile(Q.outputSchema);this._cachedToolOutputValidators.set(Q.name,Z)}catch(Z){}}getToolOutputValidator(J){return this._cachedToolOutputValidators.get(J)}async listTools(J,Q){let Z=await this.request({method:"tools/list",params:J},$G1,Q);return this.cacheToolOutputSchemas(Z.tools),Z}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}});function Qz1(J){}function hc(J){if(typeof J=="function")throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:Q=Qz1,onError:Z=Qz1,onRetry:X=Qz1,onComment:Y}=J,K="",q=!0,G,z="",U="";function W(V){let N=q?V.replace(/^\xEF\xBB\xBF/,""):V,[L,A]=qw6(`${K}${N}`);for(let O of L)F(O);K=A,q=!1}function F(V){if(V===""){B();return}if(V.startsWith(":")){Y&&Y(V.slice(V.startsWith(": ")?2:1));return}let N=V.indexOf(":");if(N!==-1){let L=V.slice(0,N),A=V[N+1]===" "?2:1,O=V.slice(N+A);H(L,O,V);return}H(V,"",V)}function H(V,N,L){switch(V){case"event":U=N;break;case"data":z=`${z}${N}
45
+ `+Z)}function AN(J,Q,Z,X,Y,K){if(J.listenerCount("wsClientError")){let q=Error(Y);Error.captureStackTrace(q,AN),J.emit("wsClientError",q,Z,Q)}else yS(Z,X,Y,K)}});var GG1={};L6(GG1,{default:()=>SO6,createWebSocketStream:()=>Gr1.default,WebSocketServer:()=>Wr1.default,WebSocket:()=>fS.default,Sender:()=>Ur1.default,Receiver:()=>zr1.default});var Gr1,zr1,Ur1,fS,Wr1,SO6;var zG1=u(()=>{Gr1=p6(ea1(),1),zr1=p6(tq1(),1),Ur1=p6(JG1(),1),fS=p6(zc(),1),Wr1=p6(qr1(),1),SO6=fS.default});class Hr1{_status={};statusSubject=new I4(this._status);messageSubject=new I4(null);appendToPromptSubject=new I4(null);projectConfig;ws;id=1;reconnectTimeoutId;reconnectDelay=UG1;isReconnecting=!1;pendingRequests=new Map;diagnosticsCache=new Map;DIAGNOSTICS_TTL_MS=300000;get status(){return new Z0((J)=>{J.next(this._status);let Q=this.statusSubject.subscribe(J);return()=>Q.unsubscribe()})}sendStatus(J){this._status={...this._status,...J},this.statusSubject.next(this._status)}get messages(){return new Z0((J)=>{let Q=this.messageSubject.subscribe((Z)=>{if(Z!==null)J.next(Z)});return()=>Q.unsubscribe()})}get appendToPrompt(){return new Z0((J)=>{let Q=this.appendToPromptSubject.subscribe((Z)=>{if(Z!==null)J.next(Z)});return()=>Q.unsubscribe()})}emitMessage(J){this.messageSubject.next(J)}emitAppendToPrompt(J){this.appendToPromptSubject.next(J)}async start(J){this.projectConfig=J,this.sendStatus({enabled:!0}),await this.tryConnect(this.projectConfig)}sendRequest=(J,Q)=>{let Z=this.ws;if(!Z)return Promise.resolve(void 0);if(!this.isWsOpen())return Promise.reject(Error("WebSocket is not open"));return new Promise((X,Y)=>{let K=`${this.id++}`,q={clientRequest:{id:K,[J]:Q}},G=setTimeout(()=>{this.pendingRequests.delete(K),Y(Error(`Timeout after ${Fr1}ms for request ${JSON.stringify(q,null,2)}`))},Fr1);this.pendingRequests.set(K,{resolve:X,reject:Y,timeout:G,method:J}),Z.send(JSON.stringify(q))})};clearPendingRequests(){for(let[J,Q]of this.pendingRequests.entries())clearTimeout(Q.timeout),Q.reject(Error("WebSocket connection closed"));this.pendingRequests.clear()}handleResponse(J){if(!J?.id)return;let Q=this.pendingRequests.get(J.id);if(!Q)return;if(n.debug("Received response for request",{type:"response_received",source:"jetbrains",responseId:J?.id,hasError:!!J?.error}),clearTimeout(Q.timeout),this.pendingRequests.delete(J.id),J.error){Q.reject(Error(JSON.stringify(J.error)));return}let Z=J[Q.method];if(Z)Q.resolve(Z);else Q.reject(Error(`Invalid response for method ${Q.method}. Got ${JSON.stringify(J,null,2)}`))}async tryConnect(J){if(await this.isConnected()){n.debug("Already connected to JetBrains IDE",{type:"already_connected",source:"jetbrains"});return}if(this.clearReconnectTimeout(),this.ws?.close(),this.clearPendingRequests(),n.debug("ide-client",{config:J}),!J){this.sendStatus({connected:!1,authenticated:!1,openFile:void 0,selections:void 0,errorMessage:"IDE Not Connected"});return}n.info("Establishing connection to JetBrains IDE",{type:"establishing_connection",source:"jetbrains",ideName:J.ideName,port:J.port}),this.sendStatus({ideName:J.ideName});let Z=new(await _O6())(`ws://localhost:${J.port}?auth=${encodeURIComponent(J.authToken)}`);this.ws=Z,this.id=1,Z.onopen=async()=>{try{n.info("Connected to JetBrains IDE",{type:"connected",source:"jetbrains",ideName:J.ideName,port:J.port}),this.sendStatus({connected:!0,authenticated:!0,errorMessage:void 0}),this.reconnectDelay=UG1,this.isReconnecting=!1}catch(X){n.error("Error connecting to JetBrains IDE",X),this.sendStatus({connected:!1,authenticated:!1,openFile:void 0,selections:void 0,errorMessage:"IDE Not Connected"})}},Z.onclose=(X)=>{try{if(this.clearPendingRequests(),X.code===1000&&X.reason==="Authentication failed")this.sendStatus({connected:!1,authenticated:!1,openFile:void 0,selections:void 0,errorMessage:"IDE authentication failed - try restarting your IDE"});else n.warn("Disconnected from JetBrains IDE",{code:X.code,reason:X.reason}),this.sendStatus({connected:!1,authenticated:!1,openFile:void 0,selections:void 0,errorMessage:"IDE Not Connected"});this.ws=void 0,this.scheduleReconnect()}catch(Y){n.error("Error handling disconnect",Y)}},Z.onerror=(X)=>{n.error("WebSocket error from JetBrains IDE",X),this.clearPendingRequests()},Z.onmessage=async(X)=>{let Y=X.data.toString();try{let K=xn1.safeParse(JSON.parse(Y));if(K.error){n.error("Failed to parse server message",C0.prettifyError(K.error));return}if(K.data?.serverResponse)this.handleResponse(K.data.serverResponse);this.handleNotification(K.data?.serverNotification)}catch(K){n.error("Error handling server message",{error:K,data:Y})}}}clearReconnectTimeout(){if(this.reconnectTimeoutId)clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=void 0}scheduleReconnect(){if(this.isReconnecting)return;this.isReconnecting=!0,n.info("Scheduling reconnect",{delayMs:this.reconnectDelay,type:"reconnect_scheduled",source:"jetbrains"}),this.reconnectTimeoutId=setTimeout(()=>{this.executeReconnectAttempt().catch((J)=>{n.error("Reconnect timer task failed",J)})},this.reconnectDelay)}async executeReconnectAttempt(){let J=!1;try{let Q=this.projectConfig;if(Q){try{await this.tryConnect(Q)}catch(Z){n.error("Reconnection attempt failed",Z)}J=await this.isConnected()}else n.debug("No project config available during reconnect; will retry")}catch(Q){n.error("Reconnect loop error",Q)}finally{if(this.isReconnecting=!1,!J)this.reconnectDelay=Math.min(this.reconnectDelay*kO6,vO6),this.scheduleReconnect();else this.reconnectDelay=UG1}}isWsOpen(){return this.ws?.readyState===1}async isConnected(){if(!this._status.authenticated)return!1;if(!this.isWsOpen())return!1;try{return(await this.sendRequest("ping",{message:"beepboop"}))?.message==="beepboop"}catch(J){return n.debug("JetBrains isConnected ping failed",{error:J}),!1}}getDiagnosticsForPath(J){this.cleanupExpiredDiagnostics();let Q=K8(P0.file(J)),Z=this.diagnosticsCache.get(Q);if(Z)return Z.diagnostics;let X=[],Y=P0.file(J);for(let[K,q]of this.diagnosticsCache.entries()){let G=P0.parse(K);if(p0.hasPrefix(G,Y))X.push(...q.diagnostics)}return X}convertJetBrainsDiagnostics(J,Q){return J.map((Z)=>({message:Z.description,severity:this.convertJetBrainsSeverity(Z.severity),source:"JetBrains",uri:Q,range:{type:"full",start:{line:Z.range.startLine,character:Z.range.startCharacter},end:{line:Z.range.endLine,character:Z.range.endCharacter}}}))}convertJetBrainsSeverity(J){switch(J.toLowerCase()){case"error":return"error";case"warning":return"warning";case"information":case"info":return"info";case"hint":return"hint";default:return"info"}}cleanupExpiredDiagnostics(){let J=Date.now(),Q=[];for(let[Z,X]of this.diagnosticsCache.entries())if(J-X.timestamp>this.DIAGNOSTICS_TTL_MS)Q.push(Z);for(let Z of Q)this.diagnosticsCache.delete(Z);if(Q.length>0)n.debug("Cleaned up expired diagnostics cache",{expired:Q.length})}handleNotification(J){if(!J)return;if(J.selectionDidChange)this.sendStatus({selections:J.selectionDidChange.selections,openFile:J.selectionDidChange.uri});else if(J.visibleFilesDidChange)this.sendStatus({visibleFiles:J.visibleFilesDidChange.uris});else if(J.pluginMetadata)this.sendStatus({pluginVersion:J.pluginMetadata.version,pluginDirectory:J.pluginMetadata.pluginDirectory});else if(J.diagnosticsDidChange){let Q=J.diagnosticsDidChange.uri,Z=J.diagnosticsDidChange.diagnostics,X=this.convertJetBrainsDiagnostics(Z,Q);this.diagnosticsCache.set(Q,{diagnostics:X,timestamp:Date.now()});let Y=Z.slice(0,2).map((K)=>`L${K.range.startLine+1}: ${K.description.slice(0,40)}...`);n.debug("[<-] DIAGNOSTICS RECEIVED FROM JETBRAINS",{type:"diagnostics_received",source:"jetbrains",file:Q.split("/").pop()||Q,count:Z.length,samples:Y})}else if(J.userSentMessage)this.handleMessageFromIDE(J.userSentMessage.message);else if(J.appendToPrompt)this.handleAppendToPrompt(J.appendToPrompt.message)}async handleMessageFromIDE(J){n.debug("Received message from IDE",{message:J.slice(0,100)}),this.emitMessage(J)}handleAppendToPrompt(J){n.debug("Received appendToPrompt from IDE",{text:J.slice(0,100)}),this.emitAppendToPrompt(J)}selectConfig(J){this.projectConfig=J}getSelectedConfig(){return this.projectConfig}}async function _O6(){if(typeof WebSocket<"u")return WebSocket;let{default:J}=await Promise.resolve().then(() => (zG1(),GG1));return J}var Fr1=2000,UG1=1000,vO6=30000,kO6=2,SJ;var ZR=u(()=>{a6();b0();aj();D0();yq1();SJ=new Hr1});import{homedir as WG1}from"node:os";import XR from"node:path";var Br1,bO6,Dr1,xO6,Mr1,yO6,YR,FG1;var hS=u(()=>{nV();Br1=XR.join(WG1(),".local/share"),bO6=process.platform==="win32"||process.platform==="darwin"?Br1:dH??Br1,Dr1=XR.join(WG1(),".config"),xO6=process.platform==="win32"||process.platform==="darwin"?Dr1:cH??Dr1,Mr1=XR.join(bO6,"amp"),yO6=XR.join(xO6,"amp"),YR=XR.join(yO6,"tools"),FG1=XR.join(WG1(),".cache","amp")});import Wc from"node:fs";import Vr1 from"node:path";async function Fc(J){let Q=await Ar1(),Z=await Promise.all(Q.map((z)=>Or1(z))),X=[];for(let z of Z){if(!z)continue;if(Nr1(z.pid))X.push(z)}let Y=X;if(J?.jetbrainsOnly)Y=X.filter((z)=>{let U=z.ideName.toLowerCase();return U.includes("intellij")||U.includes("webstorm")||U.includes("pycharm")||U.includes("goland")||U.includes("phpstorm")||U.includes("rubymine")||U.includes("clion")||U.includes("rider")||U.includes("datagrip")||U.includes("appcode")||U.includes("android studio")||U.includes("fleet")});let K=process.platform==="win32"?process.cwd().replaceAll("\\","/"):process.cwd(),q=fO6(Y,K),G=q.exact.length>0?q.exact:q.prefix;if(G.length===1)return G;return[...q.exact,...q.prefix,...q.other]}function Nr1(J){if(J<=0)return!1;try{return process.kill(J,0),!0}catch(Q){let Z=Q?.code;if(Z==="ESRCH")return!1;if(Z==="EPERM"||Z==="EACCES")return!0;return n.debug("PID check error",{pid:J,code:Z}),!1}}async function Lr1(){let J=await Ar1();for(let Q of J){let Z=await Or1(Q);if(!Z||!Nr1(Z.pid))try{await Wc.promises.unlink(Q)}catch(X){n.debug("Failed to remove orphaned lockfile",{path:Q,error:X instanceof Error?X.message:String(X)})}}}async function Ar1(){await Wc.promises.mkdir(HG1,{recursive:!0});let J=[];for(let Q of await Wc.promises.readdir(HG1,{withFileTypes:!0}))if(Q.isFile()&&Q.name.endsWith(".json")){let Z=Vr1.join(HG1,Q.name);J.push(Z)}return J}async function Or1(J){try{let Q=await Wc.promises.readFile(J,"utf-8"),Z=yn1.safeParse(JSON.parse(Q));if(Z.success)return Z.data;else n.debug("Invalid IDE config file",{file:J,errors:Z.error.issues})}catch(Q){n.debug("Unreadable IDE config file",{file:J,error:Q instanceof Error?Q.message:String(Q)})}return}function fO6(J,Q){let Z=[],X=[],Y=[];for(let K of J)if(K.workspaceFolders.includes(Q))Z.push(K);else if(K.workspaceFolders.some((q)=>Q.startsWith(q)))X.push(K);else Y.push(K);return{exact:Z,prefix:X,other:Y}}var HG1;var BG1=u(()=>{hS();D0();yq1();HG1=Vr1.join(Mr1,"ide")});var jr1=100;var Rr1=()=>{};var KR="2025-06-18",wr1,Hc="2.0",Ir1,Er1,hO6,OY,FZ,gS,iG,jY,Bc,$r1,Dc=(J)=>$r1.safeParse(J).success,Pr1,Tr1=(J)=>Pr1.safeParse(J).success,Cr1,mS=(J)=>Cr1.safeParse(J).success,AY,Sr1,vr1=(J)=>Sr1.safeParse(J).success,zB,ON,Mc,uS,kr1,gO6,mO6,uO6,DG1,_r1,br1=(J)=>_r1.safeParse(J).success,Vc,pO6,Nc,Lc,Ac,xr1,yr1,MG1,fr1,hr1,dO6,cO6,VG1,lO6,NG1,iO6,LG1,AG1,nO6,aO6,rO6,sO6,oO6,tO6,OG1,eO6,jG1,RG1,wG1,Jj6,Qj6,gr1,Zj6,IG1,EG1,Xj6,Yj6,Kj6,$G1,Oc,_B9,qj6,PG1,mr1,Gj6,zj6,Uj6,Wj6,Fj6,TG1,Hj6,Bj6,Dj6,Mj6,Vj6,Nj6,Lj6,Aj6,Oj6,jj6,Rj6,CG1,wj6,Ij6,Ej6,$j6,bB9,xB9,yB9,fB9,hB9,gB9,rK;var KW=u(()=>{fG();wr1=[KR,"2025-03-26","2024-11-05","2024-10-07"],Ir1=J1.union([J1.string(),J1.number().int()]),Er1=J1.string(),hO6=J1.object({progressToken:J1.optional(Ir1)}).passthrough(),OY=J1.object({_meta:J1.optional(hO6)}).passthrough(),FZ=J1.object({method:J1.string(),params:J1.optional(OY)}),gS=J1.object({_meta:J1.optional(J1.object({}).passthrough())}).passthrough(),iG=J1.object({method:J1.string(),params:J1.optional(gS)}),jY=J1.object({_meta:J1.optional(J1.object({}).passthrough())}).passthrough(),Bc=J1.union([J1.string(),J1.number().int()]),$r1=J1.object({jsonrpc:J1.literal(Hc),id:Bc}).merge(FZ).strict(),Pr1=J1.object({jsonrpc:J1.literal(Hc)}).merge(iG).strict(),Cr1=J1.object({jsonrpc:J1.literal(Hc),id:Bc,result:jY}).strict();(function(J){J[J.ConnectionClosed=-32000]="ConnectionClosed",J[J.RequestTimeout=-32001]="RequestTimeout",J[J.ParseError=-32700]="ParseError",J[J.InvalidRequest=-32600]="InvalidRequest",J[J.MethodNotFound=-32601]="MethodNotFound",J[J.InvalidParams=-32602]="InvalidParams",J[J.InternalError=-32603]="InternalError"})(AY||(AY={}));Sr1=J1.object({jsonrpc:J1.literal(Hc),id:Bc,error:J1.object({code:J1.number().int(),message:J1.string(),data:J1.optional(J1.unknown())})}).strict(),zB=J1.union([$r1,Pr1,Cr1,Sr1]),ON=jY.strict(),Mc=iG.extend({method:J1.literal("notifications/cancelled"),params:gS.extend({requestId:Bc,reason:J1.string().optional()})}),uS=J1.object({name:J1.string(),title:J1.optional(J1.string())}).passthrough(),kr1=uS.extend({version:J1.string()}),gO6=J1.object({experimental:J1.optional(J1.object({}).passthrough()),sampling:J1.optional(J1.object({}).passthrough()),elicitation:J1.optional(J1.object({}).passthrough()),roots:J1.optional(J1.object({listChanged:J1.optional(J1.boolean())}).passthrough())}).passthrough(),mO6=FZ.extend({method:J1.literal("initialize"),params:OY.extend({protocolVersion:J1.string(),capabilities:gO6,clientInfo:kr1})}),uO6=J1.object({experimental:J1.optional(J1.object({}).passthrough()),logging:J1.optional(J1.object({}).passthrough()),completions:J1.optional(J1.object({}).passthrough()),prompts:J1.optional(J1.object({listChanged:J1.optional(J1.boolean())}).passthrough()),resources:J1.optional(J1.object({subscribe:J1.optional(J1.boolean()),listChanged:J1.optional(J1.boolean())}).passthrough()),tools:J1.optional(J1.object({listChanged:J1.optional(J1.boolean())}).passthrough())}).passthrough(),DG1=jY.extend({protocolVersion:J1.string(),capabilities:uO6,serverInfo:kr1,instructions:J1.optional(J1.string())}),_r1=iG.extend({method:J1.literal("notifications/initialized")}),Vc=FZ.extend({method:J1.literal("ping")}),pO6=J1.object({progress:J1.number(),total:J1.optional(J1.number()),message:J1.optional(J1.string())}).passthrough(),Nc=iG.extend({method:J1.literal("notifications/progress"),params:gS.merge(pO6).extend({progressToken:Ir1})}),Lc=FZ.extend({params:OY.extend({cursor:J1.optional(Er1)}).optional()}),Ac=jY.extend({nextCursor:J1.optional(Er1)}),xr1=J1.object({uri:J1.string(),mimeType:J1.optional(J1.string()),_meta:J1.optional(J1.object({}).passthrough())}).passthrough(),yr1=xr1.extend({text:J1.string()}),MG1=J1.string().refine((J)=>{try{return atob(J),!0}catch(Q){return!1}},{message:"Invalid Base64 string"}),fr1=xr1.extend({blob:MG1}),hr1=uS.extend({uri:J1.string(),description:J1.optional(J1.string()),mimeType:J1.optional(J1.string()),_meta:J1.optional(J1.object({}).passthrough())}),dO6=uS.extend({uriTemplate:J1.string(),description:J1.optional(J1.string()),mimeType:J1.optional(J1.string()),_meta:J1.optional(J1.object({}).passthrough())}),cO6=Lc.extend({method:J1.literal("resources/list")}),VG1=Ac.extend({resources:J1.array(hr1)}),lO6=Lc.extend({method:J1.literal("resources/templates/list")}),NG1=Ac.extend({resourceTemplates:J1.array(dO6)}),iO6=FZ.extend({method:J1.literal("resources/read"),params:OY.extend({uri:J1.string()})}),LG1=jY.extend({contents:J1.array(J1.union([yr1,fr1]))}),AG1=iG.extend({method:J1.literal("notifications/resources/list_changed")}),nO6=FZ.extend({method:J1.literal("resources/subscribe"),params:OY.extend({uri:J1.string()})}),aO6=FZ.extend({method:J1.literal("resources/unsubscribe"),params:OY.extend({uri:J1.string()})}),rO6=iG.extend({method:J1.literal("notifications/resources/updated"),params:gS.extend({uri:J1.string()})}),sO6=J1.object({name:J1.string(),description:J1.optional(J1.string()),required:J1.optional(J1.boolean())}).passthrough(),oO6=uS.extend({description:J1.optional(J1.string()),arguments:J1.optional(J1.array(sO6)),_meta:J1.optional(J1.object({}).passthrough())}),tO6=Lc.extend({method:J1.literal("prompts/list")}),OG1=Ac.extend({prompts:J1.array(oO6)}),eO6=FZ.extend({method:J1.literal("prompts/get"),params:OY.extend({name:J1.string(),arguments:J1.optional(J1.record(J1.string()))})}),jG1=J1.object({type:J1.literal("text"),text:J1.string(),_meta:J1.optional(J1.object({}).passthrough())}).passthrough(),RG1=J1.object({type:J1.literal("image"),data:MG1,mimeType:J1.string(),_meta:J1.optional(J1.object({}).passthrough())}).passthrough(),wG1=J1.object({type:J1.literal("audio"),data:MG1,mimeType:J1.string(),_meta:J1.optional(J1.object({}).passthrough())}).passthrough(),Jj6=J1.object({type:J1.literal("resource"),resource:J1.union([yr1,fr1]),_meta:J1.optional(J1.object({}).passthrough())}).passthrough(),Qj6=hr1.extend({type:J1.literal("resource_link")}),gr1=J1.union([jG1,RG1,wG1,Qj6,Jj6]),Zj6=J1.object({role:J1.enum(["user","assistant"]),content:gr1}).passthrough(),IG1=jY.extend({description:J1.optional(J1.string()),messages:J1.array(Zj6)}),EG1=iG.extend({method:J1.literal("notifications/prompts/list_changed")}),Xj6=J1.object({title:J1.optional(J1.string()),readOnlyHint:J1.optional(J1.boolean()),destructiveHint:J1.optional(J1.boolean()),idempotentHint:J1.optional(J1.boolean()),openWorldHint:J1.optional(J1.boolean())}).passthrough(),Yj6=uS.extend({description:J1.optional(J1.string()),inputSchema:J1.object({type:J1.literal("object"),properties:J1.optional(J1.object({}).passthrough()),required:J1.optional(J1.array(J1.string()))}).passthrough(),outputSchema:J1.optional(J1.object({type:J1.literal("object"),properties:J1.optional(J1.object({}).passthrough()),required:J1.optional(J1.array(J1.string()))}).passthrough()),annotations:J1.optional(Xj6),_meta:J1.optional(J1.object({}).passthrough())}),Kj6=Lc.extend({method:J1.literal("tools/list")}),$G1=Ac.extend({tools:J1.array(Yj6)}),Oc=jY.extend({content:J1.array(gr1).default([]),structuredContent:J1.object({}).passthrough().optional(),isError:J1.optional(J1.boolean())}),_B9=Oc.or(jY.extend({toolResult:J1.unknown()})),qj6=FZ.extend({method:J1.literal("tools/call"),params:OY.extend({name:J1.string(),arguments:J1.optional(J1.record(J1.unknown()))})}),PG1=iG.extend({method:J1.literal("notifications/tools/list_changed")}),mr1=J1.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Gj6=FZ.extend({method:J1.literal("logging/setLevel"),params:OY.extend({level:mr1})}),zj6=iG.extend({method:J1.literal("notifications/message"),params:gS.extend({level:mr1,logger:J1.optional(J1.string()),data:J1.unknown()})}),Uj6=J1.object({name:J1.string().optional()}).passthrough(),Wj6=J1.object({hints:J1.optional(J1.array(Uj6)),costPriority:J1.optional(J1.number().min(0).max(1)),speedPriority:J1.optional(J1.number().min(0).max(1)),intelligencePriority:J1.optional(J1.number().min(0).max(1))}).passthrough(),Fj6=J1.object({role:J1.enum(["user","assistant"]),content:J1.union([jG1,RG1,wG1])}).passthrough(),TG1=FZ.extend({method:J1.literal("sampling/createMessage"),params:OY.extend({messages:J1.array(Fj6),systemPrompt:J1.optional(J1.string()),includeContext:J1.optional(J1.enum(["none","thisServer","allServers"])),temperature:J1.optional(J1.number()),maxTokens:J1.number().int(),stopSequences:J1.optional(J1.array(J1.string())),metadata:J1.optional(J1.object({}).passthrough()),modelPreferences:J1.optional(Wj6)})}),Hj6=jY.extend({model:J1.string(),stopReason:J1.optional(J1.enum(["endTurn","stopSequence","maxTokens"]).or(J1.string())),role:J1.enum(["user","assistant"]),content:J1.discriminatedUnion("type",[jG1,RG1,wG1])}),Bj6=J1.object({type:J1.literal("boolean"),title:J1.optional(J1.string()),description:J1.optional(J1.string()),default:J1.optional(J1.boolean())}).passthrough(),Dj6=J1.object({type:J1.literal("string"),title:J1.optional(J1.string()),description:J1.optional(J1.string()),minLength:J1.optional(J1.number()),maxLength:J1.optional(J1.number()),format:J1.optional(J1.enum(["email","uri","date","date-time"]))}).passthrough(),Mj6=J1.object({type:J1.enum(["number","integer"]),title:J1.optional(J1.string()),description:J1.optional(J1.string()),minimum:J1.optional(J1.number()),maximum:J1.optional(J1.number())}).passthrough(),Vj6=J1.object({type:J1.literal("string"),title:J1.optional(J1.string()),description:J1.optional(J1.string()),enum:J1.array(J1.string()),enumNames:J1.optional(J1.array(J1.string()))}).passthrough(),Nj6=J1.union([Bj6,Dj6,Mj6,Vj6]),Lj6=FZ.extend({method:J1.literal("elicitation/create"),params:OY.extend({message:J1.string(),requestedSchema:J1.object({type:J1.literal("object"),properties:J1.record(J1.string(),Nj6),required:J1.optional(J1.array(J1.string()))}).passthrough()})}),Aj6=jY.extend({action:J1.enum(["accept","decline","cancel"]),content:J1.optional(J1.record(J1.string(),J1.unknown()))}),Oj6=J1.object({type:J1.literal("ref/resource"),uri:J1.string()}).passthrough(),jj6=J1.object({type:J1.literal("ref/prompt"),name:J1.string()}).passthrough(),Rj6=FZ.extend({method:J1.literal("completion/complete"),params:OY.extend({ref:J1.union([jj6,Oj6]),argument:J1.object({name:J1.string(),value:J1.string()}).passthrough(),context:J1.optional(J1.object({arguments:J1.optional(J1.record(J1.string(),J1.string()))}))})}),CG1=jY.extend({completion:J1.object({values:J1.array(J1.string()).max(100),total:J1.optional(J1.number().int()),hasMore:J1.optional(J1.boolean())}).passthrough()}),wj6=J1.object({uri:J1.string().startsWith("file://"),name:J1.optional(J1.string()),_meta:J1.optional(J1.object({}).passthrough())}).passthrough(),Ij6=FZ.extend({method:J1.literal("roots/list")}),Ej6=jY.extend({roots:J1.array(wj6)}),$j6=iG.extend({method:J1.literal("notifications/roots/list_changed")}),bB9=J1.union([Vc,mO6,Rj6,Gj6,eO6,tO6,cO6,lO6,iO6,nO6,aO6,qj6,Kj6]),xB9=J1.union([Mc,Nc,_r1,$j6]),yB9=J1.union([ON,Hj6,Aj6,Ej6]),fB9=J1.union([Vc,TG1,Lj6,Ij6]),hB9=J1.union([Mc,Nc,zj6,rO6,AG1,PG1,EG1]),gB9=J1.union([ON,DG1,CG1,IG1,OG1,VG1,NG1,LG1,Oc,$G1]);rK=class rK extends Error{constructor(J,Q,Z){super(`MCP error ${J}: ${Q}`);this.code=J,this.data=Z,this.name="McpError"}}});class SG1{constructor(J){this._options=J,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(Mc,(Q)=>{let Z=this._requestHandlerAbortControllers.get(Q.params.requestId);Z===null||Z===void 0||Z.abort(Q.params.reason)}),this.setNotificationHandler(Nc,(Q)=>{this._onprogress(Q)}),this.setRequestHandler(Vc,(Q)=>({}))}_setupTimeout(J,Q,Z,X,Y=!1){this._timeoutInfo.set(J,{timeoutId:setTimeout(X,Q),startTime:Date.now(),timeout:Q,maxTotalTimeout:Z,resetTimeoutOnProgress:Y,onTimeout:X})}_resetTimeout(J){let Q=this._timeoutInfo.get(J);if(!Q)return!1;let Z=Date.now()-Q.startTime;if(Q.maxTotalTimeout&&Z>=Q.maxTotalTimeout)throw this._timeoutInfo.delete(J),new rK(AY.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:Q.maxTotalTimeout,totalElapsed:Z});return clearTimeout(Q.timeoutId),Q.timeoutId=setTimeout(Q.onTimeout,Q.timeout),!0}_cleanupTimeout(J){let Q=this._timeoutInfo.get(J);if(Q)clearTimeout(Q.timeoutId),this._timeoutInfo.delete(J)}async connect(J){var Q,Z,X;this._transport=J;let Y=(Q=this.transport)===null||Q===void 0?void 0:Q.onclose;this._transport.onclose=()=>{Y===null||Y===void 0||Y(),this._onclose()};let K=(Z=this.transport)===null||Z===void 0?void 0:Z.onerror;this._transport.onerror=(G)=>{K===null||K===void 0||K(G),this._onerror(G)};let q=(X=this._transport)===null||X===void 0?void 0:X.onmessage;this._transport.onmessage=(G,z)=>{if(q===null||q===void 0||q(G,z),mS(G)||vr1(G))this._onresponse(G);else if(Dc(G))this._onrequest(G,z);else if(Tr1(G))this._onnotification(G);else this._onerror(Error(`Unknown message type: ${JSON.stringify(G)}`))},await this._transport.start()}_onclose(){var J;let Q=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(J=this.onclose)===null||J===void 0||J.call(this);let Z=new rK(AY.ConnectionClosed,"Connection closed");for(let X of Q.values())X(Z)}_onerror(J){var Q;(Q=this.onerror)===null||Q===void 0||Q.call(this,J)}_onnotification(J){var Q;let Z=(Q=this._notificationHandlers.get(J.method))!==null&&Q!==void 0?Q:this.fallbackNotificationHandler;if(Z===void 0)return;Promise.resolve().then(()=>Z(J)).catch((X)=>this._onerror(Error(`Uncaught error in notification handler: ${X}`)))}_onrequest(J,Q){var Z,X;let Y=(Z=this._requestHandlers.get(J.method))!==null&&Z!==void 0?Z:this.fallbackRequestHandler,K=this._transport;if(Y===void 0){K===null||K===void 0||K.send({jsonrpc:"2.0",id:J.id,error:{code:AY.MethodNotFound,message:"Method not found"}}).catch((z)=>this._onerror(Error(`Failed to send an error response: ${z}`)));return}let q=new AbortController;this._requestHandlerAbortControllers.set(J.id,q);let G={signal:q.signal,sessionId:K===null||K===void 0?void 0:K.sessionId,_meta:(X=J.params)===null||X===void 0?void 0:X._meta,sendNotification:(z)=>this.notification(z,{relatedRequestId:J.id}),sendRequest:(z,U,W)=>this.request(z,U,{...W,relatedRequestId:J.id}),authInfo:Q===null||Q===void 0?void 0:Q.authInfo,requestId:J.id,requestInfo:Q===null||Q===void 0?void 0:Q.requestInfo};Promise.resolve().then(()=>Y(J,G)).then((z)=>{if(q.signal.aborted)return;return K===null||K===void 0?void 0:K.send({result:z,jsonrpc:"2.0",id:J.id})},(z)=>{var U;if(q.signal.aborted)return;return K===null||K===void 0?void 0:K.send({jsonrpc:"2.0",id:J.id,error:{code:Number.isSafeInteger(z.code)?z.code:AY.InternalError,message:(U=z.message)!==null&&U!==void 0?U:"Internal error"}})}).catch((z)=>this._onerror(Error(`Failed to send response: ${z}`))).finally(()=>{this._requestHandlerAbortControllers.delete(J.id)})}_onprogress(J){let{progressToken:Q,...Z}=J.params,X=Number(Q),Y=this._progressHandlers.get(X);if(!Y){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(J)}`));return}let K=this._responseHandlers.get(X),q=this._timeoutInfo.get(X);if(q&&K&&q.resetTimeoutOnProgress)try{this._resetTimeout(X)}catch(G){K(G);return}Y(Z)}_onresponse(J){let Q=Number(J.id),Z=this._responseHandlers.get(Q);if(Z===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(J)}`));return}if(this._responseHandlers.delete(Q),this._progressHandlers.delete(Q),this._cleanupTimeout(Q),mS(J))Z(J);else{let X=new rK(J.error.code,J.error.message,J.error.data);Z(X)}}get transport(){return this._transport}async close(){var J;await((J=this._transport)===null||J===void 0?void 0:J.close())}request(J,Q,Z){let{relatedRequestId:X,resumptionToken:Y,onresumptiontoken:K}=Z!==null&&Z!==void 0?Z:{};return new Promise((q,G)=>{var z,U,W,F,H,B;if(!this._transport){G(Error("Not connected"));return}if(((z=this._options)===null||z===void 0?void 0:z.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod(J.method);(U=Z===null||Z===void 0?void 0:Z.signal)===null||U===void 0||U.throwIfAborted();let M=this._requestMessageId++,V={...J,jsonrpc:"2.0",id:M};if(Z===null||Z===void 0?void 0:Z.onprogress)this._progressHandlers.set(M,Z.onprogress),V.params={...J.params,_meta:{...((W=J.params)===null||W===void 0?void 0:W._meta)||{},progressToken:M}};let N=(O)=>{var j;this._responseHandlers.delete(M),this._progressHandlers.delete(M),this._cleanupTimeout(M),(j=this._transport)===null||j===void 0||j.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:M,reason:String(O)}},{relatedRequestId:X,resumptionToken:Y,onresumptiontoken:K}).catch((R)=>this._onerror(Error(`Failed to send cancellation: ${R}`))),G(O)};this._responseHandlers.set(M,(O)=>{var j;if((j=Z===null||Z===void 0?void 0:Z.signal)===null||j===void 0?void 0:j.aborted)return;if(O instanceof Error)return G(O);try{let R=Q.parse(O.result);q(R)}catch(R){G(R)}}),(F=Z===null||Z===void 0?void 0:Z.signal)===null||F===void 0||F.addEventListener("abort",()=>{var O;N((O=Z===null||Z===void 0?void 0:Z.signal)===null||O===void 0?void 0:O.reason)});let L=(H=Z===null||Z===void 0?void 0:Z.timeout)!==null&&H!==void 0?H:Pj6,A=()=>N(new rK(AY.RequestTimeout,"Request timed out",{timeout:L}));this._setupTimeout(M,L,Z===null||Z===void 0?void 0:Z.maxTotalTimeout,A,(B=Z===null||Z===void 0?void 0:Z.resetTimeoutOnProgress)!==null&&B!==void 0?B:!1),this._transport.send(V,{relatedRequestId:X,resumptionToken:Y,onresumptiontoken:K}).catch((O)=>{this._cleanupTimeout(M),G(O)})})}async notification(J,Q){var Z,X;if(!this._transport)throw Error("Not connected");if(this.assertNotificationCapability(J.method),((X=(Z=this._options)===null||Z===void 0?void 0:Z.debouncedNotificationMethods)!==null&&X!==void 0?X:[]).includes(J.method)&&!J.params&&!(Q===null||Q===void 0?void 0:Q.relatedRequestId)){if(this._pendingDebouncedNotifications.has(J.method))return;this._pendingDebouncedNotifications.add(J.method),Promise.resolve().then(()=>{var G;if(this._pendingDebouncedNotifications.delete(J.method),!this._transport)return;let z={...J,jsonrpc:"2.0"};(G=this._transport)===null||G===void 0||G.send(z,Q).catch((U)=>this._onerror(U))});return}let q={...J,jsonrpc:"2.0"};await this._transport.send(q,Q)}setRequestHandler(J,Q){let Z=J.shape.method.value;this.assertRequestHandlerCapability(Z),this._requestHandlers.set(Z,(X,Y)=>{return Promise.resolve(Q(J.parse(X),Y))})}removeRequestHandler(J){this._requestHandlers.delete(J)}assertCanSetRequestHandler(J){if(this._requestHandlers.has(J))throw Error(`A request handler for ${J} already exists, which would be overridden`)}setNotificationHandler(J,Q){this._notificationHandlers.set(J.shape.method.value,(Z)=>Promise.resolve(Q(J.parse(Z))))}removeNotificationHandler(J){this._notificationHandlers.delete(J)}}function ur1(J,Q){return Object.entries(Q).reduce((Z,[X,Y])=>{if(Y&&typeof Y==="object")Z[X]=Z[X]?{...Z[X],...Y}:Y;else Z[X]=Y;return Z},{...J})}var Pj6=60000;var pr1=u(()=>{KW()});var cr1=e((jc,dr1)=>{(function(J,Q){typeof jc==="object"&&typeof dr1<"u"?Q(jc):typeof define==="function"&&define.amd?define(["exports"],Q):Q(J.URI=J.URI||{})})(jc,function(J){function Q(){for(var S1=arguments.length,A1=Array(S1),P1=0;P1<S1;P1++)A1[P1]=arguments[P1];if(A1.length>1){A1[0]=A1[0].slice(0,-1);var c1=A1.length-1;for(var b1=1;b1<c1;++b1)A1[b1]=A1[b1].slice(1,-1);return A1[c1]=A1[c1].slice(1),A1.join("")}else return A1[0]}function Z(S1){return"(?:"+S1+")"}function X(S1){return S1===void 0?"undefined":S1===null?"null":Object.prototype.toString.call(S1).split(" ").pop().split("]").shift().toLowerCase()}function Y(S1){return S1.toUpperCase()}function K(S1){return S1!==void 0&&S1!==null?S1 instanceof Array?S1:typeof S1.length!=="number"||S1.split||S1.setInterval||S1.call?[S1]:Array.prototype.slice.call(S1):[]}function q(S1,A1){var P1=S1;if(A1)for(var c1 in A1)P1[c1]=A1[c1];return P1}function G(S1){var A1="[A-Za-z]",P1="[\\x0D]",c1="[0-9]",b1="[\\x22]",A0=Q(c1,"[A-Fa-f]"),F0="[\\x0A]",h6="[\\x20]",w6=Z(Z("%[EFef]"+A0+"%"+A0+A0+"%"+A0+A0)+"|"+Z("%[89A-Fa-f]"+A0+"%"+A0+A0)+"|"+Z("%"+A0+A0)),g6="[\\:\\/\\?\\#\\[\\]\\@]",W6="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Y8=Q(g6,W6),k0=S1?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",y1=S1?"[\\uE000-\\uF8FF]":"[]",q0=Q(A1,c1,"[\\-\\.\\_\\~]",k0),$0=Z(A1+Q(A1,c1,"[\\+\\-\\.]")+"*"),F6=Z(Z(w6+"|"+Q(q0,W6,"[\\:]"))+"*"),o8=Z(Z("25[0-5]")+"|"+Z("2[0-4]"+c1)+"|"+Z("1"+c1+c1)+"|"+Z("[1-9]"+c1)+"|"+c1),c8=Z(Z("25[0-5]")+"|"+Z("2[0-4]"+c1)+"|"+Z("1"+c1+c1)+"|"+Z("0?[1-9]"+c1)+"|0?0?"+c1),k8=Z(c8+"\\."+c8+"\\."+c8+"\\."+c8),H8=Z(A0+"{1,4}"),A9=Z(Z(H8+"\\:"+H8)+"|"+k8),n8=Z(Z(H8+"\\:")+"{6}"+A9),V2=Z("\\:\\:"+Z(H8+"\\:")+"{5}"+A9),X6=Z(Z(H8)+"?\\:\\:"+Z(H8+"\\:")+"{4}"+A9),u0=Z(Z(Z(H8+"\\:")+"{0,1}"+H8)+"?\\:\\:"+Z(H8+"\\:")+"{3}"+A9),f0=Z(Z(Z(H8+"\\:")+"{0,2}"+H8)+"?\\:\\:"+Z(H8+"\\:")+"{2}"+A9),B0=Z(Z(Z(H8+"\\:")+"{0,3}"+H8)+"?\\:\\:"+H8+"\\:"+A9),a8=Z(Z(Z(H8+"\\:")+"{0,4}"+H8)+"?\\:\\:"+A9),$1=Z(Z(Z(H8+"\\:")+"{0,5}"+H8)+"?\\:\\:"+H8),XZ=Z(Z(Z(H8+"\\:")+"{0,6}"+H8)+"?\\:\\:"),v1=Z([n8,V2,X6,u0,f0,B0,a8,$1,XZ].join("|")),P2=Z(Z(q0+"|"+w6)+"+"),sO=Z(v1+"\\%25"+P2),CG=Z(v1+Z("\\%25|\\%(?!"+A0+"{2})")+P2),t51=Z("[vV]"+A0+"+\\."+Q(q0,W6,"[\\:]")+"+"),iu=Z("\\["+Z(CG+"|"+v1+"|"+t51)+"\\]"),nu=Z(Z(w6+"|"+Q(q0,W6))+"*"),B4=Z(iu+"|"+k8+"(?!"+nu+")|"+nu),zX=Z(c1+"*"),oO=Z(Z(F6+"@")+"?"+B4+Z("\\:"+zX)+"?"),gU=Z(w6+"|"+Q(q0,W6,"[\\:\\@]")),e51=Z(gU+"*"),au=Z(gU+"+"),ru=Z(Z(w6+"|"+Q(q0,W6,"[\\@]"))+"+"),e2=Z(Z("\\/"+e51)+"*"),SG=Z("\\/"+Z(au+e2)+"?"),hK=Z(ru+e2),r5=Z(au+e2),xV="(?!"+gU+")",su=Z(e2+"|"+SG+"|"+hK+"|"+r5+"|"+xV),UX=Z(Z(gU+"|"+Q("[\\/\\?]",y1))+"*"),vG=Z(Z(gU+"|[\\/\\?]")+"*"),BY=Z(Z("\\/\\/"+oO+e2)+"|"+SG+"|"+r5+"|"+xV),ou=Z($0+"\\:"+BY+Z("\\?"+UX)+"?"+Z("\\#"+vG)+"?"),tO=Z(Z("\\/\\/"+oO+e2)+"|"+SG+"|"+hK+"|"+xV),XC=Z(tO+Z("\\?"+UX)+"?"+Z("\\#"+vG)+"?"),WX=Z(ou+"|"+XC),sK9=Z($0+"\\:"+BY+Z("\\?"+UX)+"?"),oK9="^("+$0+")\\:"+Z(Z("\\/\\/("+Z("("+F6+")@")+"?("+B4+")"+Z("\\:("+zX+")")+"?)")+"?("+e2+"|"+SG+"|"+r5+"|"+xV+")")+Z("\\?("+UX+")")+"?"+Z("\\#("+vG+")")+"?$",tK9="^(){0}"+Z(Z("\\/\\/("+Z("("+F6+")@")+"?("+B4+")"+Z("\\:("+zX+")")+"?)")+"?("+e2+"|"+SG+"|"+hK+"|"+xV+")")+Z("\\?("+UX+")")+"?"+Z("\\#("+vG+")")+"?$",eK9="^("+$0+")\\:"+Z(Z("\\/\\/("+Z("("+F6+")@")+"?("+B4+")"+Z("\\:("+zX+")")+"?)")+"?("+e2+"|"+SG+"|"+r5+"|"+xV+")")+Z("\\?("+UX+")")+"?$",Jq9="^"+Z("\\#("+vG+")")+"?$",Qq9="^"+Z("("+F6+")@")+"?("+B4+")"+Z("\\:("+zX+")")+"?$";return{NOT_SCHEME:new RegExp(Q("[^]",A1,c1,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(Q("[^\\%\\:]",q0,W6),"g"),NOT_HOST:new RegExp(Q("[^\\%\\[\\]\\:]",q0,W6),"g"),NOT_PATH:new RegExp(Q("[^\\%\\/\\:\\@]",q0,W6),"g"),NOT_PATH_NOSCHEME:new RegExp(Q("[^\\%\\/\\@]",q0,W6),"g"),NOT_QUERY:new RegExp(Q("[^\\%]",q0,W6,"[\\:\\@\\/\\?]",y1),"g"),NOT_FRAGMENT:new RegExp(Q("[^\\%]",q0,W6,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(Q("[^]",q0,W6),"g"),UNRESERVED:new RegExp(q0,"g"),OTHER_CHARS:new RegExp(Q("[^\\%]",q0,Y8),"g"),PCT_ENCODED:new RegExp(w6,"g"),IPV4ADDRESS:new RegExp("^("+k8+")$"),IPV6ADDRESS:new RegExp("^\\[?("+v1+")"+Z(Z("\\%25|\\%(?!"+A0+"{2})")+"("+P2+")")+"?\\]?$")}}var z=G(!1),U=G(!0),W=function(){function S1(A1,P1){var c1=[],b1=!0,A0=!1,F0=void 0;try{for(var h6=A1[Symbol.iterator](),w6;!(b1=(w6=h6.next()).done);b1=!0)if(c1.push(w6.value),P1&&c1.length===P1)break}catch(g6){A0=!0,F0=g6}finally{try{if(!b1&&h6.return)h6.return()}finally{if(A0)throw F0}}return c1}return function(A1,P1){if(Array.isArray(A1))return A1;else if(Symbol.iterator in Object(A1))return S1(A1,P1);else throw TypeError("Invalid attempt to destructure non-iterable instance")}}(),F=function(S1){if(Array.isArray(S1)){for(var A1=0,P1=Array(S1.length);A1<S1.length;A1++)P1[A1]=S1[A1];return P1}else return Array.from(S1)},H=2147483647,B=36,M=1,V=26,N=38,L=700,A=72,O=128,j="-",R=/^xn--/,I=/[^\0-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,E={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$=B-M,P=Math.floor,C=String.fromCharCode;function k(S1){throw RangeError(E[S1])}function g(S1,A1){var P1=[],c1=S1.length;while(c1--)P1[c1]=A1(S1[c1]);return P1}function T(S1,A1){var P1=S1.split("@"),c1="";if(P1.length>1)c1=P1[0]+"@",S1=P1[1];S1=S1.replace(w,".");var b1=S1.split("."),A0=g(b1,A1).join(".");return c1+A0}function v(S1){var A1=[],P1=0,c1=S1.length;while(P1<c1){var b1=S1.charCodeAt(P1++);if(b1>=55296&&b1<=56319&&P1<c1){var A0=S1.charCodeAt(P1++);if((A0&64512)==56320)A1.push(((b1&1023)<<10)+(A0&1023)+65536);else A1.push(b1),P1--}else A1.push(b1)}return A1}var f=function(A1){return String.fromCodePoint.apply(String,F(A1))},h=function(A1){if(A1-48<10)return A1-22;if(A1-65<26)return A1-65;if(A1-97<26)return A1-97;return B},S=function(A1,P1){return A1+22+75*(A1<26)-((P1!=0)<<5)},x=function(A1,P1,c1){var b1=0;A1=c1?P(A1/L):A1>>1,A1+=P(A1/P1);for(;A1>$*V>>1;b1+=B)A1=P(A1/$);return P(b1+($+1)*A1/(A1+N))},b=function(A1){var P1=[],c1=A1.length,b1=0,A0=O,F0=A,h6=A1.lastIndexOf(j);if(h6<0)h6=0;for(var w6=0;w6<h6;++w6){if(A1.charCodeAt(w6)>=128)k("not-basic");P1.push(A1.charCodeAt(w6))}for(var g6=h6>0?h6+1:0;g6<c1;){var W6=b1;for(var Y8=1,k0=B;;k0+=B){if(g6>=c1)k("invalid-input");var y1=h(A1.charCodeAt(g6++));if(y1>=B||y1>P((H-b1)/Y8))k("overflow");b1+=y1*Y8;var q0=k0<=F0?M:k0>=F0+V?V:k0-F0;if(y1<q0)break;var $0=B-q0;if(Y8>P(H/$0))k("overflow");Y8*=$0}var F6=P1.length+1;if(F0=x(b1-W6,F6,W6==0),P(b1/F6)>H-A0)k("overflow");A0+=P(b1/F6),b1%=F6,P1.splice(b1++,0,A0)}return String.fromCodePoint.apply(String,P1)},m=function(A1){var P1=[];A1=v(A1);var c1=A1.length,b1=O,A0=0,F0=A,h6=!0,w6=!1,g6=void 0;try{for(var W6=A1[Symbol.iterator](),Y8;!(h6=(Y8=W6.next()).done);h6=!0){var k0=Y8.value;if(k0<128)P1.push(C(k0))}}catch(CG){w6=!0,g6=CG}finally{try{if(!h6&&W6.return)W6.return()}finally{if(w6)throw g6}}var y1=P1.length,q0=y1;if(y1)P1.push(j);while(q0<c1){var $0=H,F6=!0,o8=!1,c8=void 0;try{for(var k8=A1[Symbol.iterator](),H8;!(F6=(H8=k8.next()).done);F6=!0){var A9=H8.value;if(A9>=b1&&A9<$0)$0=A9}}catch(CG){o8=!0,c8=CG}finally{try{if(!F6&&k8.return)k8.return()}finally{if(o8)throw c8}}var n8=q0+1;if($0-b1>P((H-A0)/n8))k("overflow");A0+=($0-b1)*n8,b1=$0;var V2=!0,X6=!1,u0=void 0;try{for(var f0=A1[Symbol.iterator](),B0;!(V2=(B0=f0.next()).done);V2=!0){var a8=B0.value;if(a8<b1&&++A0>H)k("overflow");if(a8==b1){var $1=A0;for(var XZ=B;;XZ+=B){var v1=XZ<=F0?M:XZ>=F0+V?V:XZ-F0;if($1<v1)break;var P2=$1-v1,sO=B-v1;P1.push(C(S(v1+P2%sO,0))),$1=P(P2/sO)}P1.push(C(S($1,0))),F0=x(A0,n8,q0==y1),A0=0,++q0}}}catch(CG){X6=!0,u0=CG}finally{try{if(!V2&&f0.return)f0.return()}finally{if(X6)throw u0}}++A0,++b1}return P1.join("")},a=function(A1){return T(A1,function(P1){return R.test(P1)?b(P1.slice(4).toLowerCase()):P1})},p=function(A1){return T(A1,function(P1){return I.test(P1)?"xn--"+m(P1):P1})},Q1={version:"2.1.0",ucs2:{decode:v,encode:f},decode:b,encode:m,toASCII:p,toUnicode:a},z1={};function F1(S1){var A1=S1.charCodeAt(0),P1=void 0;if(A1<16)P1="%0"+A1.toString(16).toUpperCase();else if(A1<128)P1="%"+A1.toString(16).toUpperCase();else if(A1<2048)P1="%"+(A1>>6|192).toString(16).toUpperCase()+"%"+(A1&63|128).toString(16).toUpperCase();else P1="%"+(A1>>12|224).toString(16).toUpperCase()+"%"+(A1>>6&63|128).toString(16).toUpperCase()+"%"+(A1&63|128).toString(16).toUpperCase();return P1}function X1(S1){var A1="",P1=0,c1=S1.length;while(P1<c1){var b1=parseInt(S1.substr(P1+1,2),16);if(b1<128)A1+=String.fromCharCode(b1),P1+=3;else if(b1>=194&&b1<224){if(c1-P1>=6){var A0=parseInt(S1.substr(P1+4,2),16);A1+=String.fromCharCode((b1&31)<<6|A0&63)}else A1+=S1.substr(P1,6);P1+=6}else if(b1>=224){if(c1-P1>=9){var F0=parseInt(S1.substr(P1+4,2),16),h6=parseInt(S1.substr(P1+7,2),16);A1+=String.fromCharCode((b1&15)<<12|(F0&63)<<6|h6&63)}else A1+=S1.substr(P1,9);P1+=9}else A1+=S1.substr(P1,3),P1+=3}return A1}function H1(S1,A1){function P1(c1){var b1=X1(c1);return!b1.match(A1.UNRESERVED)?c1:b1}if(S1.scheme)S1.scheme=String(S1.scheme).replace(A1.PCT_ENCODED,P1).toLowerCase().replace(A1.NOT_SCHEME,"");if(S1.userinfo!==void 0)S1.userinfo=String(S1.userinfo).replace(A1.PCT_ENCODED,P1).replace(A1.NOT_USERINFO,F1).replace(A1.PCT_ENCODED,Y);if(S1.host!==void 0)S1.host=String(S1.host).replace(A1.PCT_ENCODED,P1).toLowerCase().replace(A1.NOT_HOST,F1).replace(A1.PCT_ENCODED,Y);if(S1.path!==void 0)S1.path=String(S1.path).replace(A1.PCT_ENCODED,P1).replace(S1.scheme?A1.NOT_PATH:A1.NOT_PATH_NOSCHEME,F1).replace(A1.PCT_ENCODED,Y);if(S1.query!==void 0)S1.query=String(S1.query).replace(A1.PCT_ENCODED,P1).replace(A1.NOT_QUERY,F1).replace(A1.PCT_ENCODED,Y);if(S1.fragment!==void 0)S1.fragment=String(S1.fragment).replace(A1.PCT_ENCODED,P1).replace(A1.NOT_FRAGMENT,F1).replace(A1.PCT_ENCODED,Y);return S1}function l(S1){return S1.replace(/^0*(.*)/,"$1")||"0"}function d(S1,A1){var P1=S1.match(A1.IPV4ADDRESS)||[],c1=W(P1,2),b1=c1[1];if(b1)return b1.split(".").map(l).join(".");else return S1}function i(S1,A1){var P1=S1.match(A1.IPV6ADDRESS)||[],c1=W(P1,3),b1=c1[1],A0=c1[2];if(b1){var F0=b1.toLowerCase().split("::").reverse(),h6=W(F0,2),w6=h6[0],g6=h6[1],W6=g6?g6.split(":").map(l):[],Y8=w6.split(":").map(l),k0=A1.IPV4ADDRESS.test(Y8[Y8.length-1]),y1=k0?7:8,q0=Y8.length-y1,$0=Array(y1);for(var F6=0;F6<y1;++F6)$0[F6]=W6[F6]||Y8[q0+F6]||"";if(k0)$0[y1-1]=d($0[y1-1],A1);var o8=$0.reduce(function(n8,V2,X6){if(!V2||V2==="0"){var u0=n8[n8.length-1];if(u0&&u0.index+u0.length===X6)u0.length++;else n8.push({index:X6,length:1})}return n8},[]),c8=o8.sort(function(n8,V2){return V2.length-n8.length})[0],k8=void 0;if(c8&&c8.length>1){var H8=$0.slice(0,c8.index),A9=$0.slice(c8.index+c8.length);k8=H8.join(":")+"::"+A9.join(":")}else k8=$0.join(":");if(A0)k8+="%"+A0;return k8}else return S1}var r=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,o="".match(/(){0}/)[1]===void 0;function K1(S1){var A1=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P1={},c1=A1.iri!==!1?U:z;if(A1.reference==="suffix")S1=(A1.scheme?A1.scheme+":":"")+"//"+S1;var b1=S1.match(r);if(b1){if(o){if(P1.scheme=b1[1],P1.userinfo=b1[3],P1.host=b1[4],P1.port=parseInt(b1[5],10),P1.path=b1[6]||"",P1.query=b1[7],P1.fragment=b1[8],isNaN(P1.port))P1.port=b1[5]}else if(P1.scheme=b1[1]||void 0,P1.userinfo=S1.indexOf("@")!==-1?b1[3]:void 0,P1.host=S1.indexOf("//")!==-1?b1[4]:void 0,P1.port=parseInt(b1[5],10),P1.path=b1[6]||"",P1.query=S1.indexOf("?")!==-1?b1[7]:void 0,P1.fragment=S1.indexOf("#")!==-1?b1[8]:void 0,isNaN(P1.port))P1.port=S1.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?b1[4]:void 0;if(P1.host)P1.host=i(d(P1.host,c1),c1);if(P1.scheme===void 0&&P1.userinfo===void 0&&P1.host===void 0&&P1.port===void 0&&!P1.path&&P1.query===void 0)P1.reference="same-document";else if(P1.scheme===void 0)P1.reference="relative";else if(P1.fragment===void 0)P1.reference="absolute";else P1.reference="uri";if(A1.reference&&A1.reference!=="suffix"&&A1.reference!==P1.reference)P1.error=P1.error||"URI is not a "+A1.reference+" reference.";var A0=z1[(A1.scheme||P1.scheme||"").toLowerCase()];if(!A1.unicodeSupport&&(!A0||!A0.unicodeSupport)){if(P1.host&&(A1.domainHost||A0&&A0.domainHost))try{P1.host=Q1.toASCII(P1.host.replace(c1.PCT_ENCODED,X1).toLowerCase())}catch(F0){P1.error=P1.error||"Host's domain name can not be converted to ASCII via punycode: "+F0}H1(P1,z)}else H1(P1,c1);if(A0&&A0.parse)A0.parse(P1,A1)}else P1.error=P1.error||"URI can not be parsed.";return P1}function Z1(S1,A1){var P1=A1.iri!==!1?U:z,c1=[];if(S1.userinfo!==void 0)c1.push(S1.userinfo),c1.push("@");if(S1.host!==void 0)c1.push(i(d(String(S1.host),P1),P1).replace(P1.IPV6ADDRESS,function(b1,A0,F0){return"["+A0+(F0?"%25"+F0:"")+"]"}));if(typeof S1.port==="number"||typeof S1.port==="string")c1.push(":"),c1.push(String(S1.port));return c1.length?c1.join(""):void 0}var B1=/^\.\.?\//,U1=/^\/\.(\/|$)/,W1=/^\/\.\.(\/|$)/,j1=/^\/?(?:.|\n)*?(?=\/|$)/;function D1(S1){var A1=[];while(S1.length)if(S1.match(B1))S1=S1.replace(B1,"");else if(S1.match(U1))S1=S1.replace(U1,"/");else if(S1.match(W1))S1=S1.replace(W1,"/"),A1.pop();else if(S1==="."||S1==="..")S1="";else{var P1=S1.match(j1);if(P1){var c1=P1[0];S1=S1.slice(c1.length),A1.push(c1)}else throw Error("Unexpected dot segment condition")}return A1.join("")}function d1(S1){var A1=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P1=A1.iri?U:z,c1=[],b1=z1[(A1.scheme||S1.scheme||"").toLowerCase()];if(b1&&b1.serialize)b1.serialize(S1,A1);if(S1.host){if(P1.IPV6ADDRESS.test(S1.host));else if(A1.domainHost||b1&&b1.domainHost)try{S1.host=!A1.iri?Q1.toASCII(S1.host.replace(P1.PCT_ENCODED,X1).toLowerCase()):Q1.toUnicode(S1.host)}catch(h6){S1.error=S1.error||"Host's domain name can not be converted to "+(!A1.iri?"ASCII":"Unicode")+" via punycode: "+h6}}if(H1(S1,P1),A1.reference!=="suffix"&&S1.scheme)c1.push(S1.scheme),c1.push(":");var A0=Z1(S1,A1);if(A0!==void 0){if(A1.reference!=="suffix")c1.push("//");if(c1.push(A0),S1.path&&S1.path.charAt(0)!=="/")c1.push("/")}if(S1.path!==void 0){var F0=S1.path;if(!A1.absolutePath&&(!b1||!b1.absolutePath))F0=D1(F0);if(A0===void 0)F0=F0.replace(/^\/\//,"/%2F");c1.push(F0)}if(S1.query!==void 0)c1.push("?"),c1.push(S1.query);if(S1.fragment!==void 0)c1.push("#"),c1.push(S1.fragment);return c1.join("")}function n1(S1,A1){var P1=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},c1=arguments[3],b1={};if(!c1)S1=K1(d1(S1,P1),P1),A1=K1(d1(A1,P1),P1);if(P1=P1||{},!P1.tolerant&&A1.scheme)b1.scheme=A1.scheme,b1.userinfo=A1.userinfo,b1.host=A1.host,b1.port=A1.port,b1.path=D1(A1.path||""),b1.query=A1.query;else{if(A1.userinfo!==void 0||A1.host!==void 0||A1.port!==void 0)b1.userinfo=A1.userinfo,b1.host=A1.host,b1.port=A1.port,b1.path=D1(A1.path||""),b1.query=A1.query;else{if(!A1.path)if(b1.path=S1.path,A1.query!==void 0)b1.query=A1.query;else b1.query=S1.query;else{if(A1.path.charAt(0)==="/")b1.path=D1(A1.path);else{if((S1.userinfo!==void 0||S1.host!==void 0||S1.port!==void 0)&&!S1.path)b1.path="/"+A1.path;else if(!S1.path)b1.path=A1.path;else b1.path=S1.path.slice(0,S1.path.lastIndexOf("/")+1)+A1.path;b1.path=D1(b1.path)}b1.query=A1.query}b1.userinfo=S1.userinfo,b1.host=S1.host,b1.port=S1.port}b1.scheme=S1.scheme}return b1.fragment=A1.fragment,b1}function r1(S1,A1,P1){var c1=q({scheme:"null"},P1);return d1(n1(K1(S1,c1),K1(A1,c1),c1,!0),c1)}function u1(S1,A1){if(typeof S1==="string")S1=d1(K1(S1,A1),A1);else if(X(S1)==="object")S1=K1(d1(S1,A1),A1);return S1}function a1(S1,A1,P1){if(typeof S1==="string")S1=d1(K1(S1,P1),P1);else if(X(S1)==="object")S1=d1(S1,P1);if(typeof A1==="string")A1=d1(K1(A1,P1),P1);else if(X(A1)==="object")A1=d1(A1,P1);return S1===A1}function V1(S1,A1){return S1&&S1.toString().replace(!A1||!A1.iri?z.ESCAPE:U.ESCAPE,F1)}function t(S1,A1){return S1&&S1.toString().replace(!A1||!A1.iri?z.PCT_ENCODED:U.PCT_ENCODED,X1)}var O1={scheme:"http",domainHost:!0,parse:function(A1,P1){if(!A1.host)A1.error=A1.error||"HTTP URIs must have a host.";return A1},serialize:function(A1,P1){var c1=String(A1.scheme).toLowerCase()==="https";if(A1.port===(c1?443:80)||A1.port==="")A1.port=void 0;if(!A1.path)A1.path="/";return A1}},M1={scheme:"https",domainHost:O1.domainHost,parse:O1.parse,serialize:O1.serialize};function w1(S1){return typeof S1.secure==="boolean"?S1.secure:String(S1.scheme).toLowerCase()==="wss"}var Y1={scheme:"ws",domainHost:!0,parse:function(A1,P1){var c1=A1;return c1.secure=w1(c1),c1.resourceName=(c1.path||"/")+(c1.query?"?"+c1.query:""),c1.path=void 0,c1.query=void 0,c1},serialize:function(A1,P1){if(A1.port===(w1(A1)?443:80)||A1.port==="")A1.port=void 0;if(typeof A1.secure==="boolean")A1.scheme=A1.secure?"wss":"ws",A1.secure=void 0;if(A1.resourceName){var c1=A1.resourceName.split("?"),b1=W(c1,2),A0=b1[0],F0=b1[1];A1.path=A0&&A0!=="/"?A0:void 0,A1.query=F0,A1.resourceName=void 0}return A1.fragment=void 0,A1}},T1={scheme:"wss",domainHost:Y1.domainHost,parse:Y1.parse,serialize:Y1.serialize},G1={},I1=!0,E1="[A-Za-z0-9\\-\\.\\_\\~"+(I1?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",_1="[0-9A-Fa-f]",x1=Z(Z("%[EFef]"+_1+"%"+_1+_1+"%"+_1+_1)+"|"+Z("%[89A-Fa-f]"+_1+"%"+_1+_1)+"|"+Z("%"+_1+_1)),p1="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",z0="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",m1=Q(z0,"[\\\"\\\\]"),L0="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",I0=new RegExp(E1,"g"),V0=new RegExp(x1,"g"),g0=new RegExp(Q("[^]",p1,"[\\.]","[\\\"]",m1),"g"),R0=new RegExp(Q("[^]",E1,L0),"g"),O0=R0;function U0(S1){var A1=X1(S1);return!A1.match(I0)?S1:A1}var y0={scheme:"mailto",parse:function(A1,P1){var c1=A1,b1=c1.to=c1.path?c1.path.split(","):[];if(c1.path=void 0,c1.query){var A0=!1,F0={},h6=c1.query.split("&");for(var w6=0,g6=h6.length;w6<g6;++w6){var W6=h6[w6].split("=");switch(W6[0]){case"to":var Y8=W6[1].split(",");for(var k0=0,y1=Y8.length;k0<y1;++k0)b1.push(Y8[k0]);break;case"subject":c1.subject=t(W6[1],P1);break;case"body":c1.body=t(W6[1],P1);break;default:A0=!0,F0[t(W6[0],P1)]=t(W6[1],P1);break}}if(A0)c1.headers=F0}c1.query=void 0;for(var q0=0,$0=b1.length;q0<$0;++q0){var F6=b1[q0].split("@");if(F6[0]=t(F6[0]),!P1.unicodeSupport)try{F6[1]=Q1.toASCII(t(F6[1],P1).toLowerCase())}catch(o8){c1.error=c1.error||"Email address's domain name can not be converted to ASCII via punycode: "+o8}else F6[1]=t(F6[1],P1).toLowerCase();b1[q0]=F6.join("@")}return c1},serialize:function(A1,P1){var c1=A1,b1=K(A1.to);if(b1){for(var A0=0,F0=b1.length;A0<F0;++A0){var h6=String(b1[A0]),w6=h6.lastIndexOf("@"),g6=h6.slice(0,w6).replace(V0,U0).replace(V0,Y).replace(g0,F1),W6=h6.slice(w6+1);try{W6=!P1.iri?Q1.toASCII(t(W6,P1).toLowerCase()):Q1.toUnicode(W6)}catch(q0){c1.error=c1.error||"Email address's domain name can not be converted to "+(!P1.iri?"ASCII":"Unicode")+" via punycode: "+q0}b1[A0]=g6+"@"+W6}c1.path=b1.join(",")}var Y8=A1.headers=A1.headers||{};if(A1.subject)Y8.subject=A1.subject;if(A1.body)Y8.body=A1.body;var k0=[];for(var y1 in Y8)if(Y8[y1]!==G1[y1])k0.push(y1.replace(V0,U0).replace(V0,Y).replace(R0,F1)+"="+Y8[y1].replace(V0,U0).replace(V0,Y).replace(O0,F1));if(k0.length)c1.query=k0.join("&");return c1}},m0=/^([^\:]+)\:(.*)/,N0={scheme:"urn",parse:function(A1,P1){var c1=A1.path&&A1.path.match(m0),b1=A1;if(c1){var A0=P1.scheme||b1.scheme||"urn",F0=c1[1].toLowerCase(),h6=c1[2],w6=A0+":"+(P1.nid||F0),g6=z1[w6];if(b1.nid=F0,b1.nss=h6,b1.path=void 0,g6)b1=g6.parse(b1,P1)}else b1.error=b1.error||"URN can not be parsed.";return b1},serialize:function(A1,P1){var c1=P1.scheme||A1.scheme||"urn",b1=A1.nid,A0=c1+":"+(P1.nid||b1),F0=z1[A0];if(F0)A1=F0.serialize(A1,P1);var h6=A1,w6=A1.nss;return h6.path=(b1||P1.nid)+":"+w6,h6}},e0=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,c0={scheme:"urn:uuid",parse:function(A1,P1){var c1=A1;if(c1.uuid=c1.nss,c1.nss=void 0,!P1.tolerant&&(!c1.uuid||!c1.uuid.match(e0)))c1.error=c1.error||"UUID is not valid.";return c1},serialize:function(A1,P1){var c1=A1;return c1.nss=(A1.uuid||"").toLowerCase(),c1}};z1[O1.scheme]=O1,z1[M1.scheme]=M1,z1[Y1.scheme]=Y1,z1[T1.scheme]=T1,z1[y0.scheme]=y0,z1[N0.scheme]=N0,z1[c0.scheme]=c0,J.SCHEMES=z1,J.pctEncChar=F1,J.pctDecChars=X1,J.parse=K1,J.removeDotSegments=D1,J.serialize=d1,J.resolveComponents=n1,J.resolve=r1,J.normalize=u1,J.equal=a1,J.escapeComponent=V1,J.unescapeComponent=t,Object.defineProperty(J,"__esModule",{value:!0})})});var qR=e((dB9,lr1)=>{lr1.exports=function J(Q,Z){if(Q===Z)return!0;if(Q&&Z&&typeof Q=="object"&&typeof Z=="object"){if(Q.constructor!==Z.constructor)return!1;var X,Y,K;if(Array.isArray(Q)){if(X=Q.length,X!=Z.length)return!1;for(Y=X;Y--!==0;)if(!J(Q[Y],Z[Y]))return!1;return!0}if(Q.constructor===RegExp)return Q.source===Z.source&&Q.flags===Z.flags;if(Q.valueOf!==Object.prototype.valueOf)return Q.valueOf()===Z.valueOf();if(Q.toString!==Object.prototype.toString)return Q.toString()===Z.toString();if(K=Object.keys(Q),X=K.length,X!==Object.keys(Z).length)return!1;for(Y=X;Y--!==0;)if(!Object.prototype.hasOwnProperty.call(Z,K[Y]))return!1;for(Y=X;Y--!==0;){var q=K[Y];if(!J(Q[q],Z[q]))return!1}return!0}return Q!==Q&&Z!==Z}});var nr1=e((cB9,ir1)=>{ir1.exports=function(Q){var Z=0,X=Q.length,Y=0,K;while(Y<X)if(Z++,K=Q.charCodeAt(Y++),K>=55296&&K<=56319&&Y<X){if(K=Q.charCodeAt(Y),(K&64512)==56320)Y++}return Z}});var jN=e((lB9,sr1)=>{sr1.exports={copy:Tj6,checkDataType:vG1,checkDataTypes:Cj6,coerceToTypes:Sj6,toHash:_G1,getProperty:bG1,escapeQuotes:xG1,equal:qR(),ucs2length:nr1(),varOccurences:_j6,varReplace:bj6,schemaHasRules:xj6,schemaHasRulesExcept:yj6,schemaUnknownRules:fj6,toQuotedString:kG1,getPathExpr:hj6,getPath:gj6,getData:pj6,unescapeFragment:dj6,unescapeJsonPointer:fG1,escapeFragment:cj6,escapeJsonPointer:yG1};function Tj6(J,Q){Q=Q||{};for(var Z in J)Q[Z]=J[Z];return Q}function vG1(J,Q,Z,X){var Y=X?" !== ":" === ",K=X?" || ":" && ",q=X?"!":"",G=X?"":"!";switch(J){case"null":return Q+Y+"null";case"array":return q+"Array.isArray("+Q+")";case"object":return"("+q+Q+K+"typeof "+Q+Y+'"object"'+K+G+"Array.isArray("+Q+"))";case"integer":return"(typeof "+Q+Y+'"number"'+K+G+"("+Q+" % 1)"+K+Q+Y+Q+(Z?K+q+"isFinite("+Q+")":"")+")";case"number":return"(typeof "+Q+Y+'"'+J+'"'+(Z?K+q+"isFinite("+Q+")":"")+")";default:return"typeof "+Q+Y+'"'+J+'"'}}function Cj6(J,Q,Z){switch(J.length){case 1:return vG1(J[0],Q,Z,!0);default:var X="",Y=_G1(J);if(Y.array&&Y.object)X=Y.null?"(":"(!"+Q+" || ",X+="typeof "+Q+' !== "object")',delete Y.null,delete Y.array,delete Y.object;if(Y.number)delete Y.integer;for(var K in Y)X+=(X?" && ":"")+vG1(K,Q,Z,!0);return X}}var ar1=_G1(["string","number","integer","boolean","null"]);function Sj6(J,Q){if(Array.isArray(Q)){var Z=[];for(var X=0;X<Q.length;X++){var Y=Q[X];if(ar1[Y])Z[Z.length]=Y;else if(J==="array"&&Y==="array")Z[Z.length]=Y}if(Z.length)return Z}else if(ar1[Q])return[Q];else if(J==="array"&&Q==="array")return["array"]}function _G1(J){var Q={};for(var Z=0;Z<J.length;Z++)Q[J[Z]]=!0;return Q}var vj6=/^[a-z$_][a-z$_0-9]*$/i,kj6=/'|\\/g;function bG1(J){return typeof J=="number"?"["+J+"]":vj6.test(J)?"."+J:"['"+xG1(J)+"']"}function xG1(J){return J.replace(kj6,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function _j6(J,Q){Q+="[^0-9]";var Z=J.match(new RegExp(Q,"g"));return Z?Z.length:0}function bj6(J,Q,Z){return Q+="([^0-9])",Z=Z.replace(/\$/g,"$$$$"),J.replace(new RegExp(Q,"g"),Z+"$1")}function xj6(J,Q){if(typeof J=="boolean")return!J;for(var Z in J)if(Q[Z])return!0}function yj6(J,Q,Z){if(typeof J=="boolean")return!J&&Z!="not";for(var X in J)if(X!=Z&&Q[X])return!0}function fj6(J,Q){if(typeof J=="boolean")return;for(var Z in J)if(!Q[Z])return Z}function kG1(J){return"'"+xG1(J)+"'"}function hj6(J,Q,Z,X){var Y=Z?"'/' + "+Q+(X?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):X?"'[' + "+Q+" + ']'":"'[\\'' + "+Q+" + '\\']'";return rr1(J,Y)}function gj6(J,Q,Z){var X=Z?kG1("/"+yG1(Q)):kG1(bG1(Q));return rr1(J,X)}var mj6=/^\/(?:[^~]|~0|~1)*$/,uj6=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function pj6(J,Q,Z){var X,Y,K,q;if(J==="")return"rootData";if(J[0]=="/"){if(!mj6.test(J))throw Error("Invalid JSON-pointer: "+J);Y=J,K="rootData"}else{if(q=J.match(uj6),!q)throw Error("Invalid JSON-pointer: "+J);if(X=+q[1],Y=q[2],Y=="#"){if(X>=Q)throw Error("Cannot access property/index "+X+" levels up, current level is "+Q);return Z[Q-X]}if(X>Q)throw Error("Cannot access data "+X+" levels up, current level is "+Q);if(K="data"+(Q-X||""),!Y)return K}var G=K,z=Y.split("/");for(var U=0;U<z.length;U++){var W=z[U];if(W)K+=bG1(fG1(W)),G+=" && "+K}return G}function rr1(J,Q){if(J=='""')return Q;return(J+" + "+Q).replace(/([^\\])' \+ '/g,"$1")}function dj6(J){return fG1(decodeURIComponent(J))}function cj6(J){return encodeURIComponent(yG1(J))}function yG1(J){return J.replace(/~/g,"~0").replace(/\//g,"~1")}function fG1(J){return J.replace(/~1/g,"/").replace(/~0/g,"~")}});var hG1=e((iB9,or1)=>{var lj6=jN();or1.exports=ij6;function ij6(J){lj6.copy(J,this)}});var er1=e((nB9,tr1)=>{var UB=tr1.exports=function(J,Q,Z){if(typeof Q=="function")Z=Q,Q={};Z=Q.cb||Z;var X=typeof Z=="function"?Z:Z.pre||function(){},Y=Z.post||function(){};Rc(Q,X,Y,J,"",J)};UB.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};UB.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};UB.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};UB.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Rc(J,Q,Z,X,Y,K,q,G,z,U){if(X&&typeof X=="object"&&!Array.isArray(X)){Q(X,Y,K,q,G,z,U);for(var W in X){var F=X[W];if(Array.isArray(F)){if(W in UB.arrayKeywords)for(var H=0;H<F.length;H++)Rc(J,Q,Z,F[H],Y+"/"+W+"/"+H,K,Y,W,X,H)}else if(W in UB.propsKeywords){if(F&&typeof F=="object")for(var B in F)Rc(J,Q,Z,F[B],Y+"/"+W+"/"+nj6(B),K,Y,W,X,B)}else if(W in UB.keywords||J.allKeys&&!(W in UB.skipKeywords))Rc(J,Q,Z,F,Y+"/"+W,K,Y,W,X)}Z(X,Y,K,q,G,z,U)}}function nj6(J){return J.replace(/~/g,"~0").replace(/\//g,"~1")}});var Tc=e((aB9,Xs1)=>{var pS=cr1(),Js1=qR(),$c=jN(),wc=hG1(),aj6=er1();Xs1.exports=FB;FB.normalizeId=WB;FB.fullPath=Ic;FB.url=Ec;FB.ids=ej6;FB.inlineRef=gG1;FB.schema=Pc;function FB(J,Q,Z){var X=this._refs[Z];if(typeof X=="string")if(this._refs[X])X=this._refs[X];else return FB.call(this,J,Q,X);if(X=X||this._schemas[Z],X instanceof wc)return gG1(X.schema,this._opts.inlineRefs)?X.schema:X.validate||this._compile(X);var Y=Pc.call(this,Q,Z),K,q,G;if(Y)K=Y.schema,Q=Y.root,G=Y.baseId;if(K instanceof wc)q=K.validate||J.call(this,K.schema,Q,void 0,G);else if(K!==void 0)q=gG1(K,this._opts.inlineRefs)?K:J.call(this,K,Q,void 0,G);return q}function Pc(J,Q){var Z=pS.parse(Q),X=Zs1(Z),Y=Ic(this._getId(J.schema));if(Object.keys(J.schema).length===0||X!==Y){var K=WB(X),q=this._refs[K];if(typeof q=="string")return rj6.call(this,J,q,Z);else if(q instanceof wc){if(!q.validate)this._compile(q);J=q}else if(q=this._schemas[K],q instanceof wc){if(!q.validate)this._compile(q);if(K==WB(Q))return{schema:q,root:J,baseId:Y};J=q}else return;if(!J.schema)return;Y=Ic(this._getId(J.schema))}return Qs1.call(this,Z,Y,J.schema,J)}function rj6(J,Q,Z){var X=Pc.call(this,J,Q);if(X){var{schema:Y,baseId:K}=X;J=X.root;var q=this._getId(Y);if(q)K=Ec(K,q);return Qs1.call(this,Z,K,Y,J)}}var sj6=$c.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Qs1(J,Q,Z,X){if(J.fragment=J.fragment||"",J.fragment.slice(0,1)!="/")return;var Y=J.fragment.split("/");for(var K=1;K<Y.length;K++){var q=Y[K];if(q){if(q=$c.unescapeFragment(q),Z=Z[q],Z===void 0)break;var G;if(!sj6[q]){if(G=this._getId(Z),G)Q=Ec(Q,G);if(Z.$ref){var z=Ec(Q,Z.$ref),U=Pc.call(this,X,z);if(U)Z=U.schema,X=U.root,Q=U.baseId}}}}if(Z!==void 0&&Z!==X.schema)return{schema:Z,root:X,baseId:Q}}var oj6=$c.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function gG1(J,Q){if(Q===!1)return!1;if(Q===void 0||Q===!0)return mG1(J);else if(Q)return uG1(J)<=Q}function mG1(J){var Q;if(Array.isArray(J)){for(var Z=0;Z<J.length;Z++)if(Q=J[Z],typeof Q=="object"&&!mG1(Q))return!1}else for(var X in J){if(X=="$ref")return!1;if(Q=J[X],typeof Q=="object"&&!mG1(Q))return!1}return!0}function uG1(J){var Q=0,Z;if(Array.isArray(J))for(var X=0;X<J.length;X++){if(Z=J[X],typeof Z=="object")Q+=uG1(Z);if(Q==1/0)return 1/0}else for(var Y in J){if(Y=="$ref")return 1/0;if(oj6[Y])Q++;else{if(Z=J[Y],typeof Z=="object")Q+=uG1(Z)+1;if(Q==1/0)return 1/0}}return Q}function Ic(J,Q){if(Q!==!1)J=WB(J);var Z=pS.parse(J);return Zs1(Z)}function Zs1(J){return pS.serialize(J).split("#")[0]+"#"}var tj6=/#\/?$/;function WB(J){return J?J.replace(tj6,""):""}function Ec(J,Q){return Q=WB(Q),pS.resolve(J,Q)}function ej6(J){var Q=WB(this._getId(J)),Z={"":Q},X={"":Ic(Q,!1)},Y={},K=this;return aj6(J,{allKeys:!0},function(q,G,z,U,W,F,H){if(G==="")return;var B=K._getId(q),M=Z[U],V=X[U]+"/"+W;if(H!==void 0)V+="/"+(typeof H=="number"?H:$c.escapeFragment(H));if(typeof B=="string"){B=M=WB(M?pS.resolve(M,B):B);var N=K._refs[B];if(typeof N=="string")N=K._refs[N];if(N&&N.schema){if(!Js1(q,N.schema))throw Error('id "'+B+'" resolves to more than one schema')}else if(B!=WB(V))if(B[0]=="#"){if(Y[B]&&!Js1(q,Y[B]))throw Error('id "'+B+'" resolves to more than one schema');Y[B]=q}else K._refs[B]=V}Z[G]=M,X[G]=V}),Y}});var Cc=e((rB9,Ks1)=>{var pG1=Tc();Ks1.exports={Validation:Ys1(JR6),MissingRef:Ys1(dG1)};function JR6(J){this.message="validation failed",this.errors=J,this.ajv=this.validation=!0}dG1.message=function(J,Q){return"can't resolve reference "+Q+" from id "+J};function dG1(J,Q,Z){this.message=Z||dG1.message(J,Q),this.missingRef=pG1.url(J,Q),this.missingSchema=pG1.normalizeId(pG1.fullPath(this.missingRef))}function Ys1(J){return J.prototype=Object.create(Error.prototype),J.prototype.constructor=J,J}});var cG1=e((sB9,qs1)=>{qs1.exports=function(J,Q){if(!Q)Q={};if(typeof Q==="function")Q={cmp:Q};var Z=typeof Q.cycles==="boolean"?Q.cycles:!1,X=Q.cmp&&function(K){return function(q){return function(G,z){var U={key:G,value:q[G]},W={key:z,value:q[z]};return K(U,W)}}}(Q.cmp),Y=[];return function K(q){if(q&&q.toJSON&&typeof q.toJSON==="function")q=q.toJSON();if(q===void 0)return;if(typeof q=="number")return isFinite(q)?""+q:"null";if(typeof q!=="object")return JSON.stringify(q);var G,z;if(Array.isArray(q)){z="[";for(G=0;G<q.length;G++){if(G)z+=",";z+=K(q[G])||"null"}return z+"]"}if(q===null)return"null";if(Y.indexOf(q)!==-1){if(Z)return JSON.stringify("__cycle__");throw TypeError("Converting circular structure to JSON")}var U=Y.push(q)-1,W=Object.keys(q).sort(X&&X(q));z="";for(G=0;G<W.length;G++){var F=W[G],H=K(q[F]);if(!H)continue;if(z)z+=",";z+=JSON.stringify(F)+":"+H}return Y.splice(U,1),"{"+z+"}"}(J)}});var lG1=e((oB9,Gs1)=>{Gs1.exports=function(Q,Z,X){var Y="",K=Q.schema.$async===!0,q=Q.util.schemaHasRulesExcept(Q.schema,Q.RULES.all,"$ref"),G=Q.self._getId(Q.schema);if(Q.opts.strictKeywords){var z=Q.util.schemaUnknownRules(Q.schema,Q.RULES.keywords);if(z){var U="unknown keyword: "+z;if(Q.opts.strictKeywords==="log")Q.logger.warn(U);else throw Error(U)}}if(Q.isTop){if(Y+=" var validate = ",K)Q.async=!0,Y+="async ";if(Y+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",G&&(Q.opts.sourceCode||Q.opts.processCode))Y+=" "+("/*# sourceURL="+G+" */")+" "}if(typeof Q.schema=="boolean"||!(q||Q.schema.$ref)){var Z="false schema",W=Q.level,F=Q.dataLevel,H=Q.schema[Z],B=Q.schemaPath+Q.util.getProperty(Z),M=Q.errSchemaPath+"/"+Z,R=!Q.opts.allErrors,E,V="data"+(F||""),j="valid"+W;if(Q.schema===!1){if(Q.isTop)R=!0;else Y+=" var "+j+" = false; ";var N=N||[];if(N.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(E||"false schema")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(M)+" , params: {} ",Q.opts.messages!==!1)Y+=" , message: 'boolean schema is false' ";if(Q.opts.verbose)Y+=" , schema: false , parentSchema: validate.schema"+Q.schemaPath+" , data: "+V+" ";Y+=" } "}else Y+=" {} ";var L=Y;if(Y=N.pop(),!Q.compositeRule&&R)if(Q.async)Y+=" throw new ValidationError(["+L+"]); ";else Y+=" validate.errors = ["+L+"]; return false; ";else Y+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else if(Q.isTop)if(K)Y+=" return data; ";else Y+=" validate.errors = null; return true; ";else Y+=" var "+j+" = true; ";if(Q.isTop)Y+=" }; return validate; ";return Y}if(Q.isTop){var A=Q.isTop,W=Q.level=0,F=Q.dataLevel=0,V="data";if(Q.rootId=Q.resolve.fullPath(Q.self._getId(Q.root.schema)),Q.baseId=Q.baseId||Q.rootId,delete Q.isTop,Q.dataPathArr=[""],Q.schema.default!==void 0&&Q.opts.useDefaults&&Q.opts.strictDefaults){var O="default is ignored in the schema root";if(Q.opts.strictDefaults==="log")Q.logger.warn(O);else throw Error(O)}Y+=" var vErrors = null; ",Y+=" var errors = 0; ",Y+=" if (rootData === undefined) rootData = data; "}else{var{level:W,dataLevel:F}=Q,V="data"+(F||"");if(G)Q.baseId=Q.resolve.url(Q.baseId,G);if(K&&!Q.async)throw Error("async schema in sync schema");Y+=" var errs_"+W+" = errors;"}var j="valid"+W,R=!Q.opts.allErrors,I="",w="",E,$=Q.schema.type,P=Array.isArray($);if($&&Q.opts.nullable&&Q.schema.nullable===!0){if(P){if($.indexOf("null")==-1)$=$.concat("null")}else if($!="null")$=[$,"null"],P=!0}if(P&&$.length==1)$=$[0],P=!1;if(Q.schema.$ref&&q){if(Q.opts.extendRefs=="fail")throw Error('$ref: validation keywords used in schema at path "'+Q.errSchemaPath+'" (see option extendRefs)');else if(Q.opts.extendRefs!==!0)q=!1,Q.logger.warn('$ref: keywords ignored in schema at path "'+Q.errSchemaPath+'"')}if(Q.schema.$comment&&Q.opts.$comment)Y+=" "+Q.RULES.all.$comment.code(Q,"$comment");if($){if(Q.opts.coerceTypes)var C=Q.util.coerceToTypes(Q.opts.coerceTypes,$);var k=Q.RULES.types[$];if(C||P||k===!0||k&&!j1(k)){var B=Q.schemaPath+".type",M=Q.errSchemaPath+"/type",B=Q.schemaPath+".type",M=Q.errSchemaPath+"/type",g=P?"checkDataTypes":"checkDataType";if(Y+=" if ("+Q.util[g]($,V,Q.opts.strictNumbers,!0)+") { ",C){var T="dataType"+W,v="coerced"+W;if(Y+=" var "+T+" = typeof "+V+"; var "+v+" = undefined; ",Q.opts.coerceTypes=="array")Y+=" if ("+T+" == 'object' && Array.isArray("+V+") && "+V+".length == 1) { "+V+" = "+V+"[0]; "+T+" = typeof "+V+"; if ("+Q.util.checkDataType(Q.schema.type,V,Q.opts.strictNumbers)+") "+v+" = "+V+"; } ";Y+=" if ("+v+" !== undefined) ; ";var f=C;if(f){var h,S=-1,x=f.length-1;while(S<x)if(h=f[S+=1],h=="string")Y+=" else if ("+T+" == 'number' || "+T+" == 'boolean') "+v+" = '' + "+V+"; else if ("+V+" === null) "+v+" = ''; ";else if(h=="number"||h=="integer"){if(Y+=" else if ("+T+" == 'boolean' || "+V+" === null || ("+T+" == 'string' && "+V+" && "+V+" == +"+V+" ",h=="integer")Y+=" && !("+V+" % 1)";Y+=")) "+v+" = +"+V+"; "}else if(h=="boolean")Y+=" else if ("+V+" === 'false' || "+V+" === 0 || "+V+" === null) "+v+" = false; else if ("+V+" === 'true' || "+V+" === 1) "+v+" = true; ";else if(h=="null")Y+=" else if ("+V+" === '' || "+V+" === 0 || "+V+" === false) "+v+" = null; ";else if(Q.opts.coerceTypes=="array"&&h=="array")Y+=" else if ("+T+" == 'string' || "+T+" == 'number' || "+T+" == 'boolean' || "+V+" == null) "+v+" = ["+V+"]; "}Y+=" else { ";var N=N||[];if(N.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(E||"type")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(M)+" , params: { type: '",P)Y+=""+$.join(",");else Y+=""+$;if(Y+="' } ",Q.opts.messages!==!1){if(Y+=" , message: 'should be ",P)Y+=""+$.join(",");else Y+=""+$;Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+V+" ";Y+=" } "}else Y+=" {} ";var L=Y;if(Y=N.pop(),!Q.compositeRule&&R)if(Q.async)Y+=" throw new ValidationError(["+L+"]); ";else Y+=" validate.errors = ["+L+"]; return false; ";else Y+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Y+=" } if ("+v+" !== undefined) { ";var b=F?"data"+(F-1||""):"parentData",m=F?Q.dataPathArr[F]:"parentDataProperty";if(Y+=" "+V+" = "+v+"; ",!F)Y+="if ("+b+" !== undefined)";Y+=" "+b+"["+m+"] = "+v+"; } "}else{var N=N||[];if(N.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(E||"type")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(M)+" , params: { type: '",P)Y+=""+$.join(",");else Y+=""+$;if(Y+="' } ",Q.opts.messages!==!1){if(Y+=" , message: 'should be ",P)Y+=""+$.join(",");else Y+=""+$;Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+V+" ";Y+=" } "}else Y+=" {} ";var L=Y;if(Y=N.pop(),!Q.compositeRule&&R)if(Q.async)Y+=" throw new ValidationError(["+L+"]); ";else Y+=" validate.errors = ["+L+"]; return false; ";else Y+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}Y+=" } "}}if(Q.schema.$ref&&!q){if(Y+=" "+Q.RULES.all.$ref.code(Q,"$ref")+" ",R){if(Y+=" } if (errors === ",A)Y+="0";else Y+="errs_"+W;Y+=") { ",w+="}"}}else{var a=Q.RULES;if(a){var k,p=-1,Q1=a.length-1;while(p<Q1)if(k=a[p+=1],j1(k)){if(k.type)Y+=" if ("+Q.util.checkDataType(k.type,V,Q.opts.strictNumbers)+") { ";if(Q.opts.useDefaults){if(k.type=="object"&&Q.schema.properties){var H=Q.schema.properties,z1=Object.keys(H),F1=z1;if(F1){var X1,H1=-1,l=F1.length-1;while(H1<l){X1=F1[H1+=1];var d=H[X1];if(d.default!==void 0){var i=V+Q.util.getProperty(X1);if(Q.compositeRule){if(Q.opts.strictDefaults){var O="default is ignored for: "+i;if(Q.opts.strictDefaults==="log")Q.logger.warn(O);else throw Error(O)}}else{if(Y+=" if ("+i+" === undefined ",Q.opts.useDefaults=="empty")Y+=" || "+i+" === null || "+i+" === '' ";if(Y+=" ) "+i+" = ",Q.opts.useDefaults=="shared")Y+=" "+Q.useDefault(d.default)+" ";else Y+=" "+JSON.stringify(d.default)+" ";Y+="; "}}}}}else if(k.type=="array"&&Array.isArray(Q.schema.items)){var r=Q.schema.items;if(r){var d,S=-1,o=r.length-1;while(S<o)if(d=r[S+=1],d.default!==void 0){var i=V+"["+S+"]";if(Q.compositeRule){if(Q.opts.strictDefaults){var O="default is ignored for: "+i;if(Q.opts.strictDefaults==="log")Q.logger.warn(O);else throw Error(O)}}else{if(Y+=" if ("+i+" === undefined ",Q.opts.useDefaults=="empty")Y+=" || "+i+" === null || "+i+" === '' ";if(Y+=" ) "+i+" = ",Q.opts.useDefaults=="shared")Y+=" "+Q.useDefault(d.default)+" ";else Y+=" "+JSON.stringify(d.default)+" ";Y+="; "}}}}}var K1=k.rules;if(K1){var Z1,B1=-1,U1=K1.length-1;while(B1<U1)if(Z1=K1[B1+=1],D1(Z1)){var W1=Z1.code(Q,Z1.keyword,k.type);if(W1){if(Y+=" "+W1+" ",R)I+="}"}}}if(R)Y+=" "+I+" ",I="";if(k.type){if(Y+=" } ",$&&$===k.type&&!C){Y+=" else { ";var B=Q.schemaPath+".type",M=Q.errSchemaPath+"/type",N=N||[];if(N.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(E||"type")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(M)+" , params: { type: '",P)Y+=""+$.join(",");else Y+=""+$;if(Y+="' } ",Q.opts.messages!==!1){if(Y+=" , message: 'should be ",P)Y+=""+$.join(",");else Y+=""+$;Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+V+" ";Y+=" } "}else Y+=" {} ";var L=Y;if(Y=N.pop(),!Q.compositeRule&&R)if(Q.async)Y+=" throw new ValidationError(["+L+"]); ";else Y+=" validate.errors = ["+L+"]; return false; ";else Y+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Y+=" } "}}if(R){if(Y+=" if (errors === ",A)Y+="0";else Y+="errs_"+W;Y+=") { ",w+="}"}}}}if(R)Y+=" "+w+" ";if(A){if(K)Y+=" if (errors === 0) return data; ",Y+=" else throw new ValidationError(vErrors); ";else Y+=" validate.errors = vErrors; ",Y+=" return errors === 0; ";Y+=" }; return validate;"}else Y+=" var "+j+" = errors === errs_"+W+";";function j1(n1){var r1=n1.rules;for(var u1=0;u1<r1.length;u1++)if(D1(r1[u1]))return!0}function D1(n1){return Q.schema[n1.keyword]!==void 0||n1.implements&&d1(n1)}function d1(n1){var r1=n1.implements;for(var u1=0;u1<r1.length;u1++)if(Q.schema[r1[u1]]!==void 0)return!0}return Y}});var Hs1=e((tB9,Fs1)=>{var Sc=Tc(),kc=jN(),Us1=Cc(),QR6=cG1(),zs1=lG1(),ZR6=kc.ucs2length,XR6=qR(),YR6=Us1.Validation;Fs1.exports=iG1;function iG1(J,Q,Z,X){var Y=this,K=this._opts,q=[void 0],G={},z=[],U={},W=[],F={},H=[];Q=Q||{schema:J,refVal:q,refs:G};var B=KR6.call(this,J,Q,X),M=this._compilations[B.index];if(B.compiling)return M.callValidate=O;var V=this._formats,N=this.RULES;try{var L=j(J,Q,Z,X);M.validate=L;var A=M.callValidate;if(A){if(A.schema=L.schema,A.errors=null,A.refs=L.refs,A.refVal=L.refVal,A.root=L.root,A.$async=L.$async,K.sourceCode)A.source=L.source}return L}finally{qR6.call(this,J,Q,X)}function O(){var g=M.validate,T=g.apply(this,arguments);return O.errors=g.errors,T}function j(g,T,v,f){var h=!T||T&&T.schema==g;if(T.schema!=Q.schema)return iG1.call(Y,g,T,v,f);var S=g.$async===!0,x=zs1({isTop:!0,schema:g,isRoot:h,baseId:f,root:T,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Us1.MissingRef,RULES:N,validate:zs1,util:kc,resolve:Sc,resolveRef:R,usePattern:P,useDefault:C,useCustomRule:k,opts:K,formats:V,logger:Y.logger,self:Y});if(x=vc(q,UR6)+vc(z,GR6)+vc(W,zR6)+vc(H,WR6)+x,K.processCode)x=K.processCode(x,g);var b;try{var m=Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",x);b=m(Y,N,V,Q,q,W,H,XR6,ZR6,YR6),q[0]=b}catch(a){throw Y.logger.error("Error compiling schema, function code:",x),a}if(b.schema=g,b.errors=null,b.refs=G,b.refVal=q,b.root=h?b:T,S)b.$async=!0;if(K.sourceCode===!0)b.source={code:x,patterns:z,defaults:W};return b}function R(g,T,v){T=Sc.url(g,T);var f=G[T],h,S;if(f!==void 0)return h=q[f],S="refVal["+f+"]",$(h,S);if(!v&&Q.refs){var x=Q.refs[T];if(x!==void 0)return h=Q.refVal[x],S=I(T,h),$(h,S)}S=I(T);var b=Sc.call(Y,j,Q,T);if(b===void 0){var m=Z&&Z[T];if(m)b=Sc.inlineRef(m,K.inlineRefs)?m:iG1.call(Y,m,Q,Z,g)}if(b===void 0)w(T);else return E(T,b),$(b,S)}function I(g,T){var v=q.length;return q[v]=T,G[g]=v,"refVal"+v}function w(g){delete G[g]}function E(g,T){var v=G[g];q[v]=T}function $(g,T){return typeof g=="object"||typeof g=="boolean"?{code:T,schema:g,inline:!0}:{code:T,$async:g&&!!g.$async}}function P(g){var T=U[g];if(T===void 0)T=U[g]=z.length,z[T]=g;return"pattern"+T}function C(g){switch(typeof g){case"boolean":case"number":return""+g;case"string":return kc.toQuotedString(g);case"object":if(g===null)return"null";var T=QR6(g),v=F[T];if(v===void 0)v=F[T]=W.length,W[v]=g;return"default"+v}}function k(g,T,v,f){if(Y._opts.validateSchema!==!1){var h=g.definition.dependencies;if(h&&!h.every(function(F1){return Object.prototype.hasOwnProperty.call(v,F1)}))throw Error("parent schema must have all required keywords: "+h.join(","));var S=g.definition.validateSchema;if(S){var x=S(T);if(!x){var b="keyword schema is invalid: "+Y.errorsText(S.errors);if(Y._opts.validateSchema=="log")Y.logger.error(b);else throw Error(b)}}}var m=g.definition.compile,a=g.definition.inline,p=g.definition.macro,Q1;if(m)Q1=m.call(Y,T,v,f);else if(p){if(Q1=p.call(Y,T,v,f),K.validateSchema!==!1)Y.validateSchema(Q1,!0)}else if(a)Q1=a.call(Y,f,g.keyword,T,v);else if(Q1=g.definition.validate,!Q1)return;if(Q1===void 0)throw Error('custom keyword "'+g.keyword+'"failed to compile');var z1=H.length;return H[z1]=Q1,{code:"customRule"+z1,validate:Q1}}}function KR6(J,Q,Z){var X=Ws1.call(this,J,Q,Z);if(X>=0)return{index:X,compiling:!0};return X=this._compilations.length,this._compilations[X]={schema:J,root:Q,baseId:Z},{index:X,compiling:!1}}function qR6(J,Q,Z){var X=Ws1.call(this,J,Q,Z);if(X>=0)this._compilations.splice(X,1)}function Ws1(J,Q,Z){for(var X=0;X<this._compilations.length;X++){var Y=this._compilations[X];if(Y.schema==J&&Y.root==Q&&Y.baseId==Z)return X}return-1}function GR6(J,Q){return"var pattern"+J+" = new RegExp("+kc.toQuotedString(Q[J])+");"}function zR6(J){return"var default"+J+" = defaults["+J+"];"}function UR6(J,Q){return Q[J]===void 0?"":"var refVal"+J+" = refVal["+J+"];"}function WR6(J){return"var customRule"+J+" = customRules["+J+"];"}function vc(J,Q){if(!J.length)return"";var Z="";for(var X=0;X<J.length;X++)Z+=Q(X,J);return Z}});var Ds1=e((eB9,Bs1)=>{var _c=Bs1.exports=function(){this._cache={}};_c.prototype.put=function(Q,Z){this._cache[Q]=Z};_c.prototype.get=function(Q){return this._cache[Q]};_c.prototype.del=function(Q){delete this._cache[Q]};_c.prototype.clear=function(){this._cache={}}});var $s1=e((JD9,Es1)=>{var FR6=jN(),HR6=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,BR6=[0,31,28,31,30,31,30,31,31,30,31,30,31],DR6=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Ms1=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,MR6=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,VR6=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Vs1=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Ns1=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,Ls1=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,As1=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Os1=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,js1=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Es1.exports=bc;function bc(J){return J=J=="full"?"full":"fast",FR6.copy(bc[J])}bc.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":Vs1,url:Ns1,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:Ms1,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:Is1,uuid:Ls1,"json-pointer":As1,"json-pointer-uri-fragment":Os1,"relative-json-pointer":js1};bc.full={date:Rs1,time:ws1,"date-time":AR6,uri:jR6,"uri-reference":VR6,"uri-template":Vs1,url:Ns1,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:Ms1,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:Is1,uuid:Ls1,"json-pointer":As1,"json-pointer-uri-fragment":Os1,"relative-json-pointer":js1};function NR6(J){return J%4===0&&(J%100!==0||J%400===0)}function Rs1(J){var Q=J.match(HR6);if(!Q)return!1;var Z=+Q[1],X=+Q[2],Y=+Q[3];return X>=1&&X<=12&&Y>=1&&Y<=(X==2&&NR6(Z)?29:BR6[X])}function ws1(J,Q){var Z=J.match(DR6);if(!Z)return!1;var X=Z[1],Y=Z[2],K=Z[3],q=Z[5];return(X<=23&&Y<=59&&K<=59||X==23&&Y==59&&K==60)&&(!Q||q)}var LR6=/t|\s/i;function AR6(J){var Q=J.split(LR6);return Q.length==2&&Rs1(Q[0])&&ws1(Q[1],!0)}var OR6=/\/|:/;function jR6(J){return OR6.test(J)&&MR6.test(J)}var RR6=/[^\\]\\Z/;function Is1(J){if(RR6.test(J))return!1;try{return new RegExp(J),!0}catch(Q){return!1}}});var Ts1=e((QD9,Ps1)=>{Ps1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.errSchemaPath+"/"+Z,U=!Q.opts.allErrors,W="data"+(q||""),F="valid"+K,H,B;if(G=="#"||G=="#/")if(Q.isRoot)H=Q.async,B="validate";else H=Q.root.schema.$async===!0,B="root.refVal[0]";else{var M=Q.resolveRef(Q.baseId,G,Q.isRoot);if(M===void 0){var V=Q.MissingRefError.message(Q.baseId,G);if(Q.opts.missingRefs=="fail"){Q.logger.error(V);var N=N||[];if(N.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(z)+" , params: { ref: '"+Q.util.escapeQuotes(G)+"' } ",Q.opts.messages!==!1)Y+=" , message: 'can\\'t resolve reference "+Q.util.escapeQuotes(G)+"' ";if(Q.opts.verbose)Y+=" , schema: "+Q.util.toQuotedString(G)+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+W+" ";Y+=" } "}else Y+=" {} ";var L=Y;if(Y=N.pop(),!Q.compositeRule&&U)if(Q.async)Y+=" throw new ValidationError(["+L+"]); ";else Y+=" validate.errors = ["+L+"]; return false; ";else Y+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(U)Y+=" if (false) { "}else if(Q.opts.missingRefs=="ignore"){if(Q.logger.warn(V),U)Y+=" if (true) { "}else throw new Q.MissingRefError(Q.baseId,G,V)}else if(M.inline){var A=Q.util.copy(Q);A.level++;var O="valid"+A.level;A.schema=M.schema,A.schemaPath="",A.errSchemaPath=G;var j=Q.validate(A).replace(/validate\.schema/g,M.code);if(Y+=" "+j+" ",U)Y+=" if ("+O+") { "}else H=M.$async===!0||Q.async&&M.$async!==!1,B=M.code}if(B){var N=N||[];if(N.push(Y),Y="",Q.opts.passContext)Y+=" "+B+".call(this, ";else Y+=" "+B+"( ";if(Y+=" "+W+", (dataPath || '')",Q.errorPath!='""')Y+=" + "+Q.errorPath;var R=q?"data"+(q-1||""):"parentData",I=q?Q.dataPathArr[q]:"parentDataProperty";Y+=" , "+R+" , "+I+", rootData) ";var w=Y;if(Y=N.pop(),H){if(!Q.async)throw Error("async schema referenced by sync schema");if(U)Y+=" var "+F+"; ";if(Y+=" try { await "+w+"; ",U)Y+=" "+F+" = true; ";if(Y+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",U)Y+=" "+F+" = false; ";if(Y+=" } ",U)Y+=" if ("+F+") { "}else if(Y+=" if (!"+w+") { if (vErrors === null) vErrors = "+B+".errors; else vErrors = vErrors.concat("+B+".errors); errors = vErrors.length; } ",U)Y+=" else { "}return Y}});var Ss1=e((ZD9,Cs1)=>{Cs1.exports=function(Q,Z,X){var Y=" ",K=Q.schema[Z],q=Q.schemaPath+Q.util.getProperty(Z),G=Q.errSchemaPath+"/"+Z,z=!Q.opts.allErrors,U=Q.util.copy(Q),W="";U.level++;var F="valid"+U.level,H=U.baseId,B=!0,M=K;if(M){var V,N=-1,L=M.length-1;while(N<L)if(V=M[N+=1],Q.opts.strictKeywords?typeof V=="object"&&Object.keys(V).length>0||V===!1:Q.util.schemaHasRules(V,Q.RULES.all)){if(B=!1,U.schema=V,U.schemaPath=q+"["+N+"]",U.errSchemaPath=G+"/"+N,Y+=" "+Q.validate(U)+" ",U.baseId=H,z)Y+=" if ("+F+") { ",W+="}"}}if(z)if(B)Y+=" if (true) { ";else Y+=" "+W.slice(0,-1)+" ";return Y}});var ks1=e((XD9,vs1)=>{vs1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B="errs__"+K,M=Q.util.copy(Q),V="";M.level++;var N="valid"+M.level,L=G.every(function(E){return Q.opts.strictKeywords?typeof E=="object"&&Object.keys(E).length>0||E===!1:Q.util.schemaHasRules(E,Q.RULES.all)});if(L){var A=M.baseId;Y+=" var "+B+" = errors; var "+H+" = false; ";var O=Q.compositeRule;Q.compositeRule=M.compositeRule=!0;var j=G;if(j){var R,I=-1,w=j.length-1;while(I<w)R=j[I+=1],M.schema=R,M.schemaPath=z+"["+I+"]",M.errSchemaPath=U+"/"+I,Y+=" "+Q.validate(M)+" ",M.baseId=A,Y+=" "+H+" = "+H+" || "+N+"; if (!"+H+") { ",V+="}"}if(Q.compositeRule=M.compositeRule=O,Y+=" "+V+" if (!"+H+") { var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: {} ",Q.opts.messages!==!1)Y+=" , message: 'should match some schema in anyOf' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";if(Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(vErrors); ";else Y+=" validate.errors = vErrors; return false; ";if(Y+=" } else { errors = "+B+"; if (vErrors !== null) { if ("+B+") vErrors.length = "+B+"; else vErrors = null; } ",Q.opts.allErrors)Y+=" } "}else if(W)Y+=" if (true) { ";return Y}});var bs1=e((YD9,_s1)=>{_s1.exports=function(Q,Z,X){var Y=" ",K=Q.schema[Z],q=Q.errSchemaPath+"/"+Z,G=!Q.opts.allErrors,z=Q.util.toQuotedString(K);if(Q.opts.$comment===!0)Y+=" console.log("+z+");";else if(typeof Q.opts.$comment=="function")Y+=" self._opts.$comment("+z+", "+Q.util.toQuotedString(q)+", validate.root.schema);";return Y}});var ys1=e((KD9,xs1)=>{xs1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B=Q.opts.$data&&G&&G.$data,M;if(B)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",M="schema"+K;else M=G;if(!B)Y+=" var schema"+K+" = validate.schema"+z+";";Y+="var "+H+" = equal("+F+", schema"+K+"); if (!"+H+") { ";var V=V||[];if(V.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'const' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { allowedValue: schema"+K+" } ",Q.opts.messages!==!1)Y+=" , message: 'should be equal to constant' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var N=Y;if(Y=V.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+N+"]); ";else Y+=" validate.errors = ["+N+"]; return false; ";else Y+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" }",W)Y+=" else { ";return Y}});var hs1=e((qD9,fs1)=>{fs1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B="errs__"+K,M=Q.util.copy(Q),V="";M.level++;var N="valid"+M.level,L="i"+K,A=M.dataLevel=Q.dataLevel+1,O="data"+A,j=Q.baseId,R=Q.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:Q.util.schemaHasRules(G,Q.RULES.all);if(Y+="var "+B+" = errors;var "+H+";",R){var I=Q.compositeRule;Q.compositeRule=M.compositeRule=!0,M.schema=G,M.schemaPath=z,M.errSchemaPath=U,Y+=" var "+N+" = false; for (var "+L+" = 0; "+L+" < "+F+".length; "+L+"++) { ",M.errorPath=Q.util.getPathExpr(Q.errorPath,L,Q.opts.jsonPointers,!0);var w=F+"["+L+"]";M.dataPathArr[A]=L;var E=Q.validate(M);if(M.baseId=j,Q.util.varOccurences(E,O)<2)Y+=" "+Q.util.varReplace(E,O,w)+" ";else Y+=" var "+O+" = "+w+"; "+E+" ";Y+=" if ("+N+") break; } ",Q.compositeRule=M.compositeRule=I,Y+=" "+V+" if (!"+N+") {"}else Y+=" if ("+F+".length == 0) {";var $=$||[];if($.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: {} ",Q.opts.messages!==!1)Y+=" , message: 'should contain a valid item' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var P=Y;if(Y=$.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+P+"]); ";else Y+=" validate.errors = ["+P+"]; return false; ";else Y+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" } else { ",R)Y+=" errors = "+B+"; if (vErrors !== null) { if ("+B+") vErrors.length = "+B+"; else vErrors = null; } ";if(Q.opts.allErrors)Y+=" } ";return Y}});var ms1=e((GD9,gs1)=>{gs1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="errs__"+K,B=Q.util.copy(Q),M="";B.level++;var V="valid"+B.level,N={},L={},A=Q.opts.ownProperties;for(I in G){if(I=="__proto__")continue;var O=G[I],j=Array.isArray(O)?L:N;j[I]=O}Y+="var "+H+" = errors;";var R=Q.errorPath;Y+="var missing"+K+";";for(var I in L)if(j=L[I],j.length){if(Y+=" if ( "+F+Q.util.getProperty(I)+" !== undefined ",A)Y+=" && Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(I)+"') ";if(W){Y+=" && ( ";var w=j;if(w){var E,$=-1,P=w.length-1;while($<P){if(E=w[$+=1],$)Y+=" || ";var C=Q.util.getProperty(E),k=F+C;if(Y+=" ( ( "+k+" === undefined ",A)Y+=" || ! Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(E)+"') ";Y+=") && (missing"+K+" = "+Q.util.toQuotedString(Q.opts.jsonPointers?E:C)+") ) "}}Y+=")) { ";var g="missing"+K,T="' + "+g+" + '";if(Q.opts._errorDataPathProperty)Q.errorPath=Q.opts.jsonPointers?Q.util.getPathExpr(R,g,!0):R+" + "+g;var v=v||[];if(v.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { property: '"+Q.util.escapeQuotes(I)+"', missingProperty: '"+T+"', depsCount: "+j.length+", deps: '"+Q.util.escapeQuotes(j.length==1?j[0]:j.join(", "))+"' } ",Q.opts.messages!==!1){if(Y+=" , message: 'should have ",j.length==1)Y+="property "+Q.util.escapeQuotes(j[0]);else Y+="properties "+Q.util.escapeQuotes(j.join(", "));Y+=" when property "+Q.util.escapeQuotes(I)+" is present' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var f=Y;if(Y=v.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+f+"]); ";else Y+=" validate.errors = ["+f+"]; return false; ";else Y+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{Y+=" ) { ";var h=j;if(h){var E,S=-1,x=h.length-1;while(S<x){E=h[S+=1];var C=Q.util.getProperty(E),T=Q.util.escapeQuotes(E),k=F+C;if(Q.opts._errorDataPathProperty)Q.errorPath=Q.util.getPath(R,E,Q.opts.jsonPointers);if(Y+=" if ( "+k+" === undefined ",A)Y+=" || ! Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(E)+"') ";if(Y+=") { var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { property: '"+Q.util.escapeQuotes(I)+"', missingProperty: '"+T+"', depsCount: "+j.length+", deps: '"+Q.util.escapeQuotes(j.length==1?j[0]:j.join(", "))+"' } ",Q.opts.messages!==!1){if(Y+=" , message: 'should have ",j.length==1)Y+="property "+Q.util.escapeQuotes(j[0]);else Y+="properties "+Q.util.escapeQuotes(j.join(", "));Y+=" when property "+Q.util.escapeQuotes(I)+" is present' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}if(Y+=" } ",W)M+="}",Y+=" else { "}Q.errorPath=R;var b=B.baseId;for(var I in N){var O=N[I];if(Q.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:Q.util.schemaHasRules(O,Q.RULES.all)){if(Y+=" "+V+" = true; if ( "+F+Q.util.getProperty(I)+" !== undefined ",A)Y+=" && Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(I)+"') ";if(Y+=") { ",B.schema=O,B.schemaPath=z+Q.util.getProperty(I),B.errSchemaPath=U+"/"+Q.util.escapeFragment(I),Y+=" "+Q.validate(B)+" ",B.baseId=b,Y+=" } ",W)Y+=" if ("+V+") { ",M+="}"}}if(W)Y+=" "+M+" if ("+H+" == errors) {";return Y}});var ps1=e((zD9,us1)=>{us1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B=Q.opts.$data&&G&&G.$data,M;if(B)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",M="schema"+K;else M=G;var V="i"+K,N="schema"+K;if(!B)Y+=" var "+N+" = validate.schema"+z+";";if(Y+="var "+H+";",B)Y+=" if (schema"+K+" === undefined) "+H+" = true; else if (!Array.isArray(schema"+K+")) "+H+" = false; else {";if(Y+=""+H+" = false;for (var "+V+"=0; "+V+"<"+N+".length; "+V+"++) if (equal("+F+", "+N+"["+V+"])) { "+H+" = true; break; }",B)Y+=" } ";Y+=" if (!"+H+") { ";var L=L||[];if(L.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { allowedValues: schema"+K+" } ",Q.opts.messages!==!1)Y+=" , message: 'should be equal to one of the allowed values' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var A=Y;if(Y=L.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+A+"]); ";else Y+=" validate.errors = ["+A+"]; return false; ";else Y+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" }",W)Y+=" else { ";return Y}});var cs1=e((UD9,ds1)=>{ds1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||"");if(Q.opts.format===!1){if(W)Y+=" if (true) { ";return Y}var H=Q.opts.$data&&G&&G.$data,B;if(H)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",B="schema"+K;else B=G;var M=Q.opts.unknownFormats,V=Array.isArray(M);if(H){var N="format"+K,L="isObject"+K,A="formatType"+K;if(Y+=" var "+N+" = formats["+B+"]; var "+L+" = typeof "+N+" == 'object' && !("+N+" instanceof RegExp) && "+N+".validate; var "+A+" = "+L+" && "+N+".type || 'string'; if ("+L+") { ",Q.async)Y+=" var async"+K+" = "+N+".async; ";if(Y+=" "+N+" = "+N+".validate; } if ( ",H)Y+=" ("+B+" !== undefined && typeof "+B+" != 'string') || ";if(Y+=" (",M!="ignore"){if(Y+=" ("+B+" && !"+N+" ",V)Y+=" && self._opts.unknownFormats.indexOf("+B+") == -1 ";Y+=") || "}if(Y+=" ("+N+" && "+A+" == '"+X+"' && !(typeof "+N+" == 'function' ? ",Q.async)Y+=" (async"+K+" ? await "+N+"("+F+") : "+N+"("+F+")) ";else Y+=" "+N+"("+F+") ";Y+=" : "+N+".test("+F+"))))) {"}else{var N=Q.formats[G];if(!N)if(M=="ignore"){if(Q.logger.warn('unknown format "'+G+'" ignored in schema at path "'+Q.errSchemaPath+'"'),W)Y+=" if (true) { ";return Y}else if(V&&M.indexOf(G)>=0){if(W)Y+=" if (true) { ";return Y}else throw Error('unknown format "'+G+'" is used in schema at path "'+Q.errSchemaPath+'"');var L=typeof N=="object"&&!(N instanceof RegExp)&&N.validate,A=L&&N.type||"string";if(L){var O=N.async===!0;N=N.validate}if(A!=X){if(W)Y+=" if (true) { ";return Y}if(O){if(!Q.async)throw Error("async format in sync schema");var j="formats"+Q.util.getProperty(G)+".validate";Y+=" if (!(await "+j+"("+F+"))) { "}else{Y+=" if (! ";var j="formats"+Q.util.getProperty(G);if(L)j+=".validate";if(typeof N=="function")Y+=" "+j+"("+F+") ";else Y+=" "+j+".test("+F+") ";Y+=") { "}}var R=R||[];if(R.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'format' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { format: ",H)Y+=""+B;else Y+=""+Q.util.toQuotedString(G);if(Y+=" } ",Q.opts.messages!==!1){if(Y+=` , message: 'should match format "`,H)Y+="' + "+B+" + '";else Y+=""+Q.util.escapeQuotes(G);Y+=`"' `}if(Q.opts.verbose){if(Y+=" , schema: ",H)Y+="validate.schema"+z;else Y+=""+Q.util.toQuotedString(G);Y+=" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" "}Y+=" } "}else Y+=" {} ";var I=Y;if(Y=R.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+I+"]); ";else Y+=" validate.errors = ["+I+"]; return false; ";else Y+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" } ",W)Y+=" else { ";return Y}});var is1=e((WD9,ls1)=>{ls1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B="errs__"+K,M=Q.util.copy(Q);M.level++;var V="valid"+M.level,N=Q.schema.then,L=Q.schema.else,A=N!==void 0&&(Q.opts.strictKeywords?typeof N=="object"&&Object.keys(N).length>0||N===!1:Q.util.schemaHasRules(N,Q.RULES.all)),O=L!==void 0&&(Q.opts.strictKeywords?typeof L=="object"&&Object.keys(L).length>0||L===!1:Q.util.schemaHasRules(L,Q.RULES.all)),j=M.baseId;if(A||O){var R;M.createErrors=!1,M.schema=G,M.schemaPath=z,M.errSchemaPath=U,Y+=" var "+B+" = errors; var "+H+" = true; ";var I=Q.compositeRule;if(Q.compositeRule=M.compositeRule=!0,Y+=" "+Q.validate(M)+" ",M.baseId=j,M.createErrors=!0,Y+=" errors = "+B+"; if (vErrors !== null) { if ("+B+") vErrors.length = "+B+"; else vErrors = null; } ",Q.compositeRule=M.compositeRule=I,A){if(Y+=" if ("+V+") { ",M.schema=Q.schema.then,M.schemaPath=Q.schemaPath+".then",M.errSchemaPath=Q.errSchemaPath+"/then",Y+=" "+Q.validate(M)+" ",M.baseId=j,Y+=" "+H+" = "+V+"; ",A&&O)R="ifClause"+K,Y+=" var "+R+" = 'then'; ";else R="'then'";if(Y+=" } ",O)Y+=" else { "}else Y+=" if (!"+V+") { ";if(O){if(M.schema=Q.schema.else,M.schemaPath=Q.schemaPath+".else",M.errSchemaPath=Q.errSchemaPath+"/else",Y+=" "+Q.validate(M)+" ",M.baseId=j,Y+=" "+H+" = "+V+"; ",A&&O)R="ifClause"+K,Y+=" var "+R+" = 'else'; ";else R="'else'";Y+=" } "}if(Y+=" if (!"+H+") { var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'if' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { failingKeyword: "+R+" } ",Q.opts.messages!==!1)Y+=` , message: 'should match "' + `+R+` + '" schema' `;if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";if(Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(vErrors); ";else Y+=" validate.errors = vErrors; return false; ";if(Y+=" } ",W)Y+=" else { "}else if(W)Y+=" if (true) { ";return Y}});var as1=e((FD9,ns1)=>{ns1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B="errs__"+K,M=Q.util.copy(Q),V="";M.level++;var N="valid"+M.level,L="i"+K,A=M.dataLevel=Q.dataLevel+1,O="data"+A,j=Q.baseId;if(Y+="var "+B+" = errors;var "+H+";",Array.isArray(G)){var R=Q.schema.additionalItems;if(R===!1){Y+=" "+H+" = "+F+".length <= "+G.length+"; ";var I=U;U=Q.errSchemaPath+"/additionalItems",Y+=" if (!"+H+") { ";var w=w||[];if(w.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { limit: "+G.length+" } ",Q.opts.messages!==!1)Y+=" , message: 'should NOT have more than "+G.length+" items' ";if(Q.opts.verbose)Y+=" , schema: false , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var E=Y;if(Y=w.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+E+"]); ";else Y+=" validate.errors = ["+E+"]; return false; ";else Y+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" } ",U=I,W)V+="}",Y+=" else { "}var $=G;if($){var P,C=-1,k=$.length-1;while(C<k)if(P=$[C+=1],Q.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:Q.util.schemaHasRules(P,Q.RULES.all)){Y+=" "+N+" = true; if ("+F+".length > "+C+") { ";var g=F+"["+C+"]";M.schema=P,M.schemaPath=z+"["+C+"]",M.errSchemaPath=U+"/"+C,M.errorPath=Q.util.getPathExpr(Q.errorPath,C,Q.opts.jsonPointers,!0),M.dataPathArr[A]=C;var T=Q.validate(M);if(M.baseId=j,Q.util.varOccurences(T,O)<2)Y+=" "+Q.util.varReplace(T,O,g)+" ";else Y+=" var "+O+" = "+g+"; "+T+" ";if(Y+=" } ",W)Y+=" if ("+N+") { ",V+="}"}}if(typeof R=="object"&&(Q.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:Q.util.schemaHasRules(R,Q.RULES.all))){M.schema=R,M.schemaPath=Q.schemaPath+".additionalItems",M.errSchemaPath=Q.errSchemaPath+"/additionalItems",Y+=" "+N+" = true; if ("+F+".length > "+G.length+") { for (var "+L+" = "+G.length+"; "+L+" < "+F+".length; "+L+"++) { ",M.errorPath=Q.util.getPathExpr(Q.errorPath,L,Q.opts.jsonPointers,!0);var g=F+"["+L+"]";M.dataPathArr[A]=L;var T=Q.validate(M);if(M.baseId=j,Q.util.varOccurences(T,O)<2)Y+=" "+Q.util.varReplace(T,O,g)+" ";else Y+=" var "+O+" = "+g+"; "+T+" ";if(W)Y+=" if (!"+N+") break; ";if(Y+=" } } ",W)Y+=" if ("+N+") { ",V+="}"}}else if(Q.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:Q.util.schemaHasRules(G,Q.RULES.all)){M.schema=G,M.schemaPath=z,M.errSchemaPath=U,Y+=" for (var "+L+" = 0; "+L+" < "+F+".length; "+L+"++) { ",M.errorPath=Q.util.getPathExpr(Q.errorPath,L,Q.opts.jsonPointers,!0);var g=F+"["+L+"]";M.dataPathArr[A]=L;var T=Q.validate(M);if(M.baseId=j,Q.util.varOccurences(T,O)<2)Y+=" "+Q.util.varReplace(T,O,g)+" ";else Y+=" var "+O+" = "+g+"; "+T+" ";if(W)Y+=" if (!"+N+") break; ";Y+=" }"}if(W)Y+=" "+V+" if ("+B+" == errors) {";return Y}});var nG1=e((HD9,rs1)=>{rs1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,j,F="data"+(q||""),H=Q.opts.$data&&G&&G.$data,B;if(H)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",B="schema"+K;else B=G;var M=Z=="maximum",V=M?"exclusiveMaximum":"exclusiveMinimum",N=Q.schema[V],L=Q.opts.$data&&N&&N.$data,A=M?"<":">",O=M?">":"<",j=void 0;if(!(H||typeof G=="number"||G===void 0))throw Error(Z+" must be number");if(!(L||N===void 0||typeof N=="number"||typeof N=="boolean"))throw Error(V+" must be number or boolean");if(L){var R=Q.util.getData(N.$data,q,Q.dataPathArr),I="exclusive"+K,w="exclType"+K,E="exclIsNumber"+K,$="op"+K,P="' + "+$+" + '";Y+=" var schemaExcl"+K+" = "+R+"; ",R="schemaExcl"+K,Y+=" var "+I+"; var "+w+" = typeof "+R+"; if ("+w+" != 'boolean' && "+w+" != 'undefined' && "+w+" != 'number') { ";var j=V,C=C||[];if(C.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(j||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: {} ",Q.opts.messages!==!1)Y+=" , message: '"+V+" should be boolean' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var k=Y;if(Y=C.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+k+"]); ";else Y+=" validate.errors = ["+k+"]; return false; ";else Y+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" } else if ( ",H)Y+=" ("+B+" !== undefined && typeof "+B+" != 'number') || ";if(Y+=" "+w+" == 'number' ? ( ("+I+" = "+B+" === undefined || "+R+" "+A+"= "+B+") ? "+F+" "+O+"= "+R+" : "+F+" "+O+" "+B+" ) : ( ("+I+" = "+R+" === true) ? "+F+" "+O+"= "+B+" : "+F+" "+O+" "+B+" ) || "+F+" !== "+F+") { var op"+K+" = "+I+" ? '"+A+"' : '"+A+"='; ",G===void 0)j=V,U=Q.errSchemaPath+"/"+V,B=R,H=L}else{var E=typeof N=="number",P=A;if(E&&H){var $="'"+P+"'";if(Y+=" if ( ",H)Y+=" ("+B+" !== undefined && typeof "+B+" != 'number') || ";Y+=" ( "+B+" === undefined || "+N+" "+A+"= "+B+" ? "+F+" "+O+"= "+N+" : "+F+" "+O+" "+B+" ) || "+F+" !== "+F+") { "}else{if(E&&G===void 0)I=!0,j=V,U=Q.errSchemaPath+"/"+V,B=N,O+="=";else{if(E)B=Math[M?"min":"max"](N,G);if(N===(E?B:!0))I=!0,j=V,U=Q.errSchemaPath+"/"+V,O+="=";else I=!1,P+="="}var $="'"+P+"'";if(Y+=" if ( ",H)Y+=" ("+B+" !== undefined && typeof "+B+" != 'number') || ";Y+=" "+F+" "+O+" "+B+" || "+F+" !== "+F+") { "}}j=j||Z;var C=C||[];if(C.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(j||"_limit")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { comparison: "+$+", limit: "+B+", exclusive: "+I+" } ",Q.opts.messages!==!1)if(Y+=" , message: 'should be "+P+" ",H)Y+="' + "+B;else Y+=""+B+"'";if(Q.opts.verbose){if(Y+=" , schema: ",H)Y+="validate.schema"+z;else Y+=""+G;Y+=" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" "}Y+=" } "}else Y+=" {} ";var k=Y;if(Y=C.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+k+"]); ";else Y+=" validate.errors = ["+k+"]; return false; ";else Y+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" } ",W)Y+=" else { ";return Y}});var aG1=e((BD9,ss1)=>{ss1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,V,F="data"+(q||""),H=Q.opts.$data&&G&&G.$data,B;if(H)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",B="schema"+K;else B=G;if(!(H||typeof G=="number"))throw Error(Z+" must be number");var M=Z=="maxItems"?">":"<";if(Y+="if ( ",H)Y+=" ("+B+" !== undefined && typeof "+B+" != 'number') || ";Y+=" "+F+".length "+M+" "+B+") { ";var V=Z,N=N||[];if(N.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(V||"_limitItems")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { limit: "+B+" } ",Q.opts.messages!==!1){if(Y+=" , message: 'should NOT have ",Z=="maxItems")Y+="more";else Y+="fewer";if(Y+=" than ",H)Y+="' + "+B+" + '";else Y+=""+G;Y+=" items' "}if(Q.opts.verbose){if(Y+=" , schema: ",H)Y+="validate.schema"+z;else Y+=""+G;Y+=" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" "}Y+=" } "}else Y+=" {} ";var L=Y;if(Y=N.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+L+"]); ";else Y+=" validate.errors = ["+L+"]; return false; ";else Y+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+="} ",W)Y+=" else { ";return Y}});var rG1=e((DD9,os1)=>{os1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,V,F="data"+(q||""),H=Q.opts.$data&&G&&G.$data,B;if(H)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",B="schema"+K;else B=G;if(!(H||typeof G=="number"))throw Error(Z+" must be number");var M=Z=="maxLength"?">":"<";if(Y+="if ( ",H)Y+=" ("+B+" !== undefined && typeof "+B+" != 'number') || ";if(Q.opts.unicode===!1)Y+=" "+F+".length ";else Y+=" ucs2length("+F+") ";Y+=" "+M+" "+B+") { ";var V=Z,N=N||[];if(N.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(V||"_limitLength")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { limit: "+B+" } ",Q.opts.messages!==!1){if(Y+=" , message: 'should NOT be ",Z=="maxLength")Y+="longer";else Y+="shorter";if(Y+=" than ",H)Y+="' + "+B+" + '";else Y+=""+G;Y+=" characters' "}if(Q.opts.verbose){if(Y+=" , schema: ",H)Y+="validate.schema"+z;else Y+=""+G;Y+=" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" "}Y+=" } "}else Y+=" {} ";var L=Y;if(Y=N.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+L+"]); ";else Y+=" validate.errors = ["+L+"]; return false; ";else Y+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+="} ",W)Y+=" else { ";return Y}});var sG1=e((MD9,ts1)=>{ts1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,V,F="data"+(q||""),H=Q.opts.$data&&G&&G.$data,B;if(H)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",B="schema"+K;else B=G;if(!(H||typeof G=="number"))throw Error(Z+" must be number");var M=Z=="maxProperties"?">":"<";if(Y+="if ( ",H)Y+=" ("+B+" !== undefined && typeof "+B+" != 'number') || ";Y+=" Object.keys("+F+").length "+M+" "+B+") { ";var V=Z,N=N||[];if(N.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(V||"_limitProperties")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { limit: "+B+" } ",Q.opts.messages!==!1){if(Y+=" , message: 'should NOT have ",Z=="maxProperties")Y+="more";else Y+="fewer";if(Y+=" than ",H)Y+="' + "+B+" + '";else Y+=""+G;Y+=" properties' "}if(Q.opts.verbose){if(Y+=" , schema: ",H)Y+="validate.schema"+z;else Y+=""+G;Y+=" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" "}Y+=" } "}else Y+=" {} ";var L=Y;if(Y=N.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+L+"]); ";else Y+=" validate.errors = ["+L+"]; return false; ";else Y+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+="} ",W)Y+=" else { ";return Y}});var Jo1=e((VD9,es1)=>{es1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H=Q.opts.$data&&G&&G.$data,B;if(H)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",B="schema"+K;else B=G;if(!(H||typeof G=="number"))throw Error(Z+" must be number");if(Y+="var division"+K+";if (",H)Y+=" "+B+" !== undefined && ( typeof "+B+" != 'number' || ";if(Y+=" (division"+K+" = "+F+" / "+B+", ",Q.opts.multipleOfPrecision)Y+=" Math.abs(Math.round(division"+K+") - division"+K+") > 1e-"+Q.opts.multipleOfPrecision+" ";else Y+=" division"+K+" !== parseInt(division"+K+") ";if(Y+=" ) ",H)Y+=" ) ";Y+=" ) { ";var M=M||[];if(M.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { multipleOf: "+B+" } ",Q.opts.messages!==!1)if(Y+=" , message: 'should be multiple of ",H)Y+="' + "+B;else Y+=""+B+"'";if(Q.opts.verbose){if(Y+=" , schema: ",H)Y+="validate.schema"+z;else Y+=""+G;Y+=" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" "}Y+=" } "}else Y+=" {} ";var V=Y;if(Y=M.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+V+"]); ";else Y+=" validate.errors = ["+V+"]; return false; ";else Y+=" var err = "+V+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+="} ",W)Y+=" else { ";return Y}});var Zo1=e((ND9,Qo1)=>{Qo1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="errs__"+K,B=Q.util.copy(Q);B.level++;var M="valid"+B.level;if(Q.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:Q.util.schemaHasRules(G,Q.RULES.all)){B.schema=G,B.schemaPath=z,B.errSchemaPath=U,Y+=" var "+H+" = errors; ";var V=Q.compositeRule;Q.compositeRule=B.compositeRule=!0,B.createErrors=!1;var N;if(B.opts.allErrors)N=B.opts.allErrors,B.opts.allErrors=!1;if(Y+=" "+Q.validate(B)+" ",B.createErrors=!0,N)B.opts.allErrors=N;Q.compositeRule=B.compositeRule=V,Y+=" if ("+M+") { ";var L=L||[];if(L.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'not' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: {} ",Q.opts.messages!==!1)Y+=" , message: 'should NOT be valid' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var A=Y;if(Y=L.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+A+"]); ";else Y+=" validate.errors = ["+A+"]; return false; ";else Y+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" } else { errors = "+H+"; if (vErrors !== null) { if ("+H+") vErrors.length = "+H+"; else vErrors = null; } ",Q.opts.allErrors)Y+=" } "}else{if(Y+=" var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'not' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: {} ",Q.opts.messages!==!1)Y+=" , message: 'should NOT be valid' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";if(Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",W)Y+=" if (false) { "}return Y}});var Yo1=e((LD9,Xo1)=>{Xo1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B="errs__"+K,M=Q.util.copy(Q),V="";M.level++;var N="valid"+M.level,L=M.baseId,A="prevValid"+K,O="passingSchemas"+K;Y+="var "+B+" = errors , "+A+" = false , "+H+" = false , "+O+" = null; ";var j=Q.compositeRule;Q.compositeRule=M.compositeRule=!0;var R=G;if(R){var I,w=-1,E=R.length-1;while(w<E){if(I=R[w+=1],Q.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===!1:Q.util.schemaHasRules(I,Q.RULES.all))M.schema=I,M.schemaPath=z+"["+w+"]",M.errSchemaPath=U+"/"+w,Y+=" "+Q.validate(M)+" ",M.baseId=L;else Y+=" var "+N+" = true; ";if(w)Y+=" if ("+N+" && "+A+") { "+H+" = false; "+O+" = ["+O+", "+w+"]; } else { ",V+="}";Y+=" if ("+N+") { "+H+" = "+A+" = true; "+O+" = "+w+"; }"}}if(Q.compositeRule=M.compositeRule=j,Y+=""+V+"if (!"+H+") { var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { passingSchemas: "+O+" } ",Q.opts.messages!==!1)Y+=" , message: 'should match exactly one schema in oneOf' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";if(Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(vErrors); ";else Y+=" validate.errors = vErrors; return false; ";if(Y+="} else { errors = "+B+"; if (vErrors !== null) { if ("+B+") vErrors.length = "+B+"; else vErrors = null; }",Q.opts.allErrors)Y+=" } ";return Y}});var qo1=e((AD9,Ko1)=>{Ko1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H=Q.opts.$data&&G&&G.$data,B;if(H)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",B="schema"+K;else B=G;var M=H?"(new RegExp("+B+"))":Q.usePattern(G);if(Y+="if ( ",H)Y+=" ("+B+" !== undefined && typeof "+B+" != 'string') || ";Y+=" !"+M+".test("+F+") ) { ";var V=V||[];if(V.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { pattern: ",H)Y+=""+B;else Y+=""+Q.util.toQuotedString(G);if(Y+=" } ",Q.opts.messages!==!1){if(Y+=` , message: 'should match pattern "`,H)Y+="' + "+B+" + '";else Y+=""+Q.util.escapeQuotes(G);Y+=`"' `}if(Q.opts.verbose){if(Y+=" , schema: ",H)Y+="validate.schema"+z;else Y+=""+Q.util.toQuotedString(G);Y+=" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" "}Y+=" } "}else Y+=" {} ";var N=Y;if(Y=V.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+N+"]); ";else Y+=" validate.errors = ["+N+"]; return false; ";else Y+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+="} ",W)Y+=" else { ";return Y}});var zo1=e((OD9,Go1)=>{Go1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="errs__"+K,B=Q.util.copy(Q),M="";B.level++;var V="valid"+B.level,N="key"+K,L="idx"+K,A=B.dataLevel=Q.dataLevel+1,O="data"+A,j="dataProperties"+K,R=Object.keys(G||{}).filter(S),I=Q.schema.patternProperties||{},w=Object.keys(I).filter(S),E=Q.schema.additionalProperties,$=R.length||w.length,P=E===!1,C=typeof E=="object"&&Object.keys(E).length,k=Q.opts.removeAdditional,g=P||C||k,T=Q.opts.ownProperties,v=Q.baseId,f=Q.schema.required;if(f&&!(Q.opts.$data&&f.$data)&&f.length<Q.opts.loopRequired)var h=Q.util.toHash(f);function S(t){return t!=="__proto__"}if(Y+="var "+H+" = errors;var "+V+" = true;",T)Y+=" var "+j+" = undefined;";if(g){if(T)Y+=" "+j+" = "+j+" || Object.keys("+F+"); for (var "+L+"=0; "+L+"<"+j+".length; "+L+"++) { var "+N+" = "+j+"["+L+"]; ";else Y+=" for (var "+N+" in "+F+") { ";if($){if(Y+=" var isAdditional"+K+" = !(false ",R.length)if(R.length>8)Y+=" || validate.schema"+z+".hasOwnProperty("+N+") ";else{var x=R;if(x){var b,m=-1,a=x.length-1;while(m<a)b=x[m+=1],Y+=" || "+N+" == "+Q.util.toQuotedString(b)+" "}}if(w.length){var p=w;if(p){var Q1,z1=-1,F1=p.length-1;while(z1<F1)Q1=p[z1+=1],Y+=" || "+Q.usePattern(Q1)+".test("+N+") "}}Y+=" ); if (isAdditional"+K+") { "}if(k=="all")Y+=" delete "+F+"["+N+"]; ";else{var X1=Q.errorPath,H1="' + "+N+" + '";if(Q.opts._errorDataPathProperty)Q.errorPath=Q.util.getPathExpr(Q.errorPath,N,Q.opts.jsonPointers);if(P)if(k)Y+=" delete "+F+"["+N+"]; ";else{Y+=" "+V+" = false; ";var l=U;U=Q.errSchemaPath+"/additionalProperties";var d=d||[];if(d.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { additionalProperty: '"+H1+"' } ",Q.opts.messages!==!1){if(Y+=" , message: '",Q.opts._errorDataPathProperty)Y+="is an invalid additional property";else Y+="should NOT have additional properties";Y+="' "}if(Q.opts.verbose)Y+=" , schema: false , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var i=Y;if(Y=d.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+i+"]); ";else Y+=" validate.errors = ["+i+"]; return false; ";else Y+=" var err = "+i+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(U=l,W)Y+=" break; "}else if(C)if(k=="failing"){Y+=" var "+H+" = errors; ";var r=Q.compositeRule;Q.compositeRule=B.compositeRule=!0,B.schema=E,B.schemaPath=Q.schemaPath+".additionalProperties",B.errSchemaPath=Q.errSchemaPath+"/additionalProperties",B.errorPath=Q.opts._errorDataPathProperty?Q.errorPath:Q.util.getPathExpr(Q.errorPath,N,Q.opts.jsonPointers);var o=F+"["+N+"]";B.dataPathArr[A]=N;var K1=Q.validate(B);if(B.baseId=v,Q.util.varOccurences(K1,O)<2)Y+=" "+Q.util.varReplace(K1,O,o)+" ";else Y+=" var "+O+" = "+o+"; "+K1+" ";Y+=" if (!"+V+") { errors = "+H+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+F+"["+N+"]; } ",Q.compositeRule=B.compositeRule=r}else{B.schema=E,B.schemaPath=Q.schemaPath+".additionalProperties",B.errSchemaPath=Q.errSchemaPath+"/additionalProperties",B.errorPath=Q.opts._errorDataPathProperty?Q.errorPath:Q.util.getPathExpr(Q.errorPath,N,Q.opts.jsonPointers);var o=F+"["+N+"]";B.dataPathArr[A]=N;var K1=Q.validate(B);if(B.baseId=v,Q.util.varOccurences(K1,O)<2)Y+=" "+Q.util.varReplace(K1,O,o)+" ";else Y+=" var "+O+" = "+o+"; "+K1+" ";if(W)Y+=" if (!"+V+") break; "}Q.errorPath=X1}if($)Y+=" } ";if(Y+=" } ",W)Y+=" if ("+V+") { ",M+="}"}var Z1=Q.opts.useDefaults&&!Q.compositeRule;if(R.length){var B1=R;if(B1){var b,U1=-1,W1=B1.length-1;while(U1<W1){b=B1[U1+=1];var j1=G[b];if(Q.opts.strictKeywords?typeof j1=="object"&&Object.keys(j1).length>0||j1===!1:Q.util.schemaHasRules(j1,Q.RULES.all)){var D1=Q.util.getProperty(b),o=F+D1,d1=Z1&&j1.default!==void 0;B.schema=j1,B.schemaPath=z+D1,B.errSchemaPath=U+"/"+Q.util.escapeFragment(b),B.errorPath=Q.util.getPath(Q.errorPath,b,Q.opts.jsonPointers),B.dataPathArr[A]=Q.util.toQuotedString(b);var K1=Q.validate(B);if(B.baseId=v,Q.util.varOccurences(K1,O)<2){K1=Q.util.varReplace(K1,O,o);var n1=o}else{var n1=O;Y+=" var "+O+" = "+o+"; "}if(d1)Y+=" "+K1+" ";else{if(h&&h[b]){if(Y+=" if ( "+n1+" === undefined ",T)Y+=" || ! Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(b)+"') ";Y+=") { "+V+" = false; ";var X1=Q.errorPath,l=U,r1=Q.util.escapeQuotes(b);if(Q.opts._errorDataPathProperty)Q.errorPath=Q.util.getPath(X1,b,Q.opts.jsonPointers);U=Q.errSchemaPath+"/required";var d=d||[];if(d.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'required' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { missingProperty: '"+r1+"' } ",Q.opts.messages!==!1){if(Y+=" , message: '",Q.opts._errorDataPathProperty)Y+="is a required property";else Y+="should have required property \\'"+r1+"\\'";Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var i=Y;if(Y=d.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+i+"]); ";else Y+=" validate.errors = ["+i+"]; return false; ";else Y+=" var err = "+i+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";U=l,Q.errorPath=X1,Y+=" } else { "}else if(W){if(Y+=" if ( "+n1+" === undefined ",T)Y+=" || ! Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(b)+"') ";Y+=") { "+V+" = true; } else { "}else{if(Y+=" if ("+n1+" !== undefined ",T)Y+=" && Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(b)+"') ";Y+=" ) { "}Y+=" "+K1+" } "}}if(W)Y+=" if ("+V+") { ",M+="}"}}}if(w.length){var u1=w;if(u1){var Q1,a1=-1,V1=u1.length-1;while(a1<V1){Q1=u1[a1+=1];var j1=I[Q1];if(Q.opts.strictKeywords?typeof j1=="object"&&Object.keys(j1).length>0||j1===!1:Q.util.schemaHasRules(j1,Q.RULES.all)){if(B.schema=j1,B.schemaPath=Q.schemaPath+".patternProperties"+Q.util.getProperty(Q1),B.errSchemaPath=Q.errSchemaPath+"/patternProperties/"+Q.util.escapeFragment(Q1),T)Y+=" "+j+" = "+j+" || Object.keys("+F+"); for (var "+L+"=0; "+L+"<"+j+".length; "+L+"++) { var "+N+" = "+j+"["+L+"]; ";else Y+=" for (var "+N+" in "+F+") { ";Y+=" if ("+Q.usePattern(Q1)+".test("+N+")) { ",B.errorPath=Q.util.getPathExpr(Q.errorPath,N,Q.opts.jsonPointers);var o=F+"["+N+"]";B.dataPathArr[A]=N;var K1=Q.validate(B);if(B.baseId=v,Q.util.varOccurences(K1,O)<2)Y+=" "+Q.util.varReplace(K1,O,o)+" ";else Y+=" var "+O+" = "+o+"; "+K1+" ";if(W)Y+=" if (!"+V+") break; ";if(Y+=" } ",W)Y+=" else "+V+" = true; ";if(Y+=" } ",W)Y+=" if ("+V+") { ",M+="}"}}}}if(W)Y+=" "+M+" if ("+H+" == errors) {";return Y}});var Wo1=e((jD9,Uo1)=>{Uo1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="errs__"+K,B=Q.util.copy(Q),M="";B.level++;var V="valid"+B.level;if(Y+="var "+H+" = errors;",Q.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:Q.util.schemaHasRules(G,Q.RULES.all)){B.schema=G,B.schemaPath=z,B.errSchemaPath=U;var N="key"+K,L="idx"+K,A="i"+K,O="' + "+N+" + '",j=B.dataLevel=Q.dataLevel+1,R="data"+j,I="dataProperties"+K,w=Q.opts.ownProperties,E=Q.baseId;if(w)Y+=" var "+I+" = undefined; ";if(w)Y+=" "+I+" = "+I+" || Object.keys("+F+"); for (var "+L+"=0; "+L+"<"+I+".length; "+L+"++) { var "+N+" = "+I+"["+L+"]; ";else Y+=" for (var "+N+" in "+F+") { ";Y+=" var startErrs"+K+" = errors; ";var $=N,P=Q.compositeRule;Q.compositeRule=B.compositeRule=!0;var C=Q.validate(B);if(B.baseId=E,Q.util.varOccurences(C,R)<2)Y+=" "+Q.util.varReplace(C,R,$)+" ";else Y+=" var "+R+" = "+$+"; "+C+" ";if(Q.compositeRule=B.compositeRule=P,Y+=" if (!"+V+") { for (var "+A+"=startErrs"+K+"; "+A+"<errors; "+A+"++) { vErrors["+A+"].propertyName = "+N+"; } var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { propertyName: '"+O+"' } ",Q.opts.messages!==!1)Y+=" , message: 'property name \\'"+O+"\\' is invalid' ";if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";if(Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(vErrors); ";else Y+=" validate.errors = vErrors; return false; ";if(W)Y+=" break; ";Y+=" } }"}if(W)Y+=" "+M+" if ("+H+" == errors) {";return Y}});var Ho1=e((RD9,Fo1)=>{Fo1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B=Q.opts.$data&&G&&G.$data,M;if(B)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",M="schema"+K;else M=G;var V="schema"+K;if(!B)if(G.length<Q.opts.loopRequired&&Q.schema.properties&&Object.keys(Q.schema.properties).length){var N=[],L=G;if(L){var A,O=-1,j=L.length-1;while(O<j){A=L[O+=1];var R=Q.schema.properties[A];if(!(R&&(Q.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:Q.util.schemaHasRules(R,Q.RULES.all))))N[N.length]=A}}}else var N=G;if(B||N.length){var I=Q.errorPath,w=B||N.length>=Q.opts.loopRequired,E=Q.opts.ownProperties;if(W)if(Y+=" var missing"+K+"; ",w){if(!B)Y+=" var "+V+" = validate.schema"+z+"; ";var $="i"+K,P="schema"+K+"["+$+"]",C="' + "+P+" + '";if(Q.opts._errorDataPathProperty)Q.errorPath=Q.util.getPathExpr(I,P,Q.opts.jsonPointers);if(Y+=" var "+H+" = true; ",B)Y+=" if (schema"+K+" === undefined) "+H+" = true; else if (!Array.isArray(schema"+K+")) "+H+" = false; else {";if(Y+=" for (var "+$+" = 0; "+$+" < "+V+".length; "+$+"++) { "+H+" = "+F+"["+V+"["+$+"]] !== undefined ",E)Y+=" && Object.prototype.hasOwnProperty.call("+F+", "+V+"["+$+"]) ";if(Y+="; if (!"+H+") break; } ",B)Y+=" } ";Y+=" if (!"+H+") { ";var k=k||[];if(k.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'required' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { missingProperty: '"+C+"' } ",Q.opts.messages!==!1){if(Y+=" , message: '",Q.opts._errorDataPathProperty)Y+="is a required property";else Y+="should have required property \\'"+C+"\\'";Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var g=Y;if(Y=k.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+g+"]); ";else Y+=" validate.errors = ["+g+"]; return false; ";else Y+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Y+=" } else { "}else{Y+=" if ( ";var T=N;if(T){var v,$=-1,f=T.length-1;while($<f){if(v=T[$+=1],$)Y+=" || ";var h=Q.util.getProperty(v),S=F+h;if(Y+=" ( ( "+S+" === undefined ",E)Y+=" || ! Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(v)+"') ";Y+=") && (missing"+K+" = "+Q.util.toQuotedString(Q.opts.jsonPointers?v:h)+") ) "}}Y+=") { ";var P="missing"+K,C="' + "+P+" + '";if(Q.opts._errorDataPathProperty)Q.errorPath=Q.opts.jsonPointers?Q.util.getPathExpr(I,P,!0):I+" + "+P;var k=k||[];if(k.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'required' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { missingProperty: '"+C+"' } ",Q.opts.messages!==!1){if(Y+=" , message: '",Q.opts._errorDataPathProperty)Y+="is a required property";else Y+="should have required property \\'"+C+"\\'";Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";var g=Y;if(Y=k.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+g+"]); ";else Y+=" validate.errors = ["+g+"]; return false; ";else Y+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Y+=" } else { "}else if(w){if(!B)Y+=" var "+V+" = validate.schema"+z+"; ";var $="i"+K,P="schema"+K+"["+$+"]",C="' + "+P+" + '";if(Q.opts._errorDataPathProperty)Q.errorPath=Q.util.getPathExpr(I,P,Q.opts.jsonPointers);if(B){if(Y+=" if ("+V+" && !Array.isArray("+V+")) { var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'required' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { missingProperty: '"+C+"' } ",Q.opts.messages!==!1){if(Y+=" , message: '",Q.opts._errorDataPathProperty)Y+="is a required property";else Y+="should have required property \\'"+C+"\\'";Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+V+" !== undefined) { "}if(Y+=" for (var "+$+" = 0; "+$+" < "+V+".length; "+$+"++) { if ("+F+"["+V+"["+$+"]] === undefined ",E)Y+=" || ! Object.prototype.hasOwnProperty.call("+F+", "+V+"["+$+"]) ";if(Y+=") { var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'required' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { missingProperty: '"+C+"' } ",Q.opts.messages!==!1){if(Y+=" , message: '",Q.opts._errorDataPathProperty)Y+="is a required property";else Y+="should have required property \\'"+C+"\\'";Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";if(Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",B)Y+=" } "}else{var x=N;if(x){var v,b=-1,m=x.length-1;while(b<m){v=x[b+=1];var h=Q.util.getProperty(v),C=Q.util.escapeQuotes(v),S=F+h;if(Q.opts._errorDataPathProperty)Q.errorPath=Q.util.getPath(I,v,Q.opts.jsonPointers);if(Y+=" if ( "+S+" === undefined ",E)Y+=" || ! Object.prototype.hasOwnProperty.call("+F+", '"+Q.util.escapeQuotes(v)+"') ";if(Y+=") { var err = ",Q.createErrors!==!1){if(Y+=" { keyword: 'required' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { missingProperty: '"+C+"' } ",Q.opts.messages!==!1){if(Y+=" , message: '",Q.opts._errorDataPathProperty)Y+="is a required property";else Y+="should have required property \\'"+C+"\\'";Y+="' "}if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" ";Y+=" } "}else Y+=" {} ";Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}Q.errorPath=I}else if(W)Y+=" if (true) {";return Y}});var Do1=e((wD9,Bo1)=>{Bo1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F="data"+(q||""),H="valid"+K,B=Q.opts.$data&&G&&G.$data,M;if(B)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",M="schema"+K;else M=G;if((G||B)&&Q.opts.uniqueItems!==!1){if(B)Y+=" var "+H+"; if ("+M+" === false || "+M+" === undefined) "+H+" = true; else if (typeof "+M+" != 'boolean') "+H+" = false; else { ";Y+=" var i = "+F+".length , "+H+" = true , j; if (i > 1) { ";var V=Q.schema.items&&Q.schema.items.type,N=Array.isArray(V);if(!V||V=="object"||V=="array"||N&&(V.indexOf("object")>=0||V.indexOf("array")>=0))Y+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+F+"[i], "+F+"[j])) { "+H+" = false; break outer; } } } ";else{Y+=" var itemIndices = {}, item; for (;i--;) { var item = "+F+"[i]; ";var L="checkDataType"+(N?"s":"");if(Y+=" if ("+Q.util[L](V,"item",Q.opts.strictNumbers,!0)+") continue; ",N)Y+=` if (typeof item == 'string') item = '"' + item; `;Y+=" if (typeof itemIndices[item] == 'number') { "+H+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}if(Y+=" } ",B)Y+=" } ";Y+=" if (!"+H+") { ";var A=A||[];if(A.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { i: i, j: j } ",Q.opts.messages!==!1)Y+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' ";if(Q.opts.verbose){if(Y+=" , schema: ",B)Y+="validate.schema"+z;else Y+=""+G;Y+=" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+F+" "}Y+=" } "}else Y+=" {} ";var O=Y;if(Y=A.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+O+"]); ";else Y+=" validate.errors = ["+O+"]; return false; ";else Y+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Y+=" } ",W)Y+=" else { "}else if(W)Y+=" if (true) { ";return Y}});var Vo1=e((ID9,Mo1)=>{Mo1.exports={$ref:Ts1(),allOf:Ss1(),anyOf:ks1(),$comment:bs1(),const:ys1(),contains:hs1(),dependencies:ms1(),enum:ps1(),format:cs1(),if:is1(),items:as1(),maximum:nG1(),minimum:nG1(),maxItems:aG1(),minItems:aG1(),maxLength:rG1(),minLength:rG1(),maxProperties:sG1(),minProperties:sG1(),multipleOf:Jo1(),not:Zo1(),oneOf:Yo1(),pattern:qo1(),properties:zo1(),propertyNames:Wo1(),required:Ho1(),uniqueItems:Do1(),validate:lG1()}});var Ao1=e((ED9,Lo1)=>{var No1=Vo1(),oG1=jN().toHash;Lo1.exports=function(){var Q=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],Z=["type","$comment"],X=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],Y=["number","integer","string","array","object","boolean","null"];return Q.all=oG1(Z),Q.types=oG1(Y),Q.forEach(function(K){if(K.rules=K.rules.map(function(q){var G;if(typeof q=="object"){var z=Object.keys(q)[0];G=q[z],q=z,G.forEach(function(W){Z.push(W),Q.all[W]=!0})}Z.push(q);var U=Q.all[q]={keyword:q,code:No1[q],implements:G};return U}),Q.all.$comment={keyword:"$comment",code:No1.$comment},K.type)Q.types[K.type]=K}),Q.keywords=oG1(Z.concat(X)),Q.custom={},Q}});var Ro1=e(($D9,jo1)=>{var Oo1=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];jo1.exports=function(J,Q){for(var Z=0;Z<Q.length;Z++){J=JSON.parse(JSON.stringify(J));var X=Q[Z].split("/"),Y=J,K;for(K=1;K<X.length;K++)Y=Y[X[K]];for(K=0;K<Oo1.length;K++){var q=Oo1[K],G=Y[q];if(G)Y[q]={anyOf:[G,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}}}return J}});var Eo1=e((PD9,Io1)=>{var wR6=Cc().MissingRef;Io1.exports=wo1;function wo1(J,Q,Z){var X=this;if(typeof this._opts.loadSchema!="function")throw Error("options.loadSchema should be a function");if(typeof Q=="function")Z=Q,Q=void 0;var Y=K(J).then(function(){var G=X._addSchema(J,void 0,Q);return G.validate||q(G)});if(Z)Y.then(function(G){Z(null,G)},Z);return Y;function K(G){var z=G.$schema;return z&&!X.getSchema(z)?wo1.call(X,{$ref:z},!0):Promise.resolve()}function q(G){try{return X._compile(G)}catch(U){if(U instanceof wR6)return z(U);throw U}function z(U){var W=U.missingSchema;if(B(W))throw Error("Schema "+W+" is loaded but "+U.missingRef+" cannot be resolved");var F=X._loadingSchemas[W];if(!F)F=X._loadingSchemas[W]=X._opts.loadSchema(W),F.then(H,H);return F.then(function(M){if(!B(W))return K(M).then(function(){if(!B(W))X.addSchema(M,W,void 0,Q)})}).then(function(){return q(G)});function H(){delete X._loadingSchemas[W]}function B(M){return X._refs[M]||X._schemas[M]}}}}});var Po1=e((TD9,$o1)=>{$o1.exports=function(Q,Z,X){var Y=" ",K=Q.level,q=Q.dataLevel,G=Q.schema[Z],z=Q.schemaPath+Q.util.getProperty(Z),U=Q.errSchemaPath+"/"+Z,W=!Q.opts.allErrors,F,H="data"+(q||""),B="valid"+K,M="errs__"+K,V=Q.opts.$data&&G&&G.$data,N;if(V)Y+=" var schema"+K+" = "+Q.util.getData(G.$data,q,Q.dataPathArr)+"; ",N="schema"+K;else N=G;var L=this,A="definition"+K,O=L.definition,j="",R,I,w,E,$;if(V&&O.$data){$="keywordValidate"+K;var P=O.validateSchema;Y+=" var "+A+" = RULES.custom['"+Z+"'].definition; var "+$+" = "+A+".validate;"}else{if(E=Q.useCustomRule(L,G,Q.schema,Q),!E)return;N="validate.schema"+z,$=E.code,R=O.compile,I=O.inline,w=O.macro}var C=$+".errors",k="i"+K,g="ruleErr"+K,T=O.async;if(T&&!Q.async)throw Error("async keyword in sync schema");if(!(I||w))Y+=""+C+" = null;";if(Y+="var "+M+" = errors;var "+B+";",V&&O.$data){if(j+="}",Y+=" if ("+N+" === undefined) { "+B+" = true; } else { ",P)j+="}",Y+=" "+B+" = "+A+".validateSchema("+N+"); if ("+B+") { "}if(I)if(O.statements)Y+=" "+E.validate+" ";else Y+=" "+B+" = "+E.validate+"; ";else if(w){var v=Q.util.copy(Q),j="";v.level++;var f="valid"+v.level;v.schema=E.validate,v.schemaPath="";var h=Q.compositeRule;Q.compositeRule=v.compositeRule=!0;var S=Q.validate(v).replace(/validate\.schema/g,$);Q.compositeRule=v.compositeRule=h,Y+=" "+S}else{var x=x||[];if(x.push(Y),Y="",Y+=" "+$+".call( ",Q.opts.passContext)Y+="this";else Y+="self";if(R||O.schema===!1)Y+=" , "+H+" ";else Y+=" , "+N+" , "+H+" , validate.schema"+Q.schemaPath+" ";if(Y+=" , (dataPath || '')",Q.errorPath!='""')Y+=" + "+Q.errorPath;var b=q?"data"+(q-1||""):"parentData",m=q?Q.dataPathArr[q]:"parentDataProperty";Y+=" , "+b+" , "+m+" , rootData ) ";var a=Y;if(Y=x.pop(),O.errors===!1){if(Y+=" "+B+" = ",T)Y+="await ";Y+=""+a+"; "}else if(T)C="customErrors"+K,Y+=" var "+C+" = null; try { "+B+" = await "+a+"; } catch (e) { "+B+" = false; if (e instanceof ValidationError) "+C+" = e.errors; else throw e; } ";else Y+=" "+C+" = null; "+B+" = "+a+"; "}if(O.modifying)Y+=" if ("+b+") "+H+" = "+b+"["+m+"];";if(Y+=""+j,O.valid){if(W)Y+=" if (true) { "}else{if(Y+=" if ( ",O.valid===void 0)if(Y+=" !",w)Y+=""+f;else Y+=""+B;else Y+=" "+!O.valid+" ";Y+=") { ",F=L.keyword;var x=x||[];x.push(Y),Y="";var x=x||[];if(x.push(Y),Y="",Q.createErrors!==!1){if(Y+=" { keyword: '"+(F||"custom")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { keyword: '"+L.keyword+"' } ",Q.opts.messages!==!1)Y+=` , message: 'should pass "`+L.keyword+`" keyword validation' `;if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+H+" ";Y+=" } "}else Y+=" {} ";var p=Y;if(Y=x.pop(),!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(["+p+"]); ";else Y+=" validate.errors = ["+p+"]; return false; ";else Y+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var Q1=Y;if(Y=x.pop(),I)if(O.errors){if(O.errors!="full"){if(Y+=" for (var "+k+"="+M+"; "+k+"<errors; "+k+"++) { var "+g+" = vErrors["+k+"]; if ("+g+".dataPath === undefined) "+g+".dataPath = (dataPath || '') + "+Q.errorPath+"; if ("+g+".schemaPath === undefined) { "+g+'.schemaPath = "'+U+'"; } ',Q.opts.verbose)Y+=" "+g+".schema = "+N+"; "+g+".data = "+H+"; ";Y+=" } "}}else if(O.errors===!1)Y+=" "+Q1+" ";else{if(Y+=" if ("+M+" == errors) { "+Q1+" } else { for (var "+k+"="+M+"; "+k+"<errors; "+k+"++) { var "+g+" = vErrors["+k+"]; if ("+g+".dataPath === undefined) "+g+".dataPath = (dataPath || '') + "+Q.errorPath+"; if ("+g+".schemaPath === undefined) { "+g+'.schemaPath = "'+U+'"; } ',Q.opts.verbose)Y+=" "+g+".schema = "+N+"; "+g+".data = "+H+"; ";Y+=" } } "}else if(w){if(Y+=" var err = ",Q.createErrors!==!1){if(Y+=" { keyword: '"+(F||"custom")+"' , dataPath: (dataPath || '') + "+Q.errorPath+" , schemaPath: "+Q.util.toQuotedString(U)+" , params: { keyword: '"+L.keyword+"' } ",Q.opts.messages!==!1)Y+=` , message: 'should pass "`+L.keyword+`" keyword validation' `;if(Q.opts.verbose)Y+=" , schema: validate.schema"+z+" , parentSchema: validate.schema"+Q.schemaPath+" , data: "+H+" ";Y+=" } "}else Y+=" {} ";if(Y+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!Q.compositeRule&&W)if(Q.async)Y+=" throw new ValidationError(vErrors); ";else Y+=" validate.errors = vErrors; return false; "}else if(O.errors===!1)Y+=" "+Q1+" ";else{if(Y+=" if (Array.isArray("+C+")) { if (vErrors === null) vErrors = "+C+"; else vErrors = vErrors.concat("+C+"); errors = vErrors.length; for (var "+k+"="+M+"; "+k+"<errors; "+k+"++) { var "+g+" = vErrors["+k+"]; if ("+g+".dataPath === undefined) "+g+".dataPath = (dataPath || '') + "+Q.errorPath+"; "+g+'.schemaPath = "'+U+'"; ',Q.opts.verbose)Y+=" "+g+".schema = "+N+"; "+g+".data = "+H+"; ";Y+=" } } else { "+Q1+" } "}if(Y+=" } ",W)Y+=" else { "}return Y}});var tG1=e((CD9,IR6)=>{IR6.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var So1=e((SD9,Co1)=>{var To1=tG1();Co1.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:To1.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:To1.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var ko1=e((vD9,vo1)=>{var ER6=/^[a-z_$][a-z0-9_$-]*$/i,$R6=Po1(),PR6=So1();vo1.exports={add:TR6,get:CR6,remove:SR6,validate:eG1};function TR6(J,Q){var Z=this.RULES;if(Z.keywords[J])throw Error("Keyword "+J+" is already defined");if(!ER6.test(J))throw Error("Keyword "+J+" is not a valid identifier");if(Q){this.validateKeyword(Q,!0);var X=Q.type;if(Array.isArray(X))for(var Y=0;Y<X.length;Y++)q(J,X[Y],Q);else q(J,X,Q);var K=Q.metaSchema;if(K){if(Q.$data&&this._opts.$data)K={anyOf:[K,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]};Q.validateSchema=this.compile(K,!0)}}Z.keywords[J]=Z.all[J]=!0;function q(G,z,U){var W;for(var F=0;F<Z.length;F++){var H=Z[F];if(H.type==z){W=H;break}}if(!W)W={type:z,rules:[]},Z.push(W);var B={keyword:G,definition:U,custom:!0,code:$R6,implements:U.implements};W.rules.push(B),Z.custom[G]=B}return this}function CR6(J){var Q=this.RULES.custom[J];return Q?Q.definition:this.RULES.keywords[J]||!1}function SR6(J){var Q=this.RULES;delete Q.keywords[J],delete Q.all[J],delete Q.custom[J];for(var Z=0;Z<Q.length;Z++){var X=Q[Z].rules;for(var Y=0;Y<X.length;Y++)if(X[Y].keyword==J){X.splice(Y,1);break}}return this}function eG1(J,Q){eG1.errors=null;var Z=this._validateKeyword=this._validateKeyword||this.compile(PR6,!0);if(Z(J))return!0;if(eG1.errors=Z.errors,Q)throw Error("custom keyword definition is invalid: "+this.errorsText(Z.errors));else return!1}});var _o1=e((kD9,vR6)=>{vR6.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var do1=e((_D9,po1)=>{var xo1=Hs1(),RN=Tc(),kR6=Ds1(),yo1=hG1(),_R6=cG1(),bR6=$s1(),xR6=Ao1(),fo1=Ro1(),ho1=jN();po1.exports=u4;u4.prototype.validate=fR6;u4.prototype.compile=hR6;u4.prototype.addSchema=gR6;u4.prototype.addMetaSchema=mR6;u4.prototype.validateSchema=uR6;u4.prototype.getSchema=dR6;u4.prototype.removeSchema=lR6;u4.prototype.addFormat=eR6;u4.prototype.errorsText=tR6;u4.prototype._addSchema=iR6;u4.prototype._compile=nR6;u4.prototype.compileAsync=Eo1();var fc=ko1();u4.prototype.addKeyword=fc.add;u4.prototype.getKeyword=fc.get;u4.prototype.removeKeyword=fc.remove;u4.prototype.validateKeyword=fc.validate;var go1=Cc();u4.ValidationError=go1.Validation;u4.MissingRefError=go1.MissingRef;u4.$dataMetaSchema=fo1;var yc="http://json-schema.org/draft-07/schema",bo1=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],yR6=["/properties"];function u4(J){if(!(this instanceof u4))return new u4(J);if(J=this._opts=ho1.copy(J)||{},Kw6(this),this._schemas={},this._refs={},this._fragments={},this._formats=bR6(J.format),this._cache=J.cache||new kR6,this._loadingSchemas={},this._compilations=[],this.RULES=xR6(),this._getId=aR6(J),J.loopRequired=J.loopRequired||1/0,J.errorDataPath=="property")J._errorDataPathProperty=!0;if(J.serialize===void 0)J.serialize=_R6;if(this._metaOpts=Yw6(this),J.formats)Zw6(this);if(J.keywords)Xw6(this);if(Jw6(this),typeof J.meta=="object")this.addMetaSchema(J.meta);if(J.nullable)this.addKeyword("nullable",{metaSchema:{type:"boolean"}});Qw6(this)}function fR6(J,Q){var Z;if(typeof J=="string"){if(Z=this.getSchema(J),!Z)throw Error('no schema with key or ref "'+J+'"')}else{var X=this._addSchema(J);Z=X.validate||this._compile(X)}var Y=Z(Q);if(Z.$async!==!0)this.errors=Z.errors;return Y}function hR6(J,Q){var Z=this._addSchema(J,void 0,Q);return Z.validate||this._compile(Z)}function gR6(J,Q,Z,X){if(Array.isArray(J)){for(var Y=0;Y<J.length;Y++)this.addSchema(J[Y],void 0,Z,X);return this}var K=this._getId(J);if(K!==void 0&&typeof K!="string")throw Error("schema id must be string");return Q=RN.normalizeId(Q||K),uo1(this,Q),this._schemas[Q]=this._addSchema(J,Z,X,!0),this}function mR6(J,Q,Z){return this.addSchema(J,Q,Z,!0),this}function uR6(J,Q){var Z=J.$schema;if(Z!==void 0&&typeof Z!="string")throw Error("$schema must be a string");if(Z=Z||this._opts.defaultMeta||pR6(this),!Z)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var X=this.validate(Z,J);if(!X&&Q){var Y="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(Y);else throw Error(Y)}return X}function pR6(J){var Q=J._opts.meta;return J._opts.defaultMeta=typeof Q=="object"?J._getId(Q)||Q:J.getSchema(yc)?yc:void 0,J._opts.defaultMeta}function dR6(J){var Q=mo1(this,J);switch(typeof Q){case"object":return Q.validate||this._compile(Q);case"string":return this.getSchema(Q);case"undefined":return cR6(this,J)}}function cR6(J,Q){var Z=RN.schema.call(J,{schema:{}},Q);if(Z){var{schema:X,root:Y,baseId:K}=Z,q=xo1.call(J,X,Y,void 0,K);return J._fragments[Q]=new yo1({ref:Q,fragment:!0,schema:X,root:Y,baseId:K,validate:q}),q}}function mo1(J,Q){return Q=RN.normalizeId(Q),J._schemas[Q]||J._refs[Q]||J._fragments[Q]}function lR6(J){if(J instanceof RegExp)return xc(this,this._schemas,J),xc(this,this._refs,J),this;switch(typeof J){case"undefined":return xc(this,this._schemas),xc(this,this._refs),this._cache.clear(),this;case"string":var Q=mo1(this,J);if(Q)this._cache.del(Q.cacheKey);return delete this._schemas[J],delete this._refs[J],this;case"object":var Z=this._opts.serialize,X=Z?Z(J):J;this._cache.del(X);var Y=this._getId(J);if(Y)Y=RN.normalizeId(Y),delete this._schemas[Y],delete this._refs[Y]}return this}function xc(J,Q,Z){for(var X in Q){var Y=Q[X];if(!Y.meta&&(!Z||Z.test(X)))J._cache.del(Y.cacheKey),delete Q[X]}}function iR6(J,Q,Z,X){if(typeof J!="object"&&typeof J!="boolean")throw Error("schema should be object or boolean");var Y=this._opts.serialize,K=Y?Y(J):J,q=this._cache.get(K);if(q)return q;X=X||this._opts.addUsedSchema!==!1;var G=RN.normalizeId(this._getId(J));if(G&&X)uo1(this,G);var z=this._opts.validateSchema!==!1&&!Q,U;if(z&&!(U=G&&G==RN.normalizeId(J.$schema)))this.validateSchema(J,!0);var W=RN.ids.call(this,J),F=new yo1({id:G,schema:J,localRefs:W,cacheKey:K,meta:Z});if(G[0]!="#"&&X)this._refs[G]=F;if(this._cache.put(K,F),z&&U)this.validateSchema(J,!0);return F}function nR6(J,Q){if(J.compiling){if(J.validate=Y,Y.schema=J.schema,Y.errors=null,Y.root=Q?Q:Y,J.schema.$async===!0)Y.$async=!0;return Y}J.compiling=!0;var Z;if(J.meta)Z=this._opts,this._opts=this._metaOpts;var X;try{X=xo1.call(this,J.schema,Q,J.localRefs)}catch(K){throw delete J.validate,K}finally{if(J.compiling=!1,J.meta)this._opts=Z}return J.validate=X,J.refs=X.refs,J.refVal=X.refVal,J.root=X.root,X;function Y(){var K=J.validate,q=K.apply(this,arguments);return Y.errors=K.errors,q}}function aR6(J){switch(J.schemaId){case"auto":return oR6;case"id":return rR6;default:return sR6}}function rR6(J){if(J.$id)this.logger.warn("schema $id ignored",J.$id);return J.id}function sR6(J){if(J.id)this.logger.warn("schema id ignored",J.id);return J.$id}function oR6(J){if(J.$id&&J.id&&J.$id!=J.id)throw Error("schema $id is different from id");return J.$id||J.id}function tR6(J,Q){if(J=J||this.errors,!J)return"No errors";Q=Q||{};var Z=Q.separator===void 0?", ":Q.separator,X=Q.dataVar===void 0?"data":Q.dataVar,Y="";for(var K=0;K<J.length;K++){var q=J[K];if(q)Y+=X+q.dataPath+" "+q.message+Z}return Y.slice(0,-Z.length)}function eR6(J,Q){if(typeof Q=="string")Q=new RegExp(Q);return this._formats[J]=Q,this}function Jw6(J){var Q;if(J._opts.$data)Q=_o1(),J.addMetaSchema(Q,Q.$id,!0);if(J._opts.meta===!1)return;var Z=tG1();if(J._opts.$data)Z=fo1(Z,yR6);J.addMetaSchema(Z,yc,!0),J._refs["http://json-schema.org/schema"]=yc}function Qw6(J){var Q=J._opts.schemas;if(!Q)return;if(Array.isArray(Q))J.addSchema(Q);else for(var Z in Q)J.addSchema(Q[Z],Z)}function Zw6(J){for(var Q in J._opts.formats){var Z=J._opts.formats[Q];J.addFormat(Q,Z)}}function Xw6(J){for(var Q in J._opts.keywords){var Z=J._opts.keywords[Q];J.addKeyword(Q,Z)}}function uo1(J,Q){if(J._schemas[Q]||J._refs[Q])throw Error('schema with key or id "'+Q+'" already exists')}function Yw6(J){var Q=ho1.copy(J._opts);for(var Z=0;Z<bo1.length;Z++)delete Q[bo1[Z]];return Q}function Kw6(J){var Q=J._opts.logger;if(Q===!1)J.logger={log:Jz1,warn:Jz1,error:Jz1};else{if(Q===void 0)Q=console;if(!(typeof Q=="object"&&Q.log&&Q.warn&&Q.error))throw Error("logger must implement log, warn and error methods");J.logger=Q}}function Jz1(){}});var co1,dS;var lo1=u(()=>{pr1();KW();co1=p6(do1(),1);dS=class dS extends SG1{constructor(J,Q){var Z;super(Q);this._clientInfo=J,this._cachedToolOutputValidators=new Map,this._capabilities=(Z=Q===null||Q===void 0?void 0:Q.capabilities)!==null&&Z!==void 0?Z:{},this._ajv=new co1.default}registerCapabilities(J){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=ur1(this._capabilities,J)}assertCapability(J,Q){var Z;if(!((Z=this._serverCapabilities)===null||Z===void 0?void 0:Z[J]))throw Error(`Server does not support ${J} (required for ${Q})`)}async connect(J,Q){if(await super.connect(J),J.sessionId!==void 0)return;try{let Z=await this.request({method:"initialize",params:{protocolVersion:KR,capabilities:this._capabilities,clientInfo:this._clientInfo}},DG1,Q);if(Z===void 0)throw Error(`Server sent invalid initialize result: ${Z}`);if(!wr1.includes(Z.protocolVersion))throw Error(`Server's protocol version is not supported: ${Z.protocolVersion}`);if(this._serverCapabilities=Z.capabilities,this._serverVersion=Z.serverInfo,J.setProtocolVersion)J.setProtocolVersion(Z.protocolVersion);this._instructions=Z.instructions,await this.notification({method:"notifications/initialized"})}catch(Z){throw this.close(),Z}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(J){var Q,Z,X,Y,K;switch(J){case"logging/setLevel":if(!((Q=this._serverCapabilities)===null||Q===void 0?void 0:Q.logging))throw Error(`Server does not support logging (required for ${J})`);break;case"prompts/get":case"prompts/list":if(!((Z=this._serverCapabilities)===null||Z===void 0?void 0:Z.prompts))throw Error(`Server does not support prompts (required for ${J})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!((X=this._serverCapabilities)===null||X===void 0?void 0:X.resources))throw Error(`Server does not support resources (required for ${J})`);if(J==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${J})`);break;case"tools/call":case"tools/list":if(!((Y=this._serverCapabilities)===null||Y===void 0?void 0:Y.tools))throw Error(`Server does not support tools (required for ${J})`);break;case"completion/complete":if(!((K=this._serverCapabilities)===null||K===void 0?void 0:K.completions))throw Error(`Server does not support completions (required for ${J})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(J){var Q;switch(J){case"notifications/roots/list_changed":if(!((Q=this._capabilities.roots)===null||Q===void 0?void 0:Q.listChanged))throw Error(`Client does not support roots list changed notifications (required for ${J})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(J){switch(J){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${J})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${J})`);break;case"roots/list":if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${J})`);break;case"ping":break}}async ping(J){return this.request({method:"ping"},ON,J)}async complete(J,Q){return this.request({method:"completion/complete",params:J},CG1,Q)}async setLoggingLevel(J,Q){return this.request({method:"logging/setLevel",params:{level:J}},ON,Q)}async getPrompt(J,Q){return this.request({method:"prompts/get",params:J},IG1,Q)}async listPrompts(J,Q){return this.request({method:"prompts/list",params:J},OG1,Q)}async listResources(J,Q){return this.request({method:"resources/list",params:J},VG1,Q)}async listResourceTemplates(J,Q){return this.request({method:"resources/templates/list",params:J},NG1,Q)}async readResource(J,Q){return this.request({method:"resources/read",params:J},LG1,Q)}async subscribeResource(J,Q){return this.request({method:"resources/subscribe",params:J},ON,Q)}async unsubscribeResource(J,Q){return this.request({method:"resources/unsubscribe",params:J},ON,Q)}async callTool(J,Q=Oc,Z){let X=await this.request({method:"tools/call",params:J},Q,Z),Y=this.getToolOutputValidator(J.name);if(Y){if(!X.structuredContent&&!X.isError)throw new rK(AY.InvalidRequest,`Tool ${J.name} has an output schema but did not return structured content`);if(X.structuredContent)try{if(!Y(X.structuredContent))throw new rK(AY.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(Y.errors)}`)}catch(K){if(K instanceof rK)throw K;throw new rK(AY.InvalidParams,`Failed to validate structured content: ${K instanceof Error?K.message:String(K)}`)}}return X}cacheToolOutputSchemas(J){this._cachedToolOutputValidators.clear();for(let Q of J)if(Q.outputSchema)try{let Z=this._ajv.compile(Q.outputSchema);this._cachedToolOutputValidators.set(Q.name,Z)}catch(Z){}}getToolOutputValidator(J){return this._cachedToolOutputValidators.get(J)}async listTools(J,Q){let Z=await this.request({method:"tools/list",params:J},$G1,Q);return this.cacheToolOutputSchemas(Z.tools),Z}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}});function Qz1(J){}function hc(J){if(typeof J=="function")throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:Q=Qz1,onError:Z=Qz1,onRetry:X=Qz1,onComment:Y}=J,K="",q=!0,G,z="",U="";function W(V){let N=q?V.replace(/^\xEF\xBB\xBF/,""):V,[L,A]=qw6(`${K}${N}`);for(let O of L)F(O);K=A,q=!1}function F(V){if(V===""){B();return}if(V.startsWith(":")){Y&&Y(V.slice(V.startsWith(": ")?2:1));return}let N=V.indexOf(":");if(N!==-1){let L=V.slice(0,N),A=V[N+1]===" "?2:1,O=V.slice(N+A);H(L,O,V);return}H(V,"",V)}function H(V,N,L){switch(V){case"event":U=N;break;case"data":z=`${z}${N}
46
46
  `;break;case"id":G=N.includes("\x00")?void 0:N;break;case"retry":/^\d+$/.test(N)?X(parseInt(N,10)):Z(new Zz1(`Invalid \`retry\` value: "${N}"`,{type:"invalid-retry",value:N,line:L}));break;default:Z(new Zz1(`Unknown field "${V.length>20?`${V.slice(0,20)}…`:V}"`,{type:"unknown-field",field:V,value:N,line:L}));break}}function B(){z.length>0&&Q({id:G,event:U||void 0,data:z.endsWith(`
47
47
  `)?z.slice(0,-1):z}),G=void 0,z="",U=""}function M(V={}){K&&V.consume&&F(K),q=!0,G=void 0,z="",U="",K=""}return{feed:W,reset:M}}function qw6(J){let Q=[],Z="",X=0;for(;X<J.length;){let Y=J.indexOf("\r",X),K=J.indexOf(`
48
48
  `,X),q=-1;if(Y!==-1&&K!==-1?q=Math.min(Y,K):Y!==-1?Y===J.length-1?q=-1:q=Y:K!==-1&&(q=K),q===-1){Z=J.slice(X);break}else{let G=J.slice(X,q);Q.push(G),X=q+1,J[X-1]==="\r"&&J[X]===`
@@ -110,7 +110,7 @@ ${Q.join(`
110
110
  <working_directory>${X}</working_directory>
111
111
  <output>${Y}</output>
112
112
  <exit_code>${K}</exit_code>
113
- `;return[{type:"text",text:Q},{type:"text",text:q}]}function ul(J){if(!Array.isArray(J)&&typeof J==="object"&&J!==null){let Q={};for(let[Z,X]of Object.entries(J))if(!Z.startsWith("hidden_"))Q[Z]=X;return Q}return J}var pv=u(()=>{gl()});function pl(J){return q6(gI6,J)}function Ie1(J,Q,Z){let X=["fine-grained-tool-streaming-2025-05-14"];if(/claude-.*sonnet-4/i.test(Z))X.push("context-1m-2025-08-07");if(J["anthropic.interleavedThinking.enabled"])X.push("interleaved-thinking-2025-05-14");return{...uG(),"anthropic-beta":X.join(","),...J["anthropic.provider"]?{"x-amp-override-provider":J["anthropic.provider"]}:{},[mG]:"amp.chat",[VY]:Q}}function dv(J){let{summaryBlock:Q,index:Z}=zZ(J)??{summaryBlock:void 0,index:0},X=[];if(Q&&Q.summary.type==="message")X.push({role:"assistant",content:[{type:"text",text:Q.summary.summary.trimEnd()}]});for(let Y=Z+(Q?1:0);Y<J.messages.length;Y++){let K=J.messages[Y];if(!K)continue;switch(K.role){case"user":{let q=dI6(K);if(q.length===0)continue;X.push({role:"user",content:q});break}case"assistant":{let q=K.content.filter((W)=>{if(W.type==="tool_use"&&W.inputPartialJSON)return!1;return!0}).map((W)=>{let F={...W};return delete F.inputIncomplete,F}),G=NQ(J);for(let W of q)if(W.type==="tool_use"){if(!G.get(W.id)?.run)throw Error(`(bug) corresponding tool_result not found for tool_use (id=${W.id}, name=${W.name})`)}if(q.length===0)break;let z=pI6(q),U=z.length-1;while(U>=0){let W=z[U];if(!W||W.type!=="thinking"&&W.type!=="redacted_thinking")break;U--}if(U<z.length-1)z=z.slice(0,U+1);if(z.length>0)X.push({role:"assistant",content:l8(z)});break}case"info":{for(let q of K.content)if(q.type==="manual_bash_invocation"){let G=_R(q);if(G.length>0)X.push({role:"user",content:G})}break}}}return X}function Ee1(J){return{type:"assistant:message",message:{role:"assistant",content:J.content.map(mI6),state:{type:"complete",stopReason:J.stop_reason}}}}function mI6(J){switch(J.type){case"tool_use":if(!gC.test(J.name))return{type:"tool_use",id:J.id,name:cQ1,input:{invalid_tool_name:J.name,...J.input}};return{type:"tool_use",id:J.id,name:J.name,input:J.input};case"server_tool_use":return{type:"tool_use",id:J.id,name:J.name,input:J.input};case"web_search_tool_result":return J;case"text":return{type:"text",text:J.text};default:if(J.type==="thinking")return{...J,provider:"anthropic"};if(J.type==="redacted_thinking")return{...J,provider:"anthropic"};return J}}function Pe1(J){let Q=`anthropic/${J.replace(/^[^/]+\//,"")}`,Z=Q.split("/");if(Z.length===2&&Z[0]==="anthropic"&&Z[1])return Q;return null}function Te1(J){let Q=J.findLast((K)=>K.role==="user");if(!Q||!Array.isArray(Q.content))return TU1;let Z=Q.content.filter((K)=>K.type==="text").map((K)=>K.text).join(" ").toLowerCase(),X=[/\bthink harder\b/,/\bthink intensely\b/,/\bthink longer\b/,/\bthink really hard\b/,/\bthink super hard\b/,/\bthink very hard\b/],Y=[/\bthink about it\b/,/\bthink a lot\b/,/\bthink deeply\b/,/\bthink hard\b/,/\bthink more\b/];for(let K of X)if(K.test(Z))return 31999;for(let K of Y)if(K.test(Z))return 1e4;if(/\bthink\b/.test(Z))return TU1;return TU1}async function*Ce1(J,Q,Z,X,Y,K,q){let G=await pl(K),z=await U9(K);K?.throwIfAborted();let U=z.settings["anthropic.thinking.enabled"]??!0;Q=U?Q:ke1(Q);let F={model:J,max_tokens:q??CU1,messages:l8(Se1(Q)),system:X,tools:ve1(Z),stream:!0},H=U?Te1(Q):0;if(U)F.thinking={type:"enabled",budget_tokens:H};let B=z.settings["anthropic.temperature"];if(B!==void 0&&!U)F.temperature=B;let M=G.messages.stream(F,{signal:K,headers:Ie1(z.settings,Y,J)});try{yield*M}catch(O){if(O instanceof C5)throw new DOMException("Aborted","AbortError");throw O}let V;try{V=await M.finalMessage()}catch(O){if(O instanceof tG.AnthropicError&&O.message.includes("without producing a Message"))V=void 0;else throw O}let N=Pe1(J),L=pG(N),A=L.contextWindow-L.maxOutputTokens;return{message:V,"~debugParamsUsed":F,"~debugUsage":V?{model:J,maxInputTokens:A,inputTokens:V.usage.input_tokens,outputTokens:V.usage.output_tokens,cacheCreationInputTokens:V.usage.cache_creation_input_tokens,cacheReadInputTokens:V.usage.cache_read_input_tokens,totalInputTokens:V.usage.input_tokens+(V.usage.cache_creation_input_tokens??0)+(V.usage.cache_read_input_tokens??0),thinkingBudget:U?H:void 0}:{model:J,maxInputTokens:A,inputTokens:0,outputTokens:0,cacheCreationInputTokens:null,cacheReadInputTokens:null,totalInputTokens:0,thinkingBudget:U?H:void 0}}}function Se1(J){return J.map((Q,Z)=>{if(Z!==J.length-1||!Array.isArray(Q.content))return Q;else return{...Q,content:Q.content.map((X,Y)=>{if(Y!==Q.content.length-1)return X;else{if(X.type==="thinking"||X.type==="text"&&X.text.trim()==="")return X;return{...X,cache_control:{type:"ephemeral"}}}})}})}function dl(J){if(J.length===0)return J;let Q=J[J.length-1];if(!Q||Q?.cache_control)return J;return Q.cache_control={type:"ephemeral"},J}function pI6(J){return J.map((Q)=>{if(Q.type==="text")return{...Q,text:Q.text.trimEnd()};return Q})}async function RB(J,Q,Z,X,Y,K){let q=await pl(K),G=await U9(K);K?.throwIfAborted();let z=G.settings["anthropic.thinking.enabled"]??!0;J=z?J:ke1(J);let U=l8(Se1(J)),W=Y??cv,F={model:W,max_tokens:uI6,messages:U,system:Z,tools:ve1(Q)},H=G.settings["anthropic.temperature"];if(H!==void 0&&!z)F.temperature=H;let B=await q.messages.create(F,{signal:K,headers:Ie1(G.settings,X,W)}).catch((A)=>{throw sI6(A)}),M=Pe1(W),V=pG(M),N=V.contextWindow-V.maxOutputTokens;return{message:B,"~debugParamsUsed":F,"~debugUsage":{model:W,maxInputTokens:N,inputTokens:B.usage.input_tokens,outputTokens:B.usage.output_tokens,cacheCreationInputTokens:B.usage.cache_creation_input_tokens,cacheReadInputTokens:B.usage.cache_read_input_tokens,totalInputTokens:B.usage.input_tokens+(B.usage.cache_creation_input_tokens??0)+(B.usage.cache_read_input_tokens??0),thinkingBudget:z?Te1(J):void 0}}}function ve1(J){let Q=new Set;return J.filter((Z)=>{if(Q.has(Z.name))return!1;return Q.add(Z.name),!0}).map((Z)=>({name:Z.name,description:Z.description??"",input_schema:Z.inputSchema}))}function dI6(J){let Q=J.fileMentions&&J.fileMentions.files.length>0?{type:"text",text:IY(J.fileMentions)}:null,Z=J.userState?{type:"text",text:eG(J.userState)}:null,X=[],Y=[];for(let K of J.content)if(K.type==="tool_result"){let q=LW(K.toolUseID,K.run);if(q)X.push(q)}else if(K.type==="image")if(K.source.type==="base64"&&"mediaType"in K.source&&"data"in K.source)Y.push({type:"image",source:{type:"base64",media_type:K.source.mediaType,data:K.source.data}});else if(K.source.type==="url"&&"url"in K.source&&typeof K.source.url==="string")Y.push({type:"image",source:{type:"url",url:K.source.url}});else throw Error(`(bug) unexpected image block: ${JSON.stringify(K).slice(0,25)}...`);else if(K.type==="text"){if(K.text.trim().length>0)Y.push(K)}return[...X,Q,Z,...Y].filter((K)=>K!==null)}function LW(J,Q){if(!E5(Q)){n.error("runToBlockParam","run is not terminal",{run:Q});return}let Z=[];switch(Q.status){case"done":Z=iI6(Q.result);break;case"error":Z=[{type:"text",text:Q.error?lI6(Q.error):"unknown error"}];break;case"rejected-by-user":Z=[{type:"text",text:"User rejected invoking the tool"}];break;case"cancelled":if(Q.progress)Z=[{type:"text",text:`The user cancelled the tool so it is no longer running. Progress until cancelation:
113
+ `;return[{type:"text",text:Q},{type:"text",text:q}]}function ul(J){if(!Array.isArray(J)&&typeof J==="object"&&J!==null){let Q={};for(let[Z,X]of Object.entries(J))if(!Z.startsWith("hidden_"))Q[Z]=X;return Q}return J}var pv=u(()=>{gl()});function pl(J){return q6(gI6,J)}function Ie1(J,Q,Z){let X=["fine-grained-tool-streaming-2025-05-14"];if(/claude-.*sonnet-4/i.test(Z))X.push("context-1m-2025-08-07");if(J["anthropic.interleavedThinking.enabled"])X.push("interleaved-thinking-2025-05-14");return{...uG(),"anthropic-beta":X.join(","),...J["anthropic.provider"]?{"x-amp-override-provider":J["anthropic.provider"]}:{},[mG]:"amp.chat",[VY]:Q}}function dv(J){let{summaryBlock:Q,index:Z}=zZ(J)??{summaryBlock:void 0,index:0},X=[];if(Q&&Q.summary.type==="message")X.push({role:"assistant",content:[{type:"text",text:Q.summary.summary.trimEnd()}]});for(let Y=Z+(Q?1:0);Y<J.messages.length;Y++){let K=J.messages[Y];if(!K)continue;switch(K.role){case"user":{let q=dI6(K);if(q.length===0)continue;X.push({role:"user",content:q});break}case"assistant":{let q=K.content.filter((W)=>{if(W.type==="tool_use"&&W.inputPartialJSON)return!1;return!0}).map((W)=>{let F={...W};return delete F.inputIncomplete,F}),G=NQ(J);for(let W of q)if(W.type==="tool_use"){if(!G.get(W.id)?.run)throw Error(`(bug) corresponding tool_result not found for tool_use (id=${W.id}, name=${W.name})`)}if(q.length===0)break;let z=pI6(q),U=z.length-1;while(U>=0){let W=z[U];if(!W||W.type!=="thinking"&&W.type!=="redacted_thinking")break;U--}if(U<z.length-1)z=z.slice(0,U+1);if(z.length>0)X.push({role:"assistant",content:l8(z)});break}case"info":{for(let q of K.content)if(q.type==="manual_bash_invocation"){let G=_R(q);if(G.length>0)X.push({role:"user",content:G})}break}}}return X}function Ee1(J){return{type:"assistant:message",message:{role:"assistant",content:J.content.map(mI6),state:{type:"complete",stopReason:J.stop_reason}}}}function mI6(J){switch(J.type){case"tool_use":if(!gC.test(J.name))return{type:"tool_use",id:J.id,name:cQ1,input:{invalid_tool_name:J.name,...J.input}};return{type:"tool_use",id:J.id,name:J.name,input:J.input};case"server_tool_use":return{type:"tool_use",id:J.id,name:J.name,input:J.input};case"web_search_tool_result":return J;case"text":return{type:"text",text:J.text};default:if(J.type==="thinking")return{...J,provider:"anthropic"};if(J.type==="redacted_thinking")return{...J,provider:"anthropic"};return J}}function Pe1(J){let Q=`anthropic/${J.replace(/^[^/]+\//,"")}`,Z=Q.split("/");if(Z.length===2&&Z[0]==="anthropic"&&Z[1])return Q;return null}function Te1(J){let Q=J.findLast((K)=>K.role==="user");if(!Q||!Array.isArray(Q.content))return TU1;let Z=Q.content.filter((K)=>K.type==="text").map((K)=>K.text).join(" ").toLowerCase(),X=[/\bthink harder\b/,/\bthink intensely\b/,/\bthink longer\b/,/\bthink really hard\b/,/\bthink super hard\b/,/\bthink very hard\b/],Y=[/\bthink about it\b/,/\bthink a lot\b/,/\bthink deeply\b/,/\bthink hard\b/,/\bthink more\b/];for(let K of X)if(K.test(Z))return 31999;for(let K of Y)if(K.test(Z))return 1e4;if(/\bthink\b/.test(Z))return TU1;return TU1}async function*Ce1(J,Q,Z,X,Y,K,q){let G=await pl(K),z=await U9(K);K?.throwIfAborted();let U=z.settings["anthropic.thinking.enabled"]??!0;Q=U?Q:ke1(Q);let F={model:J,max_tokens:q??CU1,messages:l8(Se1(Q)),system:X,tools:ve1(Z),stream:!0},H=U?Te1(Q):0;if(U)F.thinking={type:"enabled",budget_tokens:H};let B=z.settings["anthropic.temperature"];if(B!==void 0&&!U)F.temperature=B;let M=G.messages.stream(F,{signal:K,headers:Ie1(z.settings,Y,J)});try{yield*M}catch(O){if(O instanceof C5)throw new DOMException("Aborted","AbortError");throw O}let V;try{V=await M.finalMessage()}catch(O){if(O instanceof tG.AnthropicError&&O.message.includes("without producing a Message"))V=void 0;else throw O}let N=Pe1(J),L=pG(N),A=L.contextWindow-L.maxOutputTokens;return{message:V,"~debugParamsUsed":F,"~debugUsage":V?{model:J,maxInputTokens:A,inputTokens:V.usage.input_tokens,outputTokens:V.usage.output_tokens,cacheCreationInputTokens:V.usage.cache_creation_input_tokens,cacheReadInputTokens:V.usage.cache_read_input_tokens,totalInputTokens:V.usage.input_tokens+(V.usage.cache_creation_input_tokens??0)+(V.usage.cache_read_input_tokens??0),thinkingBudget:U?H:void 0}:{model:J,maxInputTokens:A,inputTokens:0,outputTokens:0,cacheCreationInputTokens:null,cacheReadInputTokens:null,totalInputTokens:0,thinkingBudget:U?H:void 0}}}function Se1(J){return J.map((Q,Z)=>{if(Z!==J.length-1||!Array.isArray(Q.content))return Q;else return{...Q,content:Q.content.map((X,Y)=>{if(Y!==Q.content.length-1)return X;else{if(X.type==="thinking"||X.type==="text"&&X.text.trim()==="")return X;return{...X,cache_control:{type:"ephemeral"}}}})}})}function dl(J){if(J.length===0)return J;let Q=J[J.length-1];if(!Q||Q?.cache_control)return J;return Q.cache_control={type:"ephemeral"},J}function pI6(J){return J.map((Q)=>{if(Q.type==="text")return{...Q,text:Q.text.trimEnd()};return Q}).filter((Q)=>Q.type!=="text"||Q.text!=="")}async function RB(J,Q,Z,X,Y,K){let q=await pl(K),G=await U9(K);K?.throwIfAborted();let z=G.settings["anthropic.thinking.enabled"]??!0;J=z?J:ke1(J);let U=l8(Se1(J)),W=Y??cv,F={model:W,max_tokens:uI6,messages:U,system:Z,tools:ve1(Q)},H=G.settings["anthropic.temperature"];if(H!==void 0&&!z)F.temperature=H;let B=await q.messages.create(F,{signal:K,headers:Ie1(G.settings,X,W)}).catch((A)=>{throw sI6(A)}),M=Pe1(W),V=pG(M),N=V.contextWindow-V.maxOutputTokens;return{message:B,"~debugParamsUsed":F,"~debugUsage":{model:W,maxInputTokens:N,inputTokens:B.usage.input_tokens,outputTokens:B.usage.output_tokens,cacheCreationInputTokens:B.usage.cache_creation_input_tokens,cacheReadInputTokens:B.usage.cache_read_input_tokens,totalInputTokens:B.usage.input_tokens+(B.usage.cache_creation_input_tokens??0)+(B.usage.cache_read_input_tokens??0),thinkingBudget:z?Te1(J):void 0}}}function ve1(J){let Q=new Set;return J.filter((Z)=>{if(Q.has(Z.name))return!1;return Q.add(Z.name),!0}).map((Z)=>({name:Z.name,description:Z.description??"",input_schema:Z.inputSchema}))}function dI6(J){let Q=J.fileMentions&&J.fileMentions.files.length>0?{type:"text",text:IY(J.fileMentions)}:null,Z=J.userState?{type:"text",text:eG(J.userState)}:null,X=[],Y=[];for(let K of J.content)if(K.type==="tool_result"){let q=LW(K.toolUseID,K.run);if(q)X.push(q)}else if(K.type==="image")if(K.source.type==="base64"&&"mediaType"in K.source&&"data"in K.source)Y.push({type:"image",source:{type:"base64",media_type:K.source.mediaType,data:K.source.data}});else if(K.source.type==="url"&&"url"in K.source&&typeof K.source.url==="string")Y.push({type:"image",source:{type:"url",url:K.source.url}});else throw Error(`(bug) unexpected image block: ${JSON.stringify(K).slice(0,25)}...`);else if(K.type==="text"){if(K.text.trim().length>0)Y.push(K)}return[...X,Q,Z,...Y].filter((K)=>K!==null)}function LW(J,Q){if(!E5(Q)){n.error("runToBlockParam","run is not terminal",{run:Q});return}let Z=[];switch(Q.status){case"done":Z=iI6(Q.result);break;case"error":Z=[{type:"text",text:Q.error?lI6(Q.error):"unknown error"}];break;case"rejected-by-user":Z=[{type:"text",text:"User rejected invoking the tool"}];break;case"cancelled":if(Q.progress)Z=[{type:"text",text:`The user cancelled the tool so it is no longer running. Progress until cancelation:
114
114
  ${cI6(Q.progress)}
115
115
  --- Tool was cancelled and is no longer running
116
116
  `}];else Z=[{type:"text",text:"User cancelled tool invocation"}];break;default:throw Error("(bug) unreachable")}return{type:"tool_result",tool_use_id:J,content:Z,is_error:Q.status==="error"||Q.status==="cancelled"||Q.status==="rejected-by-user"}}function cI6(J){if(!J)return"";if(typeof J==="string")return J;if(Array.isArray(J))return J.join(`
@@ -5795,7 +5795,7 @@ See https://ampcode.com/manual#toolboxes`);return Q[0]||YR}function ZZ6(J,Q){let
5795
5795
  `);J.command("use").argument("<tool-name>","The tool to invoke").summary("Invoke a tool with arguments or JSON input from stdin").description(Z).option("--only <field>","Extract only the specified field from the result").allowUnknownOption(!0).allowExcessArguments(!0).action(async function(X,Y,K){let q=K.optsWithGlobals(),G=await Q(K,q),z=0;await G.mcpService.initialized;let U=K.args.slice(1),W;if(eQ6()){let F=[];for await(let H of process.stdin)F.push(H);W=Buffer.concat(F).toString("utf-8").trim()}await oQ6({toolName:X,rawArgs:U,stdinInput:W,only:Y.only,threadDeps:G,stdout:process.stdout,stderr:process.stderr,exit:(F)=>{z=F}}),await G.asyncDispose(),G.cleanupTerminal(),process.exit(z)})}var XZ6=u(()=>{hS();GV();yQ6();mQ6();pQ6();JZ6()});function YZ6(J){let Q=J.trim();if(Q==="quit"||Q==="exit")return"/quit";return J}import i49 from"node:fs";import KZ6 from"node:path";function qZ6(J){let Q=J.trim().replace(/^["']|["']$/g,"");if(Q=Q.replace(/\\(.)/g,"$1"),!/\.(png|jpe?g|gif|webp)$/i.test(Q))return null;if(!KZ6.isAbsolute(Q))return null;return n.debug("Extracted image path",{original:J,extracted:Q}),Q}function GZ6(J){try{let Q=KZ6.extname(J).toLowerCase(),Z=Vt1(Q);if(!Z)return n.warn("Unsupported image file extension",{ext:Q}),null;try{let X=i49.readFileSync(J);return n49(X,Z)}catch(X){n.error(`Failed to read image file ${J}:`,X)}}catch(Q){n.error("Error handling image file path",{imagePath:J,error:Q})}return null}function n49(J,Q){if(J.length>AR)return n.warn(`Image file too large: ${J.length} bytes (max: ${AR})`),null;return{type:"image",source:{type:"base64",data:J.toString("base64"),mediaType:Q}}}var zZ6=u(()=>{D0();EN()});function UZ6(J){return J.kind==="executable"}function WZ6(J){return J.kind==="markdown"}import{spawn as a49}from"node:child_process";import{promises as r49}from"node:fs";async function Sx1(J,Q,Z,X={}){let{timeoutMs:Y=FZ6,signal:K}=X;try{let q=await Z.getCommand(J);if(!q)return{success:!1,output:"",error:`Command '${J}' not found`};if(!await Z.isCommandAvailable(J))return{success:!1,output:"",error:`Command '${J}' is not available for execution`};if(n.debug("Executing command",{commandName:J,filePath:q.filePath,args:Q}),WZ6(q))return await s49(q,Q);else if(UZ6(q))return await o49(q,Q,Y,K);else return{success:!1,output:"",error:"Unsupported command type"}}catch(q){return n.error("Failed to execute command",{commandName:J,error:q}),{success:!1,output:"",error:q instanceof Error?q.message:"Unknown error occurred"}}}async function s49(J,Q){try{if(Q.length>0)return{success:!1,output:"",error:"Markdown commands do not accept arguments"};let Z=await r49.readFile(J.filePath,"utf8");return{success:!0,output:(Z.length>LH?Z.slice(0,LH)+`
5796
5796
  ... (output truncated at ${LH} characters)`:Z).trim(),exitCode:0}}catch(Z){return{success:!1,output:"",error:Z instanceof Error?Z.message:"Failed to read markdown file"}}}async function o49(J,Q,Z=FZ6,X){return new Promise((Y)=>{let[K,q]=t49(J,Q);n.debug("Spawning command",{spawnCommand:K,spawnArgs:q.slice(0,10),filePath:J.filePath,timeoutMs:Z});let G=Ht1(X),z=!1,U=setTimeout(()=>{z=!0,G.abort(),n.warn("Command execution timed out",{commandName:J.name,timeoutMs:Z})},Z),W=a49(K,q,{stdio:["pipe","pipe","pipe"],signal:G.signal,detached:!0}),F=[],H=[],B=0;W.stdout?.on("data",(M)=>{let V=M.toString();if(B+=V.length,B<=LH)F.push(V);else{let N=LH-(B-V.length);if(N>0)F.push(V.slice(0,N))}}),W.stderr?.on("data",(M)=>{let V=M.toString();if(B+=V.length,B<=LH)H.push(V);else{let N=LH-(B-V.length);if(N>0)H.push(V.slice(0,N))}}),W.on("close",(M)=>{if(clearTimeout(U),z){Y({success:!1,output:F.join(""),error:`Command timed out after ${Z}ms`,exitCode:void 0});return}if(G.signal.aborted){Y({success:!1,output:F.join(""),error:"The command was aborted",exitCode:M??void 0});return}let V=M===0||M===1,N=F.join(""),L=H.join(""),A=N;if(!V&&!N.trim()&&L.trim())A=L;else if(L.trim())A+=N?`
5797
5797
  ${L}`:L;if(B>LH)A+=`
5798
- ... (output truncated at ${LH} characters)`;Y({success:V,output:A.trim(),error:!V?L.trim()||"Command failed":void 0,exitCode:M??void 0})}),W.on("error",(M)=>{clearTimeout(U);let V=M.message;if(z)V=`Command timed out after ${Z}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")V="The command was aborted";Y({success:!1,output:F.join(""),error:V})})})}function t49(J,Q){let{filePath:Z,interpreter:X,extension:Y}=J;if(process.platform==="win32")return J79(Z,X?[...X]:null,Y,Q);else return e49(Z,X?[...X]:null,Y,Q)}function e49(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function J79(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Z.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}var LH=50000,FZ6=300000;var HZ6=u(()=>{NR();D0()});var BZ6=u(()=>{HZ6();UQ1()});var r41,TF2,CF2,SF2,vF2,kF2,_F2,bF2,xF2,yF2,am,fF2,hF2,gF2,mF2,uF2;var DZ6=u(()=>{r41=globalThis.window?.document!==void 0,TF2=globalThis.process?.versions?.node!==void 0,CF2=globalThis.process?.versions?.bun!==void 0,SF2=globalThis.Deno?.version?.deno!==void 0,vF2=globalThis.process?.versions?.electron!==void 0,kF2=globalThis.navigator?.userAgent?.includes("jsdom")===!0,_F2=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,bF2=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,xF2=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,yF2=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,am=globalThis.navigator?.userAgentData?.platform,fF2=am==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",hF2=am==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",gF2=am==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",mF2=am==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),uF2=am==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android"});var s41={};L6(s41,{scrollUp:()=>O79,scrollDown:()=>j79,link:()=>P79,image:()=>T79,iTerm:()=>C79,exitAlternativeScreen:()=>E79,eraseUp:()=>A79,eraseStartLine:()=>N79,eraseScreen:()=>vx1,eraseLines:()=>M79,eraseLine:()=>LZ6,eraseEndLine:()=>V79,eraseDown:()=>L79,enterAlternativeScreen:()=>I79,cursorUp:()=>VZ6,cursorTo:()=>X79,cursorShow:()=>D79,cursorSavePosition:()=>z79,cursorRestorePosition:()=>U79,cursorPrevLine:()=>H79,cursorNextLine:()=>F79,cursorMove:()=>Y79,cursorLeft:()=>NZ6,cursorHide:()=>B79,cursorGetPosition:()=>W79,cursorForward:()=>q79,cursorDown:()=>K79,cursorBackward:()=>G79,clearTerminal:()=>w79,clearScreen:()=>R79,beep:()=>$79});import kx1 from"node:process";var U2="\x1B[",sm="\x1B]",_T="\x07",rm=";",MZ6,Q79,Z79,X79=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");if(typeof Q!=="number")return U2+(J+1)+"G";return U2+(Q+1)+rm+(J+1)+"H"},Y79=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");let Z="";if(J<0)Z+=U2+-J+"D";else if(J>0)Z+=U2+J+"C";if(Q<0)Z+=U2+-Q+"A";else if(Q>0)Z+=U2+Q+"B";return Z},VZ6=(J=1)=>U2+J+"A",K79=(J=1)=>U2+J+"B",q79=(J=1)=>U2+J+"C",G79=(J=1)=>U2+J+"D",NZ6,z79,U79,W79,F79,H79,B79,D79,M79=(J)=>{let Q="";for(let Z=0;Z<J;Z++)Q+=LZ6+(Z<J-1?VZ6():"");if(J)Q+=NZ6;return Q},V79,N79,LZ6,L79,A79,vx1,O79,j79,R79="\x1Bc",w79,I79,E79,$79,P79=(J,Q)=>[sm,"8",rm,rm,Q,_T,J,sm,"8",rm,rm,_T].join(""),T79=(J,Q={})=>{let Z=`${sm}1337;File=inline=1`;if(Q.width)Z+=`;width=${Q.width}`;if(Q.height)Z+=`;height=${Q.height}`;if(Q.preserveAspectRatio===!1)Z+=";preserveAspectRatio=0";return Z+":"+Buffer.from(J).toString("base64")+_T},C79;var _x1=u(()=>{DZ6();MZ6=!r41&&kx1.env.TERM_PROGRAM==="Apple_Terminal",Q79=!r41&&kx1.platform==="win32",Z79=r41?()=>{throw Error("`process.cwd()` only works in Node.js, not the browser.")}:kx1.cwd,NZ6=U2+"G",z79=MZ6?"\x1B7":U2+"s",U79=MZ6?"\x1B8":U2+"u",W79=U2+"6n",F79=U2+"E",H79=U2+"F",B79=U2+"?25l",D79=U2+"?25h",V79=U2+"K",N79=U2+"1K",LZ6=U2+"2K",L79=U2+"J",A79=U2+"1J",vx1=U2+"2J",O79=U2+"S",j79=U2+"T",w79=Q79?`${vx1}${U2}0f`:`${vx1}${U2}3J${U2}H`,I79=U2+"?1049h",E79=U2+"?1049l",$79=_T,C79={setCwd:(J=Z79())=>`${sm}50;CurrentDir=${J}${_T}`,annotation(J,Q={}){let Z=`${sm}1337;`,X=Q.x!==void 0,Y=Q.y!==void 0;if((X||Y)&&!(X&&Y&&Q.length!==void 0))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");if(J=J.replaceAll("|",""),Z+=Q.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",Q.length>0)Z+=(X?[J,Q.length,Q.x,Q.y]:[Q.length,J]).join("|");else Z+=J;return Z+_T}}});var AZ6=u(()=>{_x1();_x1()});var bx1=e((nF2,OZ6)=>{OZ6.exports=(J,Q=process.argv)=>{let Z=J.startsWith("-")?"":J.length===1?"-":"--",X=Q.indexOf(Z+J),Y=Q.indexOf("--");return X!==-1&&(Y===-1||X<Y)}});var wZ6=e((aF2,RZ6)=>{var S79=o1("os"),jZ6=o1("tty"),bK=bx1(),{env:n5}=process,NV;if(bK("no-color")||bK("no-colors")||bK("color=false")||bK("color=never"))NV=0;else if(bK("color")||bK("colors")||bK("color=true")||bK("color=always"))NV=1;if("FORCE_COLOR"in n5)if(n5.FORCE_COLOR==="true")NV=1;else if(n5.FORCE_COLOR==="false")NV=0;else NV=n5.FORCE_COLOR.length===0?1:Math.min(parseInt(n5.FORCE_COLOR,10),3);function xx1(J){if(J===0)return!1;return{level:J,hasBasic:!0,has256:J>=2,has16m:J>=3}}function yx1(J,Q){if(NV===0)return 0;if(bK("color=16m")||bK("color=full")||bK("color=truecolor"))return 3;if(bK("color=256"))return 2;if(J&&!Q&&NV===void 0)return 0;let Z=NV||0;if(n5.TERM==="dumb")return Z;if(process.platform==="win32"){let X=S79.release().split(".");if(Number(X[0])>=10&&Number(X[2])>=10586)return Number(X[2])>=14931?3:2;return 1}if("CI"in n5){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((X)=>(X in n5))||n5.CI_NAME==="codeship")return 1;return Z}if("TEAMCITY_VERSION"in n5)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(n5.TEAMCITY_VERSION)?1:0;if(n5.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in n5){let X=parseInt((n5.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(n5.TERM_PROGRAM){case"iTerm.app":return X>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(n5.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(n5.TERM))return 1;if("COLORTERM"in n5)return 1;return Z}function v79(J){let Q=yx1(J,J&&J.isTTY);return xx1(Q)}RZ6.exports={supportsColor:v79,stdout:xx1(yx1(!0,jZ6.isatty(1))),stderr:xx1(yx1(!0,jZ6.isatty(2)))}});var $Z6=e((rF2,EZ6)=>{var k79=wZ6(),bT=bx1();function IZ6(J){if(/^\d{3,4}$/.test(J)){let Z=/(\d{1,2})(\d{2})/.exec(J)||[];return{major:0,minor:parseInt(Z[1],10),patch:parseInt(Z[2],10)}}let Q=(J||"").split(".").map((Z)=>parseInt(Z,10));return{major:Q[0],minor:Q[1],patch:Q[2]}}function fx1(J){let{CI:Q,FORCE_HYPERLINK:Z,NETLIFY:X,TEAMCITY_VERSION:Y,TERM_PROGRAM:K,TERM_PROGRAM_VERSION:q,VTE_VERSION:G,TERM:z}=process.env;if(Z)return!(Z.length>0&&parseInt(Z,10)===0);if(bT("no-hyperlink")||bT("no-hyperlinks")||bT("hyperlink=false")||bT("hyperlink=never"))return!1;if(bT("hyperlink=true")||bT("hyperlink=always"))return!0;if(X)return!0;if(!k79.supportsColor(J))return!1;if(J&&!J.isTTY)return!1;if("WT_SESSION"in process.env)return!0;if(process.platform==="win32")return!1;if(Q)return!1;if(Y)return!1;if(K){let U=IZ6(q||"");switch(K){case"iTerm.app":if(U.major===3)return U.minor>=1;return U.major>3;case"WezTerm":return U.major>=20200620;case"vscode":return U.major>1||U.major===1&&U.minor>=72;case"ghostty":return!0}}if(G){if(G==="0.50.0")return!1;let U=IZ6(G);return U.major>0||U.minor>=50}switch(z){case"alacritty":return!0}return!1}EZ6.exports={supportsHyperlink:fx1,stdout:fx1(process.stdout),stderr:fx1(process.stderr)}});function LV(J,Q,{target:Z="stdout",...X}={}){if(!o41.default[Z]){if(X.fallback===!1)return J;return typeof X.fallback==="function"?X.fallback(J,Q):`${J} (​${Q}​)`}return s41.link(J,Q)}var o41;var PZ6=u(()=>{AZ6();o41=p6($Z6(),1);LV.isSupported=o41.default.stdout;LV.stderr=(J,Q,Z={})=>LV(J,Q,{target:"stderr",...Z});LV.stderr.isSupported=o41.default.stderr});class hx1{enabled;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(J){this.enabled=J;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let J=Array.from(this.commandCounts.entries()).map(([Q,Z])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.1759392119-g5695f1"},parameters:{metadata:{count:Z}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await U00(Q)}catch(Q){n.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}var TZ6=u(()=>{D0();Qz()});class GY{message;name;constructor(J){this.message=J;this.name="InformationMessage"}}function CZ6(J){if(J instanceof t41)return{title:"Cannot compact thread",description:"Thread has no messages to compact.",type:"error"};if(J instanceof GY)return{title:"Info",description:J.message,type:"info"};return n.warn("Unknown error type encountered",{name:J.name,message:J.message,stack:J.stack}),{title:"Error",description:J.message||"An unexpected error occurred.",type:"error"}}var t41;var gx1=u(()=>{D0();t41=class t41 extends Error{constructor(J="Thread has no messages to compact"){super(J);this.name="NoMessagesToCompactError"}}});import{execSync as SZ6}from"node:child_process";import{rmdir as _79}from"node:fs/promises";import{tmpdir as b79}from"node:os";import vZ6 from"node:path";import{mkdtemp as x79,readFile as y79,unlink as f79,writeFile as RH2}from"fs/promises";class mx1{commands;customRegistry;latestCustom=[];telemetrySubmitter;constructor(J=DC()){this.customRegistry=J,this._initBaseCommands(!1),this.customRegistry.commands.subscribe((Q)=>this.latestCustom=Q),this.telemetrySubmitter=new hx1(async()=>{try{return(await U9()).settings["experimental.cli.commandTelemetry.enabled"]===!0}catch{return!1}}),k9.pipe(v0((Q)=>Q.settings["internal.modes"]),P8()).subscribe((Q)=>{this._initBaseCommands(Q??!1)})}_initBaseCommands(J){if(this.commands={...h79},J)Object.assign(this.commands,g79)}async execute(J,Q,Z=[],X){this.telemetrySubmitter.submit(J).catch((G)=>{n.debug("Failed to submit command telemetry",G)});let Y=this.commands[J];if(Y)return Y.execute(Q,Z);let K=this.latestCustom.find((G)=>G.name===J),q=await Sx1(J,Z,this.customRegistry,{signal:X});if(q.success)if(K?.kind==="markdown"){Q.editorDispatch({type:"set-input",input:q.output});return}else{Q.worker.handle({type:"user:message",message:{content:[{type:"text",text:q.output}]}});return}return Error(q.error??`Command '${J}' failed`)}query(J,Q,Z){let X=J.toLowerCase(),Y=Object.values(this.commands).filter((q)=>q.name.toLowerCase().includes(X)).filter((q)=>{if(!Q||!q.isVisible)return!0;return q.isVisible(Q,Z)}),K=this.latestCustom.filter((q)=>q.available&&q.name.toLowerCase().includes(X)).map((q)=>({name:q.name,description:"Custom command",requiresArgs:q.kind==="executable",execute:(G,z)=>this.execute(q.name,G,z??[])}));return[...Y,...K]}async cleanup(){await this.telemetrySubmitter.dispose()}get(J){let Q=this.commands[J];if(Q)return Q;let Z=this.latestCustom.find((X)=>X.name===J);return{name:J,description:"Custom command",requiresArgs:Z?.kind==="executable",execute:(X,Y)=>this.execute(J,X,Y??[])}}}var h79,g79;var kZ6=u(()=>{BZ6();D0();iw();u2();MC();lw();q7();JN();Ex1();Qz();ZD();a6();b0();PZ6();d41();$x1();TZ6();gx1();h79={"generate-agent-file":{name:"generate-agent-file",description:`Generate an ${qJ} file in the current workspace`,execute:async(J,Q)=>{J.worker.handle({type:"user:message",message:{content:[{type:"text",text:vK0}]}});return}},compact:{name:"compact",description:"Compact the thread. Optional: /compact [message] to queue a message after compaction",execute:async(J,Q)=>{if(J.thread.messages.length===0)return new t41;if(Q&&Q.length>0){let X=[{type:"text",text:Q.join(" ").trim()}],Y=J.takeImageAttachments?.()??[];if(Y.length>0)X.push(...Y);J.worker.handle({type:"user:message-queue:enqueue",message:{content:X}})}try{await J.worker.summarizeThread()}catch(Z){return Z instanceof Error?Z:Error("Failed to compact thread")}}},editor:{name:"editor",description:"Open $EDITOR to write a prompt",launchesWindow:!0,execute:async(J,Q)=>{try{let Z=process.env.EDITOR||process.env.VISUAL||"nano",X=await x79(vZ6.join(b79(),"amp-edit-")),Y=vZ6.join(X,"message.amp.md");SZ6(`${Z} "${Y}"`,{stdio:"inherit"}),process.stdout.write("\x1B[?25l");try{let q=(await y79(Y,"utf-8")).trim();if(q)J.editorDispatch({type:"set-input",input:q})}catch(K){if(K?.code==="ENOENT")return;return n.error("Failed to read temporary file",K),Error("Failed to read editor content")}try{await f79(Y),await _79(X)}catch(K){n.warn("Failed to clean up temporary file",K)}return}catch(Z){return n.error("Failed to open editor",Z),Error("Failed to open editor")}}},help:{name:"help",description:"Show help and hotkeys",execute:async(J,Q)=>{J.openHelp();return}},permissions:{name:"permissions",description:"Edit permission rules in $EDITOR, or `/permissions off|on` to toggle for this session",launchesWindow:!0,execute:async(J,Q)=>{if(Q&&Q.length>0){let Y=Q[0]?.trim().toLowerCase();switch(Y){case"on":try{return pU("dangerouslyAllowAll",!1),new GY("Amp is now following permissions rules for this session")}catch(K){return n.error("Failed to set dangerously allow all setting",K),Error("Failed to enable permissions for this session")}case"off":try{return pU("dangerouslyAllowAll",!0),new GY("Permissions disabled for this session - you will NOT be asked for confirmation before Amp runs a command.")}catch(K){return n.error("Failed to set dangerously allow all setting",K),Error("Failed to disable permissions for this session")}case"edit":break;default:return Error(`Invalid option: ${Y}. Use: on, off, or edit (or no argument for edit)`)}}let Z=await vT();if(Z===null)return Error("No editor found, please set $EDITOR to edit permissions");let X="";try{let Y={stdin:process.stdin,stdout:process.stdout,stderr:{write:(K)=>{return X=K.toString(),!0}},exit:(K)=>{if(K!==0)throw n.error("editPermissions exited with status",K),Error(X)},settingsFile:J.settingsFilePath,resolveEditor:vT};await n41(Y);return}catch(Y){n.error("failed to open permissions editor:",Y);let K=Y instanceof Error?`: ${Y.message}`:"";return Error(`Failed to open ${Z}${K}`)}finally{process.stdout.write("\x1B[?25l")}}},new:{name:"new",description:"Start a new thread",execute:async(J,Q)=>{try{await J.startNewThread();return}catch(Z){return n.error("Failed to start new thread",Z),Error("Failed to start new thread")}},isVisible:(J)=>J.messages.length!==0},continue:{name:"continue",description:"Continue an existing thread",requiresArgs:!1,requiresPicker:!0,execute:async(J,Q)=>{try{if(Q&&Q.length>0){let Z=Q[0]?.trim();if(!Z)return Error("Invalid thread ID provided");return await J.switchToThread(Z),new GY(`Switched to existing thread: ${Z}`)}await J.pickAndContinueThread();return}catch(Z){return n.error("Failed to continue thread",Z),Error("Failed to continue thread")}}},queue:{name:"queue",description:"Queue a message to send when inference completes. If no inference running, sends immediately.",requiresArgs:!0,execute:async(J,Q)=>{if(!Q||Q.length===0)return Error("Queue command requires a message argument. Usage: /queue <message>");let X=[{type:"text",text:Q.join(" ").trim()}],Y=J.takeImageAttachments?.()??[];if(Y.length>0)X.push(...Y);J.worker.handle({type:"user:message-queue:enqueue",message:{content:X}})}},dequeue:{name:"dequeue",description:"Dequeue all messages and restore them to the prompt editor",execute:async(J,Q)=>{let Z=J.thread.queuedMessages??[];if(Z.length===0)return;let Y=Z.map((K)=>{return K.queuedMessage.content.filter((G)=>G.type==="text").map((G)=>G.text).join("").trim()}).filter(Boolean).join(`
5798
+ ... (output truncated at ${LH} characters)`;Y({success:V,output:A.trim(),error:!V?L.trim()||"Command failed":void 0,exitCode:M??void 0})}),W.on("error",(M)=>{clearTimeout(U);let V=M.message;if(z)V=`Command timed out after ${Z}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")V="The command was aborted";Y({success:!1,output:F.join(""),error:V})})})}function t49(J,Q){let{filePath:Z,interpreter:X,extension:Y}=J;if(process.platform==="win32")return J79(Z,X?[...X]:null,Y,Q);else return e49(Z,X?[...X]:null,Y,Q)}function e49(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function J79(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Z.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}var LH=50000,FZ6=300000;var HZ6=u(()=>{NR();D0()});var BZ6=u(()=>{HZ6();UQ1()});var r41,TF2,CF2,SF2,vF2,kF2,_F2,bF2,xF2,yF2,am,fF2,hF2,gF2,mF2,uF2;var DZ6=u(()=>{r41=globalThis.window?.document!==void 0,TF2=globalThis.process?.versions?.node!==void 0,CF2=globalThis.process?.versions?.bun!==void 0,SF2=globalThis.Deno?.version?.deno!==void 0,vF2=globalThis.process?.versions?.electron!==void 0,kF2=globalThis.navigator?.userAgent?.includes("jsdom")===!0,_F2=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,bF2=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,xF2=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,yF2=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,am=globalThis.navigator?.userAgentData?.platform,fF2=am==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",hF2=am==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",gF2=am==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",mF2=am==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),uF2=am==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android"});var s41={};L6(s41,{scrollUp:()=>O79,scrollDown:()=>j79,link:()=>P79,image:()=>T79,iTerm:()=>C79,exitAlternativeScreen:()=>E79,eraseUp:()=>A79,eraseStartLine:()=>N79,eraseScreen:()=>vx1,eraseLines:()=>M79,eraseLine:()=>LZ6,eraseEndLine:()=>V79,eraseDown:()=>L79,enterAlternativeScreen:()=>I79,cursorUp:()=>VZ6,cursorTo:()=>X79,cursorShow:()=>D79,cursorSavePosition:()=>z79,cursorRestorePosition:()=>U79,cursorPrevLine:()=>H79,cursorNextLine:()=>F79,cursorMove:()=>Y79,cursorLeft:()=>NZ6,cursorHide:()=>B79,cursorGetPosition:()=>W79,cursorForward:()=>q79,cursorDown:()=>K79,cursorBackward:()=>G79,clearTerminal:()=>w79,clearScreen:()=>R79,beep:()=>$79});import kx1 from"node:process";var U2="\x1B[",sm="\x1B]",_T="\x07",rm=";",MZ6,Q79,Z79,X79=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");if(typeof Q!=="number")return U2+(J+1)+"G";return U2+(Q+1)+rm+(J+1)+"H"},Y79=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");let Z="";if(J<0)Z+=U2+-J+"D";else if(J>0)Z+=U2+J+"C";if(Q<0)Z+=U2+-Q+"A";else if(Q>0)Z+=U2+Q+"B";return Z},VZ6=(J=1)=>U2+J+"A",K79=(J=1)=>U2+J+"B",q79=(J=1)=>U2+J+"C",G79=(J=1)=>U2+J+"D",NZ6,z79,U79,W79,F79,H79,B79,D79,M79=(J)=>{let Q="";for(let Z=0;Z<J;Z++)Q+=LZ6+(Z<J-1?VZ6():"");if(J)Q+=NZ6;return Q},V79,N79,LZ6,L79,A79,vx1,O79,j79,R79="\x1Bc",w79,I79,E79,$79,P79=(J,Q)=>[sm,"8",rm,rm,Q,_T,J,sm,"8",rm,rm,_T].join(""),T79=(J,Q={})=>{let Z=`${sm}1337;File=inline=1`;if(Q.width)Z+=`;width=${Q.width}`;if(Q.height)Z+=`;height=${Q.height}`;if(Q.preserveAspectRatio===!1)Z+=";preserveAspectRatio=0";return Z+":"+Buffer.from(J).toString("base64")+_T},C79;var _x1=u(()=>{DZ6();MZ6=!r41&&kx1.env.TERM_PROGRAM==="Apple_Terminal",Q79=!r41&&kx1.platform==="win32",Z79=r41?()=>{throw Error("`process.cwd()` only works in Node.js, not the browser.")}:kx1.cwd,NZ6=U2+"G",z79=MZ6?"\x1B7":U2+"s",U79=MZ6?"\x1B8":U2+"u",W79=U2+"6n",F79=U2+"E",H79=U2+"F",B79=U2+"?25l",D79=U2+"?25h",V79=U2+"K",N79=U2+"1K",LZ6=U2+"2K",L79=U2+"J",A79=U2+"1J",vx1=U2+"2J",O79=U2+"S",j79=U2+"T",w79=Q79?`${vx1}${U2}0f`:`${vx1}${U2}3J${U2}H`,I79=U2+"?1049h",E79=U2+"?1049l",$79=_T,C79={setCwd:(J=Z79())=>`${sm}50;CurrentDir=${J}${_T}`,annotation(J,Q={}){let Z=`${sm}1337;`,X=Q.x!==void 0,Y=Q.y!==void 0;if((X||Y)&&!(X&&Y&&Q.length!==void 0))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");if(J=J.replaceAll("|",""),Z+=Q.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",Q.length>0)Z+=(X?[J,Q.length,Q.x,Q.y]:[Q.length,J]).join("|");else Z+=J;return Z+_T}}});var AZ6=u(()=>{_x1();_x1()});var bx1=e((nF2,OZ6)=>{OZ6.exports=(J,Q=process.argv)=>{let Z=J.startsWith("-")?"":J.length===1?"-":"--",X=Q.indexOf(Z+J),Y=Q.indexOf("--");return X!==-1&&(Y===-1||X<Y)}});var wZ6=e((aF2,RZ6)=>{var S79=o1("os"),jZ6=o1("tty"),bK=bx1(),{env:n5}=process,NV;if(bK("no-color")||bK("no-colors")||bK("color=false")||bK("color=never"))NV=0;else if(bK("color")||bK("colors")||bK("color=true")||bK("color=always"))NV=1;if("FORCE_COLOR"in n5)if(n5.FORCE_COLOR==="true")NV=1;else if(n5.FORCE_COLOR==="false")NV=0;else NV=n5.FORCE_COLOR.length===0?1:Math.min(parseInt(n5.FORCE_COLOR,10),3);function xx1(J){if(J===0)return!1;return{level:J,hasBasic:!0,has256:J>=2,has16m:J>=3}}function yx1(J,Q){if(NV===0)return 0;if(bK("color=16m")||bK("color=full")||bK("color=truecolor"))return 3;if(bK("color=256"))return 2;if(J&&!Q&&NV===void 0)return 0;let Z=NV||0;if(n5.TERM==="dumb")return Z;if(process.platform==="win32"){let X=S79.release().split(".");if(Number(X[0])>=10&&Number(X[2])>=10586)return Number(X[2])>=14931?3:2;return 1}if("CI"in n5){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((X)=>(X in n5))||n5.CI_NAME==="codeship")return 1;return Z}if("TEAMCITY_VERSION"in n5)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(n5.TEAMCITY_VERSION)?1:0;if(n5.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in n5){let X=parseInt((n5.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(n5.TERM_PROGRAM){case"iTerm.app":return X>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(n5.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(n5.TERM))return 1;if("COLORTERM"in n5)return 1;return Z}function v79(J){let Q=yx1(J,J&&J.isTTY);return xx1(Q)}RZ6.exports={supportsColor:v79,stdout:xx1(yx1(!0,jZ6.isatty(1))),stderr:xx1(yx1(!0,jZ6.isatty(2)))}});var $Z6=e((rF2,EZ6)=>{var k79=wZ6(),bT=bx1();function IZ6(J){if(/^\d{3,4}$/.test(J)){let Z=/(\d{1,2})(\d{2})/.exec(J)||[];return{major:0,minor:parseInt(Z[1],10),patch:parseInt(Z[2],10)}}let Q=(J||"").split(".").map((Z)=>parseInt(Z,10));return{major:Q[0],minor:Q[1],patch:Q[2]}}function fx1(J){let{CI:Q,FORCE_HYPERLINK:Z,NETLIFY:X,TEAMCITY_VERSION:Y,TERM_PROGRAM:K,TERM_PROGRAM_VERSION:q,VTE_VERSION:G,TERM:z}=process.env;if(Z)return!(Z.length>0&&parseInt(Z,10)===0);if(bT("no-hyperlink")||bT("no-hyperlinks")||bT("hyperlink=false")||bT("hyperlink=never"))return!1;if(bT("hyperlink=true")||bT("hyperlink=always"))return!0;if(X)return!0;if(!k79.supportsColor(J))return!1;if(J&&!J.isTTY)return!1;if("WT_SESSION"in process.env)return!0;if(process.platform==="win32")return!1;if(Q)return!1;if(Y)return!1;if(K){let U=IZ6(q||"");switch(K){case"iTerm.app":if(U.major===3)return U.minor>=1;return U.major>3;case"WezTerm":return U.major>=20200620;case"vscode":return U.major>1||U.major===1&&U.minor>=72;case"ghostty":return!0}}if(G){if(G==="0.50.0")return!1;let U=IZ6(G);return U.major>0||U.minor>=50}switch(z){case"alacritty":return!0}return!1}EZ6.exports={supportsHyperlink:fx1,stdout:fx1(process.stdout),stderr:fx1(process.stderr)}});function LV(J,Q,{target:Z="stdout",...X}={}){if(!o41.default[Z]){if(X.fallback===!1)return J;return typeof X.fallback==="function"?X.fallback(J,Q):`${J} (​${Q}​)`}return s41.link(J,Q)}var o41;var PZ6=u(()=>{AZ6();o41=p6($Z6(),1);LV.isSupported=o41.default.stdout;LV.stderr=(J,Q,Z={})=>LV(J,Q,{target:"stderr",...Z});LV.stderr.isSupported=o41.default.stderr});class hx1{enabled;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(J){this.enabled=J;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let J=Array.from(this.commandCounts.entries()).map(([Q,Z])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.1759406505-gba06ab"},parameters:{metadata:{count:Z}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await U00(Q)}catch(Q){n.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}var TZ6=u(()=>{D0();Qz()});class GY{message;name;constructor(J){this.message=J;this.name="InformationMessage"}}function CZ6(J){if(J instanceof t41)return{title:"Cannot compact thread",description:"Thread has no messages to compact.",type:"error"};if(J instanceof GY)return{title:"Info",description:J.message,type:"info"};return n.warn("Unknown error type encountered",{name:J.name,message:J.message,stack:J.stack}),{title:"Error",description:J.message||"An unexpected error occurred.",type:"error"}}var t41;var gx1=u(()=>{D0();t41=class t41 extends Error{constructor(J="Thread has no messages to compact"){super(J);this.name="NoMessagesToCompactError"}}});import{execSync as SZ6}from"node:child_process";import{rmdir as _79}from"node:fs/promises";import{tmpdir as b79}from"node:os";import vZ6 from"node:path";import{mkdtemp as x79,readFile as y79,unlink as f79,writeFile as RH2}from"fs/promises";class mx1{commands;customRegistry;latestCustom=[];telemetrySubmitter;constructor(J=DC()){this.customRegistry=J,this._initBaseCommands(!1),this.customRegistry.commands.subscribe((Q)=>this.latestCustom=Q),this.telemetrySubmitter=new hx1(async()=>{try{return(await U9()).settings["experimental.cli.commandTelemetry.enabled"]===!0}catch{return!1}}),k9.pipe(v0((Q)=>Q.settings["internal.modes"]),P8()).subscribe((Q)=>{this._initBaseCommands(Q??!1)})}_initBaseCommands(J){if(this.commands={...h79},J)Object.assign(this.commands,g79)}async execute(J,Q,Z=[],X){this.telemetrySubmitter.submit(J).catch((G)=>{n.debug("Failed to submit command telemetry",G)});let Y=this.commands[J];if(Y)return Y.execute(Q,Z);let K=this.latestCustom.find((G)=>G.name===J),q=await Sx1(J,Z,this.customRegistry,{signal:X});if(q.success)if(K?.kind==="markdown"){Q.editorDispatch({type:"set-input",input:q.output});return}else{Q.worker.handle({type:"user:message",message:{content:[{type:"text",text:q.output}]}});return}return Error(q.error??`Command '${J}' failed`)}query(J,Q,Z){let X=J.toLowerCase(),Y=Object.values(this.commands).filter((q)=>q.name.toLowerCase().includes(X)).filter((q)=>{if(!Q||!q.isVisible)return!0;return q.isVisible(Q,Z)}),K=this.latestCustom.filter((q)=>q.available&&q.name.toLowerCase().includes(X)).map((q)=>({name:q.name,description:"Custom command",requiresArgs:q.kind==="executable",execute:(G,z)=>this.execute(q.name,G,z??[])}));return[...Y,...K]}async cleanup(){await this.telemetrySubmitter.dispose()}get(J){let Q=this.commands[J];if(Q)return Q;let Z=this.latestCustom.find((X)=>X.name===J);return{name:J,description:"Custom command",requiresArgs:Z?.kind==="executable",execute:(X,Y)=>this.execute(J,X,Y??[])}}}var h79,g79;var kZ6=u(()=>{BZ6();D0();iw();u2();MC();lw();q7();JN();Ex1();Qz();ZD();a6();b0();PZ6();d41();$x1();TZ6();gx1();h79={"generate-agent-file":{name:"generate-agent-file",description:`Generate an ${qJ} file in the current workspace`,execute:async(J,Q)=>{J.worker.handle({type:"user:message",message:{content:[{type:"text",text:vK0}]}});return}},compact:{name:"compact",description:"Compact the thread. Optional: /compact [message] to queue a message after compaction",execute:async(J,Q)=>{if(J.thread.messages.length===0)return new t41;if(Q&&Q.length>0){let X=[{type:"text",text:Q.join(" ").trim()}],Y=J.takeImageAttachments?.()??[];if(Y.length>0)X.push(...Y);J.worker.handle({type:"user:message-queue:enqueue",message:{content:X}})}try{await J.worker.summarizeThread()}catch(Z){return Z instanceof Error?Z:Error("Failed to compact thread")}}},editor:{name:"editor",description:"Open $EDITOR to write a prompt",launchesWindow:!0,execute:async(J,Q)=>{try{let Z=process.env.EDITOR||process.env.VISUAL||"nano",X=await x79(vZ6.join(b79(),"amp-edit-")),Y=vZ6.join(X,"message.amp.md");SZ6(`${Z} "${Y}"`,{stdio:"inherit"}),process.stdout.write("\x1B[?25l");try{let q=(await y79(Y,"utf-8")).trim();if(q)J.editorDispatch({type:"set-input",input:q})}catch(K){if(K?.code==="ENOENT")return;return n.error("Failed to read temporary file",K),Error("Failed to read editor content")}try{await f79(Y),await _79(X)}catch(K){n.warn("Failed to clean up temporary file",K)}return}catch(Z){return n.error("Failed to open editor",Z),Error("Failed to open editor")}}},help:{name:"help",description:"Show help and hotkeys",execute:async(J,Q)=>{J.openHelp();return}},permissions:{name:"permissions",description:"Edit permission rules in $EDITOR, or `/permissions off|on` to toggle for this session",launchesWindow:!0,execute:async(J,Q)=>{if(Q&&Q.length>0){let Y=Q[0]?.trim().toLowerCase();switch(Y){case"on":try{return pU("dangerouslyAllowAll",!1),new GY("Amp is now following permissions rules for this session")}catch(K){return n.error("Failed to set dangerously allow all setting",K),Error("Failed to enable permissions for this session")}case"off":try{return pU("dangerouslyAllowAll",!0),new GY("Permissions disabled for this session - you will NOT be asked for confirmation before Amp runs a command.")}catch(K){return n.error("Failed to set dangerously allow all setting",K),Error("Failed to disable permissions for this session")}case"edit":break;default:return Error(`Invalid option: ${Y}. Use: on, off, or edit (or no argument for edit)`)}}let Z=await vT();if(Z===null)return Error("No editor found, please set $EDITOR to edit permissions");let X="";try{let Y={stdin:process.stdin,stdout:process.stdout,stderr:{write:(K)=>{return X=K.toString(),!0}},exit:(K)=>{if(K!==0)throw n.error("editPermissions exited with status",K),Error(X)},settingsFile:J.settingsFilePath,resolveEditor:vT};await n41(Y);return}catch(Y){n.error("failed to open permissions editor:",Y);let K=Y instanceof Error?`: ${Y.message}`:"";return Error(`Failed to open ${Z}${K}`)}finally{process.stdout.write("\x1B[?25l")}}},new:{name:"new",description:"Start a new thread",execute:async(J,Q)=>{try{await J.startNewThread();return}catch(Z){return n.error("Failed to start new thread",Z),Error("Failed to start new thread")}},isVisible:(J)=>J.messages.length!==0},continue:{name:"continue",description:"Continue an existing thread",requiresArgs:!1,requiresPicker:!0,execute:async(J,Q)=>{try{if(Q&&Q.length>0){let Z=Q[0]?.trim();if(!Z)return Error("Invalid thread ID provided");return await J.switchToThread(Z),new GY(`Switched to existing thread: ${Z}`)}await J.pickAndContinueThread();return}catch(Z){return n.error("Failed to continue thread",Z),Error("Failed to continue thread")}}},queue:{name:"queue",description:"Queue a message to send when inference completes. If no inference running, sends immediately.",requiresArgs:!0,execute:async(J,Q)=>{if(!Q||Q.length===0)return Error("Queue command requires a message argument. Usage: /queue <message>");let X=[{type:"text",text:Q.join(" ").trim()}],Y=J.takeImageAttachments?.()??[];if(Y.length>0)X.push(...Y);J.worker.handle({type:"user:message-queue:enqueue",message:{content:X}})}},dequeue:{name:"dequeue",description:"Dequeue all messages and restore them to the prompt editor",execute:async(J,Q)=>{let Z=J.thread.queuedMessages??[];if(Z.length===0)return;let Y=Z.map((K)=>{return K.queuedMessage.content.filter((G)=>G.type==="text").map((G)=>G.text).join("").trim()}).filter(Boolean).join(`
5799
5799
  `).trim();await J.worker.handle({type:"user:message-queue:discard"}),J.editorDispatch({type:"set-input",input:Y})},isVisible:(J)=>(J.queuedMessages?.length??0)>0},share:{name:"share",description:"Set thread visibility - `/share private|workspace|group|public`",execute:async(J,Q)=>{let{thread:Z,threadSyncService:X,ampURL:Y}=J;if(!Q||Q.length===0)return Error("Please specify a visibility option: private, workspace, group, or public");let K=tv(new URL(Y),Z.id).toString(),G=`Thread URL: ${LV(K,K,{fallback:()=>K})}`,z=Q[0]?.trim().toLowerCase(),U;switch(z){case"private":U={visibility:"private",sharedGroupIDs:[]};break;case"workspace":U={visibility:"thread_workspace_shared"};break;case"group":U={visibility:"private",sharedGroupIDs:[],shareWithAllCreatorGroups:!0};break;case"public":U={visibility:"public"};break;default:return Error(`Invalid visibility option: ${z}. Use: private, workspace, group, or public`)}try{return await X.updateThreadMeta(Z.id,U),new GY(`${G}
5800
5800
 
5801
5801
  This thread's visibility has been updated to: ${z}`)}catch(W){let F=W instanceof Error?W.message:String(W);if(F.includes("no-workspace"))return Error("You are not a member of any workspace.");if(F.includes("groups-disabled"))return Error("The groups feature is not enabled for this workspace.");if(F.includes("no-groups"))return Error("You are not a member of any groups.");return n.error("Unexpected failure to update thread visibility",W),Error(`Failed to update thread visibility for ${Z.id}`)}}},browser:{name:"browser",description:"Open the current thread in your browser",requiresArgs:!1,execute:async(J,Q)=>{let{thread:Z,ampURL:X}=J,Y=tv(new URL(X),Z.id).toString();try{return await ST(Y),new GY("Thread opened in browser")}catch(K){n.error("Failed to open browser",{error:K});let q=LV(Y,Y,{fallback:()=>Y});return new GY(`Could not open browser automatically. Thread URL: ${q}`)}},isVisible:(J)=>J.messages.length!==0},settings:{name:"settings",description:"Open CLI settings file in $EDITOR",launchesWindow:!0,execute:async(J)=>{let Q=await vT();if(Q===null)return Error("No editor found, please set $EDITOR to edit settings");try{SZ6(`${Q} "${J.settingsFilePath}"`,{stdio:"inherit"}),process.stdout.write("\x1B[?25l");return}catch(Z){return n.error("Failed to open settings in editor",Z),Error(`Failed to open ${Q}`)}}},"agent-files":{name:"agent-files",description:"List AGENTS.md guidance files in use for the current thread",execute:async(J)=>{try{let Q=await J.getGuidanceFiles();if(Q.length===0)return new GY("No guidance files are currently in use for this thread.");let Z=Q.length,X=`Agent ${BX(Z,"File")} (${Z}):`,Y=Q.map((K)=>` • ${MY(FX(K.uri))} (${K.type})`).join(`
@@ -5953,7 +5953,7 @@ Press ? to view full diff`;else return`Invoke tool ${J.name} with input ${JSON.s
5953
5953
  `,G)}),...this.buildPrettyHelpSection(WY9,z,W,F),new n0({height:1}),new W0({text:new C1(`Scrolling & Navigation
5954
5954
  `,G)}),...this.buildPrettyHelpSection(FY9,z,W,F),new n0({height:1}),new W0({text:new C1(`Slash Commands
5955
5955
  `,G)}),...this.buildPrettyHelpSection(HY9,U,W,F),new n0({height:1})]})})}),O=new O5({child:new W0({text:new C1("",H,[new C1("Press ",H),new C1("Escape",z),new C1(" to close • Use ",H),new C1("↑↓",z),new C1(" or ",H),new C1("j/k",z),new C1(" to scroll",H)])})}),j=new k6({crossAxisAlignment:"stretch",children:[new o2({child:A}),O]});return new O5({child:new i6({constraints:new f6(L,L,0,N),decoration:new h2(Z.background,H4.all(new g4(Z.primary,1,"rounded"))),child:j})})}buildPrettyHelpSection(J,Q,Z,X){let Y=[],K=30;for(let q of J){let G=[],z=[];for(let F of q.methods){let H=this.buildCleanKeyCombination(F);z.push(H)}let W=z.join(", ").padEnd(30," ");G.push(new C1(" ",Z)),G.push(new C1(W,Q)),G.push(new C1(" ",Z)),G.push(new C1(q.description,Z)),G.push(new C1(`
5956
- `,Z)),Y.push(new W0({text:new C1("",Z,G)}))}return Y}buildCleanKeyCombination(J){let{keys:Q,input:Z}=J,X=[];if(X.push(...Q),Z)X.push(Z);return X.join("+")}}});var mu,VW6;var Vg1=u(()=>{L9();vU();KX();RJ();FY();m7();M2();qX();Fg1();kU();Q2();mu=class mu extends j6{options;onSelect;onChange;title;body;borderColor;selectedIndex;autofocus;showDismissalMessage;enableMouseInteraction;maxVisibleItems;scrollBuffer;constructor({key:J,options:Q,onSelect:Z,onChange:X,title:Y,body:K,borderColor:q=l1.index(8),selectedIndex:G=0,autofocus:z=!0,showDismissalMessage:U=!0,enableMouseInteraction:W=!0,maxVisibleItems:F=20,scrollBuffer:H=3}){super({key:J});this.options=Q,this.onSelect=Z,this.onChange=X,this.title=Y,this.body=K,this.borderColor=q,this.selectedIndex=Math.max(0,Math.min(G,Q.length-1)),this.autofocus=z,this.showDismissalMessage=U,this.enableMouseInteraction=W,this.maxVisibleItems=F,this.scrollBuffer=H}createState(){return new VW6}};VW6=class VW6 extends O6{selectedIndex=0;focusNode=new j2({});scrollOffset=0;initState(){super.initState(),this.selectedIndex=this.widget.selectedIndex,this.focusNode.addKeyHandler(this.handleKeyEvent.bind(this)),this.updateScrollPosition()}dispose(){this.focusNode.dispose(),super.dispose()}handleKeyEvent(J){let Q=(Z,X)=>{return J.key===Z&&J.shiftKey===(X?.shift??!1)&&J.ctrlKey===(X?.ctrl??!1)&&J.altKey===(X?.alt??!1)&&J.metaKey===(X?.meta??!1)};if(Q("ArrowDown")||Q("n",{ctrl:!0})||Q("Tab")||Q("j"))return this.moveSelection(1),"handled";if(Q("ArrowUp")||Q("p",{ctrl:!0})||Q("Tab",{shift:!0})||Q("k"))return this.moveSelection(-1),"handled";if(Q("Enter")){let Z=this.widget.options[this.selectedIndex];if(Z&&(Z.enabled??!0))this.widget.onSelect(Z.value);return"handled"}if(Q("Escape"))return this.widget.onSelect(null),"handled";return"ignored"}handleMouseScroll(J){if(J.direction==="down")this.moveSelection(1);else this.moveSelection(-1)}moveSelection(J){if(this.widget.options.length===0)return;let Q=this.selectedIndex+J;Q=Math.max(0,Math.min(Q,this.widget.options.length-1));let Z=Q,X=0;while(X<this.widget.options.length){let Y=this.widget.options[Q];if(Y&&(Y.enabled??!0))break;if(Q=Q+Math.sign(J),Q<0||Q>=this.widget.options.length){Q=Z;break}X++}if(this.selectedIndex!==Q)this.setState(()=>{if(this.selectedIndex=Q,this.updateScrollPosition(),this.widget.onChange){let Y=this.widget.options[Q];if(Y)this.widget.onChange(Q,Y)}})}updateScrollPosition(){let J=this.widget.maxVisibleItems,Q=this.widget.scrollBuffer,Z=this.selectedIndex,X=Z-this.scrollOffset,Y=this.scrollOffset;if(X>=J-Q)Y=Math.max(0,Z-(J-Q-1));if(X<Q)Y=Math.max(0,Z-Q);let K=Math.max(0,this.widget.options.length-J);if(Y=Math.min(Y,K),Y!==this.scrollOffset)this.scrollOffset=Y}build(J){if(this.widget.options.length===0)return new n0({width:0,height:0});let Q=[];if(this.widget.title)Q.push(new W0({text:new C1(this.widget.title,new h1({bold:!0}))})),Q.push(new n0({height:1}));if(this.widget.body){if(typeof this.widget.body==="string")Q.push(new W0({text:new C1(this.widget.body)}));else Q.push(this.widget.body);Q.push(new n0({height:1}))}let Z=this.scrollOffset,X=Math.min(this.widget.options.length,Z+this.widget.maxVisibleItems);for(let q=Z;q<X;q++){let G=this.widget.options[q],z=q===this.selectedIndex,U=G.enabled??!0,W=new _51({title:G.label,subtitle:G.description,selected:z,enabled:U,onTap:U&&this.widget.enableMouseInteraction?()=>this.widget.onSelect(G.value):void 0});Q.push(W)}if(this.widget.showDismissalMessage)Q.push(new n0({height:1})),Q.push(new W0({text:new C1("Escape to close",new h1({color:l1.index(8)}))}));let Y=new k6({crossAxisAlignment:"stretch",mainAxisSize:"min",children:Q}),K=new i6({child:new v8({padding:new B6(1,0,1,0),child:Y}),decoration:new h2(void 0,H4.all(new g4(this.widget.borderColor,1,"rounded")))});return new Z2({focusNode:this.focusNode,autofocus:this.widget.autofocus,child:new L5({onScroll:this.handleMouseScroll.bind(this),child:K})})}}});var NW6=u(()=>{xT();yT();ax1();Xu();L9();J71();OH()});var Ng1,LW6;var AW6=u(()=>{D0();BG1();R5();qX();Vg1();NW6();Ng1=class Ng1 extends j6{props;constructor(J){super();this.props=J}createState(){return new LW6}};LW6=class LW6 extends O6{options=[];loading=!0;error=null;async initState(){try{this.loading=!0,this.error=null;let J=await Fc();if(J.length===0){this.error="No IDE configurations found. Make sure you have an IDE with the Amp plugin running.";return}this.options=J.map((Q)=>{let Z=Q.workspaceFolders.length>0?Q.workspaceFolders[0]:"Unknown project",X=Q.ideName;return{value:{config:Q,label:X},label:X,description:Z}})}catch(J){n.error("Failed to load IDE configurations:",J),this.error="Failed to load IDE configurations"}finally{this.loading=!1,this.setState()}}handleKeyEvent=(J)=>{if(J.key==="Escape"||J.key==="c"&&J.ctrlKey)return this.widget.props.onCancel(),"handled";return"ignored"};build(J){if(this.loading)return new W0({text:new C1("Loading available IDEs...",new h1({color:l1.white}))});if(this.error)return new W0({text:new C1(this.error,new h1({color:l1.red}))});if(this.options.length===0)return new W0({text:new C1("No IDE configurations found.",new h1({color:l1.yellow}))});let Q=d8.sizeOf(J),Z=Math.max(5,Q.height);Z-=6;let X=Math.floor(Math.max(1,Z/2));return new Z2({autofocus:this.widget.props.autofocus??!0,onKey:this.handleKeyEvent,child:new mu({title:"Select IDE:",options:this.options,onSelect:(Y)=>{if(Y)this.widget.props.onSelect(Y.config);else this.widget.props.onCancel()},maxVisibleItems:X,autofocus:this.widget.props.autofocus??!0})})}}});var wW6=e((Hx2,RW6)=>{RW6.exports=b51;function b51(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}b51.prototype.go=function(J){if(this.pending<this.max)jW6(this,J);else this.waiting.push(J)};b51.prototype.wait=function(J){if(this.pending===0)J(this.error);else this.listeners.push(J)};b51.prototype.hold=function(){return OW6(this)};function OW6(J){J.pending+=1;var Q=!1;return Z;function Z(Y){if(Q)throw Error("callback called twice");if(Q=!0,J.error=J.error||Y,J.pending-=1,J.waiting.length>0&&J.pending<J.max)jW6(J,J.waiting.shift());else if(J.pending===0){var K=J.listeners;J.listeners=[],K.forEach(X)}}function X(Y){Y(J.error)}}function jW6(J,Q){Q(OW6(J))}});var EW6=e((NY9)=>{var uu=o1("fs"),x51=o1("util"),Lg1=o1("stream"),IW6=Lg1.Readable,Ag1=Lg1.Writable,BY9=Lg1.PassThrough,DY9=wW6(),y51=o1("events").EventEmitter;NY9.createFromBuffer=MY9;NY9.createFromFd=VY9;NY9.BufferSlicer=yH;NY9.FdSlicer=xH;x51.inherits(xH,y51);function xH(J,Q){Q=Q||{},y51.call(this),this.fd=J,this.pend=new DY9,this.pend.max=1,this.refCount=0,this.autoClose=!!Q.autoClose}xH.prototype.read=function(J,Q,Z,X,Y){var K=this;K.pend.go(function(q){uu.read(K.fd,J,Q,Z,X,function(G,z,U){q(),Y(G,z,U)})})};xH.prototype.write=function(J,Q,Z,X,Y){var K=this;K.pend.go(function(q){uu.write(K.fd,J,Q,Z,X,function(G,z,U){q(),Y(G,z,U)})})};xH.prototype.createReadStream=function(J){return new f51(this,J)};xH.prototype.createWriteStream=function(J){return new h51(this,J)};xH.prototype.ref=function(){this.refCount+=1};xH.prototype.unref=function(){var J=this;if(J.refCount-=1,J.refCount>0)return;if(J.refCount<0)throw Error("invalid unref");if(J.autoClose)uu.close(J.fd,Q);function Q(Z){if(Z)J.emit("error",Z);else J.emit("close")}};x51.inherits(f51,IW6);function f51(J,Q){Q=Q||{},IW6.call(this,Q),this.context=J,this.context.ref(),this.start=Q.start||0,this.endOffset=Q.end,this.pos=this.start,this.destroyed=!1}f51.prototype._read=function(J){var Q=this;if(Q.destroyed)return;var Z=Math.min(Q._readableState.highWaterMark,J);if(Q.endOffset!=null)Z=Math.min(Z,Q.endOffset-Q.pos);if(Z<=0){Q.destroyed=!0,Q.push(null),Q.context.unref();return}Q.context.pend.go(function(X){if(Q.destroyed)return X();var Y=Buffer.allocUnsafe(Z);uu.read(Q.context.fd,Y,0,Z,Q.pos,function(K,q){if(K)Q.destroy(K);else if(q===0)Q.destroyed=!0,Q.push(null),Q.context.unref();else Q.pos+=q,Q.push(Y.slice(0,q));X()})})};f51.prototype.destroy=function(J){if(this.destroyed)return;J=J||Error("stream destroyed"),this.destroyed=!0,this.emit("error",J),this.context.unref()};x51.inherits(h51,Ag1);function h51(J,Q){Q=Q||{},Ag1.call(this,Q),this.context=J,this.context.ref(),this.start=Q.start||0,this.endOffset=Q.end==null?1/0:+Q.end,this.bytesWritten=0,this.pos=this.start,this.destroyed=!1,this.on("finish",this.destroy.bind(this))}h51.prototype._write=function(J,Q,Z){var X=this;if(X.destroyed)return;if(X.pos+J.length>X.endOffset){var Y=Error("maximum file length exceeded");Y.code="ETOOBIG",X.destroy(),Z(Y);return}X.context.pend.go(function(K){if(X.destroyed)return K();uu.write(X.context.fd,J,0,J.length,X.pos,function(q,G){if(q)X.destroy(),K(),Z(q);else X.bytesWritten+=G,X.pos+=G,X.emit("progress"),K(),Z()})})};h51.prototype.destroy=function(){if(this.destroyed)return;this.destroyed=!0,this.context.unref()};x51.inherits(yH,y51);function yH(J,Q){y51.call(this),Q=Q||{},this.refCount=0,this.buffer=J,this.maxChunkSize=Q.maxChunkSize||Number.MAX_SAFE_INTEGER}yH.prototype.read=function(J,Q,Z,X,Y){if(!(0<=Q&&Q<=J.length))throw RangeError("offset outside buffer: 0 <= "+Q+" <= "+J.length);if(X<0)throw RangeError("position is negative: "+X);if(Q+Z>J.length)Z=J.length-Q;if(X+Z>this.buffer.length)Z=this.buffer.length-X;if(Z<=0){setImmediate(function(){Y(null,0)});return}this.buffer.copy(J,Q,X,X+Z),setImmediate(function(){Y(null,Z)})};yH.prototype.write=function(J,Q,Z,X,Y){J.copy(this.buffer,X,Q,Q+Z),setImmediate(function(){Y(null,Z,J)})};yH.prototype.createReadStream=function(J){J=J||{};var Q=new BY9(J);Q.destroyed=!1,Q.start=J.start||0,Q.endOffset=J.end,Q.pos=Q.endOffset||this.buffer.length;var Z=this.buffer.slice(Q.start,Q.pos),X=0;while(!0){var Y=X+this.maxChunkSize;if(Y>=Z.length){if(X<Z.length)Q.write(Z.slice(X,Z.length));break}Q.write(Z.slice(X,Y)),X=Y}return Q.end(),Q.destroy=function(){Q.destroyed=!0},Q};yH.prototype.createWriteStream=function(J){var Q=this;J=J||{};var Z=new Ag1(J);return Z.start=J.start||0,Z.endOffset=J.end==null?this.buffer.length:+J.end,Z.bytesWritten=0,Z.pos=Z.start,Z.destroyed=!1,Z._write=function(X,Y,K){if(Z.destroyed)return;var q=Z.pos+X.length;if(q>Z.endOffset){var G=Error("maximum file length exceeded");G.code="ETOOBIG",Z.destroyed=!0,K(G);return}X.copy(Q.buffer,Z.pos,0,X.length),Z.bytesWritten+=X.length,Z.pos=q,Z.emit("progress"),K()},Z.destroy=function(){Z.destroyed=!0},Z};yH.prototype.ref=function(){this.refCount+=1};yH.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw Error("invalid unref")};function MY9(J,Q){return new yH(J,Q)}function VY9(J,Q){return new xH(J,Q)}});var TW6=e((Dx2,PW6)=>{var _V=o1("buffer").Buffer,Og1=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];if(typeof Int32Array<"u")Og1=new Int32Array(Og1);function $W6(J){if(_V.isBuffer(J))return J;var Q=typeof _V.alloc==="function"&&typeof _V.from==="function";if(typeof J==="number")return Q?_V.alloc(J):new _V(J);else if(typeof J==="string")return Q?_V.from(J):new _V(J);else throw Error("input must be buffer, number, or string, received "+typeof J)}function RY9(J){var Q=$W6(4);return Q.writeInt32BE(J,0),Q}function jg1(J,Q){if(J=$W6(J),_V.isBuffer(Q))Q=Q.readUInt32BE(0);var Z=~~Q^-1;for(var X=0;X<J.length;X++)Z=Og1[(Z^J[X])&255]^Z>>>8;return Z^-1}function Rg1(){return RY9(jg1.apply(null,arguments))}Rg1.signed=function(){return jg1.apply(null,arguments)};Rg1.unsigned=function(){return jg1.apply(null,arguments)>>>0};PW6.exports=Rg1});function PY9(J,Q,Z){if(typeof Q==="function")Z=Q,Q=null;if(Q==null)Q={};if(Q.autoClose==null)Q.autoClose=!0;if(Q.lazyEntries==null)Q.lazyEntries=!1;if(Q.decodeStrings==null)Q.decodeStrings=!0;if(Q.validateEntrySizes==null)Q.validateEntrySizes=!0;if(Q.strictFileNames==null)Q.strictFileNames=!1;if(Z==null)Z=m51;wg1.open(J,"r",function(X,Y){if(X)return Z(X);TY9(Y,Q,function(K,q){if(K)wg1.close(Y,m51);Z(K,q)})})}function TY9(J,Q,Z){if(typeof Q==="function")Z=Q,Q=null;if(Q==null)Q={};if(Q.autoClose==null)Q.autoClose=!1;if(Q.lazyEntries==null)Q.lazyEntries=!1;if(Q.decodeStrings==null)Q.decodeStrings=!0;if(Q.validateEntrySizes==null)Q.validateEntrySizes=!0;if(Q.strictFileNames==null)Q.strictFileNames=!1;if(Z==null)Z=m51;wg1.fstat(J,function(X,Y){if(X)return Z(X);var K=IY9.createFromFd(J,{autoClose:!0});CY9(K,Y.size,Q,Z)})}function CY9(J,Q,Z,X){if(typeof Z==="function")X=Z,Z=null;if(Z==null)Z={};if(Z.autoClose==null)Z.autoClose=!0;if(Z.lazyEntries==null)Z.lazyEntries=!1;if(Z.decodeStrings==null)Z.decodeStrings=!0;var Y=!!Z.decodeStrings;if(Z.validateEntrySizes==null)Z.validateEntrySizes=!0;if(Z.strictFileNames==null)Z.strictFileNames=!1;if(X==null)X=m51;if(typeof Q!=="number")throw Error("expected totalSize parameter to be a number");if(Q>Number.MAX_SAFE_INTEGER)throw Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");J.ref();var K=22,q=20,G=65535,z=Math.min(q+K+G,Q),U=hH(z),W=Q-U.length;ZC(J,U,0,z,W,function(F){if(F)return X(F);for(var H=z-K;H>=0;H-=1){if(U.readUInt32LE(H)!==101010256)continue;var B=U.subarray(H),M=B.readUInt16LE(4),V=B.readUInt16LE(10),N=B.readUInt32LE(16),L=B.readUInt16LE(20),A=B.length-K;if(L!==A)return X(Error("Invalid comment length. Expected: "+A+". Found: "+L+". Are there extra bytes at the end of the file? Or is the end of central dir signature `PK☺☻` in the comment?"));var O=Y?g51(B.subarray(22),!1):B.subarray(22);if(H-q>=0&&U.readUInt32LE(H-q)===117853008){var j=U.subarray(H-q,H-q+q),R=QC(j,8),I=hH(56);return ZC(J,I,0,I.length,R,function(w){if(w)return X(w);if(I.readUInt32LE(0)!==101075792)return X(Error("invalid zip64 end of central directory record signature"));if(M=I.readUInt32LE(16),M!==0)return X(Error("multi-disk zip files are not supported: found disk number: "+M));return V=QC(I,32),N=QC(I,48),X(null,new fH(J,N,Q,V,O,Z.autoClose,Z.lazyEntries,Y,Z.validateEntrySizes,Z.strictFileNames))})}if(M!==0)return X(Error("multi-disk zip files are not supported: found disk number: "+M));return X(null,new fH(J,N,Q,V,O,Z.autoClose,Z.lazyEntries,Y,Z.validateEntrySizes,Z.strictFileNames))}X(Error("End of central directory record signature not found. Either not a zip file, or file is truncated."))})}function fH(J,Q,Z,X,Y,K,q,G,z,U){var W=this;if(p51.call(W),W.reader=J,W.reader.on("error",function(F){SW6(W,F)}),W.reader.once("close",function(){W.emit("close")}),W.readEntryCursor=Q,W.fileSize=Z,W.entryCount=X,W.comment=Y,W.entriesRead=0,W.autoClose=!!K,W.lazyEntries=!!q,W.decodeStrings=!!G,W.validateEntrySizes=!!z,W.strictFileNames=!!U,W.isOpen=!0,W.emittedError=!1,!W.lazyEntries)W._readEntry()}function hU(J,Q){if(J.autoClose)J.close();SW6(J,Q)}function SW6(J,Q){if(J.emittedError)return;J.emittedError=!0,J.emit("error",Q)}function d51(){}function SY9(){}function vY9(J,Q,Z){var X=J&31,Y=(J>>5&15)-1,K=(J>>9&127)+1980,q=0,G=(Q&31)*2,z=Q>>5&63,U=Q>>11&31;if(Z==null||Z==="local")return new Date(K,Y,X,U,z,G,q);else if(Z==="UTC")return new Date(Date.UTC(K,Y,X,U,z,G,q));else throw Error("unrecognized options.timezone: "+options.timezone)}function kY9(J,Q,Z,X){var Y=null;for(var K=0;K<Z.length;K++){var q=Z[K];if(q.id===28789){if(q.data.length<6)continue;if(q.data.readUInt8(0)!==1)continue;var G=q.data.readUInt32LE(1);if(EY9.unsigned(Q)!==G)continue;Y=g51(q.data.subarray(5),!0);break}}if(Y==null){var z=(J&2048)!==0;Y=g51(Q,z)}if(!X)Y=Y.replace(/\\/g,"/");return Y}function _Y9(J){if(J.indexOf("\\")!==-1)return"invalid characters in fileName: "+J;if(/^[a-zA-Z]:/.test(J)||/^\//.test(J))return"absolute path: "+J;if(J.split("/").indexOf("..")!==-1)return"invalid relative path: "+J;return null}function bY9(J){var Q=[],Z=0;while(Z<J.length-3){var X=J.readUInt16LE(Z+0),Y=J.readUInt16LE(Z+2),K=Z+4,q=K+Y;if(q>J.length)throw Error("extra field length exceeds extra field buffer size");var G=J.subarray(K,q);Q.push({id:X,data:G}),Z=q}return Q}function ZC(J,Q,Z,X,Y,K){if(X===0)return setImmediate(function(){K(null,hH(0))});J.read(Q,Z,X,Y,function(q,G){if(q)return K(q);if(G<X)return K(Error("unexpected EOF"));K()})}function pu(J){CW6.call(this),this.actualByteCount=0,this.expectedByteCount=J}function nO(){p51.call(this),this.refCount=0}function c51(J){Eg1.call(this),this.context=J,this.context.ref(),this.unreffedYet=!1}function g51(J,Q){if(Q)return J.toString("utf8");else{var Z="";for(var X=0;X<J.length;X++)Z+=xY9[J[X]];return Z}}function QC(J,Q){var Z=J.readUInt32LE(Q),X=J.readUInt32LE(Q+4);return X*4294967296+Z}function Ig1(J,Q){if(typeof J.destroy==="function")J._destroy=function(Z,X){if(Q(),X!=null)X(Z)};else J.destroy=Q}function m51(J){if(J)throw J}var wg1,wY9,IY9,EY9,u51,p51,CW6,Eg1,$Y9,$g1,xY9="\x00☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ",hH;var vW6=u(()=>{wg1=o1("fs"),wY9=o1("zlib"),IY9=EW6(),EY9=TW6(),u51=o1("util"),p51=o1("events").EventEmitter,CW6=o1("stream").Transform,Eg1=o1("stream").PassThrough,$Y9=o1("stream").Writable;$g1=PY9;u51.inherits(fH,p51);fH.prototype.close=function(){if(!this.isOpen)return;this.isOpen=!1,this.reader.unref()};fH.prototype.readEntry=function(){if(!this.lazyEntries)throw Error("readEntry() called without lazyEntries:true");this._readEntry()};fH.prototype._readEntry=function(){var J=this;if(J.entryCount===J.entriesRead){setImmediate(function(){if(J.autoClose)J.close();if(J.emittedError)return;J.emit("end")});return}if(J.emittedError)return;var Q=hH(46);ZC(J.reader,Q,0,Q.length,J.readEntryCursor,function(Z){if(Z)return hU(J,Z);if(J.emittedError)return;var X=new d51,Y=Q.readUInt32LE(0);if(Y!==33639248)return hU(J,Error("invalid central directory file header signature: 0x"+Y.toString(16)));if(X.versionMadeBy=Q.readUInt16LE(4),X.versionNeededToExtract=Q.readUInt16LE(6),X.generalPurposeBitFlag=Q.readUInt16LE(8),X.compressionMethod=Q.readUInt16LE(10),X.lastModFileTime=Q.readUInt16LE(12),X.lastModFileDate=Q.readUInt16LE(14),X.crc32=Q.readUInt32LE(16),X.compressedSize=Q.readUInt32LE(20),X.uncompressedSize=Q.readUInt32LE(24),X.fileNameLength=Q.readUInt16LE(28),X.extraFieldLength=Q.readUInt16LE(30),X.fileCommentLength=Q.readUInt16LE(32),X.internalFileAttributes=Q.readUInt16LE(36),X.externalFileAttributes=Q.readUInt32LE(38),X.relativeOffsetOfLocalHeader=Q.readUInt32LE(42),X.generalPurposeBitFlag&64)return hU(J,Error("strong encryption is not supported"));J.readEntryCursor+=46,Q=hH(X.fileNameLength+X.extraFieldLength+X.fileCommentLength),ZC(J.reader,Q,0,Q.length,J.readEntryCursor,function(K){if(K)return hU(J,K);if(J.emittedError)return;X.fileNameRaw=Q.subarray(0,X.fileNameLength);var q=X.fileNameLength+X.extraFieldLength;X.extraFieldRaw=Q.subarray(X.fileNameLength,q),X.fileCommentRaw=Q.subarray(q,q+X.fileCommentLength);try{X.extraFields=bY9(X.extraFieldRaw)}catch(V){return hU(J,V)}if(J.decodeStrings){var G=(X.generalPurposeBitFlag&2048)!==0;X.fileComment=g51(X.fileCommentRaw,G),X.fileName=kY9(X.generalPurposeBitFlag,X.fileNameRaw,X.extraFields,J.strictFileNames);var z=_Y9(X.fileName);if(z!=null)return hU(J,Error(z))}else X.fileComment=X.fileCommentRaw,X.fileName=X.fileNameRaw;X.comment=X.fileComment,J.readEntryCursor+=Q.length,J.entriesRead+=1;for(var U=0;U<X.extraFields.length;U++){var W=X.extraFields[U];if(W.id!==1)continue;var F=W.data,H=0;if(X.uncompressedSize===4294967295){if(H+8>F.length)return hU(J,Error("zip64 extended information extra field does not include uncompressed size"));X.uncompressedSize=QC(F,H),H+=8}if(X.compressedSize===4294967295){if(H+8>F.length)return hU(J,Error("zip64 extended information extra field does not include compressed size"));X.compressedSize=QC(F,H),H+=8}if(X.relativeOffsetOfLocalHeader===4294967295){if(H+8>F.length)return hU(J,Error("zip64 extended information extra field does not include relative header offset"));X.relativeOffsetOfLocalHeader=QC(F,H),H+=8}break}if(J.validateEntrySizes&&X.compressionMethod===0){var B=X.uncompressedSize;if(X.isEncrypted())B+=12;if(X.compressedSize!==B){var M="compressed/uncompressed size mismatch for stored file: "+X.compressedSize+" != "+X.uncompressedSize;return hU(J,Error(M))}}if(J.emit("entry",X),!J.lazyEntries)J._readEntry()})})};fH.prototype.openReadStream=function(J,Q,Z){var X=this,Y=0,K=J.compressedSize;if(Z==null)Z=Q,Q=null;if(Q==null)Q={};else{if(Q.decrypt!=null){if(!J.isEncrypted())throw Error("options.decrypt can only be specified for encrypted entries");if(Q.decrypt!==!1)throw Error("invalid options.decrypt value: "+Q.decrypt);if(J.isCompressed()){if(Q.decompress!==!1)throw Error("entry is encrypted and compressed, and options.decompress !== false")}}if(Q.decompress!=null){if(!J.isCompressed())throw Error("options.decompress can only be specified for compressed entries");if(!(Q.decompress===!1||Q.decompress===!0))throw Error("invalid options.decompress value: "+Q.decompress)}if(Q.start!=null||Q.end!=null){if(J.isCompressed()&&Q.decompress!==!1)throw Error("start/end range not allowed for compressed entry without options.decompress === false");if(J.isEncrypted()&&Q.decrypt!==!1)throw Error("start/end range not allowed for encrypted entry without options.decrypt === false")}if(Q.start!=null){if(Y=Q.start,Y<0)throw Error("options.start < 0");if(Y>J.compressedSize)throw Error("options.start > entry.compressedSize")}if(Q.end!=null){if(K=Q.end,K<0)throw Error("options.end < 0");if(K>J.compressedSize)throw Error("options.end > entry.compressedSize");if(K<Y)throw Error("options.end < options.start")}}if(!X.isOpen)return Z(Error("closed"));if(J.isEncrypted()){if(Q.decrypt!==!1)return Z(Error("entry is encrypted, and options.decrypt !== false"))}var q;if(J.compressionMethod===0)q=!1;else if(J.compressionMethod===8)q=Q.decompress!=null?Q.decompress:!0;else return Z(Error("unsupported compression method: "+J.compressionMethod));X.readLocalFileHeader(J,{minimal:!0},function(G,z){if(G)return Z(G);X.openReadStreamLowLevel(z.fileDataStart,J.compressedSize,Y,K,q,J.uncompressedSize,Z)})};fH.prototype.openReadStreamLowLevel=function(J,Q,Z,X,Y,K,q){var G=this,z=J+Q,U=G.reader.createReadStream({start:J+Z,end:J+X}),W=U;if(Y){var F=!1,H=wY9.createInflateRaw();if(U.on("error",function(B){setImmediate(function(){if(!F)H.emit("error",B)})}),U.pipe(H),G.validateEntrySizes)W=new pu(K),H.on("error",function(B){setImmediate(function(){if(!F)W.emit("error",B)})}),H.pipe(W);else W=H;Ig1(W,function(){if(F=!0,H!==W)H.unpipe(W);U.unpipe(H),U.destroy()})}q(null,W)};fH.prototype.readLocalFileHeader=function(J,Q,Z){var X=this;if(Z==null)Z=Q,Q=null;if(Q==null)Q={};X.reader.ref();var Y=hH(30);ZC(X.reader,Y,0,Y.length,J.relativeOffsetOfLocalHeader,function(K){try{if(K)return Z(K);var q=Y.readUInt32LE(0);if(q!==67324752)return Z(Error("invalid local file header signature: 0x"+q.toString(16)));var G=Y.readUInt16LE(26),z=Y.readUInt16LE(28),U=J.relativeOffsetOfLocalHeader+30+G+z;if(U+J.compressedSize>X.fileSize)return Z(Error("file data overflows file bounds: "+U+" + "+J.compressedSize+" > "+X.fileSize));if(Q.minimal)return Z(null,{fileDataStart:U});var W=new SY9;W.fileDataStart=U,W.versionNeededToExtract=Y.readUInt16LE(4),W.generalPurposeBitFlag=Y.readUInt16LE(6),W.compressionMethod=Y.readUInt16LE(8),W.lastModFileTime=Y.readUInt16LE(10),W.lastModFileDate=Y.readUInt16LE(12),W.crc32=Y.readUInt32LE(14),W.compressedSize=Y.readUInt32LE(18),W.uncompressedSize=Y.readUInt32LE(22),W.fileNameLength=G,W.extraFieldLength=z,Y=hH(G+z),X.reader.ref(),ZC(X.reader,Y,0,Y.length,J.relativeOffsetOfLocalHeader+30,function(F){try{if(F)return Z(F);return W.fileName=Y.subarray(0,G),W.extraField=Y.subarray(G),Z(null,W)}finally{X.reader.unref()}})}finally{X.reader.unref()}})};d51.prototype.getLastModDate=function(J){if(J==null)J={};if(!J.forceDosFormat)for(var Q=0;Q<this.extraFields.length;Q++){var Z=this.extraFields[Q];if(Z.id===21589){var X=Z.data;if(X.length<5)continue;var Y=X[0],K=1;if(!(Y&K))continue;var q=X.readInt32LE(1);return new Date(q*1000)}else if(Z.id===10){var X=Z.data,G=4;while(G<X.length+4){var z=X.readUInt16LE(G);G+=2;var U=X.readUInt16LE(G);if(G+=2,z!==1){G+=U;continue}if(U<8||G+U>X.length)break;var W=4294967296*X.readInt32LE(G+4)+X.readUInt32LE(G),F=W/1e4-11644473600000;return new Date(F)}}}return vY9(this.lastModFileDate,this.lastModFileTime,J.timezone)};d51.prototype.isEncrypted=function(){return(this.generalPurposeBitFlag&1)!==0};d51.prototype.isCompressed=function(){return this.compressionMethod===8};u51.inherits(pu,CW6);pu.prototype._transform=function(J,Q,Z){if(this.actualByteCount+=J.length,this.actualByteCount>this.expectedByteCount){var X="too many bytes in the stream. expected "+this.expectedByteCount+". got at least "+this.actualByteCount;return Z(Error(X))}Z(null,J)};pu.prototype._flush=function(J){if(this.actualByteCount<this.expectedByteCount){var Q="not enough bytes in the stream. expected "+this.expectedByteCount+". got only "+this.actualByteCount;return J(Error(Q))}J()};u51.inherits(nO,p51);nO.prototype.ref=function(){this.refCount+=1};nO.prototype.unref=function(){var J=this;if(J.refCount-=1,J.refCount>0)return;if(J.refCount<0)throw Error("invalid unref");J.close(Q);function Q(Z){if(Z)return J.emit("error",Z);J.emit("close")}};nO.prototype.createReadStream=function(J){if(J==null)J={};var{start:Q,end:Z}=J;if(Q===Z){var X=new Eg1;return setImmediate(function(){X.end()}),X}var Y=this._readStreamForRange(Q,Z),K=!1,q=new c51(this);Y.on("error",function(z){setImmediate(function(){if(!K)q.emit("error",z)})}),Ig1(q,function(){Y.unpipe(q),q.unref(),Y.destroy()});var G=new pu(Z-Q);return q.on("error",function(z){setImmediate(function(){if(!K)G.emit("error",z)})}),Ig1(G,function(){K=!0,q.unpipe(G),q.destroy()}),Y.pipe(q).pipe(G)};nO.prototype._readStreamForRange=function(J,Q){throw Error("not implemented")};nO.prototype.read=function(J,Q,Z,X,Y){var K=this.createReadStream({start:X,end:X+Z}),q=new $Y9,G=0;q._write=function(z,U,W){z.copy(J,Q+G,0,z.length),G+=z.length,W()},q.on("finish",Y),K.on("error",function(z){Y(z)}),K.pipe(q)};nO.prototype.close=function(J){setImmediate(J)};u51.inherits(c51,Eg1);c51.prototype._flush=function(J){this.unref(),J()};c51.prototype.unref=function(J){if(this.unreffedYet)return;this.unreffedYet=!0,this.context.unref()};if(typeof Buffer.allocUnsafe==="function")hH=function(J){return Buffer.allocUnsafe(J)};else hH=function(J){return new Buffer(J)}});import{createWriteStream as yY9,existsSync as fY9,mkdirSync as hY9,readdirSync as gY9,rmSync as mY9}from"node:fs";import{writeFile as uY9}from"node:fs/promises";import du from"node:path";import{pipeline as pY9}from"node:stream/promises";async function kW6(J,Q,Z,X=dY9){n.debug("jetbrains-plugin-install",{pluginDirectory:J});let Y=du.join(J,"lib");if(fY9(Y)){let q=gY9(Y,{withFileTypes:!0}).filter((G)=>G.name.endsWith(".jar"));n.info("jetbrains-plugin-install",{libDirectory:Y,removableJarFiles:q.map((G)=>G.name)}),q.forEach((G)=>{mY9(du.join(G.parentPath,G.name))})}hY9(Y,{recursive:!0});let K=du.join(J,"version.txt");return await uY9(K,Z,"utf8"),X(Q,Y)}function dY9(J,Q){return new Promise((Z,X)=>{$g1(J,{lazyEntries:!0},(Y,K)=>{if(Y)return X(Y);if(!K)return X(Error("Failed to open ZIP file"));K.readEntry(),K.on("entry",(q)=>{if(q.fileName.startsWith("amp-jetbrains-plugin/lib/"))K.openReadStream(q,async(G,z)=>{if(G)return X(G);if(!z)return X(Error("Failed to open read stream"));let U=du.basename(q.fileName),W=du.join(Q,U);await pY9(z,yY9(W)),K.readEntry()});else K.readEntry()}),K.on("end",Z),K.on("error",X)})})}var _W6=u(()=>{vW6();D0()});import{createHash as cY9}from"node:crypto";import{createWriteStream as lY9,existsSync as l51,readdirSync as iY9,readFileSync as nY9}from"node:fs";import{copyFile as aY9,mkdir as rY9,readFile as sY9,rename as oY9,unlink as tY9}from"node:fs/promises";import{homedir as bW6,platform as Tg1}from"node:os";import bV from"node:path";import{Readable as eY9}from"node:stream";import{pipeline as JK9}from"node:stream/promises";async function Pg1(J,Q=3){for(let Z=1;Z<=Q;Z++)try{let X=await fetch(J);if(!X.ok)throw Error(`HTTP ${X.status}: ${X.statusText} for ${J}`);return X}catch(X){let Y=X instanceof Error?X.message:String(X);if(X instanceof Error&&X.message.match(/HTTP 4\d\d:/))throw X;if(Z===Q)throw X;let K=500*Math.pow(2,Z-1);n.warn("fetchWithRetry",{url:J,attempt:Z,maxRetries:Q,message:Y,retryingInMs:K}),await new Promise((q)=>setTimeout(q,K))}throw Error("Unexpected end of retry loop")}async function hW6(){if(cu)return n.debug("jetbrains-plugin-version",{message:"Using cached version info",cachedVersionInfo:cu}),cu;return n.debug("jetbrains-plugin-version",{message:"Fetching version info",url:xW6}),cu=await(await Pg1(xW6)).json(),cu}async function Cg1(){return(await hW6()).plugin_version}async function gW6(){let J=await Cg1();return`${fW6}-${J}.zip`}function QK9(){let J=Tg1();return n.debug("jetbrains-plugin-discovery",{os:J}),["darwin","win32"].includes(J)}function ZK9(J,Q){if(!J?.pluginVersion)return"unknown";return J?.pluginVersion===Q?"uptodate":"outdated"}function mW6(J,Q){if(n.debug("jetbrains-plugin-discovery",{ideStatus:J}),QK9()){let X=YK9();if(n.debug("jetbrains-plugin-discovery",{discoveryResult:X}),!X.success)return X;let Y=X.products.map((K)=>{let q=yW6(K.pluginDirectory,Q);return{...K,installType:q.installType,installedVersion:q.installedVersion}}).filter((K)=>yW6(K.pluginDirectory,Q).needsInstall);return n.debug("jetbrains-plugin-discovery",{installationTargets:Y}),{success:!0,products:Y}}let Z=ZK9(J,Q);if(n.debug("jetbrains-plugin-discovery",{connectedVersionStatus:Z}),Z==="outdated"&&J?.pluginDirectory&&J?.ideName)return{success:!0,products:[{name:J.ideName,version:"",pluginDirectory:J.pluginDirectory,installType:"upgrade",installedVersion:J.pluginVersion}]};if(Z==="uptodate")return{success:!0,products:[]};return{success:!0,requiresManualInstall:!0,products:[]}}async function uW6(J,Q,Z){n.debug("jetbrains-plugin-install",{message:"Starting plugin installation",targetCount:J.length,targets:J.map((Y)=>`${Y.name} ${Y.version}`),cacheDirectory:Q});let X=await n51(Q);for(let Y of J)try{n.debug("jetbrains-plugin-install:start",{product:Y}),await kW6(Y.pluginDirectory,X,Z),n.debug("jetbrains-plugin-install:complete",{product:Y})}catch(K){throw n.error("jetbrains-plugin-install",{product:Y,error:K}),Error(`Failed to install JetBrains plugin to ${Y.name} ${Y.version}: ${K}`)}n.info("jetbrains-plugin-install",{message:"All plugin installations completed successfully",installedCount:J.length})}function i51(J){let Q=Tg1(),Z;switch(Q){case"darwin":Z=bV.join(bW6(),"Library","Application Support",J);break;case"win32":{let X=process.env.APPDATA||bV.join(bW6(),"AppData","Roaming");Z=bV.join(X,J);break}default:throw Error(`Unsupported operating system: ${Q}`)}return Z}function XK9(){let J=["bl","crl","consentOptions","PrivacyPolicy","Toolbox","Chrome","Google","RLZ"];return[i51("JetBrains"),i51("Google")].flatMap((Q)=>{if(!l51(Q))return[];return iY9(Q,{withFileTypes:!0})}).filter((Q)=>{if(!Q.isDirectory())return!1;return!J.find((Z)=>Q.name.startsWith(Z))})}function YK9(){try{let J=XK9();if(J.length===0)return{success:!1,products:[],helpMessage:"Directory does not exist. Please ensure you have JetBrains IDEs installed."};n.debug("jetbrains-plugin-discovery",{productDirectories:J});let Q=[];for(let Z of J){let{productName:X,version:Y}=qK9(Z.name);if(["2020","2021","2022","2023","unknown"].find((K)=>Y.startsWith(K))){n.debug("jetbrains-plugin-discovery",{skipped:Z.name});continue}Q.push({name:X,version:Y,pluginDirectory:bV.join(Z.parentPath,Z.name,"plugins",fW6)})}return{success:!0,products:Q.sort((Z,X)=>{return Z.name.localeCompare(X.name)||Z.version.localeCompare(X.version)})}}catch(J){n.error("jetbrains-plugin-discovery",{error:J});let Q=Tg1(),X=`Failed to access JetBrains directory at: ${[i51("JetBrains"),i51("Google")].join(", ")}
5956
+ `,Z)),Y.push(new W0({text:new C1("",Z,G)}))}return Y}buildCleanKeyCombination(J){let{keys:Q,input:Z}=J,X=[];if(X.push(...Q),Z)X.push(Z);return X.join("+")}}});var mu,VW6;var Vg1=u(()=>{L9();vU();KX();RJ();FY();m7();M2();qX();Fg1();kU();Q2();mu=class mu extends j6{options;onSelect;onChange;title;body;borderColor;selectedIndex;autofocus;showDismissalMessage;enableMouseInteraction;maxVisibleItems;scrollBuffer;constructor({key:J,options:Q,onSelect:Z,onChange:X,title:Y,body:K,borderColor:q=l1.index(8),selectedIndex:G=0,autofocus:z=!0,showDismissalMessage:U=!0,enableMouseInteraction:W=!0,maxVisibleItems:F=20,scrollBuffer:H=3}){super({key:J});this.options=Q,this.onSelect=Z,this.onChange=X,this.title=Y,this.body=K,this.borderColor=q,this.selectedIndex=Math.max(0,Math.min(G,Q.length-1)),this.autofocus=z,this.showDismissalMessage=U,this.enableMouseInteraction=W,this.maxVisibleItems=F,this.scrollBuffer=H}createState(){return new VW6}};VW6=class VW6 extends O6{selectedIndex=0;focusNode=new j2({});scrollOffset=0;initState(){super.initState(),this.selectedIndex=this.widget.selectedIndex,this.focusNode.addKeyHandler(this.handleKeyEvent.bind(this)),this.updateScrollPosition()}dispose(){this.focusNode.dispose(),super.dispose()}handleKeyEvent(J){let Q=(Z,X)=>{return J.key===Z&&J.shiftKey===(X?.shift??!1)&&J.ctrlKey===(X?.ctrl??!1)&&J.altKey===(X?.alt??!1)&&J.metaKey===(X?.meta??!1)};if(Q("ArrowDown")||Q("n",{ctrl:!0})||Q("Tab")||Q("j"))return this.moveSelection(1),"handled";if(Q("ArrowUp")||Q("p",{ctrl:!0})||Q("Tab",{shift:!0})||Q("k"))return this.moveSelection(-1),"handled";if(Q("Enter")){let Z=this.widget.options[this.selectedIndex];if(Z&&(Z.enabled??!0))this.widget.onSelect(Z.value);return"handled"}if(Q("Escape"))return this.widget.onSelect(null),"handled";return"ignored"}handleMouseScroll(J){if(J.direction==="down")this.moveSelection(1);else this.moveSelection(-1)}moveSelection(J){if(this.widget.options.length===0)return;let Q=this.selectedIndex+J;Q=Math.max(0,Math.min(Q,this.widget.options.length-1));let Z=Q,X=0;while(X<this.widget.options.length){let Y=this.widget.options[Q];if(Y&&(Y.enabled??!0))break;if(Q=Q+Math.sign(J),Q<0||Q>=this.widget.options.length){Q=Z;break}X++}if(this.selectedIndex!==Q)this.setState(()=>{if(this.selectedIndex=Q,this.updateScrollPosition(),this.widget.onChange){let Y=this.widget.options[Q];if(Y)this.widget.onChange(Q,Y)}})}updateScrollPosition(){let J=this.widget.maxVisibleItems,Q=this.widget.scrollBuffer,Z=this.selectedIndex,X=Z-this.scrollOffset,Y=this.scrollOffset;if(X>=J-Q)Y=Math.max(0,Z-(J-Q-1));if(X<Q)Y=Math.max(0,Z-Q);let K=Math.max(0,this.widget.options.length-J);if(Y=Math.min(Y,K),Y!==this.scrollOffset)this.scrollOffset=Y}build(J){if(this.widget.options.length===0)return new n0({width:0,height:0});let Q=[];if(this.widget.title)Q.push(new W0({text:new C1(this.widget.title,new h1({bold:!0}))})),Q.push(new n0({height:1}));if(this.widget.body){if(typeof this.widget.body==="string")Q.push(new W0({text:new C1(this.widget.body)}));else Q.push(this.widget.body);Q.push(new n0({height:1}))}let Z=this.scrollOffset,X=Math.min(this.widget.options.length,Z+this.widget.maxVisibleItems);for(let q=Z;q<X;q++){let G=this.widget.options[q],z=q===this.selectedIndex,U=G.enabled??!0,W=new _51({title:G.label,subtitle:G.description,selected:z,enabled:U,onTap:U&&this.widget.enableMouseInteraction?()=>this.widget.onSelect(G.value):void 0});Q.push(W)}if(this.widget.showDismissalMessage)Q.push(new n0({height:1})),Q.push(new W0({text:new C1("Escape to close",new h1({color:l1.index(8)}))}));let Y=new k6({crossAxisAlignment:"stretch",mainAxisSize:"min",children:Q}),K=new i6({child:new v8({padding:new B6(1,0,1,0),child:Y}),decoration:new h2(void 0,H4.all(new g4(this.widget.borderColor,1,"rounded")))});return new Z2({focusNode:this.focusNode,autofocus:this.widget.autofocus,child:new L5({onScroll:this.handleMouseScroll.bind(this),child:K})})}}});var NW6=u(()=>{xT();yT();ax1();Xu();L9();J71();OH()});var Ng1,LW6;var AW6=u(()=>{D0();BG1();R5();qX();Vg1();NW6();Ng1=class Ng1 extends j6{props;constructor(J){super();this.props=J}createState(){return new LW6}};LW6=class LW6 extends O6{options=[];loading=!0;error=null;async initState(){try{this.loading=!0,this.error=null;let J=await Fc({jetbrainsOnly:this.widget.props.jetbrainsMode});if(J.length===0){this.error=this.widget.props.jetbrainsMode?"No JetBrains IDE configurations found. Make sure you have a JetBrains IDE with the Amp plugin running.":"No IDE configurations found. Make sure you have an IDE with the Amp plugin running.";return}this.options=J.map((Q)=>{let Z=Q.workspaceFolders.length>0?Q.workspaceFolders[0]:"Unknown project",X=Q.ideName;return{value:{config:Q,label:X},label:X,description:Z}})}catch(J){n.error("Failed to load IDE configurations:",J),this.error="Failed to load IDE configurations"}finally{this.loading=!1,this.setState()}}handleKeyEvent=(J)=>{if(J.key==="Escape"||J.key==="c"&&J.ctrlKey)return this.widget.props.onCancel(),"handled";return"ignored"};build(J){if(this.loading)return new W0({text:new C1("Loading available IDEs...",new h1({color:l1.white}))});if(this.error)return new W0({text:new C1(this.error,new h1({color:l1.red}))});if(this.options.length===0)return new W0({text:new C1("No IDE configurations found.",new h1({color:l1.yellow}))});let Q=d8.sizeOf(J),Z=Math.max(5,Q.height);Z-=6;let X=Math.floor(Math.max(1,Z/2));return new Z2({autofocus:this.widget.props.autofocus??!0,onKey:this.handleKeyEvent,child:new mu({title:"Select IDE:",options:this.options,onSelect:(Y)=>{if(Y)this.widget.props.onSelect(Y.config);else this.widget.props.onCancel()},maxVisibleItems:X,autofocus:this.widget.props.autofocus??!0})})}}});var wW6=e((Hx2,RW6)=>{RW6.exports=b51;function b51(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}b51.prototype.go=function(J){if(this.pending<this.max)jW6(this,J);else this.waiting.push(J)};b51.prototype.wait=function(J){if(this.pending===0)J(this.error);else this.listeners.push(J)};b51.prototype.hold=function(){return OW6(this)};function OW6(J){J.pending+=1;var Q=!1;return Z;function Z(Y){if(Q)throw Error("callback called twice");if(Q=!0,J.error=J.error||Y,J.pending-=1,J.waiting.length>0&&J.pending<J.max)jW6(J,J.waiting.shift());else if(J.pending===0){var K=J.listeners;J.listeners=[],K.forEach(X)}}function X(Y){Y(J.error)}}function jW6(J,Q){Q(OW6(J))}});var EW6=e((NY9)=>{var uu=o1("fs"),x51=o1("util"),Lg1=o1("stream"),IW6=Lg1.Readable,Ag1=Lg1.Writable,BY9=Lg1.PassThrough,DY9=wW6(),y51=o1("events").EventEmitter;NY9.createFromBuffer=MY9;NY9.createFromFd=VY9;NY9.BufferSlicer=yH;NY9.FdSlicer=xH;x51.inherits(xH,y51);function xH(J,Q){Q=Q||{},y51.call(this),this.fd=J,this.pend=new DY9,this.pend.max=1,this.refCount=0,this.autoClose=!!Q.autoClose}xH.prototype.read=function(J,Q,Z,X,Y){var K=this;K.pend.go(function(q){uu.read(K.fd,J,Q,Z,X,function(G,z,U){q(),Y(G,z,U)})})};xH.prototype.write=function(J,Q,Z,X,Y){var K=this;K.pend.go(function(q){uu.write(K.fd,J,Q,Z,X,function(G,z,U){q(),Y(G,z,U)})})};xH.prototype.createReadStream=function(J){return new f51(this,J)};xH.prototype.createWriteStream=function(J){return new h51(this,J)};xH.prototype.ref=function(){this.refCount+=1};xH.prototype.unref=function(){var J=this;if(J.refCount-=1,J.refCount>0)return;if(J.refCount<0)throw Error("invalid unref");if(J.autoClose)uu.close(J.fd,Q);function Q(Z){if(Z)J.emit("error",Z);else J.emit("close")}};x51.inherits(f51,IW6);function f51(J,Q){Q=Q||{},IW6.call(this,Q),this.context=J,this.context.ref(),this.start=Q.start||0,this.endOffset=Q.end,this.pos=this.start,this.destroyed=!1}f51.prototype._read=function(J){var Q=this;if(Q.destroyed)return;var Z=Math.min(Q._readableState.highWaterMark,J);if(Q.endOffset!=null)Z=Math.min(Z,Q.endOffset-Q.pos);if(Z<=0){Q.destroyed=!0,Q.push(null),Q.context.unref();return}Q.context.pend.go(function(X){if(Q.destroyed)return X();var Y=Buffer.allocUnsafe(Z);uu.read(Q.context.fd,Y,0,Z,Q.pos,function(K,q){if(K)Q.destroy(K);else if(q===0)Q.destroyed=!0,Q.push(null),Q.context.unref();else Q.pos+=q,Q.push(Y.slice(0,q));X()})})};f51.prototype.destroy=function(J){if(this.destroyed)return;J=J||Error("stream destroyed"),this.destroyed=!0,this.emit("error",J),this.context.unref()};x51.inherits(h51,Ag1);function h51(J,Q){Q=Q||{},Ag1.call(this,Q),this.context=J,this.context.ref(),this.start=Q.start||0,this.endOffset=Q.end==null?1/0:+Q.end,this.bytesWritten=0,this.pos=this.start,this.destroyed=!1,this.on("finish",this.destroy.bind(this))}h51.prototype._write=function(J,Q,Z){var X=this;if(X.destroyed)return;if(X.pos+J.length>X.endOffset){var Y=Error("maximum file length exceeded");Y.code="ETOOBIG",X.destroy(),Z(Y);return}X.context.pend.go(function(K){if(X.destroyed)return K();uu.write(X.context.fd,J,0,J.length,X.pos,function(q,G){if(q)X.destroy(),K(),Z(q);else X.bytesWritten+=G,X.pos+=G,X.emit("progress"),K(),Z()})})};h51.prototype.destroy=function(){if(this.destroyed)return;this.destroyed=!0,this.context.unref()};x51.inherits(yH,y51);function yH(J,Q){y51.call(this),Q=Q||{},this.refCount=0,this.buffer=J,this.maxChunkSize=Q.maxChunkSize||Number.MAX_SAFE_INTEGER}yH.prototype.read=function(J,Q,Z,X,Y){if(!(0<=Q&&Q<=J.length))throw RangeError("offset outside buffer: 0 <= "+Q+" <= "+J.length);if(X<0)throw RangeError("position is negative: "+X);if(Q+Z>J.length)Z=J.length-Q;if(X+Z>this.buffer.length)Z=this.buffer.length-X;if(Z<=0){setImmediate(function(){Y(null,0)});return}this.buffer.copy(J,Q,X,X+Z),setImmediate(function(){Y(null,Z)})};yH.prototype.write=function(J,Q,Z,X,Y){J.copy(this.buffer,X,Q,Q+Z),setImmediate(function(){Y(null,Z,J)})};yH.prototype.createReadStream=function(J){J=J||{};var Q=new BY9(J);Q.destroyed=!1,Q.start=J.start||0,Q.endOffset=J.end,Q.pos=Q.endOffset||this.buffer.length;var Z=this.buffer.slice(Q.start,Q.pos),X=0;while(!0){var Y=X+this.maxChunkSize;if(Y>=Z.length){if(X<Z.length)Q.write(Z.slice(X,Z.length));break}Q.write(Z.slice(X,Y)),X=Y}return Q.end(),Q.destroy=function(){Q.destroyed=!0},Q};yH.prototype.createWriteStream=function(J){var Q=this;J=J||{};var Z=new Ag1(J);return Z.start=J.start||0,Z.endOffset=J.end==null?this.buffer.length:+J.end,Z.bytesWritten=0,Z.pos=Z.start,Z.destroyed=!1,Z._write=function(X,Y,K){if(Z.destroyed)return;var q=Z.pos+X.length;if(q>Z.endOffset){var G=Error("maximum file length exceeded");G.code="ETOOBIG",Z.destroyed=!0,K(G);return}X.copy(Q.buffer,Z.pos,0,X.length),Z.bytesWritten+=X.length,Z.pos=q,Z.emit("progress"),K()},Z.destroy=function(){Z.destroyed=!0},Z};yH.prototype.ref=function(){this.refCount+=1};yH.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw Error("invalid unref")};function MY9(J,Q){return new yH(J,Q)}function VY9(J,Q){return new xH(J,Q)}});var TW6=e((Dx2,PW6)=>{var _V=o1("buffer").Buffer,Og1=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];if(typeof Int32Array<"u")Og1=new Int32Array(Og1);function $W6(J){if(_V.isBuffer(J))return J;var Q=typeof _V.alloc==="function"&&typeof _V.from==="function";if(typeof J==="number")return Q?_V.alloc(J):new _V(J);else if(typeof J==="string")return Q?_V.from(J):new _V(J);else throw Error("input must be buffer, number, or string, received "+typeof J)}function RY9(J){var Q=$W6(4);return Q.writeInt32BE(J,0),Q}function jg1(J,Q){if(J=$W6(J),_V.isBuffer(Q))Q=Q.readUInt32BE(0);var Z=~~Q^-1;for(var X=0;X<J.length;X++)Z=Og1[(Z^J[X])&255]^Z>>>8;return Z^-1}function Rg1(){return RY9(jg1.apply(null,arguments))}Rg1.signed=function(){return jg1.apply(null,arguments)};Rg1.unsigned=function(){return jg1.apply(null,arguments)>>>0};PW6.exports=Rg1});function PY9(J,Q,Z){if(typeof Q==="function")Z=Q,Q=null;if(Q==null)Q={};if(Q.autoClose==null)Q.autoClose=!0;if(Q.lazyEntries==null)Q.lazyEntries=!1;if(Q.decodeStrings==null)Q.decodeStrings=!0;if(Q.validateEntrySizes==null)Q.validateEntrySizes=!0;if(Q.strictFileNames==null)Q.strictFileNames=!1;if(Z==null)Z=m51;wg1.open(J,"r",function(X,Y){if(X)return Z(X);TY9(Y,Q,function(K,q){if(K)wg1.close(Y,m51);Z(K,q)})})}function TY9(J,Q,Z){if(typeof Q==="function")Z=Q,Q=null;if(Q==null)Q={};if(Q.autoClose==null)Q.autoClose=!1;if(Q.lazyEntries==null)Q.lazyEntries=!1;if(Q.decodeStrings==null)Q.decodeStrings=!0;if(Q.validateEntrySizes==null)Q.validateEntrySizes=!0;if(Q.strictFileNames==null)Q.strictFileNames=!1;if(Z==null)Z=m51;wg1.fstat(J,function(X,Y){if(X)return Z(X);var K=IY9.createFromFd(J,{autoClose:!0});CY9(K,Y.size,Q,Z)})}function CY9(J,Q,Z,X){if(typeof Z==="function")X=Z,Z=null;if(Z==null)Z={};if(Z.autoClose==null)Z.autoClose=!0;if(Z.lazyEntries==null)Z.lazyEntries=!1;if(Z.decodeStrings==null)Z.decodeStrings=!0;var Y=!!Z.decodeStrings;if(Z.validateEntrySizes==null)Z.validateEntrySizes=!0;if(Z.strictFileNames==null)Z.strictFileNames=!1;if(X==null)X=m51;if(typeof Q!=="number")throw Error("expected totalSize parameter to be a number");if(Q>Number.MAX_SAFE_INTEGER)throw Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");J.ref();var K=22,q=20,G=65535,z=Math.min(q+K+G,Q),U=hH(z),W=Q-U.length;ZC(J,U,0,z,W,function(F){if(F)return X(F);for(var H=z-K;H>=0;H-=1){if(U.readUInt32LE(H)!==101010256)continue;var B=U.subarray(H),M=B.readUInt16LE(4),V=B.readUInt16LE(10),N=B.readUInt32LE(16),L=B.readUInt16LE(20),A=B.length-K;if(L!==A)return X(Error("Invalid comment length. Expected: "+A+". Found: "+L+". Are there extra bytes at the end of the file? Or is the end of central dir signature `PK☺☻` in the comment?"));var O=Y?g51(B.subarray(22),!1):B.subarray(22);if(H-q>=0&&U.readUInt32LE(H-q)===117853008){var j=U.subarray(H-q,H-q+q),R=QC(j,8),I=hH(56);return ZC(J,I,0,I.length,R,function(w){if(w)return X(w);if(I.readUInt32LE(0)!==101075792)return X(Error("invalid zip64 end of central directory record signature"));if(M=I.readUInt32LE(16),M!==0)return X(Error("multi-disk zip files are not supported: found disk number: "+M));return V=QC(I,32),N=QC(I,48),X(null,new fH(J,N,Q,V,O,Z.autoClose,Z.lazyEntries,Y,Z.validateEntrySizes,Z.strictFileNames))})}if(M!==0)return X(Error("multi-disk zip files are not supported: found disk number: "+M));return X(null,new fH(J,N,Q,V,O,Z.autoClose,Z.lazyEntries,Y,Z.validateEntrySizes,Z.strictFileNames))}X(Error("End of central directory record signature not found. Either not a zip file, or file is truncated."))})}function fH(J,Q,Z,X,Y,K,q,G,z,U){var W=this;if(p51.call(W),W.reader=J,W.reader.on("error",function(F){SW6(W,F)}),W.reader.once("close",function(){W.emit("close")}),W.readEntryCursor=Q,W.fileSize=Z,W.entryCount=X,W.comment=Y,W.entriesRead=0,W.autoClose=!!K,W.lazyEntries=!!q,W.decodeStrings=!!G,W.validateEntrySizes=!!z,W.strictFileNames=!!U,W.isOpen=!0,W.emittedError=!1,!W.lazyEntries)W._readEntry()}function hU(J,Q){if(J.autoClose)J.close();SW6(J,Q)}function SW6(J,Q){if(J.emittedError)return;J.emittedError=!0,J.emit("error",Q)}function d51(){}function SY9(){}function vY9(J,Q,Z){var X=J&31,Y=(J>>5&15)-1,K=(J>>9&127)+1980,q=0,G=(Q&31)*2,z=Q>>5&63,U=Q>>11&31;if(Z==null||Z==="local")return new Date(K,Y,X,U,z,G,q);else if(Z==="UTC")return new Date(Date.UTC(K,Y,X,U,z,G,q));else throw Error("unrecognized options.timezone: "+options.timezone)}function kY9(J,Q,Z,X){var Y=null;for(var K=0;K<Z.length;K++){var q=Z[K];if(q.id===28789){if(q.data.length<6)continue;if(q.data.readUInt8(0)!==1)continue;var G=q.data.readUInt32LE(1);if(EY9.unsigned(Q)!==G)continue;Y=g51(q.data.subarray(5),!0);break}}if(Y==null){var z=(J&2048)!==0;Y=g51(Q,z)}if(!X)Y=Y.replace(/\\/g,"/");return Y}function _Y9(J){if(J.indexOf("\\")!==-1)return"invalid characters in fileName: "+J;if(/^[a-zA-Z]:/.test(J)||/^\//.test(J))return"absolute path: "+J;if(J.split("/").indexOf("..")!==-1)return"invalid relative path: "+J;return null}function bY9(J){var Q=[],Z=0;while(Z<J.length-3){var X=J.readUInt16LE(Z+0),Y=J.readUInt16LE(Z+2),K=Z+4,q=K+Y;if(q>J.length)throw Error("extra field length exceeds extra field buffer size");var G=J.subarray(K,q);Q.push({id:X,data:G}),Z=q}return Q}function ZC(J,Q,Z,X,Y,K){if(X===0)return setImmediate(function(){K(null,hH(0))});J.read(Q,Z,X,Y,function(q,G){if(q)return K(q);if(G<X)return K(Error("unexpected EOF"));K()})}function pu(J){CW6.call(this),this.actualByteCount=0,this.expectedByteCount=J}function nO(){p51.call(this),this.refCount=0}function c51(J){Eg1.call(this),this.context=J,this.context.ref(),this.unreffedYet=!1}function g51(J,Q){if(Q)return J.toString("utf8");else{var Z="";for(var X=0;X<J.length;X++)Z+=xY9[J[X]];return Z}}function QC(J,Q){var Z=J.readUInt32LE(Q),X=J.readUInt32LE(Q+4);return X*4294967296+Z}function Ig1(J,Q){if(typeof J.destroy==="function")J._destroy=function(Z,X){if(Q(),X!=null)X(Z)};else J.destroy=Q}function m51(J){if(J)throw J}var wg1,wY9,IY9,EY9,u51,p51,CW6,Eg1,$Y9,$g1,xY9="\x00☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ",hH;var vW6=u(()=>{wg1=o1("fs"),wY9=o1("zlib"),IY9=EW6(),EY9=TW6(),u51=o1("util"),p51=o1("events").EventEmitter,CW6=o1("stream").Transform,Eg1=o1("stream").PassThrough,$Y9=o1("stream").Writable;$g1=PY9;u51.inherits(fH,p51);fH.prototype.close=function(){if(!this.isOpen)return;this.isOpen=!1,this.reader.unref()};fH.prototype.readEntry=function(){if(!this.lazyEntries)throw Error("readEntry() called without lazyEntries:true");this._readEntry()};fH.prototype._readEntry=function(){var J=this;if(J.entryCount===J.entriesRead){setImmediate(function(){if(J.autoClose)J.close();if(J.emittedError)return;J.emit("end")});return}if(J.emittedError)return;var Q=hH(46);ZC(J.reader,Q,0,Q.length,J.readEntryCursor,function(Z){if(Z)return hU(J,Z);if(J.emittedError)return;var X=new d51,Y=Q.readUInt32LE(0);if(Y!==33639248)return hU(J,Error("invalid central directory file header signature: 0x"+Y.toString(16)));if(X.versionMadeBy=Q.readUInt16LE(4),X.versionNeededToExtract=Q.readUInt16LE(6),X.generalPurposeBitFlag=Q.readUInt16LE(8),X.compressionMethod=Q.readUInt16LE(10),X.lastModFileTime=Q.readUInt16LE(12),X.lastModFileDate=Q.readUInt16LE(14),X.crc32=Q.readUInt32LE(16),X.compressedSize=Q.readUInt32LE(20),X.uncompressedSize=Q.readUInt32LE(24),X.fileNameLength=Q.readUInt16LE(28),X.extraFieldLength=Q.readUInt16LE(30),X.fileCommentLength=Q.readUInt16LE(32),X.internalFileAttributes=Q.readUInt16LE(36),X.externalFileAttributes=Q.readUInt32LE(38),X.relativeOffsetOfLocalHeader=Q.readUInt32LE(42),X.generalPurposeBitFlag&64)return hU(J,Error("strong encryption is not supported"));J.readEntryCursor+=46,Q=hH(X.fileNameLength+X.extraFieldLength+X.fileCommentLength),ZC(J.reader,Q,0,Q.length,J.readEntryCursor,function(K){if(K)return hU(J,K);if(J.emittedError)return;X.fileNameRaw=Q.subarray(0,X.fileNameLength);var q=X.fileNameLength+X.extraFieldLength;X.extraFieldRaw=Q.subarray(X.fileNameLength,q),X.fileCommentRaw=Q.subarray(q,q+X.fileCommentLength);try{X.extraFields=bY9(X.extraFieldRaw)}catch(V){return hU(J,V)}if(J.decodeStrings){var G=(X.generalPurposeBitFlag&2048)!==0;X.fileComment=g51(X.fileCommentRaw,G),X.fileName=kY9(X.generalPurposeBitFlag,X.fileNameRaw,X.extraFields,J.strictFileNames);var z=_Y9(X.fileName);if(z!=null)return hU(J,Error(z))}else X.fileComment=X.fileCommentRaw,X.fileName=X.fileNameRaw;X.comment=X.fileComment,J.readEntryCursor+=Q.length,J.entriesRead+=1;for(var U=0;U<X.extraFields.length;U++){var W=X.extraFields[U];if(W.id!==1)continue;var F=W.data,H=0;if(X.uncompressedSize===4294967295){if(H+8>F.length)return hU(J,Error("zip64 extended information extra field does not include uncompressed size"));X.uncompressedSize=QC(F,H),H+=8}if(X.compressedSize===4294967295){if(H+8>F.length)return hU(J,Error("zip64 extended information extra field does not include compressed size"));X.compressedSize=QC(F,H),H+=8}if(X.relativeOffsetOfLocalHeader===4294967295){if(H+8>F.length)return hU(J,Error("zip64 extended information extra field does not include relative header offset"));X.relativeOffsetOfLocalHeader=QC(F,H),H+=8}break}if(J.validateEntrySizes&&X.compressionMethod===0){var B=X.uncompressedSize;if(X.isEncrypted())B+=12;if(X.compressedSize!==B){var M="compressed/uncompressed size mismatch for stored file: "+X.compressedSize+" != "+X.uncompressedSize;return hU(J,Error(M))}}if(J.emit("entry",X),!J.lazyEntries)J._readEntry()})})};fH.prototype.openReadStream=function(J,Q,Z){var X=this,Y=0,K=J.compressedSize;if(Z==null)Z=Q,Q=null;if(Q==null)Q={};else{if(Q.decrypt!=null){if(!J.isEncrypted())throw Error("options.decrypt can only be specified for encrypted entries");if(Q.decrypt!==!1)throw Error("invalid options.decrypt value: "+Q.decrypt);if(J.isCompressed()){if(Q.decompress!==!1)throw Error("entry is encrypted and compressed, and options.decompress !== false")}}if(Q.decompress!=null){if(!J.isCompressed())throw Error("options.decompress can only be specified for compressed entries");if(!(Q.decompress===!1||Q.decompress===!0))throw Error("invalid options.decompress value: "+Q.decompress)}if(Q.start!=null||Q.end!=null){if(J.isCompressed()&&Q.decompress!==!1)throw Error("start/end range not allowed for compressed entry without options.decompress === false");if(J.isEncrypted()&&Q.decrypt!==!1)throw Error("start/end range not allowed for encrypted entry without options.decrypt === false")}if(Q.start!=null){if(Y=Q.start,Y<0)throw Error("options.start < 0");if(Y>J.compressedSize)throw Error("options.start > entry.compressedSize")}if(Q.end!=null){if(K=Q.end,K<0)throw Error("options.end < 0");if(K>J.compressedSize)throw Error("options.end > entry.compressedSize");if(K<Y)throw Error("options.end < options.start")}}if(!X.isOpen)return Z(Error("closed"));if(J.isEncrypted()){if(Q.decrypt!==!1)return Z(Error("entry is encrypted, and options.decrypt !== false"))}var q;if(J.compressionMethod===0)q=!1;else if(J.compressionMethod===8)q=Q.decompress!=null?Q.decompress:!0;else return Z(Error("unsupported compression method: "+J.compressionMethod));X.readLocalFileHeader(J,{minimal:!0},function(G,z){if(G)return Z(G);X.openReadStreamLowLevel(z.fileDataStart,J.compressedSize,Y,K,q,J.uncompressedSize,Z)})};fH.prototype.openReadStreamLowLevel=function(J,Q,Z,X,Y,K,q){var G=this,z=J+Q,U=G.reader.createReadStream({start:J+Z,end:J+X}),W=U;if(Y){var F=!1,H=wY9.createInflateRaw();if(U.on("error",function(B){setImmediate(function(){if(!F)H.emit("error",B)})}),U.pipe(H),G.validateEntrySizes)W=new pu(K),H.on("error",function(B){setImmediate(function(){if(!F)W.emit("error",B)})}),H.pipe(W);else W=H;Ig1(W,function(){if(F=!0,H!==W)H.unpipe(W);U.unpipe(H),U.destroy()})}q(null,W)};fH.prototype.readLocalFileHeader=function(J,Q,Z){var X=this;if(Z==null)Z=Q,Q=null;if(Q==null)Q={};X.reader.ref();var Y=hH(30);ZC(X.reader,Y,0,Y.length,J.relativeOffsetOfLocalHeader,function(K){try{if(K)return Z(K);var q=Y.readUInt32LE(0);if(q!==67324752)return Z(Error("invalid local file header signature: 0x"+q.toString(16)));var G=Y.readUInt16LE(26),z=Y.readUInt16LE(28),U=J.relativeOffsetOfLocalHeader+30+G+z;if(U+J.compressedSize>X.fileSize)return Z(Error("file data overflows file bounds: "+U+" + "+J.compressedSize+" > "+X.fileSize));if(Q.minimal)return Z(null,{fileDataStart:U});var W=new SY9;W.fileDataStart=U,W.versionNeededToExtract=Y.readUInt16LE(4),W.generalPurposeBitFlag=Y.readUInt16LE(6),W.compressionMethod=Y.readUInt16LE(8),W.lastModFileTime=Y.readUInt16LE(10),W.lastModFileDate=Y.readUInt16LE(12),W.crc32=Y.readUInt32LE(14),W.compressedSize=Y.readUInt32LE(18),W.uncompressedSize=Y.readUInt32LE(22),W.fileNameLength=G,W.extraFieldLength=z,Y=hH(G+z),X.reader.ref(),ZC(X.reader,Y,0,Y.length,J.relativeOffsetOfLocalHeader+30,function(F){try{if(F)return Z(F);return W.fileName=Y.subarray(0,G),W.extraField=Y.subarray(G),Z(null,W)}finally{X.reader.unref()}})}finally{X.reader.unref()}})};d51.prototype.getLastModDate=function(J){if(J==null)J={};if(!J.forceDosFormat)for(var Q=0;Q<this.extraFields.length;Q++){var Z=this.extraFields[Q];if(Z.id===21589){var X=Z.data;if(X.length<5)continue;var Y=X[0],K=1;if(!(Y&K))continue;var q=X.readInt32LE(1);return new Date(q*1000)}else if(Z.id===10){var X=Z.data,G=4;while(G<X.length+4){var z=X.readUInt16LE(G);G+=2;var U=X.readUInt16LE(G);if(G+=2,z!==1){G+=U;continue}if(U<8||G+U>X.length)break;var W=4294967296*X.readInt32LE(G+4)+X.readUInt32LE(G),F=W/1e4-11644473600000;return new Date(F)}}}return vY9(this.lastModFileDate,this.lastModFileTime,J.timezone)};d51.prototype.isEncrypted=function(){return(this.generalPurposeBitFlag&1)!==0};d51.prototype.isCompressed=function(){return this.compressionMethod===8};u51.inherits(pu,CW6);pu.prototype._transform=function(J,Q,Z){if(this.actualByteCount+=J.length,this.actualByteCount>this.expectedByteCount){var X="too many bytes in the stream. expected "+this.expectedByteCount+". got at least "+this.actualByteCount;return Z(Error(X))}Z(null,J)};pu.prototype._flush=function(J){if(this.actualByteCount<this.expectedByteCount){var Q="not enough bytes in the stream. expected "+this.expectedByteCount+". got only "+this.actualByteCount;return J(Error(Q))}J()};u51.inherits(nO,p51);nO.prototype.ref=function(){this.refCount+=1};nO.prototype.unref=function(){var J=this;if(J.refCount-=1,J.refCount>0)return;if(J.refCount<0)throw Error("invalid unref");J.close(Q);function Q(Z){if(Z)return J.emit("error",Z);J.emit("close")}};nO.prototype.createReadStream=function(J){if(J==null)J={};var{start:Q,end:Z}=J;if(Q===Z){var X=new Eg1;return setImmediate(function(){X.end()}),X}var Y=this._readStreamForRange(Q,Z),K=!1,q=new c51(this);Y.on("error",function(z){setImmediate(function(){if(!K)q.emit("error",z)})}),Ig1(q,function(){Y.unpipe(q),q.unref(),Y.destroy()});var G=new pu(Z-Q);return q.on("error",function(z){setImmediate(function(){if(!K)G.emit("error",z)})}),Ig1(G,function(){K=!0,q.unpipe(G),q.destroy()}),Y.pipe(q).pipe(G)};nO.prototype._readStreamForRange=function(J,Q){throw Error("not implemented")};nO.prototype.read=function(J,Q,Z,X,Y){var K=this.createReadStream({start:X,end:X+Z}),q=new $Y9,G=0;q._write=function(z,U,W){z.copy(J,Q+G,0,z.length),G+=z.length,W()},q.on("finish",Y),K.on("error",function(z){Y(z)}),K.pipe(q)};nO.prototype.close=function(J){setImmediate(J)};u51.inherits(c51,Eg1);c51.prototype._flush=function(J){this.unref(),J()};c51.prototype.unref=function(J){if(this.unreffedYet)return;this.unreffedYet=!0,this.context.unref()};if(typeof Buffer.allocUnsafe==="function")hH=function(J){return Buffer.allocUnsafe(J)};else hH=function(J){return new Buffer(J)}});import{createWriteStream as yY9,existsSync as fY9,mkdirSync as hY9,readdirSync as gY9,rmSync as mY9}from"node:fs";import{writeFile as uY9}from"node:fs/promises";import du from"node:path";import{pipeline as pY9}from"node:stream/promises";async function kW6(J,Q,Z,X=dY9){n.debug("jetbrains-plugin-install",{pluginDirectory:J});let Y=du.join(J,"lib");if(fY9(Y)){let q=gY9(Y,{withFileTypes:!0}).filter((G)=>G.name.endsWith(".jar"));n.info("jetbrains-plugin-install",{libDirectory:Y,removableJarFiles:q.map((G)=>G.name)}),q.forEach((G)=>{mY9(du.join(G.parentPath,G.name))})}hY9(Y,{recursive:!0});let K=du.join(J,"version.txt");return await uY9(K,Z,"utf8"),X(Q,Y)}function dY9(J,Q){return new Promise((Z,X)=>{$g1(J,{lazyEntries:!0},(Y,K)=>{if(Y)return X(Y);if(!K)return X(Error("Failed to open ZIP file"));K.readEntry(),K.on("entry",(q)=>{if(q.fileName.startsWith("amp-jetbrains-plugin/lib/"))K.openReadStream(q,async(G,z)=>{if(G)return X(G);if(!z)return X(Error("Failed to open read stream"));let U=du.basename(q.fileName),W=du.join(Q,U);await pY9(z,yY9(W)),K.readEntry()});else K.readEntry()}),K.on("end",Z),K.on("error",X)})})}var _W6=u(()=>{vW6();D0()});import{createHash as cY9}from"node:crypto";import{createWriteStream as lY9,existsSync as l51,readdirSync as iY9,readFileSync as nY9}from"node:fs";import{copyFile as aY9,mkdir as rY9,readFile as sY9,rename as oY9,unlink as tY9}from"node:fs/promises";import{homedir as bW6,platform as Tg1}from"node:os";import bV from"node:path";import{Readable as eY9}from"node:stream";import{pipeline as JK9}from"node:stream/promises";async function Pg1(J,Q=3){for(let Z=1;Z<=Q;Z++)try{let X=await fetch(J);if(!X.ok)throw Error(`HTTP ${X.status}: ${X.statusText} for ${J}`);return X}catch(X){let Y=X instanceof Error?X.message:String(X);if(X instanceof Error&&X.message.match(/HTTP 4\d\d:/))throw X;if(Z===Q)throw X;let K=500*Math.pow(2,Z-1);n.warn("fetchWithRetry",{url:J,attempt:Z,maxRetries:Q,message:Y,retryingInMs:K}),await new Promise((q)=>setTimeout(q,K))}throw Error("Unexpected end of retry loop")}async function hW6(){if(cu)return n.debug("jetbrains-plugin-version",{message:"Using cached version info",cachedVersionInfo:cu}),cu;return n.debug("jetbrains-plugin-version",{message:"Fetching version info",url:xW6}),cu=await(await Pg1(xW6)).json(),cu}async function Cg1(){return(await hW6()).plugin_version}async function gW6(){let J=await Cg1();return`${fW6}-${J}.zip`}function QK9(){let J=Tg1();return n.debug("jetbrains-plugin-discovery",{os:J}),["darwin","win32"].includes(J)}function ZK9(J,Q){if(!J?.pluginVersion)return"unknown";return J?.pluginVersion===Q?"uptodate":"outdated"}function mW6(J,Q){if(n.debug("jetbrains-plugin-discovery",{ideStatus:J}),QK9()){let X=YK9();if(n.debug("jetbrains-plugin-discovery",{discoveryResult:X}),!X.success)return X;let Y=X.products.map((K)=>{let q=yW6(K.pluginDirectory,Q);return{...K,installType:q.installType,installedVersion:q.installedVersion}}).filter((K)=>yW6(K.pluginDirectory,Q).needsInstall);return n.debug("jetbrains-plugin-discovery",{installationTargets:Y}),{success:!0,products:Y}}let Z=ZK9(J,Q);if(n.debug("jetbrains-plugin-discovery",{connectedVersionStatus:Z}),Z==="outdated"&&J?.pluginDirectory&&J?.ideName)return{success:!0,products:[{name:J.ideName,version:"",pluginDirectory:J.pluginDirectory,installType:"upgrade",installedVersion:J.pluginVersion}]};if(Z==="uptodate")return{success:!0,products:[]};return{success:!0,requiresManualInstall:!0,products:[]}}async function uW6(J,Q,Z){n.debug("jetbrains-plugin-install",{message:"Starting plugin installation",targetCount:J.length,targets:J.map((Y)=>`${Y.name} ${Y.version}`),cacheDirectory:Q});let X=await n51(Q);for(let Y of J)try{n.debug("jetbrains-plugin-install:start",{product:Y}),await kW6(Y.pluginDirectory,X,Z),n.debug("jetbrains-plugin-install:complete",{product:Y})}catch(K){throw n.error("jetbrains-plugin-install",{product:Y,error:K}),Error(`Failed to install JetBrains plugin to ${Y.name} ${Y.version}: ${K}`)}n.info("jetbrains-plugin-install",{message:"All plugin installations completed successfully",installedCount:J.length})}function i51(J){let Q=Tg1(),Z;switch(Q){case"darwin":Z=bV.join(bW6(),"Library","Application Support",J);break;case"win32":{let X=process.env.APPDATA||bV.join(bW6(),"AppData","Roaming");Z=bV.join(X,J);break}default:throw Error(`Unsupported operating system: ${Q}`)}return Z}function XK9(){let J=["bl","crl","consentOptions","PrivacyPolicy","Toolbox","Chrome","Google","RLZ"];return[i51("JetBrains"),i51("Google")].flatMap((Q)=>{if(!l51(Q))return[];return iY9(Q,{withFileTypes:!0})}).filter((Q)=>{if(!Q.isDirectory())return!1;return!J.find((Z)=>Q.name.startsWith(Z))})}function YK9(){try{let J=XK9();if(J.length===0)return{success:!1,products:[],helpMessage:"Directory does not exist. Please ensure you have JetBrains IDEs installed."};n.debug("jetbrains-plugin-discovery",{productDirectories:J});let Q=[];for(let Z of J){let{productName:X,version:Y}=qK9(Z.name);if(["2020","2021","2022","2023","unknown"].find((K)=>Y.startsWith(K))){n.debug("jetbrains-plugin-discovery",{skipped:Z.name});continue}Q.push({name:X,version:Y,pluginDirectory:bV.join(Z.parentPath,Z.name,"plugins",fW6)})}return{success:!0,products:Q.sort((Z,X)=>{return Z.name.localeCompare(X.name)||Z.version.localeCompare(X.version)})}}catch(J){n.error("jetbrains-plugin-discovery",{error:J});let Q=Tg1(),X=`Failed to access JetBrains directory at: ${[i51("JetBrains"),i51("Google")].join(", ")}
5957
5957
  `;if(J instanceof Error&&"code"in J)switch(J.code){case"EACCES":X+="Permission denied. Please check directory permissions.";break;default:X+=`Error: ${J.message}`}else X+=`Error: ${String(J)}`;if(Q==="darwin")X+=`
5958
5958
  On macOS, JetBrains IDEs are typically installed in ~/Library/Application Support/JetBrains/`;else if(Q==="win32")X+=`
5959
5959
  On Windows, check %APPDATA%\\JetBrains\\`;return{success:!1,products:[],error:J instanceof Error?J.message:String(J),helpMessage:X}}}function KK9(J){return{IntelliJIdea:"IntelliJ IDEA",IdeaIC:"IntelliJ IDEA Community Edition",WebStorm:"WebStorm",WebIde:"PhpStorm/WebStorm",PhpStorm:"PhpStorm",PyCharm:"PyCharm",PyCharmCE:"PyCharm Community Edition",RubyMine:"RubyMine",CLion:"CLion",AppCode:"AppCode",DataGrip:"DataGrip",GoLand:"GoLand",Rider:"Rider",AndroidStudio:"Android Studio",AndroidStudioPreview:"Android Studio Preview",Fleet:"Fleet"}[J]||J}function qK9(J){let Q=J.match(/^(.+?)(\d{4}\.\d+(?:\.\d+)?)$/);if(!Q)return{productName:J,version:"unknown"};let Z=Q[1],X=Q[2];if(!Z||!X)return{productName:J,version:"unknown"};return{productName:KK9(Z),version:X}}function GK9(J){let Q=J.match(/^0\.(\d+)\./);if(!Q||!Q[1])return!1;return parseInt(Q[1],10)>=12}function yW6(J,Q){let Z=bV.join(J,"version.txt");if(n.debug("jetbrains-plugin-discovery",{ampPluginDir:J}),!l51(J))return n.debug("jetbrains-plugin-discovery",{message:"Plugin directory does not exist",ampPluginDir:J}),{needsInstall:!0,installType:"fresh"};try{if(l51(Z)){let X=nY9(Z,"utf8").trim(),Y=!GK9(X)&&X!==Q;return n.debug("jetbrains-plugin-discovery",{needsUpdate:Y,installedVersion:X,targetVersion:Q}),{needsInstall:Y,installType:"upgrade",installedVersion:X}}else return n.debug("jetbrains-plugin-discovery",{message:"No version file found, plugin needs to be installed"}),{needsInstall:!0,installType:"upgrade"}}catch(X){return n.error("jetbrains-plugin-discovery",{message:"Error reading version file",versionFilePath:Z,error:X}),{needsInstall:!0,installType:"upgrade"}}}async function zK9(J){if(n.debug("jetbrains-plugin-download",{message:"Starting download",pluginPath:J}),l51(J))return n.debug("jetbrains-plugin-download",{message:"Plugin already exists, skipping download",pluginPath:J}),J;return await UK9(J),n.info("jetbrains-plugin-install:downloadSuccess",{path:J}),J}async function n51(J){let Q=await gW6(),Z=bV.join(J,"jetbrains-plugins",Q);return n.debug("jetbrains-plugin-download",{message:"Ensuring plugin available",cacheDir:J,pluginFile:Q,pluginPath:Z}),await zK9(Z),n.debug("jetbrains-plugin-download",{message:"Plugin ensured and available",pluginPath:Z}),Z}async function pW6(J){let Q=await n51(J),Z=await gW6(),X=bV.join(process.cwd(),Z);return n.debug("jetbrains-plugin-copy",{message:"Copying plugin to current directory",from:Q,to:X}),await aY9(Q,X),n.info("jetbrains-plugin-copy",{message:"Plugin copied successfully",path:X}),X}async function UK9(J){n.debug("jetbrains-plugin-download",{message:"Starting download",destinationFile:J}),await rY9(bV.dirname(J),{recursive:!0});let Q=await hW6(),{plugin_zip:Z,plugin_sha:X}=Q;n.debug("jetbrains-plugin-download",{message:"Download URLs determined",pluginUrl:Z,checksumUrl:X,pluginVersion:Q.plugin_version}),n.debug("jetbrains-plugin-download",{message:"Downloading checksum",checksumUrl:X});let K=(await(await Pg1(X)).text()).trim().split(/\s+/)[0];n.debug("jetbrains-plugin-download",{message:"Checksum downloaded",expectedChecksum:K}),n.debug("jetbrains-plugin-download",{message:"Downloading plugin",pluginUrl:Z});let q=await Pg1(Z);if(!q.body)throw Error("Plugin response body is empty");let G=`${J}.${process.pid}.${Date.now()}.tmp`;try{n.debug("jetbrains-plugin-download",{message:"Writing plugin to temp file",tmpFile:G});let z=lY9(G),U=eY9.fromWeb(q.body);await JK9(U,z),n.debug("jetbrains-plugin-download",{message:"Plugin downloaded, verifying checksum"});let W=await FK9(G);if(W!==K)throw n.error("jetbrains-plugin-download",{message:"Checksum validation failed",expectedChecksum:K,actualChecksum:W}),Error(`JetBrains plugin checksum validation failed: expected ${K}, got ${W}`);n.debug("jetbrains-plugin-download",{message:"Checksum verified, moving to final location",from:G,to:J}),await WK9(G,J)}finally{await tY9(G).catch(()=>{})}n.debug("jetbrains-plugin-download",{message:"Download completed successfully",destinationFile:J})}async function WK9(J,Q){try{await oY9(J,Q)}catch(Z){if(Z instanceof Error&&"code"in Z&&Z.code==="EEXIST")return;throw Z}}async function FK9(J){let Q=cY9("sha256"),Z=await sY9(J);return Q.update(Z),Q.digest("hex")}var fW6="amp-jetbrains-plugin",xW6="https://storage.googleapis.com/amp-public-assets-prod-0/jetbrains/latest.json",cu=null;var dW6=u(()=>{D0();_W6()});class a51{step="discovery";requiresManualInstall=!1;products=[];error="";downloadPath="";getStep(){return this.step}getError(){return this.error}getProducts(){if(this.step==="discovery")throw Error("getProducts can only be called after discovery step is complete");return this.products}isRequiresManualInstall(){return this.requiresManualInstall}getDownloadPath(){if(["discovery","selection","downloading"].includes(this.step))throw Error("getDownloadPath can only be called after downloading step is complete");return this.downloadPath}transitionToError(J){return this.step="error",this.error=J,this}transitionToSelection(J,Q){if(this.step!=="discovery")return this;return this.requiresManualInstall=J,this.products=Q,this.step="selection",this}transitionToDownload(J){if(this.step!=="selection")return this;return this.requiresManualInstall=J,this.step="downloading",this}transitionToInstall(J){if(this.step!=="downloading")return this;if(this.requiresManualInstall)this.step="manual-installation";else this.step="installing";return this.downloadPath=J,this}transitionToSuccess(){if(this.step!=="installing")return this;return this.step="success",this}clone(){let J=new a51;return J.step=this.step,J.requiresManualInstall=this.requiresManualInstall,J.products=[...this.products],J.error=this.error,J.downloadPath=this.downloadPath,J}}function HK9(J){let Q=J.reduce((Z,X)=>{return(Z[X.name]??=[]).push(X),Z},{});return Object.entries(Q).map(([Z,X])=>({name:Z,versions:X.map((Y)=>Y.version).sort()}))}function BK9(J){if(J.length<=1)return"";if(J.length>=3)return` (${J[0]}-${J.at(-1)})`;return` (${J.join(", ")})`}var cW6=(J)=>{return(J??[]).some((Q)=>Q.installType==="fresh")},Sg1,lW6;var iW6=u(()=>{hS();dW6();R5();R5();R5();R5();R5();R5();R5();R5();C71();qX();JC();Sg1=class Sg1 extends j6{configService;ideClient;onExit;onContinue;constructor({key:J,configService:Q,ideClient:Z,onExit:X,onContinue:Y}){super({key:J});this.configService=Q,this.ideClient=Z,this.onExit=X,this.onContinue=Y}createState(){return new lW6}};lW6=class lW6 extends O6{stateNotifier=new kO(new a51);pluginVersionNotifier=new kO("");ideStateNotifier=new kO(null);ideStatusSubscription=null;ideStatusTimeoutId=null;initState(){super.initState(),this.stateNotifier.addListener(()=>{this.setState(()=>{}),this.nextStep()}),this.ideStateNotifier.addListener(()=>{this.setState(()=>{}),this.nextStep()}),this.pluginVersionNotifier.addListener(()=>{this.setState(()=>{}),this.nextStep()}),this.ideStatusSubscription=this.widget.ideClient.status.subscribe((J)=>{this.ideStateNotifier.value=J}),this.ideStatusTimeoutId=setTimeout(()=>{this.ideStateNotifier.value={connected:!1}},2000),Cg1().then((J)=>{this.pluginVersionNotifier.value=J})}dispose(){if(this.ideStatusSubscription)this.ideStatusSubscription.unsubscribe();if(this.ideStatusTimeoutId)clearTimeout(this.ideStatusTimeoutId);this.stateNotifier.dispose(),this.ideStateNotifier.dispose(),this.pluginVersionNotifier.dispose(),super.dispose()}performDiscovery=async()=>{let J=mW6(this.ideStateNotifier.value,this.pluginVersionNotifier.value);if(!J.success){this.stateNotifier.value=this.stateNotifier.value.clone().transitionToError(`JetBrains IDE discovery failed: ${J.error}
@@ -5968,7 +5968,7 @@ https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_di
5968
5968
  `),J.stdout.write(`Continue this thread with: amp threads continue ${U}
5969
5969
  `)}}function AK9(J){let Q=0;for(let Y=0;Y<J.length;Y++){let K=J.charCodeAt(Y);Q=(Q<<5)-Q+K,Q=Q&Q}let Z=[9,10,11,12,13,14,15,208,209,210,211,212,213,214,215],X=Math.abs(Q)%Z.length;return l1.index(Z[X])}var BF6,DF6;var VF6=u(()=>{D0();iw();u2();MC();lw();q7();EN();Q4();$3();a6();b0();zZ6();kZ6();_Z6();R5();j71();wO();KY6();zu();$H();Ny1();RJ();TO();zY6();p9();R71();M2();IY6();qX();Q2();ly1();p7();Xu();L9();sU6();JZ();oY6();ZW6();XW6();UW6();BW6();Cu();DW6();Bf1();MW6();AW6();iW6();nW6();lU6();rW6();eh1();tW6();JF6();Uf1();rU6();qF6();WF6();HF6();BF6=class BF6 extends j6{dependencies;constructor(J){super();this.dependencies=J}createState(){return new DF6}};DF6=class DF6 extends O6{themeColors=null;themeApp=null;selectionListener=null;ideStatus=null;isConfirmingExit=!1;isConfirmingClearInput=!1;copyMessageTimer=null;isShowingHelp=!1;isShowingConsoleOverlay=!1;isShowingConfirmationOverlay=!1;isShowingFileChangesOverlay=!1;confirmationOverlayContent="";exitConfirmTimeout=null;clearInputConfirmTimeout=null;historyIndex=-1;historyDraft=null;bashInvocations=[];dismissedEphemeralErrorKey=null;currentTitle=void 0;currentShellModeStatus=void 0;imageAttachments=[];displayMessage=null;executingCommand=null;isShowingJetBrainsInstaller=!1;isShowingIdePicker=!1;currentProgressBarState="off";progressReportTimer=null;showingSelectionCopiedHint=!1;isShowingThreadPicker=!1;submitDisabledHint=null;submitDisabledHintTimer=null;isShowingTrainingModeDialog=!1;pendingTrainingMode=null;currentAgentMode=void 0;agentModeSubscription=null;updateState="hidden";updateServiceSubscription=null;isFreeTierEnabled=!1;isProcessing(){let{threadState:J}=this.widget.dependencies;if(!J.mainThread)return!1;if(Boolean(J.viewState.state==="active"&&J.viewState.inferenceState==="running"))return!0;return[...J.activeTools,...J.subagentActiveTools].filter((Y)=>Y.toolRun.status==="in-progress"||Y.toolRun.status==="queued").length>0}isSummarizing(J){return J.state==="active"&&J.summaryState!=="idle"}parseShellModeInput(J){if(J.startsWith("$$")){let Q=J.slice(2).trim();return Q?{cmd:Q,hidden:!0}:null}if(J.startsWith("$")){let Q=J.slice(1).trim();return Q?{cmd:Q,hidden:!1}:null}return null}isSlashCommand(J){if(!J.startsWith("/"))return!1;if((J.split(" ")[0]?.slice(1)||"").includes("/"))return!1;return!0}showSubmitDisabledHint(J){if(this.submitDisabledHintTimer)clearTimeout(this.submitDisabledHintTimer);this.setState(()=>{this.submitDisabledHint=J}),this.submitDisabledHintTimer=setTimeout(()=>{this.setState(()=>{this.submitDisabledHint=null}),this.submitDisabledHintTimer=null},3000)}getUIHint(){let J=this.themeColors?.colorScheme;if(!J)return null;let Q=this.themeApp;if(!Q)return null;if(this.submitDisabledHint)return new C1(this.submitDisabledHint,new h1({color:J.foreground,dim:!0}));if(this.isConfirmingExit)return new C1("",void 0,[new C1("Ctrl+C",new h1({color:Q.keybind})),new C1(" again to exit",new h1({color:J.foreground,dim:!0}))]);if(this.isConfirmingClearInput)return new C1("",void 0,[new C1("Esc",new h1({color:Q.keybind})),new C1(" again to clear input",new h1({color:J.foreground,dim:!0}))]);if(this.isShowingHelp)return new C1("",void 0,[new C1("Escape",new h1({color:Q.keybind})),new C1(" to close help",new h1({color:J.foreground,dim:!0}))]);if(this.isProcessing()||this.bashInvocations.length>0)return new C1("",void 0,[new C1("Esc",new h1({color:Q.keybind})),new C1(" to cancel",new h1({color:J.foreground,dim:!0}))]);if(this.showingSelectionCopiedHint)return new C1("Selection copied to clipboard",new h1({color:J.foreground,dim:!0}));let Z=FF6(this.updateState,J);if(Z)return new C1("",void 0,Z);return null}isTranscriptEmpty(){let{threadState:J}=this.widget.dependencies;return J.items.length===0}textController=new k71;messageScrollControllers=new Map;getMessageScrollController(J){if(!this.messageScrollControllers.has(J))this.messageScrollControllers.set(J,new EV);return this.messageScrollControllers.get(J)}scrollMessageViewToBottom(){let{threadState:J}=this.widget.dependencies,Q=J.mainThread?.id;if(!Q)return;this.getMessageScrollController(Q).scrollToBottom()}findElementByKey(J){return this.searchElementTreeByKey(this.context.element,J)}searchElementTreeByKey(J,Q){if(!J)return null;if(J?.widget?.key?.value===Q)return J;if(J?.child){let X=this.searchElementTreeByKey(J.child,Q);if(X)return X}if(J?.children)for(let X of J.children){let Y=this.searchElementTreeByKey(X,Q);if(Y)return Y}return null}clearActiveSelection(){let J=this.findElementByKey("message-view-selection-area");if(J?.state){let Q=J.state;if(Q?.controller?.hasSelection)return Q.controller.clearSelection(),this.setState(()=>{}),!0}return!1}setupSelectionListener(){let J=this.findElementByKey("message-view-selection-area");if(J?.state){let Q=J.state;if(Q?.controller&&!this.selectionListener)this.selectionListener=()=>{this.setState(()=>{})},Q.controller.addListener(this.selectionListener),Q.controller.onSelectionCopied=()=>{if(this.copyMessageTimer)clearTimeout(this.copyMessageTimer);this.setState(()=>{this.showingSelectionCopiedHint=!0}),this.copyMessageTimer=setTimeout(()=>{this.setState(()=>{this.showingSelectionCopiedHint=!1}),this.copyMessageTimer=null},2000)}}}updateTerminalTitle(){let{threadState:J}=this.widget.dependencies,Q=J.mainThread?.title;if(Q!==this.currentTitle){this.currentTitle=Q;let Z=process.cwd().replace(process.env.HOME||"","~"),X=Q?`amp - ${Q} - ${Z}`:"";process.stdout.write(ox1(X))}}_handleTextCopy(J){if(J&&J.length>0){if(this.setState(()=>{this.showingSelectionCopiedHint=!0}),this.copyMessageTimer)clearTimeout(this.copyMessageTimer);this.copyMessageTimer=setTimeout(()=>{this.setState(()=>{this.showingSelectionCopiedHint=!1}),this.copyMessageTimer=null},2000)}}textFieldKey=new A5("text-field");ideStatusSubscription=null;ideMessageSubscription=null;ideAppendToPromptSubscription=null;commands=null;completionBuilder=null;textChangeListener=()=>{let J=this.textController.text,Q=J.startsWith("$$")?"hidden":J.startsWith("$")?"normal":void 0;if(Q!==this.currentShellModeStatus)this.currentShellModeStatus=Q,this.setState(()=>{})};getCommands(){if(!this.commands)this.commands=new mx1(this.widget.dependencies.commandRegistry);return this.commands}getCompletionBuilder(){if(!this.completionBuilder)this.completionBuilder=new Ug1(this.getCommands(),this.widget.dependencies.fuzzyServer,new r51);return this.completionBuilder}navigateHistoryPrevious=()=>{let J=this.widget.dependencies.history.previous();if(J!==null){if(this.historyIndex===-1)this.historyDraft=this.textController.text;this.historyIndex++,this.textController.text=J,this.textController.moveCursorToStart()}};navigateHistoryNext=()=>{let J=this.widget.dependencies.history.next();if(J!==null)this.historyIndex--,this.textController.text=J,this.textController.moveCursorToEnd();else if(this.historyIndex>-1)this.historyIndex=-1,this.textController.text=this.historyDraft||"",this.textController.moveCursorToEnd(),this.historyDraft=null};resetHistory=()=>{this.widget.dependencies.history.reset(),this.historyIndex=-1,this.historyDraft=null};openJetBrainsInstaller=()=>{this.setState(()=>{this.isShowingJetBrainsInstaller=!0})};dismissJetBrainsInstaller=()=>{this.setState(()=>{this.isShowingJetBrainsInstaller=!1})};openIdePicker=()=>{this.setState(()=>{this.isShowingIdePicker=!0})};dismissIdePicker=()=>{this.widget.dependencies.ideClient.sendStatus({enabled:!1}),this.setState(()=>{this.isShowingIdePicker=!1})};handleIdeSelection=async(J)=>{try{await this.connectToSelectedIde(J)}catch(Q){let Z=Q instanceof Error?Q.message:String(Q);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${Z}`)})}this.widget.dependencies.ideClient.selectConfig(J),this.setState(()=>{this.isShowingIdePicker=!1})};async connectToSelectedIde(J){await this.widget.dependencies.ideClient.start(J)}removeBashInvocation=(J)=>{this.setState(()=>{this.bashInvocations=this.bashInvocations.filter((Q)=>Q.id!==J)})};invokeBashCommand=(J,{hidden:Q})=>{let Z=Date.now(),X=`bash-${Z}-${Math.random().toString(36).substring(7)}`,Y={cmd:J},K=new AbortController;this.widget.dependencies.worker.invokeBashTool(Y,K.signal,Q).subscribe({next:(q)=>{this.setState(()=>{if(this.bashInvocations.find((z)=>z.id===X))this.bashInvocations=this.bashInvocations.map((z)=>z.id===X?{...z,toolRun:q}:z);else{let z={id:X,args:Y,toolRun:q,startTime:Z,abortController:K,hidden:Q};this.bashInvocations=[...this.bashInvocations,z]}})},error:()=>this.removeBashInvocation(X),complete:()=>this.removeBashInvocation(X)})};cancelBashInvocations=()=>{let J=this.bashInvocations.find((Q)=>Q.toolRun.status==="in-progress");if(J)J.abortController.abort()};handleHistoryNavigation=(J)=>{if(J.key==="p"&&J.ctrlKey)return this.navigateHistoryPrevious(),"handled";if(J.key==="n"&&J.ctrlKey)return this.navigateHistoryNext(),"handled";return"ignored"};onTextSubmitted=async(J)=>{let{threadState:Q}=this.widget.dependencies;if(this.isSummarizing(Q.viewState)){this.showSubmitDisabledHint("Unable to submit while compacting.");return}if(!J.trim())return;let Z=this.parseShellModeInput(J);if(Z){if(Z.cmd&&!this.isProcessing())this.invokeBashCommand(Z.cmd,{hidden:Z.hidden}),this.widget.dependencies.history.add(J),this.textController.clear(),this.resetHistory();else this.showSubmitDisabledHint("Unable to use shell mode while agent is active");return}let X=YZ6(J);if(this.isSlashCommand(X)&&Q.mainThread){let Y=X.slice(1).split(" "),K=Y[0],q=Y.slice(1).filter((G)=>G.trim()!=="");if(K){let G=Q.viewState,z=this.getCommands().query(K,Q.mainThread,G).filter((U)=>U.name===K).pop();if(z){if((z.requiresArgs||z.requiresPicker)&&q.length===0){this.textController.clear(),this.textController.insertText(`/${K} `);return}this.textController.clear(),this.resetHistory(),await this.executeCommand(z,q)}return}}this.textController.clear(),this.resetHistory(),await this.sendUserMessage(X)};onOptionSelected=(J)=>{switch(J.type){case"command":{let Q=`/${J.name} `;this.onTextSubmitted(Q);break}case"file":{let Q=this.textController.text,Z=this.textController.cursorPosition,Y=Q.slice(0,Z).lastIndexOf("@");if(Y!==-1){let K=Q.slice(0,Y),q=Q.slice(Z),G=K+`@${J.path} `+q;this.textController.clear(),this.textController.insertText(G),this.textController.cursorPosition=Y+1+J.path.length+1}break}case"thread":{let Z=this.textController.text.split(" ");if(Z.length>=1&&Z[0]==="/continue"){let X=`/continue ${J.threadId} `;this.onTextSubmitted(X)}break}case"argument":{let Z=this.textController.text.split(" ");if(Z.length>=1&&Z[0]?.startsWith("/")){let Y=`${Z[0]} ${J.value} `;this.onTextSubmitted(Y)}break}}};executeCommand=async(J,Q)=>{let{threadState:Z}=this.widget.dependencies;if(!Z.mainThread||!J)return;let X=new AbortController,Y=Date.now(),q={id:`command-${Y}-${Math.random().toString(36).substring(7)}`,name:J.name,startTime:Y,abortController:X};this.setState(()=>{this.executingCommand=q});try{if(J.name==="new"){let z=await this.widget.dependencies.startNewThread();l71(z);return}if(J.launchesWindow)IG.instance.tuiInstance.suspend();let G=await this.getCommands().execute(J.name,{worker:this.widget.dependencies.worker,thread:Z.mainThread,ampURL:this.widget.dependencies.ampURL,threadSyncService:this.widget.dependencies.threadSyncService,takeImageAttachments:()=>{let z=this.imageAttachments;return this.setState(()=>{this.imageAttachments=[]}),z},editorDispatch:(z)=>{if(z.type==="set-input")this.textController.clear(),this.textController.insertText(z.input);else if(z.type==="clear")this.textController.clear()},exitApp:()=>{process.exit(0)},openHelp:()=>{this.setState(()=>{this.isShowingHelp=!0})},showCommandOverlay:(z)=>{this.setState(()=>{this.isShowingConfirmationOverlay=!0,this.confirmationOverlayContent=z})},settingsFilePath:this.widget.dependencies.settingsStorage.getSettingsFilePath(),settingsStorage:this.widget.dependencies.settingsStorage,startNewThread:async()=>{await this.widget.dependencies.startNewThread()},pickAndContinueThread:this.widget.dependencies.pickAndContinueThread,switchToThread:async(z)=>{await this.switchToExistingThread(z)},getGuidanceFiles:async()=>{if(!Z.mainThread)return[];return(await Ea({filesystem:this.widget.dependencies.worker.fs.fileSystemReader(),configService:this.widget.dependencies.configService,threadService:this.widget.dependencies.threadService},Z.mainThread,X.signal)).map((U)=>({uri:U.uri,type:U.type}))}},Q,X.signal);if(J.launchesWindow)IG.instance.tuiInstance.resume();if(G)this.setState(()=>{this.displayMessage=G})}catch(G){n.error("Error executing command:",G)}finally{this.setState(()=>{this.executingCommand=null})}};buildOptions=async(J)=>{let Q=this.textController.text,Z=this.textController.cursorPosition,Y=fg1().detect(Q,Z);if(Y){let{threadState:K}=this.widget.dependencies;return await this.getCompletionBuilder().buildOptions(Y,K.mainThread,K.viewState)}return[]};initState(){if($G.getInstance().interceptConsole(),this.widget.dependencies.startWithPicker)this.isShowingThreadPicker=!0;this.checkFreeTierStatus(),l71(this.widget.dependencies.worker),this.ideStatusSubscription=this.widget.dependencies.ideClient.status.subscribe((Q)=>{this.setState(()=>{this.ideStatus=Q})}),this.ideMessageSubscription=this.widget.dependencies.ideClient.messages.subscribe(async(Q)=>{let Z=iT();if(!Z){n.warn("No active thread worker found to handle IDE message");return}await new Promise((X)=>setTimeout(X,50)),await Z.handle({type:"user:message",message:{content:[{type:"text",text:Q}]}}),n.debug("Message sent from IDE to agent",{message:Q.slice(0,100)})}),this.ideAppendToPromptSubscription=this.widget.dependencies.ideClient.appendToPrompt.subscribe((Q)=>{this.textController.insertText(Q),n.debug("Appended text to CLI prompt from IDE",{text:Q.slice(0,100)})}),this.updateServiceSubscription=this.widget.dependencies.updateService.state.subscribe((Q)=>{this.setState(()=>{this.updateState=Q})}),this.agentModeSubscription=k9.pipe(v0((Q)=>Dz(Q.settings)),P8()).subscribe((Q)=>{this.setState(()=>{this.currentAgentMode=Q})}),this.textController.addListener(this.textChangeListener),this.getCommands(),this.textController.onInsertText=(Q,Z)=>{if(Q.length<=3)return!0;let X=qZ6(Q);if(!X)return!0;if(this.imageAttachments.length>=Nt1)return!1;let Y=GZ6(X);if(Y)return this.setState(()=>{this.imageAttachments=[...this.imageAttachments,Y]}),!1;return!0},this.updateTerminalTitle();let J=this.widget.dependencies.ideClient.getSelectedConfig();if(J)this.connectToSelectedIde(J).catch((Q)=>{let Z=Q instanceof Error?Q.message:String(Q);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${Z}`)})});else if(this.widget.dependencies.showIdePicker)this.openIdePicker();else if(this.widget.dependencies.showJetBrainsInstaller)this.openJetBrainsInstaller()}didUpdateWidget(J){super.didUpdateWidget(J),this.setupSelectionListener()}dispose(){if(this.ideStatusSubscription)this.ideStatusSubscription.unsubscribe();if(this.ideMessageSubscription)this.ideMessageSubscription.unsubscribe();if(this.ideAppendToPromptSubscription)this.ideAppendToPromptSubscription.unsubscribe();if(this.updateServiceSubscription)this.updateServiceSubscription.unsubscribe();if(this.agentModeSubscription)this.agentModeSubscription.unsubscribe();if(this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;if(this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;if(this.textController.removeListener(this.textChangeListener),this.commands)this.commands.cleanup().catch((J)=>{n.debug("Failed to cleanup commands during disposal",J)});for(let J of this.messageScrollControllers.values())J.dispose();if(this.messageScrollControllers.clear(),process.stdout.write(ox1("")),this.shouldUseProgressBar())process.stdout.write(tx1());if(this.progressReportTimer)clearTimeout(this.progressReportTimer),this.progressReportTimer=null}getCurrentConfirmation(){let{threadState:J}=this.widget.dependencies,Z=[...J.activeTools,...J.subagentActiveTools].filter((q)=>q.toolRun.status==="blocked-on-user");if(Z.length===0)return null;let X=Z[0],Y=X.toolRun.status==="blocked-on-user"?X.toolRun.toAllow??[]:[],K=X.toolRun.status==="blocked-on-user"?X.toolRun.reason:void 0;return{type:"tool-use",tools:[{useBlock:X.toolUse,toAllow:Y}],subthreadID:X.subthreadID,reason:K}}shouldUseProgressBar(){return d8.of(this.context).capabilities.xtversion?.toLowerCase().startsWith("ghostty")??!1}updateProgressBar(){if(!this.shouldUseProgressBar())return;let{threadState:J}=this.widget.dependencies,Q=this.getCurrentConfirmation(),Z="off";if(Q)Z="paused";else if(this.isProcessing())Z="indeterminate";if(Z!==this.currentProgressBarState)this.currentProgressBarState=Z,this.sendProgressReport(Z);this.scheduleProgressReportTimer()}sendProgressReport(J){switch(J){case"indeterminate":process.stdout.write(YX6());break;case"paused":process.stdout.write(KX6());break;case"off":process.stdout.write(tx1());break}}scheduleProgressReportTimer(){if(this.progressReportTimer)clearTimeout(this.progressReportTimer),this.progressReportTimer=null;if(this.getCurrentConfirmation()||this.isProcessing())this.progressReportTimer=setTimeout(()=>{this.sendProgressReport(this.currentProgressBarState),this.scheduleProgressReportTimer()},1e4)}onConfirmationResponse=async(J)=>{let Q=this.getCurrentConfirmation();if(!Q||Q.type!=="tool-use"){n.error("No current tool confirmation found");return}let Z=Q.tools[0]?.useBlock;if(!Z){n.error("No tool use block found in confirmation");return}if(J==="allow-all-session")pU("dangerouslyAllowAll",!0);if(J==="allow-all-persistent")try{await this.widget.dependencies.settingsStorage.set("dangerouslyAllowAll",!0)}catch(Y){if(Y&&Y instanceof Error)this.setState(()=>{this.displayMessage=Y});else n.error("Failed to write dangerouslyAllowAll setting:",Y);return}if(J==="always-guarded"){let Y=Q.tools[0]?.toAllow??[],K=await this.widget.dependencies.settingsStorage.get("guardedFiles.allowlist")||[],q=[...Y,...K];await this.widget.dependencies.settingsStorage.set("guardedFiles.allowlist",q)}let X=J!==null&&["yes","allow-all-session","allow-all-persistent","always-guarded"].includes(J);try{let Y={type:"user:tool-input",toolUse:Z.id,value:{accepted:X}};if(Q.subthreadID)await(await gJ.getOrCreateForThread(this.widget.dependencies.workerDeps,Q.subthreadID)).handle(Y);else await this.widget.dependencies.worker.handle(Y)}catch(Y){n.error("Failed to send tool confirmation:",Y)}};showConfirmationOverlay=(J)=>{this.setState(()=>{this.isShowingConfirmationOverlay=!0,this.confirmationOverlayContent=J})};getErrorKey(J){return`${J.constructor.name}:${J.message}`}getCurrentEphemeralError(){let{threadState:J}=this.widget.dependencies,Q=J.viewState;if(Q.state!=="active"||!Q.ephemeralError)return null;let Z=this.getErrorKey(Q.ephemeralError);if(this.dismissedEphemeralErrorKey===Z)return null;return Q.ephemeralError}handleEphemeralErrorResponse=async(J)=>{let Q=this.getCurrentEphemeralError(),Z=this.widget.dependencies.worker;switch(J){case"retry":this.dismissedEphemeralErrorKey=null,await Z.retry();break;case"compact":this.dismissedEphemeralErrorKey=null,await Z.summarizeThread();break;case"dismiss":if(Q)this.dismissedEphemeralErrorKey=this.getErrorKey(Q);break}this.setState(()=>{})};handleDisplayMessageDismiss=()=>{this.setState(()=>{this.displayMessage=null})};cancelStreamingMessage=async()=>{await gJ.cancel(this.widget.dependencies.threadID)};switchToExistingThread=async(J)=>{try{let Q=await this.widget.dependencies.switchToThread(J);this.widget.dependencies.worker=Q,this.widget.dependencies.threadID=Q.thread.id,l71(Q),c71()?.switchWorker(this.widget.dependencies.worker),this.setState(()=>{})}catch(Q){throw n.error("Failed to switch to thread:",J,Q),Error(`Failed to switch to thread: ${J}`)}};sendUserMessage=async(J)=>{await this.proceedWithUserMessage(J)};proceedWithUserMessage=async(J)=>{this.cancelBashInvocations(),this.widget.dependencies.history.add(J);let Q=iT()||this.widget.dependencies.worker,Z=[{type:"text",text:J}];if(this.imageAttachments.length>0)Z.push(...this.imageAttachments);await Q.handle({type:"user:message",message:{content:Z}}),this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})};onTrainingModeDialogResponse=async(J)=>{if(this.setState(()=>{this.isShowingTrainingModeDialog=!1}),J&&this.pendingTrainingMode)try{let Q=await this.widget.dependencies.internalAPIClient.updateUserTrainingMode({enabled:!0});if(!Q.ok){let Z=Q.error.message||"Failed to enable training mode";await this.showErrorMessage(Z),this.textController.clear(),this.textController.insertText(this.pendingTrainingMode)}else await this.proceedWithUserMessage(this.pendingTrainingMode)}catch(Q){await this.showErrorMessage(`Failed to enable training mode:
5970
5970
 
5971
- ${Q}`),this.textController.clear(),this.textController.insertText(this.pendingTrainingMode)}else if(!J&&this.pendingTrainingMode)this.textController.clear(),this.textController.insertText(this.pendingTrainingMode);this.setState(()=>{this.pendingTrainingMode=null})};async showErrorMessage(J){this.setState(()=>{this.displayMessage=Error(J)})}async checkFreeTierStatus(){try{let J=await this.widget.dependencies.internalAPIClient.getUserFreeTierStatus({});if(J.ok)this.setState(()=>{this.isFreeTierEnabled=J.result.enabled})}catch(J){n.debug("Failed to check free tier status:",J)}}onExitPressed=()=>{if(this.isConfirmingExit){if(this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;IG.instance.stop()}else{if(this.setState(()=>{this.isConfirmingExit=!0}),this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout);this.exitConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingExit=!1}),this.exitConfirmTimeout=null},1000)}};toHomeRelative(J){let Q=NK9();if(J===Q)return"~";if(J.startsWith(Q+lu.sep))return"~"+J.slice(Q.length);return J}shorten(J){let Q=J.split(lu.sep).filter(Boolean);if(Q.length<=5)return J;return[Q.slice(0,2).join(lu.sep),"…",Q.slice(-2).join(lu.sep)].join(lu.sep)}build(J){let Q=d8.of(J),Z=y8.of(J),X=Z.base;this.themeColors=X;let{colors:Y,app:K}=Z;this.themeApp=K;let{threadState:q}=this.widget.dependencies;if(this.isShowingThreadPicker)return new SH({child:new _g1({onSelect:async(x)=>{if(x)this.isShowingThreadPicker=!1,this.setState(),await this.switchToExistingThread(x);else process.exit(0)},pageSize:50,threadFetcher:new r51})});this.updateTerminalTitle(),this.updateProgressBar();let G=this.getCurrentConfirmation(),z=q.todosList,U=q.mainThread?.id,F=this.isTranscriptEmpty()?new k51({useGpt5:this.widget.dependencies.useGpt5}):new qg1({key:U?new A5(`message-view-${U}`):void 0,items:q.items,activeTools:q.activeTools,subagentToolsByParentID:q.subagentToolsByParentID,controller:U?this.getMessageScrollController(U):new EV,autofocus:!1,onCopy:this._handleTextCopy.bind(this)}),H=Math.max(Math.floor(Q.size.height*0.4),10),B=this.getCurrentEphemeralError(),M=this.buildBottomWidget(B,G,Y,Z,q,z,H),V=Q.size.width<40,N=q.mainThread?Kl1(q.mainThread):void 0,L=new i71({threadViewState:q.viewState,threadTokenUsage:N,threadID:U??null,thread:q.mainThread??void 0,onFileChangesClick:()=>{this.setState(()=>{this.isShowingFileChangesOverlay=!this.isShowingFileChangesOverlay})},ideStatus:this.ideStatus,isNarrow:V,uiHint:this.getUIHint()??void 0,waitingForConfirmation:!!G,showingEphemeralError:Boolean(q.viewState.state==="active"&&q.viewState.ephemeralError),runningBashInvocations:this.bashInvocations.length>0,executingCommand:this.executingCommand?.name??null}),A=new d71({bashInvocations:this.bashInvocations}),O=[];if(this.isFreeTierEnabled)O.push(new i6({decoration:new h2(Y.secondary),child:new v8({padding:B6.horizontal(1),child:new W0({text:new C1("Thank you for trying the ad-supported Amp Free experiment — AD",new h1({color:l1.black})),textAlign:"center"})})}));O.push(new o2({child:F}),A,new i6({constraints:new f6(0,Q.size.width,0,H),child:M}),new n0({height:1,child:new v8({padding:B6.horizontal(1),child:L})}));let j=new k6({crossAxisAlignment:"stretch",mainAxisSize:"max",children:O}),R=new j5(()=>{if(this.getCurrentEphemeralError())return this.handleEphemeralErrorResponse("dismiss"),"handled";if(this.displayMessage)return this.handleDisplayMessageDismiss(),"handled";if(this.isShowingHelp)return this.setState(()=>{this.isShowingHelp=!1}),"handled";if(this.isShowingFileChangesOverlay)return this.setState(()=>{this.isShowingFileChangesOverlay=!1}),"handled";if(this.isShowingIdePicker)return this.dismissIdePicker(),"handled";if(this.isShowingJetBrainsInstaller)return this.dismissJetBrainsInstaller(),"handled";if(this.isShowingConfirmationOverlay)return this.setState(()=>{this.isShowingConfirmationOverlay=!1,this.confirmationOverlayContent=""}),"handled";if(this.isShowingConsoleOverlay)return this.setState(()=>{this.isShowingConsoleOverlay=!1}),"handled";if(this.clearActiveSelection())return"handled";if(this.isConfirmingClearInput){if(this.textController.clear(),this.setState(()=>{this.isConfirmingClearInput=!1,this.imageAttachments=[]}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;return"handled"}if(this.bashInvocations.length>0)return this.cancelBashInvocations(),"handled";if(this.executingCommand)return n.info("Canceling executing command:",this.executingCommand.name),this.executingCommand.abortController.abort(),"handled";if(this.isProcessing())return this.cancelStreamingMessage().catch((b)=>{n.error("Failed to cancel streaming message:",b)}),"handled";if(this.textController.text.trim()!==""||this.imageAttachments.length>0){if(this.setState(()=>{this.isConfirmingClearInput=!0}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout);return this.clearInputConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingClearInput=!1}),this.clearInputConfirmTimeout=null},1000),"handled"}return"ignored"}),I=new j5(()=>{return this.onExitPressed(),"handled"}),w=new j5(()=>{return this.setState(()=>{this.isShowingConsoleOverlay=!this.isShowingConsoleOverlay}),"handled"}),E=new j5(()=>{return kV.instance.toggleAll(),"handled"}),$=new j5(()=>{return IG.instance.toggleFrameStatsOverlay(),"handled"}),P=new j5(()=>{return IG.instance.tuiInstance.getScreen().markForRefresh(),eQ.instance.requestFrame(),"handled"}),C=new j5(()=>{let x=this.findElementByKey("message-view-selection-area");if(x?.state){let b=x.state,m=b.controller?.copySelection();if(m&&m.length>0)return this.setState(()=>{this.showingSelectionCopiedHint=!0}),setTimeout(()=>{this.setState(()=>{this.showingSelectionCopiedHint=!1})},2000),setTimeout(()=>{b.controller.endCopyHighlight(),b.controller.clear()},350),"handled"}return this.onExitPressed(),"handled"}),k=new j5(()=>{let{threadState:x}=this.widget.dependencies,b=x.mainThread?.id;if(b){let m=this.getMessageScrollController(b),a=Math.max(Math.floor(Q.size.height*0.4),10),p=Q.size.height-a;m.animatePageUp(p,100)}return"handled"}),g=new j5(()=>{let{threadState:x}=this.widget.dependencies,b=x.mainThread?.id;if(b){let m=this.getMessageScrollController(b),a=Math.max(Math.floor(Q.size.height*0.4),10),p=Q.size.height-a;m.animatePageDown(p,100)}return"handled"}),T=new j5(()=>{let{threadState:x}=this.widget.dependencies,b=x.mainThread?.id;if(b)this.getMessageScrollController(b).animateTo(0,100);return"handled"}),v=new j5(()=>{let{threadState:x}=this.widget.dependencies,b=x.mainThread?.id;if(b)this.getMessageScrollController(b).animateTo(Number.MAX_SAFE_INTEGER,100);return"handled"}),f=new Map([[g2.key("Escape"),new Vu],[g2.ctrl("c"),new pT],[g2.ctrl("l"),new Ou],[g2.alt("c"),new Nu],[g2.alt("p"),new Au],[g2.ctrl("r"),new Lu],[g2.key("PageUp"),new I71],[g2.key("PageDown"),new E71],[g2.key("Home"),new $71],[g2.key("End"),new P71]]);if(process.platform==="darwin")f.set(g2.meta("c"),new pT);let h=new Map([[Vu,R],[A71,I],[Ou,P],[Nu,w],[Lu,E],[Au,$],[pT,C],[I71,k],[E71,g],[$71,T],[P71,v]]),S=j;if(this.isShowingConsoleOverlay)S=new xK({children:[S,new Bg1]});if(this.isShowingHelp)S=new xK({children:[S,new Mg1]});if(this.isShowingFileChangesOverlay)S=new xK({children:[S,new Hf1]});if(this.isShowingConfirmationOverlay)S=new xK({children:[S,new Wg1({details:this.confirmationOverlayContent})]});if(this.isShowingIdePicker)return new SH({child:new yK({actions:h,child:new IV({shortcuts:f,debugLabel:"ide-picker-shortcuts",child:new Ng1({onCancel:this.dismissIdePicker,onSelect:this.handleIdeSelection})})})});if(this.isShowingJetBrainsInstaller)return new SH({child:new yK({actions:h,child:new IV({shortcuts:f,debugLabel:"jetbrains-installer-shortcuts",child:new Sg1({configService:this.widget.dependencies.configService,ideClient:this.widget.dependencies.ideClient,onExit:()=>process.exit(0),onContinue:this.dismissJetBrainsInstaller})})})});return new SH({child:new yK({actions:h,child:new IV({shortcuts:f,debugLabel:"main-app-shortcuts",child:S})})})}buildBottomWidget(J,Q,Z,X,Y,K,q){if(J)return new Dg1({error:J,ampURL:this.widget.dependencies.ampURL,onResponse:this.handleEphemeralErrorResponse});if(this.isShowingTrainingModeDialog)return new bg1({onResponse:this.onTrainingModeDialogResponse});if(Q){if(this.displayMessage)this.handleDisplayMessageDismiss();return new Hg1({confirmationRequest:Q,onResponse:this.onConfirmationResponse,onShowOverlay:this.showConfirmationOverlay})}if(this.displayMessage)return new vg1({message:this.displayMessage,onDismiss:this.handleDisplayMessageDismiss});let G=X.app,z=LK9(X),U=new b71({key:this.textFieldKey,controller:this.textController,triggers:[fg1()],optionsBuilder:this.buildOptions,onSelected:this.onOptionSelected,displayStringForOption:(P)=>zg1(P),overlayBorderColor:Z.border,textFieldProps:{placeholder:"Type your message... (use / for commands, @ for files)",wrap:!0,minLines:3,maxLines:null,expands:!0,autofocus:!0,onSubmitted:this.onTextSubmitted,submitKey:{character:"Enter"},prompts:z,style:{border:null},clipboard:IG.instance.tuiInstance.clipboard},optionViewBuilder:(P,C,k)=>{let g=k?Z.selection:void 0,T=C.type==="command"?Z.warning:Z.secondary,v=Z.foreground,f=Z.foreground,h,S;switch(C.type){case"command":h="/",S=C.name;break;case"file":h="@",S=C.path;break;case"thread":h="",S=C.title;break;default:h="",S=zg1(C);break}let x=QW6(C),b=new C1(h,new h1({color:T})),m=new C1(S,new h1({color:v})),a=[b,m];if(x){let p=new C1(" - ",new h1({color:f,dim:!0})),Q1=new C1(x,new h1({color:f,dim:!0}));a.push(p,Q1)}return new i6({decoration:new h2(g),child:new W0({text:new C1("",void 0,a),maxLines:1,overflow:"ellipsis"})})}}),W=Y.mainThread?.queuedMessages??[],F=new Z2({onKey:this.handleHistoryNavigation,child:U}),H=this.currentShellModeStatus,B=this.imageAttachments.length>0?new i6({padding:B6.only({bottom:1,left:1}),child:new W0({text:new C1("",void 0,[new C1("Images: ",new h1({color:Z.foreground,dim:!0})),...this.imageAttachments.flatMap((P,C)=>[new C1(`[image ${C+1}]`,new h1({color:Z.success})),...C<this.imageAttachments.length-1?[new C1(" ")]:[]])])})}):null,M=Array.isArray(K)&&K.length>0,V=Array.isArray(W)&&W.length>0,N=B?new k6({crossAxisAlignment:"start",children:[B,F]}):F,L=V?new kg1({queuedMessages:W}):void 0,A=M?new Vy1(new Gg1({todos:K}),{clipBehavior:"antiAlias"}):void 0,O=[],j=Y.viewState;if(!this.isSummarizing(j))O.push({text:new C1("",void 0,[new C1("Enter",new h1({color:G.keybind})),new C1(" to send",new h1({color:Z.foreground,dim:!0}))]),position:"bottom-left"});if(H)O.push({text:new C1(H==="hidden"?"shell mode (incognito)":"shell mode",new h1({color:H==="hidden"?X.app.shellModeHidden:X.app.shellMode})),position:"top-left",offsetY:B?1:0});let R=this.currentAgentMode;if(R&&!["default",xj[0]].includes(R)&&!H){let P=AK9(R);O.push({text:new C1("",void 0,[new C1("agent-mode: ",new h1({color:Z.foreground,dim:!0})),new C1(R,new h1({color:P}))]),position:"top-left",offsetY:0})}let I=Y.mainThread?.metadata?.treeInfo?.uri,w;if(I)w=P0.isUri(I)?I.fsPath:I;else w=process.cwd();let E=this.toHomeRelative(w),$=this.shorten(E);return O.push({text:new C1($,new h1({color:Z.foreground,dim:!0})),position:"bottom-right"}),new Xf1({leftChild:N,rightChild1:L,rightChild2:A,maxHeight:q,overlayTexts:O,borderColor:Z.border})}}});import{randomBytes as OK9}from"node:crypto";import{mkdir as jK9,readFile as OF6,writeFile as RK9}from"node:fs/promises";import wK9 from"node:os";import hg1 from"node:path";import{stderr as t2,stdout as m2}from"node:process";function IK9(J){process.emitWarning=function(Q,Z,X,Y){let K=typeof Q==="string"?Q:Q.message||String(Q),q=Z||"Warning",G=!1;J.warn(K,{name:q,code:X})}}function aO(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")pU("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("tryGpt5")==="cli")pU("gpt5",Q.tryGpt5);if(J.getOptionValueSourceWithGlobals("agentMode")==="cli")pU("experimental.agentMode",Q.agentMode)}async function ug1(J){try{await jK9(hg1.dirname(gg1),{recursive:!0}),await RK9(gg1,J,"utf-8")}catch(Q){n.debug("Failed to save last thread ID",Q)}}async function PK9(){try{return(await OF6(gg1,"utf-8")).trim()}catch(J){return null}}async function TK9(J){let Q;try{Q=JSON.parse(J)}catch(Z){throw Error(`Failed to parse --mcp-config as JSON: ${Z instanceof Error?Z.message:String(Z)}`)}try{return $K9.parse(Q)}catch(Z){if(Z instanceof C0.ZodError){let X=Z.issues.map((Y)=>`${Y.path.join(".")}: ${Y.message}`).join(", ");throw Error(`Invalid MCP server configuration: ${X}`)}throw Error(`Failed to validate MCP server configuration: ${String(Z)}`)}}function CK9(J,Q){return{...J,async get(Z){if(Z==="mcpServers"){let X=await J.get(Z)||{},Y={};if(typeof X==="object")for(let[K,q]of Object.entries(X))Y[K]={...q,_target:"global"};for(let[K,q]of Object.entries(Q))Y[K]={...q,_target:"workspace"};return Y}return J.get(Z)},async keys(){let Z=await J.keys();if(!Z.includes("mcpServers"))Z.push("mcpServers");return Z},[Symbol.dispose](){J[Symbol.dispose]()}}}function _K9(J,Q){let Z=Q.args[0],X=Q.commands.map((K)=>K.name());if(Z&&!Z.includes(" ")&&Z.length<30&&!/[./\\]/.test(Z)){let K=X.filter((G)=>Z.includes(G)||G.includes(Z)),q="Run amp --help for a list of available commands.";if(K.length>0)q=`Did you mean: ${K.join(", ")}? Or run amp --help for all commands.`;throw new $2(kK.unknownCommand(Z),1,q)}}function jg2(){return jF6}function o51(J){return{...J,getThreadEnvironment:j41,vfs:K00({os:J.fileSystem}),fileChangeTrackerStorage:new Jk(J.fileSystem),generateThreadTitle:Ca,deleteThread:(Q)=>J.threadHistoryService.delete(Q)}}async function rO(J,Q){Nl1("0.0.1759392119-g5695f1");let Z=eQ1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:Z0.of([P0.file(process.cwd())]),defaultAmpURL:J.ampURL,defaultCacheDirectory:hb1,homeDir:pg1,userConfigDir:RF6}),X=await U9();n.debug("Global configuration initialized",{hasCacheDirectory:!!X.settings.cacheDirectory,settingsKeys:Object.keys(X.settings)});let Y=Qi(vj()),K=h10({configService:Z,toolService:Y}),q=mA0(Y,R8,vt).catch((L)=>{n.warn("Toolbox registration failed, continuing anyway:",L)}),G=K.initialized.catch((L)=>{n.warn("MCP service initialization failed, continuing anyway:",L)});if(J.executeMode)await Promise.all([G,q]);if(Q.jetbrains)Ll1(!0);if(Q.ide&&Mx1())Al1(!0);if(D86(Y),Q.jetbrains)Y.registerTool(Jr);else if(Q.ide)Y.registerTool(kq0);let z;if(!J.executeMode)z=new v41(process.cwd(),{},!0);else z=new class extends v41{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(m2.write(`No API key found. Starting login flow...
5971
+ ${Q}`),this.textController.clear(),this.textController.insertText(this.pendingTrainingMode)}else if(!J&&this.pendingTrainingMode)this.textController.clear(),this.textController.insertText(this.pendingTrainingMode);this.setState(()=>{this.pendingTrainingMode=null})};async showErrorMessage(J){this.setState(()=>{this.displayMessage=Error(J)})}async checkFreeTierStatus(){try{let J=await this.widget.dependencies.internalAPIClient.getUserFreeTierStatus({});if(J.ok)this.setState(()=>{this.isFreeTierEnabled=J.result.enabled})}catch(J){n.debug("Failed to check free tier status:",J)}}onExitPressed=()=>{if(this.isConfirmingExit){if(this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;IG.instance.stop()}else{if(this.setState(()=>{this.isConfirmingExit=!0}),this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout);this.exitConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingExit=!1}),this.exitConfirmTimeout=null},1000)}};toHomeRelative(J){let Q=NK9();if(J===Q)return"~";if(J.startsWith(Q+lu.sep))return"~"+J.slice(Q.length);return J}shorten(J){let Q=J.split(lu.sep).filter(Boolean);if(Q.length<=5)return J;return[Q.slice(0,2).join(lu.sep),"…",Q.slice(-2).join(lu.sep)].join(lu.sep)}build(J){let Q=d8.of(J),Z=y8.of(J),X=Z.base;this.themeColors=X;let{colors:Y,app:K}=Z;this.themeApp=K;let{threadState:q}=this.widget.dependencies;if(this.isShowingThreadPicker)return new SH({child:new _g1({onSelect:async(x)=>{if(x)this.isShowingThreadPicker=!1,this.setState(),await this.switchToExistingThread(x);else process.exit(0)},pageSize:50,threadFetcher:new r51})});this.updateTerminalTitle(),this.updateProgressBar();let G=this.getCurrentConfirmation(),z=q.todosList,U=q.mainThread?.id,F=this.isTranscriptEmpty()?new k51({useGpt5:this.widget.dependencies.useGpt5}):new qg1({key:U?new A5(`message-view-${U}`):void 0,items:q.items,activeTools:q.activeTools,subagentToolsByParentID:q.subagentToolsByParentID,controller:U?this.getMessageScrollController(U):new EV,autofocus:!1,onCopy:this._handleTextCopy.bind(this)}),H=Math.max(Math.floor(Q.size.height*0.4),10),B=this.getCurrentEphemeralError(),M=this.buildBottomWidget(B,G,Y,Z,q,z,H),V=Q.size.width<40,N=q.mainThread?Kl1(q.mainThread):void 0,L=new i71({threadViewState:q.viewState,threadTokenUsage:N,threadID:U??null,thread:q.mainThread??void 0,onFileChangesClick:()=>{this.setState(()=>{this.isShowingFileChangesOverlay=!this.isShowingFileChangesOverlay})},ideStatus:this.ideStatus,isNarrow:V,uiHint:this.getUIHint()??void 0,waitingForConfirmation:!!G,showingEphemeralError:Boolean(q.viewState.state==="active"&&q.viewState.ephemeralError),runningBashInvocations:this.bashInvocations.length>0,executingCommand:this.executingCommand?.name??null}),A=new d71({bashInvocations:this.bashInvocations}),O=[];if(this.isFreeTierEnabled)O.push(new i6({decoration:new h2(Y.secondary),child:new v8({padding:B6.horizontal(1),child:new W0({text:new C1("Thank you for trying the ad-supported Amp Free experiment — AD",new h1({color:l1.black})),textAlign:"center"})})}));O.push(new o2({child:F}),A,new i6({constraints:new f6(0,Q.size.width,0,H),child:M}),new n0({height:1,child:new v8({padding:B6.horizontal(1),child:L})}));let j=new k6({crossAxisAlignment:"stretch",mainAxisSize:"max",children:O}),R=new j5(()=>{if(this.getCurrentEphemeralError())return this.handleEphemeralErrorResponse("dismiss"),"handled";if(this.displayMessage)return this.handleDisplayMessageDismiss(),"handled";if(this.isShowingHelp)return this.setState(()=>{this.isShowingHelp=!1}),"handled";if(this.isShowingFileChangesOverlay)return this.setState(()=>{this.isShowingFileChangesOverlay=!1}),"handled";if(this.isShowingIdePicker)return this.dismissIdePicker(),"handled";if(this.isShowingJetBrainsInstaller)return this.dismissJetBrainsInstaller(),"handled";if(this.isShowingConfirmationOverlay)return this.setState(()=>{this.isShowingConfirmationOverlay=!1,this.confirmationOverlayContent=""}),"handled";if(this.isShowingConsoleOverlay)return this.setState(()=>{this.isShowingConsoleOverlay=!1}),"handled";if(this.clearActiveSelection())return"handled";if(this.isConfirmingClearInput){if(this.textController.clear(),this.setState(()=>{this.isConfirmingClearInput=!1,this.imageAttachments=[]}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;return"handled"}if(this.bashInvocations.length>0)return this.cancelBashInvocations(),"handled";if(this.executingCommand)return n.info("Canceling executing command:",this.executingCommand.name),this.executingCommand.abortController.abort(),"handled";if(this.isProcessing())return this.cancelStreamingMessage().catch((b)=>{n.error("Failed to cancel streaming message:",b)}),"handled";if(this.textController.text.trim()!==""||this.imageAttachments.length>0){if(this.setState(()=>{this.isConfirmingClearInput=!0}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout);return this.clearInputConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingClearInput=!1}),this.clearInputConfirmTimeout=null},1000),"handled"}return"ignored"}),I=new j5(()=>{return this.onExitPressed(),"handled"}),w=new j5(()=>{return this.setState(()=>{this.isShowingConsoleOverlay=!this.isShowingConsoleOverlay}),"handled"}),E=new j5(()=>{return kV.instance.toggleAll(),"handled"}),$=new j5(()=>{return IG.instance.toggleFrameStatsOverlay(),"handled"}),P=new j5(()=>{return IG.instance.tuiInstance.getScreen().markForRefresh(),eQ.instance.requestFrame(),"handled"}),C=new j5(()=>{let x=this.findElementByKey("message-view-selection-area");if(x?.state){let b=x.state,m=b.controller?.copySelection();if(m&&m.length>0)return this.setState(()=>{this.showingSelectionCopiedHint=!0}),setTimeout(()=>{this.setState(()=>{this.showingSelectionCopiedHint=!1})},2000),setTimeout(()=>{b.controller.endCopyHighlight(),b.controller.clear()},350),"handled"}return this.onExitPressed(),"handled"}),k=new j5(()=>{let{threadState:x}=this.widget.dependencies,b=x.mainThread?.id;if(b){let m=this.getMessageScrollController(b),a=Math.max(Math.floor(Q.size.height*0.4),10),p=Q.size.height-a;m.animatePageUp(p,100)}return"handled"}),g=new j5(()=>{let{threadState:x}=this.widget.dependencies,b=x.mainThread?.id;if(b){let m=this.getMessageScrollController(b),a=Math.max(Math.floor(Q.size.height*0.4),10),p=Q.size.height-a;m.animatePageDown(p,100)}return"handled"}),T=new j5(()=>{let{threadState:x}=this.widget.dependencies,b=x.mainThread?.id;if(b)this.getMessageScrollController(b).animateTo(0,100);return"handled"}),v=new j5(()=>{let{threadState:x}=this.widget.dependencies,b=x.mainThread?.id;if(b)this.getMessageScrollController(b).animateTo(Number.MAX_SAFE_INTEGER,100);return"handled"}),f=new Map([[g2.key("Escape"),new Vu],[g2.ctrl("c"),new pT],[g2.ctrl("l"),new Ou],[g2.alt("c"),new Nu],[g2.alt("p"),new Au],[g2.ctrl("r"),new Lu],[g2.key("PageUp"),new I71],[g2.key("PageDown"),new E71],[g2.key("Home"),new $71],[g2.key("End"),new P71]]);if(process.platform==="darwin")f.set(g2.meta("c"),new pT);let h=new Map([[Vu,R],[A71,I],[Ou,P],[Nu,w],[Lu,E],[Au,$],[pT,C],[I71,k],[E71,g],[$71,T],[P71,v]]),S=j;if(this.isShowingConsoleOverlay)S=new xK({children:[S,new Bg1]});if(this.isShowingHelp)S=new xK({children:[S,new Mg1]});if(this.isShowingFileChangesOverlay)S=new xK({children:[S,new Hf1]});if(this.isShowingConfirmationOverlay)S=new xK({children:[S,new Wg1({details:this.confirmationOverlayContent})]});if(this.isShowingIdePicker)return new SH({child:new yK({actions:h,child:new IV({shortcuts:f,debugLabel:"ide-picker-shortcuts",child:new Ng1({onCancel:this.dismissIdePicker,onSelect:this.handleIdeSelection,jetbrainsMode:this.widget.dependencies.jetbrainsMode})})})});if(this.isShowingJetBrainsInstaller)return new SH({child:new yK({actions:h,child:new IV({shortcuts:f,debugLabel:"jetbrains-installer-shortcuts",child:new Sg1({configService:this.widget.dependencies.configService,ideClient:this.widget.dependencies.ideClient,onExit:()=>process.exit(0),onContinue:this.dismissJetBrainsInstaller})})})});return new SH({child:new yK({actions:h,child:new IV({shortcuts:f,debugLabel:"main-app-shortcuts",child:S})})})}buildBottomWidget(J,Q,Z,X,Y,K,q){if(J)return new Dg1({error:J,ampURL:this.widget.dependencies.ampURL,onResponse:this.handleEphemeralErrorResponse});if(this.isShowingTrainingModeDialog)return new bg1({onResponse:this.onTrainingModeDialogResponse});if(Q){if(this.displayMessage)this.handleDisplayMessageDismiss();return new Hg1({confirmationRequest:Q,onResponse:this.onConfirmationResponse,onShowOverlay:this.showConfirmationOverlay})}if(this.displayMessage)return new vg1({message:this.displayMessage,onDismiss:this.handleDisplayMessageDismiss});let G=X.app,z=LK9(X),U=new b71({key:this.textFieldKey,controller:this.textController,triggers:[fg1()],optionsBuilder:this.buildOptions,onSelected:this.onOptionSelected,displayStringForOption:(P)=>zg1(P),overlayBorderColor:Z.border,textFieldProps:{placeholder:"Type your message... (use / for commands, @ for files)",wrap:!0,minLines:3,maxLines:null,expands:!0,autofocus:!0,onSubmitted:this.onTextSubmitted,submitKey:{character:"Enter"},prompts:z,style:{border:null},clipboard:IG.instance.tuiInstance.clipboard},optionViewBuilder:(P,C,k)=>{let g=k?Z.selection:void 0,T=C.type==="command"?Z.warning:Z.secondary,v=Z.foreground,f=Z.foreground,h,S;switch(C.type){case"command":h="/",S=C.name;break;case"file":h="@",S=C.path;break;case"thread":h="",S=C.title;break;default:h="",S=zg1(C);break}let x=QW6(C),b=new C1(h,new h1({color:T})),m=new C1(S,new h1({color:v})),a=[b,m];if(x){let p=new C1(" - ",new h1({color:f,dim:!0})),Q1=new C1(x,new h1({color:f,dim:!0}));a.push(p,Q1)}return new i6({decoration:new h2(g),child:new W0({text:new C1("",void 0,a),maxLines:1,overflow:"ellipsis"})})}}),W=Y.mainThread?.queuedMessages??[],F=new Z2({onKey:this.handleHistoryNavigation,child:U}),H=this.currentShellModeStatus,B=this.imageAttachments.length>0?new i6({padding:B6.only({bottom:1,left:1}),child:new W0({text:new C1("",void 0,[new C1("Images: ",new h1({color:Z.foreground,dim:!0})),...this.imageAttachments.flatMap((P,C)=>[new C1(`[image ${C+1}]`,new h1({color:Z.success})),...C<this.imageAttachments.length-1?[new C1(" ")]:[]])])})}):null,M=Array.isArray(K)&&K.length>0,V=Array.isArray(W)&&W.length>0,N=B?new k6({crossAxisAlignment:"start",children:[B,F]}):F,L=V?new kg1({queuedMessages:W}):void 0,A=M?new Vy1(new Gg1({todos:K}),{clipBehavior:"antiAlias"}):void 0,O=[],j=Y.viewState;if(!this.isSummarizing(j))O.push({text:new C1("",void 0,[new C1("Enter",new h1({color:G.keybind})),new C1(" to send",new h1({color:Z.foreground,dim:!0}))]),position:"bottom-left"});if(H)O.push({text:new C1(H==="hidden"?"shell mode (incognito)":"shell mode",new h1({color:H==="hidden"?X.app.shellModeHidden:X.app.shellMode})),position:"top-left",offsetY:B?1:0});let R=this.currentAgentMode;if(R&&!["default",xj[0]].includes(R)&&!H){let P=AK9(R);O.push({text:new C1("",void 0,[new C1("agent-mode: ",new h1({color:Z.foreground,dim:!0})),new C1(R,new h1({color:P}))]),position:"top-left",offsetY:0})}let I=Y.mainThread?.metadata?.treeInfo?.uri,w;if(I)w=P0.isUri(I)?I.fsPath:I;else w=process.cwd();let E=this.toHomeRelative(w),$=this.shorten(E);return O.push({text:new C1($,new h1({color:Z.foreground,dim:!0})),position:"bottom-right"}),new Xf1({leftChild:N,rightChild1:L,rightChild2:A,maxHeight:q,overlayTexts:O,borderColor:Z.border})}}});import{randomBytes as OK9}from"node:crypto";import{mkdir as jK9,readFile as OF6,writeFile as RK9}from"node:fs/promises";import wK9 from"node:os";import hg1 from"node:path";import{stderr as t2,stdout as m2}from"node:process";function IK9(J){process.emitWarning=function(Q,Z,X,Y){let K=typeof Q==="string"?Q:Q.message||String(Q),q=Z||"Warning",G=!1;J.warn(K,{name:q,code:X})}}function aO(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")pU("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("tryGpt5")==="cli")pU("gpt5",Q.tryGpt5);if(J.getOptionValueSourceWithGlobals("agentMode")==="cli")pU("experimental.agentMode",Q.agentMode)}async function ug1(J){try{await jK9(hg1.dirname(gg1),{recursive:!0}),await RK9(gg1,J,"utf-8")}catch(Q){n.debug("Failed to save last thread ID",Q)}}async function PK9(){try{return(await OF6(gg1,"utf-8")).trim()}catch(J){return null}}async function TK9(J){let Q;try{Q=JSON.parse(J)}catch(Z){throw Error(`Failed to parse --mcp-config as JSON: ${Z instanceof Error?Z.message:String(Z)}`)}try{return $K9.parse(Q)}catch(Z){if(Z instanceof C0.ZodError){let X=Z.issues.map((Y)=>`${Y.path.join(".")}: ${Y.message}`).join(", ");throw Error(`Invalid MCP server configuration: ${X}`)}throw Error(`Failed to validate MCP server configuration: ${String(Z)}`)}}function CK9(J,Q){return{...J,async get(Z){if(Z==="mcpServers"){let X=await J.get(Z)||{},Y={};if(typeof X==="object")for(let[K,q]of Object.entries(X))Y[K]={...q,_target:"global"};for(let[K,q]of Object.entries(Q))Y[K]={...q,_target:"workspace"};return Y}return J.get(Z)},async keys(){let Z=await J.keys();if(!Z.includes("mcpServers"))Z.push("mcpServers");return Z},[Symbol.dispose](){J[Symbol.dispose]()}}}function _K9(J,Q){let Z=Q.args[0],X=Q.commands.map((K)=>K.name());if(Z&&!Z.includes(" ")&&Z.length<30&&!/[./\\]/.test(Z)){let K=X.filter((G)=>Z.includes(G)||G.includes(Z)),q="Run amp --help for a list of available commands.";if(K.length>0)q=`Did you mean: ${K.join(", ")}? Or run amp --help for all commands.`;throw new $2(kK.unknownCommand(Z),1,q)}}function jg2(){return jF6}function o51(J){return{...J,getThreadEnvironment:j41,vfs:K00({os:J.fileSystem}),fileChangeTrackerStorage:new Jk(J.fileSystem),generateThreadTitle:Ca,deleteThread:(Q)=>J.threadHistoryService.delete(Q)}}async function rO(J,Q){Nl1("0.0.1759406505-gba06ab");let Z=eQ1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:Z0.of([P0.file(process.cwd())]),defaultAmpURL:J.ampURL,defaultCacheDirectory:hb1,homeDir:pg1,userConfigDir:RF6}),X=await U9();n.debug("Global configuration initialized",{hasCacheDirectory:!!X.settings.cacheDirectory,settingsKeys:Object.keys(X.settings)});let Y=Qi(vj()),K=h10({configService:Z,toolService:Y}),q=mA0(Y,R8,vt).catch((L)=>{n.warn("Toolbox registration failed, continuing anyway:",L)}),G=K.initialized.catch((L)=>{n.warn("MCP service initialization failed, continuing anyway:",L)});if(J.executeMode)await Promise.all([G,q]);if(Q.jetbrains)Ll1(!0);if(Q.ide&&Mx1())Al1(!0);if(D86(Y),Q.jetbrains)Y.registerTool(Jr);else if(Q.ide)Y.registerTool(kq0);let z;if(!J.executeMode)z=new v41(process.cwd(),{},!0);else z=new class extends v41{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(m2.write(`No API key found. Starting login flow...
5972
5972
  `),!await bK9(J))await VO(),process.exit(1)}let U=await j00({isDevelopment:!1}),W=new DW1(U),F=new FW1(U,{lazy:!0}),H=new qM1(W),B=Q.notifications!==void 0?Q.notifications:!J.executeMode,M=L86({playNotificationSound:async(L)=>{if(B){V86(L);let A=Fy1(),O=Hy1();if((!A||O)&&X.settings["notifications.system.enabled"]!==!1){if(L==="idle")process.stdout.write("\x1B]777;notify;Amp;Agent is ready\x1B\\");else if(L==="requires-user-input")process.stdout.write("\x1B]777;notify;Amp;Waiting for approval\x1B\\")}}},windowFocused:()=>Promise.resolve(!1),threadService:W});n.info("Starting Amp background services");let V=gK0({threadService:W,threadHistoryService:F,isExtensionDevelopment:!1}),N={configService:Z,toolService:Y,mcpService:K,threadService:W,threadHistoryService:F,threadSummaryService:H,threadSyncService:V,threadStorage:U,secretStorage:J.secrets,settingsStorage:J.settings,fuzzyServer:z,notificationService:M,fileSystem:Q.jetbrains||Q.ide?Q00:R8};return{...N,async asyncDispose(){await N.mcpService.dispose(),await N.threadService.asyncDispose(),N.configService.unsubscribe(),N.toolService.dispose(),N.fuzzyServer.dispose(),N.threadSyncService.dispose(),N.settingsStorage[Symbol.dispose]()}}}async function bK9(J){if(!J.executeMode){if(!await Ix1("Would you like to log in to Amp? [(y)es, (n)o]: "))return m2.write(`Login cancelled. Run the command again to retry.
5973
5973
  `),!1}return await wF6(J)}async function wF6(J){let Q=OK9(32).toString("hex"),Z=await wx1(J.ampURL,Q);try{await ST(Z)}catch(Y){n.error("Failed to open browser",{error:Y})}let X=await wx1(J.ampURL,Q,!1);m2.write(`If your browser did not open automatically, visit:
5974
5974
 
@@ -5978,12 +5978,12 @@ ${Z8.blue.bold(X)}
5978
5978
  Login successful! You can now use the Amp CLI.
5979
5979
  `),!0}catch(Y){return n.error("Login failed",{error:Y}),t2.write(`
5980
5980
  Login failed: ${Y instanceof Error?Y.message:String(Y)}
5981
- `),!1}}function xK9(){let J=new Xm().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((F)=>{if(F.code==="commander.help"||F.code==="commander.version"||F.exitCode===0)MT(),process.exit(0);let H=F.originalError??F;V56(H)}),J.option("-V, --version","output the version number",()=>{m2.write(`0.0.1759392119-g5695f1 (released 2025-10-02T08:07:41.519Z)
5982
- `),process.exit(0)}),J.addHelpText("after",gJ6()),J.configureHelp({formatHelp:mJ6}),J.command("logout").description("Log out by removing stored API key").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await fK(B);await gK9(M)}),J.command("login").description("Log in to Amp").addHelpText("after","If AMP_URL is set during login, it will be persisted to global settings for future CLI invocations, though AMP_URL will continue to take precedence.").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await fK(B);await hK9(M,await Ux1(B,M.settings))});let Q=async(F,H,B)=>{eQ1({storage:H.settings,secretStorage:H.secrets,workspaceRoots:Z0.of([P0.file(process.cwd())]),defaultAmpURL:H.ampURL,homeDir:pg1,userConfigDir:RF6});let M={...H,executeMode:!1};await mg1(M,{...F,startWithPicker:!0},B)},Z=J.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await fK(B);await AF6(B,M,H)});Z.command("new").alias("n").summary("Create a new thread").description("Create a new thread and print its ID. The thread will be empty. You can set the visibility using the --visibility option.").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await fK(B);await iK9(B,M,H)}),Z.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. If no thread ID is provided, the most recently used thread will be continued.").option("--pick","Pick a thread interactively from a list").action(async(F,H,B)=>{let M=B.optsWithGlobals(),V=await fK(M);if(H.pick)await Q(M,V,B);else await lK9(M,V,F,B)}),Z.command("fork [threadId]").alias("f").summary("Fork an existing thread").description("Create a new thread by forking an existing one. This copies the conversation history up to the current point and creates a new thread where you can explore different directions. If no thread ID is provided, the most recently used thread will be forked.").action(async(F,H,B)=>{let M=B.optsWithGlobals(),V=await fK(M);await cK9(M,V,F,B)}),Z.command("list").alias("l").alias("ls").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await fK(B);await AF6(B,M,H)}),Z.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, workspace, group) or share with Amp support for debugging. Use --visibility to change who can access the thread, or --support to share with the Amp team for troubleshooting.").alias("s").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").option("--support","Share thread with Amp support for debugging").action(async(F,H,B)=>{let M=B.optsWithGlobals(),V=await fK(M);await dK9(M,V,F,B,H.support)}),Z.command("compact <threadId>").alias("co").summary("Compact a thread").description("Compact a thread by creating a summary of the conversation history. This reduces the thread size while preserving the key information and context, making it more token efficient for future use.").action(async(F,H,B)=>{let M=B.optsWithGlobals(),V=await fK(M);await pK9(M,V,F,B)}),ZZ6(J,async(F,H)=>{let B=await fK(H);aO(F,H);let M=await rO(B,H);return{context:B,mcpService:M.mcpService,toolService:M.toolService,cleanupTerminal:MT,asyncDispose:M.asyncDispose.bind(M)}}),jQ6(J),UQ6(J,async(F)=>{return(await fK(F)).settings});let X=new Xm().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async(F)=>{await Nx1(F.force||!1,F.verbose||!1,"0.0.1759392119-g5695f1"),process.exit()});J.addCommand(X,{hidden:!0});function Y(F,H,B){let V=typeof F.description==="string"?F.description:B===void 0?F.description(!0):F.description(B),N=new KO(H,V),L=kK9(F);if(L)N.default(L);if(N.hidden=SK9(F)||LF6(F),"choices"in F)N.choices([...F.choices]);return N}for(let F of NF6)switch(F.type){case"flag":{J.addOption(Y(F,`--${F.long}`)),J.addOption(Y(F,`--no-${F.long}`,!1));break}case"switch":{J.addOption(Y(F,`--${F.long}`,!0));break}default:{J.addOption(Y(F,`--${F.long} <value>`));break}}let K=new KO("-x, --execute [message]","Use execute mode, optionally with user message. In execute mode, agent will execute provided prompt (either as argument, or via stdin). Only last assistant message is printed. Enabled automatically when redirecting stdout.").default(!1);if(J.addOption(K),process.env.AMP_CLI_REMOTE){let F=new KO("-r, --remote","When used with -x/--execute, execute in an async agent on the Amp server.").default(!1);J.addOption(F)}let q=new KO("--stream-json","When used with --execute, output in Claude Code compatible stream JSON format instead of plain text.").default(!1).hideHelp(!0);J.addOption(q);let G=new KO("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1).hideHelp(!0);J.addOption(G);let z=new KO("--stats","When used with --execute, output JSON with both result and token usage data (for /evals).").default(!1).hideHelp(!0);J.addOption(z),J.action(async(F,H)=>{let B=F,M=await fK(B);if(Object.keys(B).forEach((V)=>{let N=NF6.find((L)=>L.name===V);if(N&&LF6(N)&&!vK9(N))t2.write(Z8.yellow(`Warning: '--${V}' flag is deprecated
5981
+ `),!1}}function xK9(){let J=new Xm().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((F)=>{if(F.code==="commander.help"||F.code==="commander.version"||F.exitCode===0)MT(),process.exit(0);let H=F.originalError??F;V56(H)}),J.option("-V, --version","output the version number",()=>{m2.write(`0.0.1759406505-gba06ab (released 2025-10-02T12:06:37.222Z)
5982
+ `),process.exit(0)}),J.addHelpText("after",gJ6()),J.configureHelp({formatHelp:mJ6}),J.command("logout").description("Log out by removing stored API key").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await fK(B);await gK9(M)}),J.command("login").description("Log in to Amp").addHelpText("after","If AMP_URL is set during login, it will be persisted to global settings for future CLI invocations, though AMP_URL will continue to take precedence.").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await fK(B);await hK9(M,await Ux1(B,M.settings))});let Q=async(F,H,B)=>{eQ1({storage:H.settings,secretStorage:H.secrets,workspaceRoots:Z0.of([P0.file(process.cwd())]),defaultAmpURL:H.ampURL,homeDir:pg1,userConfigDir:RF6});let M={...H,executeMode:!1};await mg1(M,{...F,startWithPicker:!0},B)},Z=J.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await fK(B);await AF6(B,M,H)});Z.command("new").alias("n").summary("Create a new thread").description("Create a new thread and print its ID. The thread will be empty. You can set the visibility using the --visibility option.").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await fK(B);await iK9(B,M,H)}),Z.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. If no thread ID is provided, the most recently used thread will be continued.").option("--pick","Pick a thread interactively from a list").action(async(F,H,B)=>{let M=B.optsWithGlobals(),V=await fK(M);if(H.pick)await Q(M,V,B);else await lK9(M,V,F,B)}),Z.command("fork [threadId]").alias("f").summary("Fork an existing thread").description("Create a new thread by forking an existing one. This copies the conversation history up to the current point and creates a new thread where you can explore different directions. If no thread ID is provided, the most recently used thread will be forked.").action(async(F,H,B)=>{let M=B.optsWithGlobals(),V=await fK(M);await cK9(M,V,F,B)}),Z.command("list").alias("l").alias("ls").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await fK(B);await AF6(B,M,H)}),Z.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, workspace, group) or share with Amp support for debugging. Use --visibility to change who can access the thread, or --support to share with the Amp team for troubleshooting.").alias("s").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").option("--support","Share thread with Amp support for debugging").action(async(F,H,B)=>{let M=B.optsWithGlobals(),V=await fK(M);await dK9(M,V,F,B,H.support)}),Z.command("compact <threadId>").alias("co").summary("Compact a thread").description("Compact a thread by creating a summary of the conversation history. This reduces the thread size while preserving the key information and context, making it more token efficient for future use.").action(async(F,H,B)=>{let M=B.optsWithGlobals(),V=await fK(M);await pK9(M,V,F,B)}),ZZ6(J,async(F,H)=>{let B=await fK(H);aO(F,H);let M=await rO(B,H);return{context:B,mcpService:M.mcpService,toolService:M.toolService,cleanupTerminal:MT,asyncDispose:M.asyncDispose.bind(M)}}),jQ6(J),UQ6(J,async(F)=>{return(await fK(F)).settings});let X=new Xm().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async(F)=>{await Nx1(F.force||!1,F.verbose||!1,"0.0.1759406505-gba06ab"),process.exit()});J.addCommand(X,{hidden:!0});function Y(F,H,B){let V=typeof F.description==="string"?F.description:B===void 0?F.description(!0):F.description(B),N=new KO(H,V),L=kK9(F);if(L)N.default(L);if(N.hidden=SK9(F)||LF6(F),"choices"in F)N.choices([...F.choices]);return N}for(let F of NF6)switch(F.type){case"flag":{J.addOption(Y(F,`--${F.long}`)),J.addOption(Y(F,`--no-${F.long}`,!1));break}case"switch":{J.addOption(Y(F,`--${F.long}`,!0));break}default:{J.addOption(Y(F,`--${F.long} <value>`));break}}let K=new KO("-x, --execute [message]","Use execute mode, optionally with user message. In execute mode, agent will execute provided prompt (either as argument, or via stdin). Only last assistant message is printed. Enabled automatically when redirecting stdout.").default(!1);if(J.addOption(K),process.env.AMP_CLI_REMOTE){let F=new KO("-r, --remote","When used with -x/--execute, execute in an async agent on the Amp server.").default(!1);J.addOption(F)}let q=new KO("--stream-json","When used with --execute, output in Claude Code compatible stream JSON format instead of plain text.").default(!1).hideHelp(!0);J.addOption(q);let G=new KO("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1).hideHelp(!0);J.addOption(G);let z=new KO("--stats","When used with --execute, output JSON with both result and token usage data (for /evals).").default(!1).hideHelp(!0);J.addOption(z),J.action(async(F,H)=>{let B=F,M=await fK(B);if(Object.keys(B).forEach((V)=>{let N=NF6.find((L)=>L.name===V);if(N&&LF6(N)&&!vK9(N))t2.write(Z8.yellow(`Warning: '--${V}' flag is deprecated
5983
5983
  `))}),H.args.length>0)_K9(M,H);await mg1(M,B,H)});let U=new Xm("doctor").summary("Generate support bundle").description("Generate a support bundle for troubleshooting issues. This collects logs, configuration, and system information into a file that can be shared with Amp support for debugging.").option("--output-dir <path>","Directory to save the support bundle",process.cwd()).option("--include-full-logs","Include full log history",!1).allowUnknownOption(!1).action(async(F)=>{await uK9(F.outputDir,F.includeFullLogs)});J.addCommand(U);let W=new Xm("update").summary("Update Amp CLI").description("Update Amp CLI to the latest version. You can specify a particular version to install, or leave blank to get the latest stable release.").option("--version <version>","Update to a specific version").allowUnknownOption(!1).action(async(F)=>{await mK9(F.version)});return J.addCommand(W),J}async function s51(J,Q){let{thread:Z,visibility:X}=Q,Y=Z?.id??nK(),K=o51(J);if(Z)await J.threadStorage.set(Y,Z);let q=await gJ.getOrCreateForThread(K,Y);if(X)await J.threadSyncService.updateThreadMeta(Y,l41(X));let G=J.threadService.observe(Y).subscribe(async(z)=>{if(K7(z,"assistant"))await ug1(Y),G.unsubscribe()});return await q.resume(),q}async function mg1(J,Q,Z){let X=process.stdin,Y=c41(Q);if(Y instanceof Error)GX(Y.message);let K,q=null;if(Q.streamJsonInput)K="";else if(typeof Q.execute==="string"){K=Q.execute;let j=(await Px1()).trimEnd();if(j)q=j}else K=(await Px1()).trimEnd();if(Q.remote&&!J.executeMode)throw new $2("The -r/--remote flag currently only works with --execute mode",1,'Use: amp --remote --execute "your message"');if(Q.streamJson&&!J.executeMode)throw new $2("The --stream-json flag requires --execute mode",1,'Use: amp --execute "your message" --stream-json');if(Q.streamJsonInput&&!J.executeMode)throw new $2("The --stream-json-input flag requires --execute mode",1,"Use: amp --execute --stream-json --stream-json-input");if(Q.streamJsonInput&&!Q.streamJson)throw new $2("The --stream-json-input flag requires --stream-json",1,"Use: amp --execute --stream-json --stream-json-input");if(Q.stats&&!J.executeMode)throw new $2("The --stats flag requires --execute mode",1,'Use: amp --execute "your message" --stats');if(Q.streamJsonInput&&typeof Q.execute==="string"&&Q.execute.trim()!=="")throw new $2("Do not provide a message argument when using --stream-json-input",1,`Supply messages via stdin JSONL instead: echo '{"type":"user","message":{"role":"user","content":[{"type":"text","text":"your message"}]}}' | amp --execute --stream-json --stream-json-input`);if(J.executeMode&&K===""&&!Q.streamJsonInput)throw new $2("User message must be provided through stdin or as argument when using execute mode",1,`Either pass a message as an argument: amp --execute "your message"
5984
5984
  Or pipe via stdin: echo "your message" | amp --execute`);if(K!==""&&!J.executeMode&&!J.streamJsonMode&&typeof Q.execute!=="string")X=await vQ6();aO(Z,Q);let G=await rO(J,Q);jF6=G;let z=o51(G),U=async(j)=>{let R=await OF6(j,"utf-8"),I=JSON.parse(R);if(!iU(I.id))throw new $2(kK.invalidThreadId);return s51(G,{visibility:Y,thread:I})},W=async(j)=>{if(!iU(j))throw new $2(kK.invalidThreadId);let R=await G.threadService.get(j)??void 0;return s51(G,{visibility:Y,thread:R})},F=async()=>{try{if(Q.threadId)return W(Q.threadId);else return s51(G,{visibility:Y})}catch(j){if(j instanceof $2)throw j;throw await R41(j,Q.threadId),Error("handleError should have called process.exit()")}},H=async()=>{return s51(G,{visibility:Y})};if(Q.format==="jsonl")t2.write(`jsonl format is deprecated. Version "0.0.1752148945-gd8844f" or earlier is required to use jsonl format.
5985
- `),await VO(),process.exit(1);if(J.executeMode&&Q.remote)await wQ6(K,q),await G.asyncDispose(),process.exit(0);let B=await F();if(J.executeMode)await C56(B,B.threadID,K,q,G,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await G.asyncDispose(),process.exit(0);let M=!1,V=!1;if(Q.jetbrains||Q.ide){await Lr1();let j=await Fc();if(j.length===0){if(Q.jetbrains)V=!await G.configService.get("jetbrains.skipInstall")}else if(j.length===1){let R=j[0];if(R)SJ.selectConfig(R)}else M=!0}let N=jx1("0.0.1759392119-g5695f1",G.settingsStorage),L=Z0.of([P0.file(process.cwd())]),A=DC(void 0,L);if(K)B.handle({type:"user:message",message:{content:[{type:"text",text:K}]}});let O=await U9();await MF6({stdin:X,stdout:process.stdout,history:new lb1,fuzzyServer:G.fuzzyServer,settingsStorage:G.settingsStorage,threadService:G.threadService,threadSyncService:G.threadSyncService,threadID:B.threadID,worker:B,workerDeps:z,configService:G.configService,internalAPIClient:MZ,ampURL:J.ampURL,useGpt5:O.settings.gpt5??!1,startNewThread:H,pickAndContinueThread:async()=>{n.info("Thread picker requested - not yet implemented in TUI")},switchToThread:W,ideClient:SJ,commandRegistry:A,showJetBrainsInstaller:V,showIdePicker:M,startWithPicker:Q.startWithPicker,updateService:N,debugWidgetTree:Q.debugWidgetTree}),await G.asyncDispose(),process.exit(0)}async function fK(J){if(J.interactive)t2.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
5986
- `);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Z=!1,X=process.stdout.isTTY&&process.stderr.isTTY,Y=SU({...J,getHook:process.env.AMP_URL?(q,G)=>{if(q==="url")return Promise.resolve(process.env.AMP_URL);return G()}:void 0});if(await PQ6(Y),await TQ6(Y),J.mcpConfig){let q=await TK9(J.mcpConfig);Y=CK9(Y,q)}let K=await Y.get("url","global");if(!K)K=YZ;if(!lH(K))n.info("Targeting custom Amp server",{ampURL:K});return Y=Sd1(Y),{executeMode:Q,streamJsonMode:Z,isTTY:X,ampURL:K,settings:Y,secrets:EQ6(await Ux1(J,Y))}}function yK9(J){let Q={};for(let Z=0;Z<J.length;Z++){let X=J[Z];if(X?.startsWith("--")){let K=X.slice(2).replace(/-([a-z])/g,(G,z)=>z.toUpperCase()),q=J[Z+1];if(q&&!q.startsWith("--"))Q[K]=q,Z++}}return Q}async function fK9(){let J=yK9(process.argv);if(K56({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),IK9(n),n.info("Starting Amp CLI.",{version:"0.0.1759392119-g5695f1",buildTimestamp:"2025-10-02T08:07:41.519Z",buildType:"'release'"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new $2(kK.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await xK9().parseAsync(process.argv)}async function hK9(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),m2.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
5985
+ `),await VO(),process.exit(1);if(J.executeMode&&Q.remote)await wQ6(K,q),await G.asyncDispose(),process.exit(0);let B=await F();if(J.executeMode)await C56(B,B.threadID,K,q,G,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await G.asyncDispose(),process.exit(0);let M=!1,V=!1;if(Q.jetbrains||Q.ide){await Lr1();let j=await Fc({jetbrainsOnly:Q.jetbrains});if(j.length===0){if(Q.jetbrains)V=!await G.configService.get("jetbrains.skipInstall")}else if(j.length===1){let R=j[0];if(R)SJ.selectConfig(R)}else M=!0}let N=jx1("0.0.1759406505-gba06ab",G.settingsStorage),L=Z0.of([P0.file(process.cwd())]),A=DC(void 0,L);if(K)B.handle({type:"user:message",message:{content:[{type:"text",text:K}]}});let O=await U9();await MF6({stdin:X,stdout:process.stdout,history:new lb1,fuzzyServer:G.fuzzyServer,settingsStorage:G.settingsStorage,threadService:G.threadService,threadSyncService:G.threadSyncService,threadID:B.threadID,worker:B,workerDeps:z,configService:G.configService,internalAPIClient:MZ,ampURL:J.ampURL,useGpt5:O.settings.gpt5??!1,startNewThread:H,pickAndContinueThread:async()=>{n.info("Thread picker requested - not yet implemented in TUI")},switchToThread:W,ideClient:SJ,commandRegistry:A,showJetBrainsInstaller:V,showIdePicker:M,startWithPicker:Q.startWithPicker,updateService:N,debugWidgetTree:Q.debugWidgetTree,jetbrainsMode:Q.jetbrains}),await G.asyncDispose(),process.exit(0)}async function fK(J){if(J.interactive)t2.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
5986
+ `);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Z=!1,X=process.stdout.isTTY&&process.stderr.isTTY,Y=SU({...J,getHook:process.env.AMP_URL?(q,G)=>{if(q==="url")return Promise.resolve(process.env.AMP_URL);return G()}:void 0});if(await PQ6(Y),await TQ6(Y),J.mcpConfig){let q=await TK9(J.mcpConfig);Y=CK9(Y,q)}let K=await Y.get("url","global");if(!K)K=YZ;if(!lH(K))n.info("Targeting custom Amp server",{ampURL:K});return Y=Sd1(Y),{executeMode:Q,streamJsonMode:Z,isTTY:X,ampURL:K,settings:Y,secrets:EQ6(await Ux1(J,Y))}}function yK9(J){let Q={};for(let Z=0;Z<J.length;Z++){let X=J[Z];if(X?.startsWith("--")){let K=X.slice(2).replace(/-([a-z])/g,(G,z)=>z.toUpperCase()),q=J[Z+1];if(q&&!q.startsWith("--"))Q[K]=q,Z++}}return Q}async function fK9(){let J=yK9(process.argv);if(K56({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),IK9(n),n.info("Starting Amp CLI.",{version:"0.0.1759406505-gba06ab",buildTimestamp:"2025-10-02T12:06:37.222Z",buildType:"'release'"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new $2(kK.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await xK9().parseAsync(process.argv)}async function hK9(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),m2.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
5987
5987
  `);else if(!lH(J.ampURL))m2.write(`Logging in to ${new URL(J.ampURL).hostname}
5988
5988
  `);let Z=process.env.AMP_API_KEY;if(Z)m2.write(`API key found in environment variable, storing...
5989
5989
  `),await Q.set("apiKey",Z,J.ampURL),m2.write(`API key successfully stored.
@@ -5999,7 +5999,7 @@ Or pipe via stdin: echo "your message" | amp --execute`);if(K!==""&&!J.executeMo
5999
5999
  `));try{let Q;if(J)Q=J,t2.write(Z8.blue(`Updating to version ${J}...
6000
6000
  `)),await TT(J),t2.write(Z8.green(`✓ Successfully updated to version ${J}
6001
6001
  `));else{t2.write(Z8.blue(`Checking for updates...
6002
- `));let{hasUpdate:X,latestVersion:Y}=await mR("0.0.1759392119-g5695f1");if(!X)t2.write(Z8.green(`✓ Amp CLI is already up to date.
6002
+ `));let{hasUpdate:X,latestVersion:Y}=await mR("0.0.1759406505-gba06ab");if(!X)t2.write(Z8.green(`✓ Amp CLI is already up to date.
6003
6003
  `)),process.exit(0);if(!Y)t2.write(Z8.yellow("[WARN] could not find latest version")),process.exit(0);Q=Y,t2.write(Z8.blue(`Updating to version ${Y}...
6004
6004
  `)),await TT(Y),t2.write(Z8.green(`✓ Successfully updated to version ${Y}
6005
6005
  `))}let Z=await RO(Q);if(Z.warning)t2.write(`