@redocly/replay 0.29.0-next.10 → 0.29.0-next.11

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 (58) hide show
  1. package/dist/{replay-AiChatProvider-DpL4VGOi.js → replay-AiChatProvider-DiP6ztPt.js} +1 -1
  2. package/dist/{replay-AiChatProvider-bepFun5r.js → replay-AiChatProvider-KaBd7DIg.js} +6 -6
  3. package/dist/{replay-AiChatSqliteDBStorage-CRdPx5Sa.js → replay-AiChatSqliteDBStorage-BiW2AzpT.js} +1 -1
  4. package/dist/{replay-AiChatSqliteDBStorage-aVd3LDCl.js → replay-AiChatSqliteDBStorage-CYG917_g.js} +1 -1
  5. package/dist/{replay-AiPanel-BKfg7MAs.js → replay-AiPanel-CRTgsNm-.js} +4 -4
  6. package/dist/{replay-AiPanel--HMLwr6r.js → replay-AiPanel-J_LTAvrH.js} +1 -1
  7. package/dist/{replay-FileWatcher-3myhktuI.js → replay-FileWatcher-BgvK_4Af.js} +2 -2
  8. package/dist/{replay-FileWatcher-U8tCGJmQ.js → replay-FileWatcher-DB6V5Z_m.js} +1 -1
  9. package/dist/{replay-SemanticSearchService-Cp-wanAz.js → replay-SemanticSearchService-CkCWaX7m.js} +1 -1
  10. package/dist/{replay-SemanticSearchService-CDvBVKCZ.js → replay-SemanticSearchService-DkXA39F0.js} +1 -1
  11. package/dist/{replay-SqliteDBStorage-Cj5ZIqdg.js → replay-SqliteDBStorage-B6X43P-l.js} +1 -1
  12. package/dist/{replay-SqliteDBStorage--jwmX3AT.js → replay-SqliteDBStorage-CaEZatJm.js} +1 -1
  13. package/dist/{replay-TauriFileSystemAdapter-AOzk-WNL.js → replay-TauriFileSystemAdapter-CTnsZgpn.js} +1 -1
  14. package/dist/{replay-TauriFileSystemAdapter-LMZ5eRoj.js → replay-TauriFileSystemAdapter-jXGkDtit.js} +1 -1
  15. package/dist/{replay-TauriRootStorage-BhvQ6BFn.js → replay-TauriRootStorage-C8Kth7fG.js} +2 -2
  16. package/dist/{replay-TauriRootStorage-DyTqNU-0.js → replay-TauriRootStorage-DldWoidz.js} +1 -1
  17. package/dist/{replay-agent-loop-DThvbk28.js → replay-agent-loop-CSQDyF19.js} +3 -3
  18. package/dist/{replay-agent-loop-DNUWb1DF.js → replay-agent-loop-CSkpuh-a.js} +1 -1
  19. package/dist/{replay-ai-chat-mappers-ipRunCfX.js → replay-ai-chat-mappers-Bn5y3wfP.js} +1 -1
  20. package/dist/{replay-ai-chat-mappers-D8OvBATY.js → replay-ai-chat-mappers-yFYjzino.js} +1 -1
  21. package/dist/{replay-create-model-CUvUtbE-.js → replay-create-model-B4AguBah.js} +3 -3
  22. package/dist/{replay-create-model-Dn3cbzAW.js → replay-create-model-DTusc1Ds.js} +3 -3
  23. package/dist/{replay-db-DY4fjjiR.js → replay-db-B4_mvLNp.js} +1 -1
  24. package/dist/{replay-db-CPZy6PnP.js → replay-db-DVp8qKD7.js} +1 -1
  25. package/dist/{replay-external-resolver-CZwjpJeo.js → replay-external-resolver-CzE3SOg1.js} +2 -2
  26. package/dist/{replay-external-resolver-BdGx04jr.js → replay-external-resolver-bSN_suNz.js} +1 -1
  27. package/dist/{replay-index-v2Pf8Cco.js → replay-index-BbQ0oJ7O.js} +1 -1
  28. package/dist/{replay-index-CwHr913S.js → replay-index-CaxaTt3L.js} +1 -1
  29. package/dist/{replay-index-CjqjkFv_.js → replay-index-Ck5-RWXm.js} +1 -1
  30. package/dist/{replay-index-CP1rnqCC.js → replay-index-Cm_7fw-J.js} +1 -1
  31. package/dist/{replay-index-DSQ-8F3e.js → replay-index-CtzJut8U.js} +1 -1
  32. package/dist/{replay-index-DWjUQcJi.js → replay-index-CyD9TpVI.js} +5 -5
  33. package/dist/replay-index-D1qU5mu0.js +4 -0
  34. package/dist/{replay-index-_0zkzi7P.js → replay-index-DAbsE71J.js} +1 -1
  35. package/dist/{replay-index-D4HNQQF4.js → replay-index-DP_00xWB.js} +16 -16
  36. package/dist/{replay-index-DgvAyfxW.js → replay-index-DU6K6x7I.js} +1 -1
  37. package/dist/{replay-index-CYb9b0_s.js → replay-index-DlFHhZgF.js} +27 -27
  38. package/dist/{replay-index-pQqtnenT.js → replay-index-DzseLquf.js} +1 -1
  39. package/dist/{replay-lint-BP7r4tG0.js → replay-lint-C4JrAlfC.js} +3 -3
  40. package/dist/{replay-lint-QqAHzsqE.js → replay-lint-CwWyWkWi.js} +3 -3
  41. package/dist/{replay-lint-graphql-CCVEELhe.js → replay-lint-graphql-3FcAXO3S.js} +2 -2
  42. package/dist/{replay-lint-graphql-Cyp_8mwt.js → replay-lint-graphql-DjFu8XDg.js} +1 -1
  43. package/dist/{replay-periodic-revalidation-B6VfUGtP.js → replay-periodic-revalidation-ChE98fdS.js} +1 -1
  44. package/dist/{replay-periodic-revalidation-CUgXefz_.js → replay-periodic-revalidation-Do5NHTEZ.js} +1 -1
  45. package/dist/{replay-resolve-Cw3__dH1.js → replay-resolve-2BhmSL2L.js} +1 -1
  46. package/dist/{replay-resolve-D5Egy48_.js → replay-resolve-DLZhNwSz.js} +1 -1
  47. package/dist/{replay-respect-run-BJd-iklq.js → replay-respect-run-4blfFaEM.js} +1 -1
  48. package/dist/{replay-respect-run-0sGatQSs.js → replay-respect-run-Cqde-SsJ.js} +3 -3
  49. package/dist/{replay-tauri-path-BxbpcNzj.js → replay-tauri-path-CxsepUAD.js} +1 -1
  50. package/dist/{replay-tauri-path-GA7m-1Yk.js → replay-tauri-path-Dlnku8cQ.js} +2 -2
  51. package/dist/{replay-useAiChatQueries-5FlnedrO.js → replay-useAiChatQueries-Br7_L25G.js} +1 -1
  52. package/dist/{replay-useAiChatQueries-DZ38fnMy.js → replay-useAiChatQueries-DNT0fI6R.js} +4 -4
  53. package/dist/{replay-validate-key-DTnhkHza.js → replay-validate-key-B5gYUcfA.js} +2 -2
  54. package/dist/{replay-validate-key-BFMbrrwB.js → replay-validate-key-Btx97_od.js} +1 -1
  55. package/dist/replay.cjs +1 -1
  56. package/dist/replay.js +1 -1
  57. package/package.json +2 -2
  58. package/dist/replay-index-BZjIH-Um.js +0 -4
@@ -523,7 +523,7 @@ ${D}`,se=Math.min($.length,E);let ce=0;for(;ce<se-1;ce++){const le=_(String(ce),
523
523
  ${L}`,U.pop(),`[${H}]`}let F=Object.keys($);const Y=F.length;if(Y===0)return"{}";if(I<U.length+1)return'"[Object]"';D+=R;const G=`,
524
524
  ${D}`;let ee="",ie="",q=Math.min(Y,E);l($)&&(ee+=c($,G,E),F=F.slice($.length),q-=$.length,ie=G),P&&(F=o(F,k)),U.push($);for(let H=0;H<q;H++){const J=F[H],se=_(J,$[J],U,R,D);se!==void 0&&(ee+=`${ie}${s(J)}: ${se}`,ie=G)}if(Y>E){const H=Y-E;ee+=`${ie}"...": "${m(H)} not stringified"`,ie=G}return ie!==""&&(ee=`
525
525
  ${D}${ee}
526
- ${L}`),U.pop(),`{${ee}}`}case"number":return isFinite($)?String($):y?y($):"null";case"boolean":return $===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String($);default:return y?y($):void 0}}function M(X,$,U){switch(typeof $){case"string":return s($);case"object":{if($===null)return"null";if(typeof $.toJSON=="function"){if($=$.toJSON(X),typeof $!="object")return M(X,$,U);if($===null)return"null"}if(U.indexOf($)!==-1)return w;let R="";const D=$.length!==void 0;if(D&&Array.isArray($)){if($.length===0)return"[]";if(I<U.length+1)return'"[Array]"';U.push($);const ee=Math.min($.length,E);let ie=0;for(;ie<ee-1;ie++){const H=M(String(ie),$[ie],U);R+=H!==void 0?H:"null",R+=","}const q=M(String(ie),$[ie],U);if(R+=q!==void 0?q:"null",$.length-1>E){const H=$.length-E-1;R+=`,"... ${m(H)} not stringified"`}return U.pop(),`[${R}]`}let L=Object.keys($);const F=L.length;if(F===0)return"{}";if(I<U.length+1)return'"[Object]"';let Y="",G=Math.min(F,E);D&&l($)&&(R+=c($,",",E),L=L.slice($.length),G-=$.length,Y=","),P&&(L=o(L,k)),U.push($);for(let ee=0;ee<G;ee++){const ie=L[ee],q=M(ie,$[ie],U);q!==void 0&&(R+=`${Y}${s(ie)}:${q}`,Y=",")}if(F>E){const ee=F-E;R+=`${Y}"...":"${m(ee)} not stringified"`}return U.pop(),`{${R}}`}case"number":return isFinite($)?String($):y?y($):"null";case"boolean":return $===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String($);default:return y?y($):void 0}}function z(X,$,U){if(arguments.length>1){let R="";if(typeof U=="number"?R=" ".repeat(Math.min(U,10)):typeof U=="string"&&(R=U.slice(0,10)),$!=null){if(typeof $=="function")return Q("",{"":X},[],$,R,"");if(Array.isArray($))return N("",X,[],g($),R,"")}if(R.length!==0)return _("",X,[],R,"")}return M("",X,[])}return z}})(jv,jv.exports)),jv.exports}var vEe=OEe();const yEe=Rl(vEe),bEe=yEe.configure;class Tm{static maxErrorTextChars=4096;static stringify=bEe({maximumDepth:2,maximumBreadth:10});sendErrorEvent;originalConsoleError=null;constructor(e){this.sendErrorEvent=e}static toErrorEvent(e,n){return{type:"error",payload:[{handler:n,errorType:this.getErrorType(e),message:this.getErrorMessage(e),stack:this.getErrorStack(e)}]}}enable(){this.originalConsoleError||(window.addEventListener("error",this.onError),window.addEventListener("unhandledrejection",this.onUnhandledRejection),this.originalConsoleError=console.error,console.error=this.patchConsoleError(this.originalConsoleError))}disable(){this.originalConsoleError&&(window.removeEventListener("error",this.onError),window.removeEventListener("unhandledrejection",this.onUnhandledRejection),console.error=this.originalConsoleError,this.originalConsoleError=null)}static getErrorMessage(e){return e?(typeof e=="object"&&"message"in e?String(e.message):String(e)).trim():void 0}static getErrorStack(e){if(!e||typeof e!="object"||!("stack"in e)||!e.stack)return;const n=String(e.stack);return n.length>this.maxErrorTextChars?n.substring(0,this.maxErrorTextChars):n}static getErrorType(e){return!e||typeof e!="object"?typeof e:"name"in e?String(e.name):"constructor"in e&&"name"in e.constructor?String(e.constructor.name):"Error"}static combineConsoleErrorArgs(e){const n=e.findIndex(i=>i instanceof Error),r=e.filter((i,s)=>s!==n).map(i=>typeof i=="string"?i:i instanceof Error?String(i):this.stringify(i)??String(i)).join(" ").substring(0,this.maxErrorTextChars);if(n===-1)return r;{const i=e[n];return r&&(i.message=`${i.message} ${r}`),i}}onError=e=>{this.sendError(e.error,"window.onerror")};onUnhandledRejection=e=>{this.sendError(e.reason,"window.onunhandledrejection")};patchConsoleError(e){const n=this;return function(...i){try{const s=Tm.combineConsoleErrorArgs(i);n.sendError(s,"console.error")}catch(s){process.env.NODE_ENV!=="production"&&e.call(this,"Error reporting failed:",s)}e.apply(this,i)}}sendError(e,n){this.sendErrorEvent(Tm.toErrorEvent(e,n))}}class YA{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new BA,this.tracer={traceStep:(e,n)=>{const r=this.constructCloudEvent(e,n,{signal:"trace"});return this.otelClient.traceStep(r)}}}updateCloudEventData=e=>{this.config?.disabled||(this.useCloudEventData=e)};send(e,n,r){try{if(!this.config?.otel.isProd)return;const s=e&&typeof e=="object"&&"type"in e&&"data"in e?e:this.constructCloudEvent(e,n,{...r,signal:"log"});this.sendToOtelService(s)}catch(i){this.config?.otel.isProd||console.error("Event reporting failed:",i)}}init(e){e.disabled||this.initialized||(this.config=e,this.initialized=!0,this.otelClient.init({serviceVersion:e.otel.serviceVersion,version:e.otel.version,isProd:e.otel.isProd,collectorUrl:e.otel.collectorUrl,collectorTraceUrl:e.otel.collectorTraceUrl,serviceName:e.otel.serviceName,tracerName:e.otel.tracerName,spanProcessors:e.otel.spanProcessors,registerGlobalTracerProvider:e.otel.registerGlobalTracerProvider}),e.otel.enableErrorInstrumentation===!0&&this.otelClient.tracer&&new Tm(n=>{this.sendToOtelService({type:n.type,data:n.payload})}).enable())}withTracer(e){const n=new YA;return n.config=this.config,n.initialized=this.initialized,n.useCloudEventData=()=>this.useCloudEventData(),n.otelClient=this.otelClient.withTracer(e),n}startSpan(e,n,r){if(this.config?.disabled)return;const i=this.constructCloudEvent(e,n,{signal:"trace"});return this.otelClient.startSpan(i,r)}constructCloudEvent(e,n,r){const i={...this.useCloudEventData(),...r};return VTe({type:e,data:n,...i,...this.otelClient.sessionId&&{sessionId:this.otelClient.sessionId}})}sendToOtelService(e){this.config?.otel.isProd||console.log("CloudEvent to be sent to OTEL service:",e),this.otelClient.send({...e,signal:"log"})}forceFlush(){return this.config?.disabled?Promise.resolve():this.otelClient.forceFlush()}shutdown(){return this.config?.disabled?Promise.resolve():this.otelClient.shutdown()}sendError(e,n){if(this.config?.disabled)return;const r=Tm.toErrorEvent(e,n);this.sendToOtelService({type:r.type,data:r.payload})}sendTabChangeMessage(e,n){this.send("com.redocly.tab.change",e,n)}sendButtonClickMessage(e,n){this.send("com.redocly.button.click",e,n)}sendTabOpenFailedMessage(e,n){this.send("com.redocly.tab.openFailed",e,n)}sendChangeMessage(e,n){this.send("com.redocly.change.occurred",e,n)}sendContentCopyMessage(e,n){this.send("com.redocly.content.copy",e,n)}sendRequestSendMessage(e,n){this.send("com.redocly.request.send",e,n)}sendResponseReceivedMessage(e,n){this.send("com.redocly.response.received",e,n)}sendTokenGenerateMessage(e,n){this.send("com.redocly.token.generate",e,n)}sendAppLifecycleMessage(e,n){this.send("com.redocly.app.lifecycle",e,n)}sendAppLoadedMessage(e,n){this.send("com.redocly.app.loaded",e,n)}sendEnvironmentManagementMessage(e,n){this.send("com.redocly.environment.management",e,n)}sendServerManagementMessage(e,n){this.send("com.redocly.server.management",e,n)}sendSourceManagementMessage(e,n){this.send("com.redocly.source.management",e,n)}sendInputManagementMessage(e,n){this.send("com.redocly.input.management",e,n)}sendNodeManagementMessage(e,n){this.send("com.redocly.node.management",e,n)}sendHistoryManagementMessage(e,n){this.send("com.redocly.history.management",e,n)}sendHistoryMigrationMessage(e,n){this.send("com.redocly.history.migration",e,n)}sendCredentialManagementMessage(e,n){this.send("com.redocly.credential.management",e,n)}sendPanelToggleMessage(e,n){this.send("com.redocly.panel.toggle",e,n)}sendWorkflowRunClickMessage(e,n){this.send("com.redocly.workflowRun.click",e,n)}sendWorkflowRunResultMessage(e,n){this.send("com.redocly.workflowRun.result",e,n)}sendStorageReadMessage(e,n){this.send("com.redocly.storage.read",e,n)}sendStorageLoadUserStateMessage(e,n){this.send("com.redocly.storage.loadUserState",e,n)}sendStorageDetectFilesMessage(e,n){this.send("com.redocly.storage.detectFiles",e,n)}sendStorageLoadApisMessage(e,n){this.send("com.redocly.storage.loadApis",e,n)}sendStorageParseApisMessage(e,n){this.send("com.redocly.storage.parseApis",e,n)}sendStorageParseCollectionsMessage(e,n){this.send("com.redocly.storage.parseCollections",e,n)}sendUpdaterCheckMessage(e,n){this.send("com.redocly.updater.check",e,n)}sendUpdaterDownloadMessage(e,n){this.send("com.redocly.updater.download",e,n)}sendUpdaterInstallMessage(e,n){this.send("com.redocly.updater.install",e,n)}sendUpdaterProcessMessage(e,n){this.send("com.redocly.updater.process",e,n)}sendErrorMessage(e,n){this.send("com.redocly.error.occurred",e,n)}sendBackendEventMessage(e,n){this.send("com.redocly.backend.event",e,n)}sendCodeEditorSearchMessage(e,n){this.send("com.redocly.codeEditor.search",e,n)}sendAiChatToolCallStartedMessage(e,n){this.send("com.redocly.aiChat.toolCallStarted",e,n)}sendAiChatToolCallFinishedMessage(e,n){this.send("com.redocly.aiChat.toolCallFinished",e,n)}sendAiChatConversationStartedMessage(e,n){this.send("com.redocly.aiChat.conversationStarted",e,n)}sendAiChatConversationFinishedMessage(e,n){this.send("com.redocly.aiChat.conversationFinished",e,n)}sendDeepLinkOpenedMessage(e,n){this.send("com.redocly.deepLink.opened",e,n)}}const iE=process.env.NODE_ENV==="development",XM=process.env.NODE_ENV==="production",xEe="0.29.0-next.10",SEe={version:xEe},wEe={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"urn:redocly:replay:app",origin:"replayUi"},UM="desktop";class NB{_client;_scopedClients=new Map;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new YA}get isInitialized(){return this._isInitialized}get client(){return this._client}awaitInit(){return this._initPromise}updateCloudEventData(e){this._client.updateCloudEventData(e)}setCloudEventData(e){this._client.updateCloudEventData(()=>({...wEe,...e,env:XM?"production":"development"}))}enrichGlobalAttributes(e){this._globalAttributes={...this._globalAttributes,...e}}getGlobalAttributes(){return{...this._globalAttributes}}clearGlobalAttributes(){this._globalAttributes={platform:"",deviceId:""}}init(e){if(this.isInitialized)return;const{cloudEventData:n,...r}=e??{},i=r.tracerName||UM,s=r.enableErrorInstrumentation??i==="desktop",o={serviceName:"replay",serviceVersion:SEe.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:XM,enableErrorInstrumentation:s};this._client.init({otel:{...o,...r}}),this.setCloudEventData(n),this._initResolve?.(this),this._isInitialized=!0}getScopedClient(e){this.init(e);const n=e?.tracerName||UM;let r=this._scopedClients.get(n);if(!r){const i=this._client.withTracer(n);r={sendEvent:(s,o)=>this.emitEvent(i,s,o),startSpan:(s,o,a)=>this.emitSpan(i,s,o,a)},this._scopedClients.set(n,r)}return r}sendEvent(e,n){this.emitEvent(this._client,e,n)}startSpan(e,n,r){return this.emitSpan(this._client,e,n,r)}emitEvent(e,n,r){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}const i=r.map(s=>({...this._globalAttributes,...s}));iE&&console.log(`[Telemetry] ${n}:`,JSON.stringify(i,null,2));try{e.send(n,i)}catch(s){console.error("Failed to send telemetry event:",s)}}emitSpan(e,n,r,i){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}try{const s=(r??[{}]).map(o=>({...this._globalAttributes,...o}));return iE&&console.log(`[Telemetry] span ${n}:`,JSON.stringify(s,null,2)),e.startSpan(n,s,i)}catch(s){console.error("Failed to start telemetry span:",s);return}}}const P0=new NB;function et(){const{telemetry:t}=Wn(),e=P0.getScopedClient(t),n=t?.cloudEventData;return x.useEffect(()=>{n&&P0.setCloudEventData(n)},[n]),e}const TEe=({awaitInit:t=!0}={})=>{const[e,n]=x.useState(void 0);return x.useEffect(()=>{(async()=>{const i=t?await P0.awaitInit():P0;n(i)})()},[t]),e};function DB(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function sE(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function MB(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function Rn(){return!!window?.__TAURI__}function ye(t,e,n="ui"){let r=`urn:redocly:replay:${n}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!Rn()&&(r=MB(window.location.href)),{object:t,id:e,uri:r}}const fi=800,Ss=T.default(ve.Button).attrs({variant:"text",size:"small",tone:"danger"})`
526
+ ${L}`),U.pop(),`{${ee}}`}case"number":return isFinite($)?String($):y?y($):"null";case"boolean":return $===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String($);default:return y?y($):void 0}}function M(X,$,U){switch(typeof $){case"string":return s($);case"object":{if($===null)return"null";if(typeof $.toJSON=="function"){if($=$.toJSON(X),typeof $!="object")return M(X,$,U);if($===null)return"null"}if(U.indexOf($)!==-1)return w;let R="";const D=$.length!==void 0;if(D&&Array.isArray($)){if($.length===0)return"[]";if(I<U.length+1)return'"[Array]"';U.push($);const ee=Math.min($.length,E);let ie=0;for(;ie<ee-1;ie++){const H=M(String(ie),$[ie],U);R+=H!==void 0?H:"null",R+=","}const q=M(String(ie),$[ie],U);if(R+=q!==void 0?q:"null",$.length-1>E){const H=$.length-E-1;R+=`,"... ${m(H)} not stringified"`}return U.pop(),`[${R}]`}let L=Object.keys($);const F=L.length;if(F===0)return"{}";if(I<U.length+1)return'"[Object]"';let Y="",G=Math.min(F,E);D&&l($)&&(R+=c($,",",E),L=L.slice($.length),G-=$.length,Y=","),P&&(L=o(L,k)),U.push($);for(let ee=0;ee<G;ee++){const ie=L[ee],q=M(ie,$[ie],U);q!==void 0&&(R+=`${Y}${s(ie)}:${q}`,Y=",")}if(F>E){const ee=F-E;R+=`${Y}"...":"${m(ee)} not stringified"`}return U.pop(),`{${R}}`}case"number":return isFinite($)?String($):y?y($):"null";case"boolean":return $===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String($);default:return y?y($):void 0}}function z(X,$,U){if(arguments.length>1){let R="";if(typeof U=="number"?R=" ".repeat(Math.min(U,10)):typeof U=="string"&&(R=U.slice(0,10)),$!=null){if(typeof $=="function")return Q("",{"":X},[],$,R,"");if(Array.isArray($))return N("",X,[],g($),R,"")}if(R.length!==0)return _("",X,[],R,"")}return M("",X,[])}return z}})(jv,jv.exports)),jv.exports}var vEe=OEe();const yEe=Rl(vEe),bEe=yEe.configure;class Tm{static maxErrorTextChars=4096;static stringify=bEe({maximumDepth:2,maximumBreadth:10});sendErrorEvent;originalConsoleError=null;constructor(e){this.sendErrorEvent=e}static toErrorEvent(e,n){return{type:"error",payload:[{handler:n,errorType:this.getErrorType(e),message:this.getErrorMessage(e),stack:this.getErrorStack(e)}]}}enable(){this.originalConsoleError||(window.addEventListener("error",this.onError),window.addEventListener("unhandledrejection",this.onUnhandledRejection),this.originalConsoleError=console.error,console.error=this.patchConsoleError(this.originalConsoleError))}disable(){this.originalConsoleError&&(window.removeEventListener("error",this.onError),window.removeEventListener("unhandledrejection",this.onUnhandledRejection),console.error=this.originalConsoleError,this.originalConsoleError=null)}static getErrorMessage(e){return e?(typeof e=="object"&&"message"in e?String(e.message):String(e)).trim():void 0}static getErrorStack(e){if(!e||typeof e!="object"||!("stack"in e)||!e.stack)return;const n=String(e.stack);return n.length>this.maxErrorTextChars?n.substring(0,this.maxErrorTextChars):n}static getErrorType(e){return!e||typeof e!="object"?typeof e:"name"in e?String(e.name):"constructor"in e&&"name"in e.constructor?String(e.constructor.name):"Error"}static combineConsoleErrorArgs(e){const n=e.findIndex(i=>i instanceof Error),r=e.filter((i,s)=>s!==n).map(i=>typeof i=="string"?i:i instanceof Error?String(i):this.stringify(i)??String(i)).join(" ").substring(0,this.maxErrorTextChars);if(n===-1)return r;{const i=e[n];return r&&(i.message=`${i.message} ${r}`),i}}onError=e=>{this.sendError(e.error,"window.onerror")};onUnhandledRejection=e=>{this.sendError(e.reason,"window.onunhandledrejection")};patchConsoleError(e){const n=this;return function(...i){try{const s=Tm.combineConsoleErrorArgs(i);n.sendError(s,"console.error")}catch(s){process.env.NODE_ENV!=="production"&&e.call(this,"Error reporting failed:",s)}e.apply(this,i)}}sendError(e,n){this.sendErrorEvent(Tm.toErrorEvent(e,n))}}class YA{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new BA,this.tracer={traceStep:(e,n)=>{const r=this.constructCloudEvent(e,n,{signal:"trace"});return this.otelClient.traceStep(r)}}}updateCloudEventData=e=>{this.config?.disabled||(this.useCloudEventData=e)};send(e,n,r){try{if(!this.config?.otel.isProd)return;const s=e&&typeof e=="object"&&"type"in e&&"data"in e?e:this.constructCloudEvent(e,n,{...r,signal:"log"});this.sendToOtelService(s)}catch(i){this.config?.otel.isProd||console.error("Event reporting failed:",i)}}init(e){e.disabled||this.initialized||(this.config=e,this.initialized=!0,this.otelClient.init({serviceVersion:e.otel.serviceVersion,version:e.otel.version,isProd:e.otel.isProd,collectorUrl:e.otel.collectorUrl,collectorTraceUrl:e.otel.collectorTraceUrl,serviceName:e.otel.serviceName,tracerName:e.otel.tracerName,spanProcessors:e.otel.spanProcessors,registerGlobalTracerProvider:e.otel.registerGlobalTracerProvider}),e.otel.enableErrorInstrumentation===!0&&this.otelClient.tracer&&new Tm(n=>{this.sendToOtelService({type:n.type,data:n.payload})}).enable())}withTracer(e){const n=new YA;return n.config=this.config,n.initialized=this.initialized,n.useCloudEventData=()=>this.useCloudEventData(),n.otelClient=this.otelClient.withTracer(e),n}startSpan(e,n,r){if(this.config?.disabled)return;const i=this.constructCloudEvent(e,n,{signal:"trace"});return this.otelClient.startSpan(i,r)}constructCloudEvent(e,n,r){const i={...this.useCloudEventData(),...r};return VTe({type:e,data:n,...i,...this.otelClient.sessionId&&{sessionId:this.otelClient.sessionId}})}sendToOtelService(e){this.config?.otel.isProd||console.log("CloudEvent to be sent to OTEL service:",e),this.otelClient.send({...e,signal:"log"})}forceFlush(){return this.config?.disabled?Promise.resolve():this.otelClient.forceFlush()}shutdown(){return this.config?.disabled?Promise.resolve():this.otelClient.shutdown()}sendError(e,n){if(this.config?.disabled)return;const r=Tm.toErrorEvent(e,n);this.sendToOtelService({type:r.type,data:r.payload})}sendTabChangeMessage(e,n){this.send("com.redocly.tab.change",e,n)}sendButtonClickMessage(e,n){this.send("com.redocly.button.click",e,n)}sendTabOpenFailedMessage(e,n){this.send("com.redocly.tab.openFailed",e,n)}sendChangeMessage(e,n){this.send("com.redocly.change.occurred",e,n)}sendContentCopyMessage(e,n){this.send("com.redocly.content.copy",e,n)}sendRequestSendMessage(e,n){this.send("com.redocly.request.send",e,n)}sendResponseReceivedMessage(e,n){this.send("com.redocly.response.received",e,n)}sendTokenGenerateMessage(e,n){this.send("com.redocly.token.generate",e,n)}sendAppLifecycleMessage(e,n){this.send("com.redocly.app.lifecycle",e,n)}sendAppLoadedMessage(e,n){this.send("com.redocly.app.loaded",e,n)}sendEnvironmentManagementMessage(e,n){this.send("com.redocly.environment.management",e,n)}sendServerManagementMessage(e,n){this.send("com.redocly.server.management",e,n)}sendSourceManagementMessage(e,n){this.send("com.redocly.source.management",e,n)}sendInputManagementMessage(e,n){this.send("com.redocly.input.management",e,n)}sendNodeManagementMessage(e,n){this.send("com.redocly.node.management",e,n)}sendHistoryManagementMessage(e,n){this.send("com.redocly.history.management",e,n)}sendHistoryMigrationMessage(e,n){this.send("com.redocly.history.migration",e,n)}sendCredentialManagementMessage(e,n){this.send("com.redocly.credential.management",e,n)}sendPanelToggleMessage(e,n){this.send("com.redocly.panel.toggle",e,n)}sendWorkflowRunClickMessage(e,n){this.send("com.redocly.workflowRun.click",e,n)}sendWorkflowRunResultMessage(e,n){this.send("com.redocly.workflowRun.result",e,n)}sendStorageReadMessage(e,n){this.send("com.redocly.storage.read",e,n)}sendStorageLoadUserStateMessage(e,n){this.send("com.redocly.storage.loadUserState",e,n)}sendStorageDetectFilesMessage(e,n){this.send("com.redocly.storage.detectFiles",e,n)}sendStorageLoadApisMessage(e,n){this.send("com.redocly.storage.loadApis",e,n)}sendStorageParseApisMessage(e,n){this.send("com.redocly.storage.parseApis",e,n)}sendStorageParseCollectionsMessage(e,n){this.send("com.redocly.storage.parseCollections",e,n)}sendUpdaterCheckMessage(e,n){this.send("com.redocly.updater.check",e,n)}sendUpdaterDownloadMessage(e,n){this.send("com.redocly.updater.download",e,n)}sendUpdaterInstallMessage(e,n){this.send("com.redocly.updater.install",e,n)}sendUpdaterProcessMessage(e,n){this.send("com.redocly.updater.process",e,n)}sendErrorMessage(e,n){this.send("com.redocly.error.occurred",e,n)}sendBackendEventMessage(e,n){this.send("com.redocly.backend.event",e,n)}sendCodeEditorSearchMessage(e,n){this.send("com.redocly.codeEditor.search",e,n)}sendAiChatToolCallStartedMessage(e,n){this.send("com.redocly.aiChat.toolCallStarted",e,n)}sendAiChatToolCallFinishedMessage(e,n){this.send("com.redocly.aiChat.toolCallFinished",e,n)}sendAiChatConversationStartedMessage(e,n){this.send("com.redocly.aiChat.conversationStarted",e,n)}sendAiChatConversationFinishedMessage(e,n){this.send("com.redocly.aiChat.conversationFinished",e,n)}sendDeepLinkOpenedMessage(e,n){this.send("com.redocly.deepLink.opened",e,n)}}const iE=process.env.NODE_ENV==="development",XM=process.env.NODE_ENV==="production",xEe="0.29.0-next.11",SEe={version:xEe},wEe={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"urn:redocly:replay:app",origin:"replayUi"},UM="desktop";class NB{_client;_scopedClients=new Map;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new YA}get isInitialized(){return this._isInitialized}get client(){return this._client}awaitInit(){return this._initPromise}updateCloudEventData(e){this._client.updateCloudEventData(e)}setCloudEventData(e){this._client.updateCloudEventData(()=>({...wEe,...e,env:XM?"production":"development"}))}enrichGlobalAttributes(e){this._globalAttributes={...this._globalAttributes,...e}}getGlobalAttributes(){return{...this._globalAttributes}}clearGlobalAttributes(){this._globalAttributes={platform:"",deviceId:""}}init(e){if(this.isInitialized)return;const{cloudEventData:n,...r}=e??{},i=r.tracerName||UM,s=r.enableErrorInstrumentation??i==="desktop",o={serviceName:"replay",serviceVersion:SEe.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:XM,enableErrorInstrumentation:s};this._client.init({otel:{...o,...r}}),this.setCloudEventData(n),this._initResolve?.(this),this._isInitialized=!0}getScopedClient(e){this.init(e);const n=e?.tracerName||UM;let r=this._scopedClients.get(n);if(!r){const i=this._client.withTracer(n);r={sendEvent:(s,o)=>this.emitEvent(i,s,o),startSpan:(s,o,a)=>this.emitSpan(i,s,o,a)},this._scopedClients.set(n,r)}return r}sendEvent(e,n){this.emitEvent(this._client,e,n)}startSpan(e,n,r){return this.emitSpan(this._client,e,n,r)}emitEvent(e,n,r){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}const i=r.map(s=>({...this._globalAttributes,...s}));iE&&console.log(`[Telemetry] ${n}:`,JSON.stringify(i,null,2));try{e.send(n,i)}catch(s){console.error("Failed to send telemetry event:",s)}}emitSpan(e,n,r,i){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}try{const s=(r??[{}]).map(o=>({...this._globalAttributes,...o}));return iE&&console.log(`[Telemetry] span ${n}:`,JSON.stringify(s,null,2)),e.startSpan(n,s,i)}catch(s){console.error("Failed to start telemetry span:",s);return}}}const P0=new NB;function et(){const{telemetry:t}=Wn(),e=P0.getScopedClient(t),n=t?.cloudEventData;return x.useEffect(()=>{n&&P0.setCloudEventData(n)},[n]),e}const TEe=({awaitInit:t=!0}={})=>{const[e,n]=x.useState(void 0);return x.useEffect(()=>{(async()=>{const i=t?await P0.awaitInit():P0;n(i)})()},[t]),e};function DB(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function sE(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function MB(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function Rn(){return!!window?.__TAURI__}function ye(t,e,n="ui"){let r=`urn:redocly:replay:${n}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!Rn()&&(r=MB(window.location.href)),{object:t,id:e,uri:r}}const fi=800,Ss=T.default(ve.Button).attrs({variant:"text",size:"small",tone:"danger"})`
527
527
  border: none;
528
528
  margin: 0;
529
529
 
@@ -780,10 +780,10 @@ ${L}`),U.pop(),`{${ee}}`}case"number":return isFinite($)?String($):y?y($):"null"
780
780
  border-radius: var(--border-radius);
781
781
  border: 1px solid var(--border-color-primary);
782
782
  padding: 0 calc(var(--spacing-xxs) / 2);
783
- `,_n=(t,e,n=new Set)=>{const r=iQ(t);if(!r.length)return t;let i=0;const s=r.flatMap(({start:o,end:a,name:l})=>{if(n.has(l))return null;const c=e.find(f=>f.name===l),u=t.slice(i,c?o:a);if(i=a,c){n.add(l);const f=_n(c.value,e,n);return n.delete(l),[u.length?u:null,f||t.slice(o,a)]}return[u.length?u:null]});return t.slice(i).length&&s.push(t.slice(i)),s.join("")};function GEe(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function HEe(t,e){const n=FB(t);if(!n.length)return d.jsx(WM,{children:t});let r=0;const i=n.flatMap(({start:s,end:o})=>{const a=t.slice(r,s),l=GEe(t.slice(s,o),e);return r=o,[a.length?a:null,l]});return t.slice(r).length&&i.push(t.slice(r)),d.jsx(WM,{children:i.join("")})}const Co=Al(Dr([]));Co.debugLabel="collections";function mi(){return Ir(Co)}function lS(){const t=Do();return x.useCallback(()=>t.get(Co),[t])}function mO(t){const e=mi();return ah(e,t)}function zc(t){const e=mi();return OO(e,t)}function qa(){const t=bl(Co);return x.useCallback(e=>t(n=>e(n)),[t])}function JEe(t){const e=qa();return x.useCallback(n=>e(r=>Xi(r,t,n)),[e,t])}function WB(t){const e=qa(),{collectionId:n,workflowId:r}=t;return x.useCallback(i=>e(s=>Ns(s,{collectionId:n,workflowId:r},i)),[e,n,r])}function KEe(t){const e=qa(),{collectionId:n,workflowId:r,stepId:i}=t;return x.useCallback(s=>e(o=>cS(o,{collectionId:n,workflowId:r,stepId:i},s)),[e,n,r,i])}function ah(t,e){return t.find(n=>n.id===e)??null}function OO(t,{collectionId:e,workflowId:n}){return ah(t,e)?.workflows.find(i=>i.workflowId===n)??null}function vO(t,{collectionId:e,workflowId:n,stepId:r}){return OO(t,{collectionId:e,workflowId:n})?.steps.find(s=>s.stepId===r)??null}function Xi(t,e,n){const r=t.findIndex(o=>o.id===e);if(r===-1)return t;const i=n(t[r]);if(i===t[r])return t;const s=[...t];return s[r]=i,s}function Ns(t,{collectionId:e,workflowId:n},r){return Xi(t,e,i=>{const s=i.workflows.findIndex(a=>a.workflowId===n);if(s===-1)return i;const o=[...i.workflows];return o[s]=r(i.workflows[s]),{...i,workflows:o}})}function cS(t,{collectionId:e,workflowId:n,stepId:r},i){return Ns(t,{collectionId:e,workflowId:n},s=>{const o=s.steps.findIndex(l=>l.stepId===r);if(o===-1)return s;const a=[...s.steps];return a[o]=i(s.steps[o]),{...s,steps:a}})}function ZB(t,e){const n=t.findIndex(r=>r.id===e);return n===-1?t:t.filter((r,i)=>i!==n)}function lE(t,{collectionId:e,workflowId:n}){return Xi(t,e,r=>{const i=r.workflows.findIndex(s=>s.workflowId===n);return i===-1?r:{...r,workflows:r.workflows.filter((s,o)=>o!==i)}})}function cE(t,{collectionId:e,workflowId:n,stepId:r}){return Ns(t,{collectionId:e,workflowId:n},i=>{const s=i.steps.findIndex(o=>o.stepId===r);return s===-1?i:{...i,steps:i.steps.filter((o,a)=>a!==s)}})}class eIe{constructor(e){this.storage=e}storage;async initialize(){await this.storage.initialize()}upsert(e){return this.storage.upsert(e)}getByWorkflow(e,n){return this.storage.getByWorkflow(e,n)}getByKey(e,n,r){return this.storage.getByKey(e,n,r)}pruneOlderThan(e){return this.storage.pruneOlderThan(e)}clear(){return this.storage.clear()}}class Cm{static instance=null;static currentDbPath=null;static async initialize(e){if(this.instance&&this.currentDbPath===e)return this.instance;this.instance&&this.currentDbPath!==e&&await this.close();const{SqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-SqliteDBStorage--jwmX3AT.js"));return this.instance=n.getInstance(e),this.currentDbPath=e,await this.instance.initialize(),this.instance}static getInstance(){if(!this.instance)throw new Error("SqliteDBConnection not initialized");return this.instance}static isInitialized(){return this.instance!==null}static async close(){this.instance&&(await this.instance.close(),this.instance=null,this.currentDbPath=null)}}const uS={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t};function bu(t){if(t!==void 0)try{return JSON.parse(JSON.stringify(t))}catch{return}}function tIe(t,e){if(typeof t!="string"||t===""||!(!e||/json/i.test(e)))return t;try{return JSON.parse(t)}catch{return t}}function nIe(t){if(!t)return null;const e=Object.fromEntries(t.headers??[]),n=Object.entries(e).find(([r])=>r.toLowerCase()==="content-type")?.[1];return{statusCode:t.status,body:tIe(t.body,n),header:e,contentType:n,time:t.duration}}async function sQ(t,e){const n={};if(!t.some(({key:i,value:s,active:o})=>i&&s&&o))return n;const{evaluateRuntimeExpression:r}=await Promise.resolve().then(()=>obe);for(const{key:i,value:s,active:o}of t)if(!(!i||!s||!o))try{n[i]=r(s,e,uS)}catch{}return n}function rIe(t,e){const n=t?.$workflows?.[e]?.steps??{};return Object.entries(n).filter(([,r])=>r?.request!=null||r?.response!=null||r?.outputs&&Object.keys(r.outputs).length>0).map(([r,i])=>({stepId:r,request:bu(i?.request)??null,response:bu(i?.response)??null,outputs:bu(i?.outputs)??{}}))}let BB=0;const uE=new Set;function iIe(){BB+=1;for(const t of uE)t()}function sIe(){return BB}function oIe(t){return uE.add(t),()=>{uE.delete(t)}}const aIe=10080*60*1e3;async function oQ(t){const e=$o.getInstance();if(e&&!(!t.collectionId||!t.workflowId||!t.stepId))try{await e.upsert({id:xm(),date:Date.now(),...t}),iIe()}catch(n){console.error("Failed to persist step context:",n)}}async function lIe(t,e,n){if($o.getInstance())for(const i of rIe(n,e))await oQ({collectionId:t,workflowId:e,...i})}class $o{static instance=null;static async initialize(e){if(this.close(),!e)return;const{StepContextSqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-StepContextSqliteDBStorage-BSepLyBI.js")),r=Cm.getInstance(),i=new n(r);this.instance=new eIe(i)}static getInstance(){return this.instance}static close(){this.instance=null}}const cIe={__replayClearedOutput:!0};function YB(t){return typeof t=="object"&&t!==null&&t.__replayClearedOutput===!0}async function GB(t,e){const n={};for(const r of t){if(n[r.stepId])continue;const i={...r.outputs??{}},s=e?.[r.stepId];if(s&&r.response){const o=s.filter(a=>a.key&&a.active&&!(a.key in i));if(o.length){const a=await sQ(o,{$response:r.response,$request:r.request??void 0});for(const[l,c]of Object.entries(a))l in i||(i[l]=c)}}for(const o of Object.keys(i))YB(i[o])&&delete i[o];n[r.stepId]={request:r.request??void 0,response:r.response??void 0,outputs:i}}return n}function HB(t){if(t!==void 0)return typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t)}const uIe=/\{\$steps\.[^}\s]+\}|^\$steps\.[^}\s]+$/g;function aQ(t){const e=new RegExp(uIe),n=[];let r;for(;(r=e.exec(t))!==null;)n.push({start:r.index,end:r.index+r[0].length});return n}const dIe=/^\{?\$steps\.([^.{}\s]+)\.(outputs|request|response)\.([^{}\s#]+)(?:#\/([^{}\s]*))?\}?$/;function JB(t){const e=dIe.exec(t.trim());if(!e)return null;const[,n,r,i,s]=e;return{stepId:n,kind:r,outputName:r==="outputs"&&!i.includes(".")?i:void 0,hasPointer:s!==void 0}}const fIe=/^(\{?)(\$steps\.[^.{}\s]+\.(?:request|response)\.[^{}\s#]+)#\/([^{}\s]*)(\}?)$/;function hIe(t,e){const n=fIe.exec(t);if(!n)return;const[,r,i,s,o]=n;if(!!r!=!!o)return;let a;try{a=Ic(`${r}${i}${o}`,{$steps:e},uS)}catch{return}let l=a;try{for(const c of s.split("/").filter(Boolean)){if(l==null)return;typeof l=="string"&&(l=JSON.parse(l)),l=l[decodeURIComponent(c)]}}catch{return}return HB(l)}function KB(t,e){if(!t||!t.includes("$steps"))return t;const n=aQ(t).map(({start:s,end:o})=>({match:t.slice(s,o),start:s,end:o}));if(!n.length)return t;let r=0;const i=[];for(const{match:s,start:o,end:a}of n){i.push(t.slice(r,o));let l=s;const c=hIe(s,e);if(c!==void 0)l=c;else try{const u=HB(Ic(s,{$steps:e},uS));u!==void 0&&(l=u)}catch{}i.push(l),r=a}return i.push(t.slice(r)),i.join("")}function e6(t,e,n){const r=OO(t,{collectionId:e,workflowId:n})?.steps;if(!r)return{};const i={};for(const s of r)i[s.stepId]=s.outputs??[];return i}async function t6(t,e){if(!t.response)return{hasValue:!1};const n=await sQ([e],{$response:t.response,$request:t.request??void 0});return e.key in n?{hasValue:!0,value:n[e.key]}:{hasValue:!1}}async function pIe(t,e){if(!e)return!1;const n=t.outputs?.[e.key];if(n===void 0||YB(n))return!1;const r=await t6(t,e);return r.hasValue?JSON.stringify(r.value)!==JSON.stringify(n):!1}async function gIe(t,e){return e?(await t6(t,e)).hasValue:!1}const mIe=/\$steps\.([^.\s"'}]+)\./g;function OIe(t){if(!t||!t.includes("$steps."))return[];const e=new Set;for(const n of t.matchAll(mIe))e.add(n[1]);return[...e]}function lQ(t,e,n,r){const i=[],s=o=>{if(o!=null)try{i.push(JSON.stringify(o))}catch(a){console.error("findReferencedStepIds: failed to scan a source for $steps references",a)}};s(t),s(e),s(n?.components.parameters);for(const o of r?.inputs??[])o.value&&i.push(o.value);return OIe(i.join("\0"))}async function dS(t,e,n,r){const i=$o.getInstance(),s=[...new Set(r)];if(!i||!e||!n||!s.length)return{};const o=(await Promise.all(s.map(a=>i.getByKey(e,n,a)))).filter(a=>a!=null);return o.length?await GB(o,e6(t,e,n)):{}}function If(t,e,n){return KB(_n(t,e),n)}const vIe=/[\n\r\t]/g;function n6(t){return t.replace(vIe,"").trim()}function va(t,e){return t.map(n=>{const r=e.boundNames==="all"||!!e.boundNames?.has(n.name),i=r?`$inputs.${n.name}`:n.example==null?"":n6(String(n.example));return{id:crypto.randomUUID(),key:n.name,value:i,active:r||i!=="",in:n.in,...n.allowReserved&&{allowReserved:n.allowReserved}}})}function yO(t,e){const[n]=t.split("?"),r=e.filter(i=>i.active).map(i=>`${i.key}=${i.value}`).join("&");return`${n}${r?`?${r}`:""}`}function bO(t){const e=t.indexOf("?");if(e===-1)return[];const n=new URLSearchParams(t.slice(e+1)),r=[];for(const[i,s]of n.entries())r.push({id:crypto.randomUUID(),active:!0,key:i,value:s,in:"query"});return r}function r6(){return{id:crypto.randomUUID(),...dO}}function yIe(){return{id:crypto.randomUUID(),...dO,description:""}}function E0(t){return{...dO,id:crypto.randomUUID(),in:t}}function bIe(){return{id:crypto.randomUUID(),...dO,type:"text",files:null}}function xIe(){return{id:crypto.randomUUID(),...dO,sendIn:di.URL}}function U1(t){return t.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function fS(t,e){return t.filter(n=>n.active&&n.value).map(({value:n})=>(e?_n(n,e):n).trim())}function Oc(t,e){const r=e.filter(i=>!!i).flatMap(i=>i).filter(i=>i.key&&i.active);return["path","header"].includes(t)?Array.from(new Map(r.map(i=>[i.key,i])).values()):r}function SIe(t,e,n){return t.map(({value:r,...i})=>({...i,value:If(r,e,n??{})}))}function wIe(t,e){if(!t.startsWith("$components.parameters."))return null;const n=t.replace("$components.parameters.","");return n&&e[n]||null}function Vn(t=[],e={}){const n=[];for(const r of t)if(Pu(r)){const i=wIe(r.reference,e);i&&n.push({...i,active:r.active,value:r.value||i.value})}else n.push(r);return n}function rc(t){return Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:n}))}class I0{constructor(e,n={},r){this.pattern=e,this.separator=n.separator||".",this.segments=this._parse(e),this.data=r,this._hasDeepWildcard=this.segments.some(i=>i.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(i=>i.attrName!==void 0),this._hasPositionSelector=this.segments.some(i=>i.position!==void 0)}_parse(e){const n=[];let r=0,i="";for(;r<e.length;)e[r]===this.separator?r+1<e.length&&e[r+1]===this.separator?(i.trim()&&(n.push(this._parseSegment(i.trim())),i=""),n.push({type:"deep-wildcard"}),r+=2):(i.trim()&&n.push(this._parseSegment(i.trim())),i="",r++):(i+=e[r],r++);return i.trim()&&n.push(this._parseSegment(i.trim())),n}_parseSegment(e){const n={type:"tag"};let r=null,i=e;const s=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(s&&(i=s[1]+s[3],s[2])){const u=s[2].slice(1,-1);u&&(r=u)}let o,a=i;if(i.includes("::")){const u=i.indexOf("::");if(o=i.substring(0,u).trim(),a=i.substring(u+2).trim(),!o)throw new Error(`Invalid namespace in pattern: ${e}`)}let l,c=null;if(a.includes(":")){const u=a.lastIndexOf(":"),f=a.substring(0,u).trim(),h=a.substring(u+1).trim();["first","last","odd","even"].includes(h)||/^nth\(\d+\)$/.test(h)?(l=f,c=h):l=a}else l=a;if(!l)throw new Error(`Invalid segment pattern: ${e}`);if(n.tag=l,o&&(n.namespace=o),r)if(r.includes("=")){const u=r.indexOf("=");n.attrName=r.substring(0,u).trim(),n.attrValue=r.substring(u+1).trim()}else n.attrName=r.trim();if(c){const u=c.match(/^nth\((\d+)\)$/);u?(n.position="nth",n.positionValue=parseInt(u[1],10)):n.position=c}return n}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class TIe{constructor(e){this._matcher=e}get separator(){return this._matcher.separator}getCurrentTag(){const e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){const e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){const n=this._matcher.path;if(n.length!==0)return n[n.length-1].values?.[e]}hasAttr(e){const n=this._matcher.path;if(n.length===0)return!1;const r=n[n.length-1];return r.values!==void 0&&e in r.values}getAnyParentAttr(e){return this._matcher.getAnyParentAttr(e)}hasAnyParentAttr(e){return this._matcher.hasAnyParentAttr(e)}getPosition(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,n=!0){return this._matcher.toString(e,n)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}}class i6{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new TIe(this),this._keptAttrs=[]}push(e,n=null,r=null,i=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const s=this.path.length;let o=this.siblingStacks[s];o||(o={counts:new Map,total:0},this.siblingStacks[s]=o);const a=r?`${r}:${e}`:e,l=o.counts.get(a)||0,c=o.total;o.counts.set(a,l+1),o.total++;const u={tag:e,position:c,counter:l};r!=null&&(u.namespace=r),n!=null&&(u.values=n),this.path.push(u);const f=this.path.length,h=i!==null?i.keep:null;if(h!=null&&h.length>0&&n)for(let p=0;p<h.length;p++){const m=h[p];n[m]!==void 0&&this._keptAttrs.push({depth:f,name:m,value:n[m]})}}pop(){if(this.path.length===0)return;this._pathStringCache=null;const e=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);const n=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=n;)this._keptAttrs.pop();return e}updateCurrent(e){if(this.path.length>0){const n=this.path[this.path.length-1];e!=null&&(n.values=e)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return!1;const n=this.path[this.path.length-1];return n.values!==void 0&&e in n.values}getAnyParentAttr(e){const n=this._keptAttrs;for(let r=n.length-1;r>=0;r--)if(n[r].name===e)return n[r].value}hasAnyParentAttr(e){const n=this._keptAttrs;for(let r=n.length-1;r>=0;r--)if(n[r].name===e)return!0;return!1}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,n=!0){const r=e||this.separator;if(r===this.separator&&n===!0){if(this._pathStringCache!==null)return this._pathStringCache;const s=this.path.map(o=>o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(r);return this._pathStringCache=s,s}return this.path.map(s=>n&&s.namespace?`${s.namespace}:${s.tag}`:s.tag).join(r)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[]}matches(e){const n=e.segments;return n.length===0?!1:e.hasDeepWildcard()?this._matchWithDeepWildcard(n):this._matchSimple(n)}_matchSimple(e){if(this.path.length!==e.length)return!1;for(let n=0;n<e.length;n++)if(!this._matchSegment(e[n],this.path[n],n===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(e){let n=this.path.length-1,r=e.length-1;for(;r>=0&&n>=0;){const i=e[r];if(i.type==="deep-wildcard"){if(r--,r<0)return!0;const s=e[r];let o=!1;for(let a=n;a>=0;a--)if(this._matchSegment(s,this.path[a],a===this.path.length-1)){n=a-1,r--,o=!0;break}if(!o)return!1}else{if(!this._matchSegment(i,this.path[n],n===this.path.length-1))return!1;n--,r--}}return r<0}_matchSegment(e,n,r){if(e.tag!=="*"&&e.tag!==n.tag||e.namespace!==void 0&&e.namespace!=="*"&&e.namespace!==n.namespace||e.attrName!==void 0&&(!r||!n.values||!(e.attrName in n.values)||e.attrValue!==void 0&&String(n.values[e.attrName])!==String(e.attrValue)))return!1;if(e.position!==void 0){if(!r)return!1;const i=n.counter??0;if(e.position==="first"&&i!==0)return!1;if(e.position==="odd"&&i%2!==1)return!1;if(e.position==="even"&&i%2!==0)return!1;if(e.position==="nth"&&i!==e.positionValue)return!1}return!0}matchesAny(e){return e.matchesAny(this)}snapshot(){return{path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>e&&{counts:new Map(e.counts),total:e.total}),keptAttrs:this._keptAttrs.map(e=>({...e}))}}restore(e){this._pathStringCache=null,this.path=e.path.map(n=>({...n})),this.siblingStacks=e.siblingStacks.map(n=>n&&{counts:new Map(n.counts),total:n.total}),this._keptAttrs=(e.keptAttrs||[]).map(n=>({...n}))}readOnly(){return this._view}}function s6(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function o6(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function lh(t){return String(t).replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const a6=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",CIe=a6+"\\-\\.\\d·̀-ͯ‿-⁀",l6=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",PIe=l6+"\\-\\.\\d·̀-ͯ҇‿-⁀",c6=(t,e,n="")=>{const r=t.replace(":",""),i=e.replace(":",""),s=`[${r}][${i}]*`;return{name:new RegExp(`^[${t}][${e}]*$`,n),ncName:new RegExp(`^${s}$`,n),qName:new RegExp(`^${s}(?::${s})?$`,n),nmToken:new RegExp(`^[${e}]+$`,n),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,n)}},kIe=c6(a6,CIe),EIe=c6(l6,PIe,"u"),IIe=(t="1.0")=>t==="1.1"?EIe:kIe,u6=(t,{xmlVersion:e="1.0"}={})=>IIe(e).qName.test(t),$Ie=`
783
+ `,_n=(t,e,n=new Set)=>{const r=iQ(t);if(!r.length)return t;let i=0;const s=r.flatMap(({start:o,end:a,name:l})=>{if(n.has(l))return null;const c=e.find(f=>f.name===l),u=t.slice(i,c?o:a);if(i=a,c){n.add(l);const f=_n(c.value,e,n);return n.delete(l),[u.length?u:null,f||t.slice(o,a)]}return[u.length?u:null]});return t.slice(i).length&&s.push(t.slice(i)),s.join("")};function GEe(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function HEe(t,e){const n=FB(t);if(!n.length)return d.jsx(WM,{children:t});let r=0;const i=n.flatMap(({start:s,end:o})=>{const a=t.slice(r,s),l=GEe(t.slice(s,o),e);return r=o,[a.length?a:null,l]});return t.slice(r).length&&i.push(t.slice(r)),d.jsx(WM,{children:i.join("")})}const Co=Al(Dr([]));Co.debugLabel="collections";function mi(){return Ir(Co)}function lS(){const t=Do();return x.useCallback(()=>t.get(Co),[t])}function mO(t){const e=mi();return ah(e,t)}function zc(t){const e=mi();return OO(e,t)}function qa(){const t=bl(Co);return x.useCallback(e=>t(n=>e(n)),[t])}function JEe(t){const e=qa();return x.useCallback(n=>e(r=>Xi(r,t,n)),[e,t])}function WB(t){const e=qa(),{collectionId:n,workflowId:r}=t;return x.useCallback(i=>e(s=>Ns(s,{collectionId:n,workflowId:r},i)),[e,n,r])}function KEe(t){const e=qa(),{collectionId:n,workflowId:r,stepId:i}=t;return x.useCallback(s=>e(o=>cS(o,{collectionId:n,workflowId:r,stepId:i},s)),[e,n,r,i])}function ah(t,e){return t.find(n=>n.id===e)??null}function OO(t,{collectionId:e,workflowId:n}){return ah(t,e)?.workflows.find(i=>i.workflowId===n)??null}function vO(t,{collectionId:e,workflowId:n,stepId:r}){return OO(t,{collectionId:e,workflowId:n})?.steps.find(s=>s.stepId===r)??null}function Xi(t,e,n){const r=t.findIndex(o=>o.id===e);if(r===-1)return t;const i=n(t[r]);if(i===t[r])return t;const s=[...t];return s[r]=i,s}function Ns(t,{collectionId:e,workflowId:n},r){return Xi(t,e,i=>{const s=i.workflows.findIndex(a=>a.workflowId===n);if(s===-1)return i;const o=[...i.workflows];return o[s]=r(i.workflows[s]),{...i,workflows:o}})}function cS(t,{collectionId:e,workflowId:n,stepId:r},i){return Ns(t,{collectionId:e,workflowId:n},s=>{const o=s.steps.findIndex(l=>l.stepId===r);if(o===-1)return s;const a=[...s.steps];return a[o]=i(s.steps[o]),{...s,steps:a}})}function ZB(t,e){const n=t.findIndex(r=>r.id===e);return n===-1?t:t.filter((r,i)=>i!==n)}function lE(t,{collectionId:e,workflowId:n}){return Xi(t,e,r=>{const i=r.workflows.findIndex(s=>s.workflowId===n);return i===-1?r:{...r,workflows:r.workflows.filter((s,o)=>o!==i)}})}function cE(t,{collectionId:e,workflowId:n,stepId:r}){return Ns(t,{collectionId:e,workflowId:n},i=>{const s=i.steps.findIndex(o=>o.stepId===r);return s===-1?i:{...i,steps:i.steps.filter((o,a)=>a!==s)}})}class eIe{constructor(e){this.storage=e}storage;async initialize(){await this.storage.initialize()}upsert(e){return this.storage.upsert(e)}getByWorkflow(e,n){return this.storage.getByWorkflow(e,n)}getByKey(e,n,r){return this.storage.getByKey(e,n,r)}pruneOlderThan(e){return this.storage.pruneOlderThan(e)}clear(){return this.storage.clear()}}class Cm{static instance=null;static currentDbPath=null;static async initialize(e){if(this.instance&&this.currentDbPath===e)return this.instance;this.instance&&this.currentDbPath!==e&&await this.close();const{SqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-SqliteDBStorage-CaEZatJm.js"));return this.instance=n.getInstance(e),this.currentDbPath=e,await this.instance.initialize(),this.instance}static getInstance(){if(!this.instance)throw new Error("SqliteDBConnection not initialized");return this.instance}static isInitialized(){return this.instance!==null}static async close(){this.instance&&(await this.instance.close(),this.instance=null,this.currentDbPath=null)}}const uS={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t};function bu(t){if(t!==void 0)try{return JSON.parse(JSON.stringify(t))}catch{return}}function tIe(t,e){if(typeof t!="string"||t===""||!(!e||/json/i.test(e)))return t;try{return JSON.parse(t)}catch{return t}}function nIe(t){if(!t)return null;const e=Object.fromEntries(t.headers??[]),n=Object.entries(e).find(([r])=>r.toLowerCase()==="content-type")?.[1];return{statusCode:t.status,body:tIe(t.body,n),header:e,contentType:n,time:t.duration}}async function sQ(t,e){const n={};if(!t.some(({key:i,value:s,active:o})=>i&&s&&o))return n;const{evaluateRuntimeExpression:r}=await Promise.resolve().then(()=>obe);for(const{key:i,value:s,active:o}of t)if(!(!i||!s||!o))try{n[i]=r(s,e,uS)}catch{}return n}function rIe(t,e){const n=t?.$workflows?.[e]?.steps??{};return Object.entries(n).filter(([,r])=>r?.request!=null||r?.response!=null||r?.outputs&&Object.keys(r.outputs).length>0).map(([r,i])=>({stepId:r,request:bu(i?.request)??null,response:bu(i?.response)??null,outputs:bu(i?.outputs)??{}}))}let BB=0;const uE=new Set;function iIe(){BB+=1;for(const t of uE)t()}function sIe(){return BB}function oIe(t){return uE.add(t),()=>{uE.delete(t)}}const aIe=10080*60*1e3;async function oQ(t){const e=$o.getInstance();if(e&&!(!t.collectionId||!t.workflowId||!t.stepId))try{await e.upsert({id:xm(),date:Date.now(),...t}),iIe()}catch(n){console.error("Failed to persist step context:",n)}}async function lIe(t,e,n){if($o.getInstance())for(const i of rIe(n,e))await oQ({collectionId:t,workflowId:e,...i})}class $o{static instance=null;static async initialize(e){if(this.close(),!e)return;const{StepContextSqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-StepContextSqliteDBStorage-BSepLyBI.js")),r=Cm.getInstance(),i=new n(r);this.instance=new eIe(i)}static getInstance(){return this.instance}static close(){this.instance=null}}const cIe={__replayClearedOutput:!0};function YB(t){return typeof t=="object"&&t!==null&&t.__replayClearedOutput===!0}async function GB(t,e){const n={};for(const r of t){if(n[r.stepId])continue;const i={...r.outputs??{}},s=e?.[r.stepId];if(s&&r.response){const o=s.filter(a=>a.key&&a.active&&!(a.key in i));if(o.length){const a=await sQ(o,{$response:r.response,$request:r.request??void 0});for(const[l,c]of Object.entries(a))l in i||(i[l]=c)}}for(const o of Object.keys(i))YB(i[o])&&delete i[o];n[r.stepId]={request:r.request??void 0,response:r.response??void 0,outputs:i}}return n}function HB(t){if(t!==void 0)return typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t)}const uIe=/\{\$steps\.[^}\s]+\}|^\$steps\.[^}\s]+$/g;function aQ(t){const e=new RegExp(uIe),n=[];let r;for(;(r=e.exec(t))!==null;)n.push({start:r.index,end:r.index+r[0].length});return n}const dIe=/^\{?\$steps\.([^.{}\s]+)\.(outputs|request|response)\.([^{}\s#]+)(?:#\/([^{}\s]*))?\}?$/;function JB(t){const e=dIe.exec(t.trim());if(!e)return null;const[,n,r,i,s]=e;return{stepId:n,kind:r,outputName:r==="outputs"&&!i.includes(".")?i:void 0,hasPointer:s!==void 0}}const fIe=/^(\{?)(\$steps\.[^.{}\s]+\.(?:request|response)\.[^{}\s#]+)#\/([^{}\s]*)(\}?)$/;function hIe(t,e){const n=fIe.exec(t);if(!n)return;const[,r,i,s,o]=n;if(!!r!=!!o)return;let a;try{a=Ic(`${r}${i}${o}`,{$steps:e},uS)}catch{return}let l=a;try{for(const c of s.split("/").filter(Boolean)){if(l==null)return;typeof l=="string"&&(l=JSON.parse(l)),l=l[decodeURIComponent(c)]}}catch{return}return HB(l)}function KB(t,e){if(!t||!t.includes("$steps"))return t;const n=aQ(t).map(({start:s,end:o})=>({match:t.slice(s,o),start:s,end:o}));if(!n.length)return t;let r=0;const i=[];for(const{match:s,start:o,end:a}of n){i.push(t.slice(r,o));let l=s;const c=hIe(s,e);if(c!==void 0)l=c;else try{const u=HB(Ic(s,{$steps:e},uS));u!==void 0&&(l=u)}catch{}i.push(l),r=a}return i.push(t.slice(r)),i.join("")}function e6(t,e,n){const r=OO(t,{collectionId:e,workflowId:n})?.steps;if(!r)return{};const i={};for(const s of r)i[s.stepId]=s.outputs??[];return i}async function t6(t,e){if(!t.response)return{hasValue:!1};const n=await sQ([e],{$response:t.response,$request:t.request??void 0});return e.key in n?{hasValue:!0,value:n[e.key]}:{hasValue:!1}}async function pIe(t,e){if(!e)return!1;const n=t.outputs?.[e.key];if(n===void 0||YB(n))return!1;const r=await t6(t,e);return r.hasValue?JSON.stringify(r.value)!==JSON.stringify(n):!1}async function gIe(t,e){return e?(await t6(t,e)).hasValue:!1}const mIe=/\$steps\.([^.\s"'}]+)\./g;function OIe(t){if(!t||!t.includes("$steps."))return[];const e=new Set;for(const n of t.matchAll(mIe))e.add(n[1]);return[...e]}function lQ(t,e,n,r){const i=[],s=o=>{if(o!=null)try{i.push(JSON.stringify(o))}catch(a){console.error("findReferencedStepIds: failed to scan a source for $steps references",a)}};s(t),s(e),s(n?.components.parameters);for(const o of r?.inputs??[])o.value&&i.push(o.value);return OIe(i.join("\0"))}async function dS(t,e,n,r){const i=$o.getInstance(),s=[...new Set(r)];if(!i||!e||!n||!s.length)return{};const o=(await Promise.all(s.map(a=>i.getByKey(e,n,a)))).filter(a=>a!=null);return o.length?await GB(o,e6(t,e,n)):{}}function If(t,e,n){return KB(_n(t,e),n)}const vIe=/[\n\r\t]/g;function n6(t){return t.replace(vIe,"").trim()}function va(t,e){return t.map(n=>{const r=e.boundNames==="all"||!!e.boundNames?.has(n.name),i=r?`$inputs.${n.name}`:n.example==null?"":n6(String(n.example));return{id:crypto.randomUUID(),key:n.name,value:i,active:r||i!=="",in:n.in,...n.allowReserved&&{allowReserved:n.allowReserved}}})}function yO(t,e){const[n]=t.split("?"),r=e.filter(i=>i.active).map(i=>`${i.key}=${i.value}`).join("&");return`${n}${r?`?${r}`:""}`}function bO(t){const e=t.indexOf("?");if(e===-1)return[];const n=new URLSearchParams(t.slice(e+1)),r=[];for(const[i,s]of n.entries())r.push({id:crypto.randomUUID(),active:!0,key:i,value:s,in:"query"});return r}function r6(){return{id:crypto.randomUUID(),...dO}}function yIe(){return{id:crypto.randomUUID(),...dO,description:""}}function E0(t){return{...dO,id:crypto.randomUUID(),in:t}}function bIe(){return{id:crypto.randomUUID(),...dO,type:"text",files:null}}function xIe(){return{id:crypto.randomUUID(),...dO,sendIn:di.URL}}function U1(t){return t.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function fS(t,e){return t.filter(n=>n.active&&n.value).map(({value:n})=>(e?_n(n,e):n).trim())}function Oc(t,e){const r=e.filter(i=>!!i).flatMap(i=>i).filter(i=>i.key&&i.active);return["path","header"].includes(t)?Array.from(new Map(r.map(i=>[i.key,i])).values()):r}function SIe(t,e,n){return t.map(({value:r,...i})=>({...i,value:If(r,e,n??{})}))}function wIe(t,e){if(!t.startsWith("$components.parameters."))return null;const n=t.replace("$components.parameters.","");return n&&e[n]||null}function Vn(t=[],e={}){const n=[];for(const r of t)if(Pu(r)){const i=wIe(r.reference,e);i&&n.push({...i,active:r.active,value:r.value||i.value})}else n.push(r);return n}function rc(t){return Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:n}))}class I0{constructor(e,n={},r){this.pattern=e,this.separator=n.separator||".",this.segments=this._parse(e),this.data=r,this._hasDeepWildcard=this.segments.some(i=>i.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(i=>i.attrName!==void 0),this._hasPositionSelector=this.segments.some(i=>i.position!==void 0)}_parse(e){const n=[];let r=0,i="";for(;r<e.length;)e[r]===this.separator?r+1<e.length&&e[r+1]===this.separator?(i.trim()&&(n.push(this._parseSegment(i.trim())),i=""),n.push({type:"deep-wildcard"}),r+=2):(i.trim()&&n.push(this._parseSegment(i.trim())),i="",r++):(i+=e[r],r++);return i.trim()&&n.push(this._parseSegment(i.trim())),n}_parseSegment(e){const n={type:"tag"};let r=null,i=e;const s=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(s&&(i=s[1]+s[3],s[2])){const u=s[2].slice(1,-1);u&&(r=u)}let o,a=i;if(i.includes("::")){const u=i.indexOf("::");if(o=i.substring(0,u).trim(),a=i.substring(u+2).trim(),!o)throw new Error(`Invalid namespace in pattern: ${e}`)}let l,c=null;if(a.includes(":")){const u=a.lastIndexOf(":"),f=a.substring(0,u).trim(),h=a.substring(u+1).trim();["first","last","odd","even"].includes(h)||/^nth\(\d+\)$/.test(h)?(l=f,c=h):l=a}else l=a;if(!l)throw new Error(`Invalid segment pattern: ${e}`);if(n.tag=l,o&&(n.namespace=o),r)if(r.includes("=")){const u=r.indexOf("=");n.attrName=r.substring(0,u).trim(),n.attrValue=r.substring(u+1).trim()}else n.attrName=r.trim();if(c){const u=c.match(/^nth\((\d+)\)$/);u?(n.position="nth",n.positionValue=parseInt(u[1],10)):n.position=c}return n}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class TIe{constructor(e){this._matcher=e}get separator(){return this._matcher.separator}getCurrentTag(){const e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){const e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){const n=this._matcher.path;if(n.length!==0)return n[n.length-1].values?.[e]}hasAttr(e){const n=this._matcher.path;if(n.length===0)return!1;const r=n[n.length-1];return r.values!==void 0&&e in r.values}getAnyParentAttr(e){return this._matcher.getAnyParentAttr(e)}hasAnyParentAttr(e){return this._matcher.hasAnyParentAttr(e)}getPosition(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,n=!0){return this._matcher.toString(e,n)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}}class i6{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new TIe(this),this._keptAttrs=[]}push(e,n=null,r=null,i=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const s=this.path.length;let o=this.siblingStacks[s];o||(o={counts:new Map,total:0},this.siblingStacks[s]=o);const a=r?`${r}:${e}`:e,l=o.counts.get(a)||0,c=o.total;o.counts.set(a,l+1),o.total++;const u={tag:e,position:c,counter:l};r!=null&&(u.namespace=r),n!=null&&(u.values=n),this.path.push(u);const f=this.path.length,h=i!==null?i.keep:null;if(h!=null&&h.length>0&&n)for(let p=0;p<h.length;p++){const m=h[p];n[m]!==void 0&&this._keptAttrs.push({depth:f,name:m,value:n[m]})}}pop(){if(this.path.length===0)return;this._pathStringCache=null;const e=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);const n=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=n;)this._keptAttrs.pop();return e}updateCurrent(e){if(this.path.length>0){const n=this.path[this.path.length-1];e!=null&&(n.values=e)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return!1;const n=this.path[this.path.length-1];return n.values!==void 0&&e in n.values}getAnyParentAttr(e){const n=this._keptAttrs;for(let r=n.length-1;r>=0;r--)if(n[r].name===e)return n[r].value}hasAnyParentAttr(e){const n=this._keptAttrs;for(let r=n.length-1;r>=0;r--)if(n[r].name===e)return!0;return!1}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,n=!0){const r=e||this.separator;if(r===this.separator&&n===!0){if(this._pathStringCache!==null)return this._pathStringCache;const s=this.path.map(o=>o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(r);return this._pathStringCache=s,s}return this.path.map(s=>n&&s.namespace?`${s.namespace}:${s.tag}`:s.tag).join(r)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[]}matches(e){const n=e.segments;return n.length===0?!1:e.hasDeepWildcard()?this._matchWithDeepWildcard(n):this._matchSimple(n)}_matchSimple(e){if(this.path.length!==e.length)return!1;for(let n=0;n<e.length;n++)if(!this._matchSegment(e[n],this.path[n],n===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(e){let n=this.path.length-1,r=e.length-1;for(;r>=0&&n>=0;){const i=e[r];if(i.type==="deep-wildcard"){if(r--,r<0)return!0;const s=e[r];let o=!1;for(let a=n;a>=0;a--)if(this._matchSegment(s,this.path[a],a===this.path.length-1)){n=a-1,r--,o=!0;break}if(!o)return!1}else{if(!this._matchSegment(i,this.path[n],n===this.path.length-1))return!1;n--,r--}}return r<0}_matchSegment(e,n,r){if(e.tag!=="*"&&e.tag!==n.tag||e.namespace!==void 0&&e.namespace!=="*"&&e.namespace!==n.namespace||e.attrName!==void 0&&(!r||!n.values||!(e.attrName in n.values)||e.attrValue!==void 0&&String(n.values[e.attrName])!==String(e.attrValue)))return!1;if(e.position!==void 0){if(!r)return!1;const i=n.counter??0;if(e.position==="first"&&i!==0)return!1;if(e.position==="odd"&&i%2!==1)return!1;if(e.position==="even"&&i%2!==0)return!1;if(e.position==="nth"&&i!==e.positionValue)return!1}return!0}matchesAny(e){return e.matchesAny(this)}snapshot(){return{path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>e&&{counts:new Map(e.counts),total:e.total}),keptAttrs:this._keptAttrs.map(e=>({...e}))}}restore(e){this._pathStringCache=null,this.path=e.path.map(n=>({...n})),this.siblingStacks=e.siblingStacks.map(n=>n&&{counts:new Map(n.counts),total:n.total}),this._keptAttrs=(e.keptAttrs||[]).map(n=>({...n}))}readOnly(){return this._view}}function s6(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function o6(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function lh(t){return String(t).replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const a6=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",CIe=a6+"\\-\\.\\d·̀-ͯ‿-⁀",l6=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",PIe=l6+"\\-\\.\\d·̀-ͯ҇‿-⁀",c6=(t,e,n="")=>{const r=t.replace(":",""),i=e.replace(":",""),s=`[${r}][${i}]*`;return{name:new RegExp(`^[${t}][${e}]*$`,n),ncName:new RegExp(`^${s}$`,n),qName:new RegExp(`^${s}(?::${s})?$`,n),nmToken:new RegExp(`^[${e}]+$`,n),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,n)}},kIe=c6(a6,CIe),EIe=c6(l6,PIe,"u"),IIe=(t="1.0")=>t==="1.1"?EIe:kIe,u6=(t,{xmlVersion:e="1.0"}={})=>IIe(e).qName.test(t),$Ie=`
784
784
  `;function AIe(t,e){if(!Array.isArray(t)||t.length===0)return"1.0";const n=t[0];if(cQ(n)==="?xml"){const i=n[":@"];if(i){const s=e.attributeNamePrefix+"version";if(i[s])return i[s]}}return"1.0"}function d6(t,e,n,r,i){return!n.sanitizeName||u6(t,{xmlVersion:i})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}function QIe(t,e){let n="";e.format&&(n=$Ie);const r=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let o=0;o<e.stopNodes.length;o++){const a=e.stopNodes[o];typeof a=="string"?r.push(new I0(a)):a instanceof I0&&r.push(a)}const i=AIe(t,e),s=new i6;return f6(t,e,n,s,r,i)}function f6(t,e,n,r,i,s){let o="",a=!1;if(e.maxNestedTags&&r.getDepth()>e.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(t)){if(t!=null){let l=t.toString();return l=dE(l,e),l}return""}for(let l=0;l<t.length;l++){const c=t[l],u=cQ(c);if(u===void 0)continue;const h=u===e.textNodeName||u===e.cdataPropName||u===e.commentPropName||u[0]==="?"?u:d6(u,!1,e,r,s),p=RIe(c[":@"],e);r.push(h,p);const m=jIe(r,i);if(h===e.textNodeName){let y=c[u];m||(y=e.tagValueProcessor(h,y),y=dE(y,e)),a&&(o+=n),o+=y,a=!1,r.pop();continue}else if(h===e.cdataPropName){a&&(o+=n);const y=c[u][0][e.textNodeName],w=o6(y);o+=`<![CDATA[${w}]]>`,a=!1,r.pop();continue}else if(h===e.commentPropName){const y=c[u][0][e.textNodeName],w=s6(y);o+=n+`<!--${w}-->`,a=!0,r.pop();continue}else if(h[0]==="?"){const y=ZM(c[":@"],e,m,r,s);o+=(h==="?xml"?"":n)+`<${h}${y}?>`,a=!0,r.pop();continue}let g=n;g!==""&&(g+=e.indentBy);const O=ZM(c[":@"],e,m,r,s),v=n+`<${h}${O}`;let b;m?b=h6(c[u],e):b=f6(c[u],e,g,r,i,s),e.unpairedTags.indexOf(h)!==-1?e.suppressUnpairedNode?o+=v+">":o+=v+"/>":(!b||b.length===0)&&e.suppressEmptyNode?o+=v+"/>":b&&b.endsWith(">")?o+=v+`>${b}${n}</${h}>`:(o+=v+">",b&&n!==""&&(b.includes("/>")||b.includes("</"))?o+=n+e.indentBy+b+n:o+=b,o+=`</${h}>`),a=!0,r.pop()}return o}function RIe(t,e){if(!t||e.ignoreAttributes)return null;const n={};let r=!1;for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;const s=i.startsWith(e.attributeNamePrefix)?i.substr(e.attributeNamePrefix.length):i;n[s]=lh(t[i]),r=!0}return r?n:null}function h6(t,e){if(!Array.isArray(t))return t!=null?t.toString():"";let n="";for(let r=0;r<t.length;r++){const i=t[r],s=cQ(i);if(s===e.textNodeName)n+=i[s];else if(s===e.cdataPropName)n+=i[s][0][e.textNodeName];else if(s===e.commentPropName)n+=i[s][0][e.textNodeName];else{if(s&&s[0]==="?")continue;if(s){const o=_Ie(i[":@"],e),a=h6(i[s],e);!a||a.length===0?n+=`<${s}${o}/>`:n+=`<${s}${o}>${a}</${s}>`}}}return n}function _Ie(t,e){let n="";if(t&&!e.ignoreAttributes)for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;let i=t[r];i===!0&&e.suppressBooleanAttributes?n+=` ${r.substr(e.attributeNamePrefix.length)}`:n+=` ${r.substr(e.attributeNamePrefix.length)}="${lh(i)}"`}return n}function cQ(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(Object.prototype.hasOwnProperty.call(t,r)&&r!==":@")return r}}function ZM(t,e,n,r,i){let s="";if(t&&!e.ignoreAttributes)for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;const a=o.substr(e.attributeNamePrefix.length),l=n?a:d6(a,!0,e,r,i);let c;n?c=t[o]:(c=e.attributeValueProcessor(o,t[o]),c=dE(c,e)),c===!0&&e.suppressBooleanAttributes?s+=` ${l}`:s+=` ${l}="${lh(c)}"`}return s}function jIe(t,e){if(!e||e.length===0)return!1;for(let n=0;n<e.length;n++)if(t.matches(e[n]))return!0;return!1}function dE(t,e){if(t&&t.length>0&&e.processEntities)for(let n=0;n<e.entities.length;n++){const r=e.entities[n];t=t.replace(r.regex,r.val)}return t}function NIe(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(const n of t)if(typeof n=="string"&&e===n||n instanceof RegExp&&n.test(e))return!0}:()=>!1}const DIe={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0,sanitizeName:!1};function Ts(t){if(this.options=Object.assign({},DIe,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(e=>typeof e=="string"&&e.startsWith("*.")?".."+e.substring(2):e)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let e=0;e<this.options.stopNodes.length;e++){const n=this.options.stopNodes[e];typeof n=="string"?this.stopNodeExpressions.push(new I0(n)):n instanceof I0&&this.stopNodeExpressions.push(n)}this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=NIe(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=zIe),this.processTextOrObjNode=VIe,this.options.format?(this.indentate=LIe,this.tagEndChar=`>
785
785
  `,this.newLine=`
786
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function MIe(t,e){const n=t["?xml"];if(n&&typeof n=="object"){if(e.attributesGroupName&&n[e.attributesGroupName]){const i=n[e.attributesGroupName][e.attributeNamePrefix+"version"];if(i)return i}const r=n[e.attributeNamePrefix+"version"];if(r)return r}return"1.0"}function q1(t,e,n,r,i){return!n.sanitizeName||u6(t,{xmlVersion:i})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}Ts.prototype.build=function(t){if(this.options.preserveOrder)return QIe(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new i6,n=MIe(t,this.options);return this.j2x(t,0,e,n).val}};Ts.prototype.j2x=function(t,e,n,r){let i="",s="";if(this.options.maxNestedTags&&n.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const o=this.options.jPath?n.toString():n,a=this.checkStopNode(n);for(let l in t){if(!Object.prototype.hasOwnProperty.call(t,l))continue;const u=l===this.options.textNodeName||l===this.options.cdataPropName||l===this.options.commentPropName||this.options.attributesGroupName&&l===this.options.attributesGroupName||this.isAttribute(l)||l[0]==="?"?l:q1(l,!1,this.options,n,r);if(typeof t[l]>"u")this.isAttribute(l)&&(s+="");else if(t[l]===null)this.isAttribute(l)||u===this.options.cdataPropName||u===this.options.commentPropName?s+="":u[0]==="?"?s+=this.indentate(e)+"<"+u+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+u+"/"+this.tagEndChar;else if(t[l]instanceof Date)s+=this.buildTextValNode(t[l],u,"",e,n);else if(typeof t[l]!="object"){const f=this.isAttribute(l);if(f&&!this.ignoreAttributesFn(f,o)){const h=q1(f,!0,this.options,n,r);i+=this.buildAttrPairStr(h,""+t[l],a)}else if(!f)if(l===this.options.textNodeName){let h=this.options.tagValueProcessor(l,""+t[l]);s+=this.replaceEntitiesValue(h)}else{n.push(u);const h=this.checkStopNode(n);if(n.pop(),h){const p=""+t[l];p===""?s+=this.indentate(e)+"<"+u+this.closeTag(u)+this.tagEndChar:s+=this.indentate(e)+"<"+u+">"+p+"</"+u+this.tagEndChar}else s+=this.buildTextValNode(t[l],u,"",e,n)}}else if(Array.isArray(t[l])){const f=t[l].length;let h="",p="";for(let m=0;m<f;m++){const g=t[l][m];if(!(typeof g>"u"))if(g===null)u[0]==="?"?s+=this.indentate(e)+"<"+u+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+u+"/"+this.tagEndChar;else if(typeof g=="object")if(this.options.oneListGroup){n.push(u);const O=this.j2x(g,e+1,n,r);n.pop(),h+=O.val,this.options.attributesGroupName&&g.hasOwnProperty(this.options.attributesGroupName)&&(p+=O.attrStr)}else h+=this.processTextOrObjNode(g,u,e,n,r);else if(this.options.oneListGroup){let O=this.options.tagValueProcessor(u,g);O=this.replaceEntitiesValue(O),h+=O}else{n.push(u);const O=this.checkStopNode(n);if(n.pop(),O){const v=""+g;v===""?h+=this.indentate(e)+"<"+u+this.closeTag(u)+this.tagEndChar:h+=this.indentate(e)+"<"+u+">"+v+"</"+u+this.tagEndChar}else h+=this.buildTextValNode(g,u,"",e,n)}}this.options.oneListGroup&&(h=this.buildObjectNode(h,u,p,e)),s+=h}else if(this.options.attributesGroupName&&l===this.options.attributesGroupName){const f=Object.keys(t[l]),h=f.length;for(let p=0;p<h;p++){const m=q1(f[p],!0,this.options,n,r);i+=this.buildAttrPairStr(m,""+t[l][f[p]],a)}}else s+=this.processTextOrObjNode(t[l],u,e,n,r)}return{attrStr:i,val:s}};Ts.prototype.buildAttrPairStr=function(t,e,n){return n||(e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+lh(e)+'"'};function VIe(t,e,n,r,i){const s=this.extractAttributes(t);if(r.push(e,s),this.checkStopNode(r)){const l=this.buildRawContent(t),c=this.buildAttributesForStopNode(t);return r.pop(),this.buildObjectNode(l,e,c,n)}const a=this.j2x(t,n+1,r,i);return r.pop(),e[0]==="?"?this.buildTextValNode("",e,a.attrStr,n,r):t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,a.attrStr,n,r):this.buildObjectNode(a.val,e,a.attrStr,n)}Ts.prototype.extractAttributes=function(t){if(!t||typeof t!="object")return null;const e={};let n=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const r=t[this.options.attributesGroupName];for(let i in r){if(!Object.prototype.hasOwnProperty.call(r,i))continue;const s=i.startsWith(this.options.attributeNamePrefix)?i.substring(this.options.attributeNamePrefix.length):i;e[s]=lh(r[i]),n=!0}}else for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const i=this.isAttribute(r);i&&(e[i]=lh(t[r]),n=!0)}return n?e:null};Ts.prototype.buildRawContent=function(t){if(typeof t=="string")return t;if(typeof t!="object"||t===null)return String(t);if(t[this.options.textNodeName]!==void 0)return t[this.options.textNodeName];let e="";for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||this.isAttribute(n)||this.options.attributesGroupName&&n===this.options.attributesGroupName)continue;const r=t[n];if(n===this.options.textNodeName)e+=r;else if(Array.isArray(r)){for(let i of r)if(typeof i=="string"||typeof i=="number")e+=`<${n}>${i}</${n}>`;else if(typeof i=="object"&&i!==null){const s=this.buildRawContent(i),o=this.buildAttributesForStopNode(i);s===""?e+=`<${n}${o}/>`:e+=`<${n}${o}>${s}</${n}>`}}else if(typeof r=="object"&&r!==null){const i=this.buildRawContent(r),s=this.buildAttributesForStopNode(r);i===""?e+=`<${n}${s}/>`:e+=`<${n}${s}>${i}</${n}>`}else e+=`<${n}>${r}</${n}>`}return e};Ts.prototype.buildAttributesForStopNode=function(t){if(!t||typeof t!="object")return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const n=t[this.options.attributesGroupName];for(let r in n){if(!Object.prototype.hasOwnProperty.call(n,r))continue;const i=r.startsWith(this.options.attributeNamePrefix)?r.substring(this.options.attributeNamePrefix.length):r,s=n[r];s===!0&&this.options.suppressBooleanAttributes?e+=" "+i:e+=" "+i+'="'+s+'"'}}else for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const r=this.isAttribute(n);if(r){const i=t[n];i===!0&&this.options.suppressBooleanAttributes?e+=" "+r:e+=" "+r+'="'+i+'"'}}return e};Ts.prototype.buildObjectNode=function(t,e,n,r){if(t==="")return e[0]==="?"?this.indentate(r)+"<"+e+n+"?"+this.tagEndChar:this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar;if(e[0]==="?")return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let i="</"+e+this.tagEndChar,s="";return e[0]==="?"&&(s="?",i=""),(n||n==="")&&t.indexOf("<")===-1?this.indentate(r)+"<"+e+n+s+">"+t+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&s.length===0?this.indentate(r)+`<!--${t}-->`+this.newLine:this.indentate(r)+"<"+e+n+s+this.tagEndChar+t+this.indentate(r)+i}};Ts.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};Ts.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||this.stopNodeExpressions.length===0)return!1;for(let e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1};Ts.prototype.buildTextValNode=function(t,e,n,r,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName){const s=o6(t);return this.indentate(r)+`<![CDATA[${s}]]>`+this.newLine}else if(this.options.commentPropName!==!1&&e===this.options.commentPropName){const s=s6(t);return this.indentate(r)+`<!--${s}-->`+this.newLine}else{if(e[0]==="?")return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(e,t);return s=this.replaceEntitiesValue(s),s===""?this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+n+">"+s+"</"+e+this.tagEndChar}}};Ts.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const n=this.options.entities[e];t=t.replace(n.regex,n.val)}return t};function LIe(t){return this.options.indentBy.repeat(t)}function zIe(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}function p6(t){return t.schema}function g6(t){return p6(t)?.fields??[]}function m6(t,e){return t.flatMap(n=>{const r=p6(n),i=r?.fields||[];return i.length>0?i.flatMap(s=>BM(s.name,s.example,n.allowReserved)):BM(n.name,r?.example??n.example,n.allowReserved)})}function BM(t,e,n){if(e===void 0)return[F1(t,"",!1,n)];const r=fE(e,t);return r.length===0?[F1(t,"",!1,n)]:r.map(i=>F1(i.key,i.value,!0,n))}function fE(t,e){return t===void 0?[]:t===null?[{key:e,value:""}]:Array.isArray(t)?t.flatMap((n,r)=>n!==null&&typeof n=="object"?fE(n,`${e}[${r}]`):[{key:e,value:String(n)}]):XIe(t)?Object.entries(t).flatMap(([n,r])=>fE(r,`${e}[${n}]`)):[{key:e,value:String(t)}]}function XIe(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function F1(t,e,n,r){return{id:crypto.randomUUID(),key:t,value:n6(e),active:n,in:"query",...r&&{allowReserved:r}}}const O6={path:"path",query:"query",header:"headers",cookie:"cookie"};function uQ(t){return t!==void 0}function UIe(t,e){if(t)return nx.isDirectConfigureRequestValues(t)?t:t[e]}function YM(t,e,n){const r=n[O6[e]],i=n.envVariables,s=new Set;for(const o of t??[])(r?.[o.name]||i?.[o.name])&&s.add(o.name);return s}function $f(t,e,n){if(nx.isDirectConfigureRequestValues(n))return YM(t,e,n);const r=new Set;for(const i of Object.values(n))if(i)for(const s of YM(t,e,i))r.add(s);return r}function GM(t,e,n){const r=n.query,i=n.envVariables;for(const s of e??[]){const o=g6(s);for(const a of o)(r?.[a.name]||i?.[a.name])&&t.add(a.name);for(const a of[...Object.keys(r??{}),...Object.keys(i??{})])!r?.[a]&&!i?.[a]||o.some(l=>a===l.name||a.startsWith(`${l.name}[`))&&t.add(a)}}function v6(t,e,n){const r=[...t??[],...e??[]],i=new Set($f(r,"query",n));if(nx.isDirectConfigureRequestValues(n))return GM(i,e,n),i;for(const s of Object.values(n))s&&GM(i,e,s);return i}function dQ(t=[],e){const n={};return t.forEach(r=>{const i=String(r[e]);n[i]||(n[i]=[]),n[i].push(r)}),n}function qIe(t){return t.replace(/{/g,"{{").replace(/}/g,"}}")}var gs=(t=>(t.Query="Query",t.Header="Header",t.Cookie="Cookie",t))(gs||{});const hE={documentedOAuth2Types:[],grantType:ae.ClientCredentials,authRequestExtraParams:[],tokenRequestExtraParams:[],[ae.ClientCredentials]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[],accessToken:""},[ae.ClientCredentialsWithJwtAssertion]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[],accessToken:""},[ae.AuthorizationCode]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],codeVerifier:"",codeChallenge:"",accessToken:""},[ae.AuthorizationCodeWithPkce]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],codeVerifier:"",codeChallenge:"",accessToken:""},[ae.Implicit]:{clientId:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],accessToken:""},[ae.Password]:{username:"",password:"",clientId:"",clientSecret:"",tokenUrl:"",accessToken:"",scopes:[]}},FIe={securityType:ne.NoAuth,securitySchemeId:null,[ne.BasicAuth]:{username:"",password:""},[ne.JWT]:{token:""},[ne.DigestAuth]:{username:"",password:"",nc:"00000001",realm:"",nonce:"",opaque:"",qop:"",algorithm:"",cnonce:""},[ne.APIKey]:{location:gs.Header,name:"",key:""},[ne.OAuth2]:hE,[ne.OpenIDConnect]:{...hE,openIdConnectUrl:"",userInfoUrl:""}},WIe={clientCredentials:ae.ClientCredentials,clientCredentialsWithJwtAssertion:ae.ClientCredentialsWithJwtAssertion,authorizationCode:ae.AuthorizationCode,authorizationCodeWithPkce:ae.AuthorizationCodeWithPkce,implicit:ae.Implicit,password:ae.Password},$0="urn:ietf:params:oauth:client-assertion-type:jwt-bearer";var Xr=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(Xr||{});const ZIe={[Xr.SIMPLE]:{condition:"",type:Xr.SIMPLE},[Xr.REGEX]:{condition:"",type:Xr.REGEX,context:""},[Xr.JSONPATH]:{condition:"",type:Xr.JSONPATH,context:""},[Xr.XPATH]:{condition:"",type:Xr.XPATH,context:""}};function ch(){return structuredClone({type:Hn.Text,content:"",activeExampleName:"",formData:{"multipart/form-data":[],"application/x-www-form-urlencoded":[]},binary:null})}const BIe={method:"GET",url:"",security:[oo()],body:ch(),queryParameters:[],headers:[],cookies:[],pathParameters:[]};function y6(){return structuredClone(BIe)}function oo(){return Ra(FIe)}function b6(t){return Ra({id:crypto.randomUUID(),...ZIe[t]})}function x6(t){return!t||typeof t!="object"?[]:Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:e,value:typeof n=="string"?n:JSON.stringify(n),active:!0,type:"text",files:null}))}function pE(t){return typeof t!="string"?JSON.stringify(t,null,2):t}function S6(t){let e=t;if(typeof e=="string")try{e=JSON.parse(e)}catch{return}if(!e||typeof e!="object"||Array.isArray(e))return;const n=e;return typeof n.query=="string"?n:void 0}function Ol(t){const e=S6(t);return e?{query:e.query,variables:e.variables===void 0?"":pE(e.variables)}:{query:pE(t),variables:""}}function A0(t,e){return JSON.stringify({query:t,variables:e})}function w6(t){if(t.trim())try{const e=JSON.parse(t);return typeof e=="string"?t:e}catch{return t}}function YIe(t){const e=S6(t);return!e||typeof e.variables!="string"?t:JSON.stringify({...e,variables:w6(e.variables)},null,2)}function T6(t,e,n){for(const r of n){const i=HM(t,r),s=HM(e,r);if(typeof i=="object"&&typeof s=="object"){if(!T6(i,s,n))return!1}else if(i!==s)return!1}return!0}function HM(t,e){const n=e.split("/");let r=t;for(const i of n)if(r&&typeof r=="object"&&i in r)r=r[i];else return;return r}function GIe(t,e){return t.length===e.length&&t.sort().join()===e.sort().join()}function HIe(t,e){return t.every(n=>e.includes(n))}function JIe(t){switch(t){case"query":return gs.Query;case"cookie":return gs.Cookie;case"header":return gs.Header;default:return}}function KIe(t,e,n){const{security:r}=e,i=t?.inputs??[];if(!n)return!1;const s=hS(n),o=s.map(c=>c.securityType),a=r.map(c=>c.securityType);return GIe(o,a)?!r.every(c=>{const u=c.securityType,f=c[ne.OAuth2]?.grantType,h=o.includes(u),p=s.find(v=>v.securityType===u),m=!p||T6(c,p,t$e(u,f)),g=e$e(c,u,c[ne.OAuth2]?.grantType,i),O=!!(h&&p&&m&&g);return!n.security?.length||O}):!0}function e$e(t,e,n,r){if(e===ne.OAuth2&&(n===ae.AuthorizationCode||n===ae.AuthorizationCodeWithPkce||n===ae.Implicit)){const i=t[ne.OAuth2][n]?.availableScopes,s=fS(t[ne.OAuth2][n]?.scopes,r);return HIe(s,i)}return!0}function t$e(t,e){return t===ne.APIKey?[`${ne.APIKey}/name`,`${ne.APIKey}/location`]:t===ne.OAuth2?[`${ne.OAuth2}/grantType`,...n$e(e)]:t===ne.OpenIDConnect?[`${ne.OpenIDConnect}/openIdConnectUrl`]:[]}function n$e(t){return t===ae.ClientCredentials?[`${ne.OAuth2}/${ae.ClientCredentials}/tokenUrl`]:t===ae.Password?[`${ne.OAuth2}/${ae.Password}/tokenUrl`]:t===ae.Implicit?[`${ne.OAuth2}/${ae.Implicit}/authorizationUrl`]:t===ae.AuthorizationCode?[`${ne.OAuth2}/${ae.AuthorizationCode}/tokenUrl`,`${ne.OAuth2}/${ae.AuthorizationCode}/authorizationUrl`]:t===ae.AuthorizationCodeWithPkce?[`${ne.OAuth2}/${ae.AuthorizationCodeWithPkce}/tokenUrl`,`${ne.OAuth2}/${ae.AuthorizationCodeWithPkce}/authorizationUrl`]:[]}function r$e(t){return t.map(e=>{const n=e.map(r=>r.id).join("_");return e.map(r=>({...r,schemeId:n}))})}function i$e(t){const e=t.security||[],n=e.map(r=>{let i="";const s=[];return r.forEach((o,a)=>{i=a===0?`${o.id}`:`${i}_${o.id}`,s.push(hQ(o))}),{id:i,security:s}});return e.length?n:[]}function s$e(t,e){const n=t.security||[];return n?.length?Q6(n).map((r,i)=>hQ(r)):[]}function C6(t){if(!(t.securityType!==ne.NoAuth||!t.securitySchemeId))return t.unsupportedScheme}function hS(t){const n=(t.security||[])[0];return n?n.map(r=>hQ(r)):[oo()]}const o$e={[ne.OAuth2]:"oauth2",[ne.OpenIDConnect]:"openIdConnect",[ne.APIKey]:"apiKey",[ne.JWT]:"http-bearer"};function a$e(t){return o$e[t]}function l$e(t){const e=fQ(t);return(e?[...ls(e)][0]:void 0)??c$e(t)}function c$e(t){const e=t.securitySchemeId;if(e){if(t.securityType===ne.JWT)return e+rt.SecurityVariablesEnvSuffix.JWTToken;if(t.securityType===ne.APIKey)return e+rt.SecurityVariablesEnvSuffix.APIKey;if(t.securityType===ne.OAuth2||t.securityType===ne.OpenIDConnect)return e+rt.SecurityVariablesEnvSuffix.Token}}function u$e(t,e){const n=fQ(t);if(!n)return"";const r=[...ls(n)][0];return r?e.find(i=>i.name===r)?.value??"":n}function JM(t,e){if(t.securityType===ne.JWT)return{...t,[ne.JWT]:{...t[ne.JWT],token:e}};if(t.securityType===ne.APIKey)return{...t,[ne.APIKey]:{...t[ne.APIKey],key:e}};if(t.securityType===ne.OAuth2||t.securityType===ne.OpenIDConnect){const n=t.securityType,r=t[n],i=r.grantType;return{...t,[n]:{...r,[i]:{...r[i],accessToken:e}}}}return t}function fQ(t){if(t.securityType===ne.JWT)return t[ne.JWT].token;if(t.securityType===ne.APIKey)return t[ne.APIKey].key;if(t.securityType===ne.OAuth2){const e=t[ne.OAuth2];return e[e.grantType]?.accessToken}if(t.securityType===ne.OpenIDConnect){const e=t[ne.OpenIDConnect];return e[e.grantType]?.accessToken}}function hQ(t,e){const n={...oo(),securitySchemeId:t.id},r=pS(t);n.securityType=r,n.unsupportedScheme=r===ne.NoAuth?t.scheme||t.type:void 0;const i=t.id;if(t.id&&r!==ne.NoAuth&&(n[r].schemeName=t.id),r===ne.BasicAuth&&(n[ne.BasicAuth].username||(n[ne.BasicAuth].username=Nn(i+rt.SecurityVariablesEnvSuffix.Username)),n[ne.BasicAuth].password||(n[ne.BasicAuth].password=Nn(i+rt.SecurityVariablesEnvSuffix.Password))),r===ne.DigestAuth&&(n[ne.DigestAuth].username||(n[ne.DigestAuth].username=Nn(i+rt.SecurityVariablesEnvSuffix.Username)),n[ne.DigestAuth].password||(n[ne.DigestAuth].password=Nn(i+rt.SecurityVariablesEnvSuffix.Password))),r===ne.JWT&&!n[ne.JWT].token&&(n[ne.JWT].token=Nn(i+rt.SecurityVariablesEnvSuffix.JWTToken)),r===ne.APIKey&&!n[ne.APIKey].key){n[ne.APIKey].name=t.name||"",n[ne.APIKey].key=Nn(i+rt.SecurityVariablesEnvSuffix.APIKey);const s=JIe(t.in);s&&(n[ne.APIKey].location=s)}if(r===ne.OAuth2){const s=mQ(t),o=Nn(i+rt.SecurityVariablesEnvSuffix.Token),a=n[ne.OAuth2];a.grantType=s[0],s.forEach(l=>{l===ae.AuthorizationCode&&!a[ae.AuthorizationCode].accessToken&&(a[ae.AuthorizationCode].accessToken=o,a[ae.AuthorizationCode].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[ae.AuthorizationCode].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[ae.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[ae.AuthorizationCode].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[ae.AuthorizationCode].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[ae.AuthorizationCode].scopes=[...rc(t.flows?.authorizationCode?.scopes||{})||[]]),l===ae.AuthorizationCodeWithPkce&&!a[ae.AuthorizationCodeWithPkce].accessToken&&(a[ae.AuthorizationCodeWithPkce].accessToken=o,a[ae.AuthorizationCodeWithPkce].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[ae.AuthorizationCodeWithPkce].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[ae.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[ae.AuthorizationCodeWithPkce].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[ae.AuthorizationCodeWithPkce].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[ae.AuthorizationCodeWithPkce].scopes=[...rc(t.flows?.authorizationCode?.scopes||{})]),l===ae.ClientCredentials&&!a[ae.ClientCredentials].accessToken&&(a[ae.ClientCredentials].accessToken=o,a[ae.ClientCredentials].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[ae.ClientCredentials].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[ae.ClientCredentials].tokenUrl=t.flows?.clientCredentials?.tokenUrl||"",a[ae.ClientCredentials].scopes=[...rc(t.flows?.clientCredentials?.scopes||{})]),l===ae.ClientCredentialsWithJwtAssertion&&!a[ae.ClientCredentialsWithJwtAssertion].accessToken&&(a[ae.ClientCredentialsWithJwtAssertion].accessToken=o,a[ae.ClientCredentialsWithJwtAssertion].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[ae.ClientCredentialsWithJwtAssertion].clientAssertion=Nn(i+rt.SecurityVariablesEnvSuffix.ClientAssertion),a[ae.ClientCredentialsWithJwtAssertion].scopes=[...rc(t.flows?.clientCredentials?.scopes||{})]),l===ae.Implicit&&!a[ae.Implicit].accessToken&&(a[ae.Implicit].accessToken=o,a[ae.Implicit].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[ae.Implicit].authorizationUrl=t.flows?.implicit?.authorizationUrl||"",a[ae.Implicit].availableScopes=Object.keys(t.flows?.implicit?.scopes||{})||[],a[ae.Implicit].scopes=[...rc(t.flows?.implicit?.scopes||{})]),l===ae.Password&&!a[ae.Password].accessToken&&(a[ae.Password].accessToken=o,a[ae.Password].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[ae.Password].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[ae.Password].tokenUrl=t.flows?.password?.tokenUrl||"",a[ae.Password].scopes=[...rc(t.flows?.password?.scopes||{})])})}if(r===ne.OpenIDConnect){const s=Nn(i+rt.SecurityVariablesEnvSuffix.Token),o=n[ne.OpenIDConnect];o[ae.AuthorizationCode].accessToken||(o[ae.AuthorizationCode].accessToken=s,o[ae.AuthorizationCode].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),o[ae.AuthorizationCode].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),o[ae.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),o[ae.AuthorizationCodeWithPkce].accessToken||(o[ae.AuthorizationCodeWithPkce].accessToken=s,o[ae.AuthorizationCodeWithPkce].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),o[ae.AuthorizationCodeWithPkce].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),o[ae.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),o[ae.Implicit].accessToken||(o[ae.Implicit].accessToken=s,o[ae.Implicit].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId))}return n}function pQ(t){try{const e=JSON.parse(t);return JSON.stringify(e,null,2)}catch(e){return console.error({error:e}),t}}function P6(t,e){return t==="application/json"&&!!e}function k6(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function d$e(t){try{const e=JSON.stringify(t);return e===void 0?"undefined":e}catch{return String(t)}}function E6(t,e){return e&&e.length>0?m6(e):va(t||[],{})}function f$e(t,e,n){if(e&&e.length>0){const r=m6(e);return h$e(r,n)}return va(t||[],{boundNames:n})}function h$e(t,e){return t.map(n=>!n.key||!e.has(n.key)?n:{...n,value:`$inputs.${n.key}`,active:!0})}function p$e(t,e=!1,n="",r){const i=dQ(t.parameters,"in"),s=I6(t),o=hS(t),a=E6(i.query,i.querystring);return{id:crypto.randomUUID(),name:t.name,operationId:t.operationId,collectionPath:r,apiPath:{path:t.path,method:t.method},apiId:n,isAdditionalOperation:e,request:{pathParameters:va(i.path||[],{}),method:t.method.toLowerCase()==="x-query"?"QUERY":t.method.toLocaleUpperCase(),url:yO(qIe(t.path),a),headers:va(i.header||[],{}),queryParameters:a,cookies:va(i.cookie||[],{}),body:s,security:o},response:null}}function gQ(t,e){const n=dQ(t.parameters,"in"),r=I6(t),i=hS(t),s=va(n.path||[],{boundNames:"all"});return e?{parameters:{pathParameters:s,queryParameters:f$e(n.query,n.querystring,v6(n.query,n.querystring,e)),headers:va(n.header||[],{boundNames:$f(n.header,"header",e)}),cookies:va(n.cookie||[],{boundNames:$f(n.cookie,"cookie",e)})},requestBody:r,security:i}:{parameters:{pathParameters:s,queryParameters:E6(n.query,n.querystring),headers:va(n.header||[],{}),cookies:va(n.cookie||[],{})},requestBody:r,security:i}}function g$e(t,e){const n=new Ts({format:!0});if(typeof t=="string")return e?.includes("json")?pQ(t):t;if(typeof t=="object"&&t!==null&&e?.includes("xml")){const i=Array.isArray(t)?t:{root:t};return n.build(i)}return JSON.stringify(t,null,2)}function m$e(t){return fA.includes(t)}function I6(t){const e=t.body?.mediaTypes;if(!e||!Object.keys(e).length)return ch();const n=b$e(e,t),r=n?.name||"",i=m$e(r),s=!i&&!I7.includes(r),o=gE(n),l=o.find(({key:f})=>f===t.body?.activeExampleName)?.value??o[0]?.value,c=s&&l?g$e(l,r):"",u={"multipart/form-data":KM(e["multipart/form-data"]),"application/x-www-form-urlencoded":KM(e["application/x-www-form-urlencoded"])};if(i&&l){const f=x6(l);f.length&&(u[r]=f)}return{...ch(),activeExampleName:t.body?.activeExampleName||o[0]?.key||"",...n&&{type:n.name},content:c,formData:u}}const O$e={[Ke.GraphqlJSON]:"graphql"};function zh(t,e){const n=O$e[t];return!n||e?.[n]===!0}function $6(t,e){return zh(t,e)?dc[t]:void 0}function A6(t,e){const n=Object.fromEntries(Object.entries(dc).filter(([r])=>zh(r,e)));return t?{...v$e(t),...n}:n}function v$e(t){return Object.keys(t.body?.mediaTypes||{}).reduce((e,n)=>(e[n]={name:n,extensions:void 0},e),{})}function KM(t){return t?t.parameters?t.parameters.map(e=>({id:crypto.randomUUID(),key:e.name,value:String(e.example)||"",active:!0,type:e.inputType,files:null})):[]:[]}const y$e="Untitled example";function gE(t){const e=t?.examples;return Object.keys(e||{}).map(n=>{const r=e?.[n];return{name:(vh.isString(r?.summary)?r?.summary:r?.summary?.raw)?.trim()||n||y$e,key:n,value:e?.[n].value}})}function b$e(t,e){const n=A6(e),r=Object.keys(t).find(i=>!!n[i]);return r?t[r]:null}function x$e(t){return!t?.security?.length||!t?[]:s$e(t)}function Q6(t){const e=new Set;return t.flat().filter(n=>e.has(n.id)?!1:(e.add(n.id),!0))}function pS(t){if(t.type==="http"){const e=t.scheme?.toLowerCase();if(e==="bearer")return ne.JWT;if(e==="basic")return ne.BasicAuth;if(e==="digest")return ne.DigestAuth}else{if(t.type==="apiKey")return ne.APIKey;if(t.type==="oauth2")return ne.OAuth2;if(t.type==="openIdConnect")return ne.OpenIDConnect}return ne.NoAuth}function S$e(t,e){if(t==="clientCredentials"&&e&&"x-assertionType"in e&&e["x-assertionType"]===$0)return ae.ClientCredentialsWithJwtAssertion;if(t==="authorizationCode"&&e&&"x-usePkce"in e&&e["x-usePkce"])return ae.AuthorizationCodeWithPkce;switch(t){case"implicit":return ae.Implicit;case"password":return ae.Password;case"clientCredentials":return ae.ClientCredentials;case"authorizationCode":return ae.AuthorizationCode;default:return ae.AuthorizationCode}}function w$e(t,e){const n=t?.security;if(!n?.length)return[];const s=r$e(n).flat().filter(o=>o.schemeId===e).find(o=>pS(o)===ne.OAuth2);return mQ(s)}function mQ(t){return Object.entries(t?.flows||{}).map(([e,n])=>S$e(e,n)).filter(Boolean)}function gS(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function zs(t){try{return new URL(t),!0}catch{return!1}}function T$e(t,e){let n;if(e.startsWith("//")){const{protocol:r}=new URL(t);n=`${r||"https:"}${e}`}else if(DB(e))n=e;else if(!e.startsWith("/"))n=sE(t)+"/"+e;else{const r=new URL(t);r.pathname=e,n=r.toString()}return sE(n)}function eV(t,e){let n=t;return e.forEach(({key:r,value:i,active:s})=>{i&&s&&(n=n.replaceAll(`{${r}}`,i))}),n}function R6(t,e){let n=t;return e.forEach(({name:r,value:i})=>{i&&(n=n.replaceAll(`{${r}}`,i))}),n}function C$e(t){return t.startsWith("http://")||t.startsWith("https://")}function Nv({url:t,serverUrl:e,corsProxyUrl:n}){let r;if(C$e(t)||!e)r=t;else{const i=new URL(e);i.pathname=t,i.search="",i.hash="",r=i.toString()}return n?`${n}${r}`:r}const _6="New Step";function mE({name:t=_6,workflow:e}={}){let n=t.replaceAll(" ","-");if(!e)return n;const r=P$e(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function P$e(t){return t.steps.filter(e=>e.state!==zt.Draft).map(e=>e.stepId)}function ja({name:t=_6,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:s,dynamicReplayValues:o,xOperation:a}={}){if(!n){const c=s?gQ(s,o):null,u=[oo()];return{stepId:mE({name:t,workflow:r}),description:t,outputs:[],successCriteria:[],state:e?zt.Draft:zt.Normal,parameters:{pathParameters:[],queryParameters:a?bO(a.url):[],headers:[],cookies:[]},requestBody:ch(),xOperation:a??(i?null:{method:"GET",url:""}),security:u,operation:i??null,...c}}const l=n;return{stepId:mE({name:t,workflow:r}),description:l.description,outputs:l.outputs,successCriteria:l.successCriteria,state:e?zt.Draft:zt.Normal,parameters:l.parameters,requestBody:l.requestBody,xOperation:l.xOperation,security:l.security,operation:l.operation}}function Ac(t){return t.xOperation?.method??t.operation?.method??""}function Fu(t){return t.xOperation?.url??t.operation?.path??""}function mS(t,e,n,r,i){const{inputs:s,servers:o}=r,a=SIe(Oc("path",[Vn(e?.parameters.pathParameters,n?.components.parameters),Vn(t.parameters.pathParameters,n?.components.parameters)]),r.inputs,i),l=t.xOperation??null,c=t.operation??null;let u="",f="";if(l)f=l.method,u=eV(l.url,a);else if(c){const m=o.find(O=>O.apiId===c.apiId);f=c.method==="x-query"?"query":c.method,u=(m?.value?R6(m.value,m.variables):"")+eV(c.path,a)}const h=u.split("?")[0];return{url:If(h,s,i??{}),method:f.toUpperCase()}}function k$e(){return structuredClone({id:crypto.randomUUID(),state:Qn.Normal,data:{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Xe.Step,draftStep:ja(),response:null,activeTabIdx:0,requestError:null,isProcessingRequest:!1}})}function E$e(t){return t?.data?.type===Xe.Step}function I$e(t,e){const{collectionId:n,workflowId:r,stepId:i}=e,s=e.draftStep??null;return n&&r&&i?vO(t,{collectionId:n,workflowId:r,stepId:i})??s:s}function $$e(t,e,n,r,i,s){const o=a=>a??"";return o(t)===r&&o(e)===i&&o(n)===s}const OE="New workflow";function j6({name:t=OE,collection:e}){let r=(t.trim().replace(/[^a-zA-Z0-9\-_\s]/g,"").replace(/\s+/g," ")||OE).replaceAll(" ","-").toLowerCase();if(!e)return r;const i=A$e(e);if(i.includes(r)){let s=1;for(;i.includes(`${r}-${s}`);)s++;r=`${r}-${s}`}return r}function A$e(t){return t.workflows.filter(e=>e.state!==zt.Draft).map(e=>e.workflowId)}function OQ({name:t=OE,isDraft:e=!1,collection:n}={}){return{workflowId:j6({name:t,collection:n}),summary:t,steps:[],state:e?zt.Draft:zt.Normal,outputs:[],parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},security:[oo()]}}function Q$e(t,e,n){const r=new Set,i=e?.components.parameters,{pathParameters:s,queryParameters:o,headers:a,cookies:l}=t.parameters,c=t.outputs;for(const{value:u}of[...Vn([...s,...o,...a,...l],i),...c])for(const f of ls(u))r.add(f);return t.steps.forEach(u=>{const f=u.security;for(const b of f)switch(b.securityType){case ne.BasicAuth:case ne.DigestAuth:for(const y of[b[b.securityType].username,b[b.securityType].password])for(const w of ls(y))r.add(w);break;case ne.JWT:for(const y of ls(b[b.securityType].token))r.add(y);break;case ne.APIKey:for(const y of ls(b[b.securityType].key))r.add(y);break;case ne.OAuth2:case ne.OpenIDConnect:{const y=b[b.securityType];for(const w of ls(y[y.grantType].accessToken))r.add(w);break}}const{pathParameters:h,queryParameters:p,headers:m,cookies:g}=u.parameters,O=u.outputs;for(const{value:b}of[...Vn([...h,...p,...m,...g],i),...O])for(const y of ls(b))r.add(y);const v=u.requestBody;switch(v.type){case Ke.FormData:case Ke.UrlEncoded:{for(const{value:b}of v.formData[v.type])for(const y of ls(b))r.add(y);break}case Ke.Binary:break;case Ke.GraphqlJSON:{const{query:b,variables:y}=zh(Ke.GraphqlJSON,n)?Ol(v.content):{query:v.content,variables:""};for(const w of[b,y])for(const S of ls(w))r.add(S);break}default:for(const b of ls(v.content))r.add(b)}}),r}function N6(t,e,n,r,i){const s=Q$e(t,n,i);if(s.size===0){r(({inputs:o,...a})=>a);return}r(o=>{const a=o.inputs,l=typeof a=="object"&&a?.properties||{};return{...o,inputs:{type:"object",properties:Object.fromEntries(Array.from(s).map(c=>{const u=e.inputs.find(f=>f.name===c)?.isSecret;return[c,u?{type:"string",format:"password"}:l[c]||{type:"string"}]}))}}})}function Xh(t){return t.summary||t.workflowId||"Untitled Workflow"}function D6(t){return t.flatMap(e=>{const n=e.id,r=e.paths??{};return Object.keys(r).flatMap(i=>{const s=r[i]??{},o=Object.keys(s).filter(c=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(c.toLowerCase())).map(c=>{const u=s[c];return{apiId:n,path:i,method:c,operationId:u?.operationId||"",summary:u?.summary,isAdditionalOperation:!1}}),a=s.additionalOperations,l=a?Object.entries(a).map(([c,u])=>({apiId:n,path:i,method:c,operationId:u.operationId||"",summary:u.summary,isAdditionalOperation:!0})):[];return[...o,...l]})})}const OS=(t,e,n)=>{if(!e)return null;const{apiId:r,method:i,path:s}=e,o=t.find(l=>l.id===r);if(!o)return null;if(n)try{return n(s,i,o)??null}catch(l){console.error("Failed to convert operation to replay value",l)}const a=o.paths?.[s]?.[i];return a?{id:a.operationId??"",name:a.summary??"",method:i,path:s,href:"",operationId:a.operationId,parameters:[],servers:[],security:[]}:null};function vS(t){const e=qo(),{convertOperationToReplayValue:n}=Wn();return x.useMemo(()=>OS(e,t,n),[e,t,n])}function vQ(){const t=SA(),{convertOperationToReplayValue:e}=Wn();return{getApiOperation:x.useCallback(r=>OS(t(),r,e),[t,e])}}function M6(t){const e=(t.match(new RegExp("\\{(?<!\\{[^}]*?\\{)([^}]+)\\}","g"))||[]).map(n=>n.slice(1,-1));return Array.from(new Set(e))}function R$e(t){const e=t.servers?.[0];if(!e)return{url:"",variables:[]};const n=e.url,i=M6(n).map(s=>({name:s,value:e.variables?.[s]?.default||""}));return{url:n,variables:i}}function V6(){const t=SA(),e=so();function n(r){const i=t().find(a=>a.id===r);if(!i){console.error(`API ${r} not found`);return}const{url:s,variables:o}=R$e(i);e(a=>{let l=!1;const c=a.map(u=>u.servers.some(f=>f.apiId===r)?u:(l=!0,{...u,servers:[...u.servers,{apiId:r,value:s,variables:o}]}));return l?c:a})}return{attachApiServerToEnvironments:n}}class sn{static utils=null;static async getUtils(){return sn.utils||(sn.utils=Rn()?await Promise.resolve().then(()=>require("./replay-tauri-path-BxbpcNzj.js")):{join:nc.join,resolve:nc.resolve,isAbsolute:nc.isAbsolute,relative:nc.relative,extname:nc.extname,dirname:nc.dirname}),sn.utils}static async dirname(e){return(await sn.getUtils()).dirname(e)}static async join(...e){return(await sn.getUtils()).join(...e)}static async resolve(e){return(await sn.getUtils()).resolve(e)}static async isAbsolute(e){return(await sn.getUtils()).isAbsolute(e)}static async relative(e,n){return(await sn.getUtils()).relative(e,n)}static async extname(e){return(await sn.getUtils()).extname(e)}}function _$e({apiName:t="new-api-source",sourceDescriptions:e}){let n=t.replaceAll(/[\s.]/g,"-").toLowerCase();if(!e.length)return n;const r=e.map(i=>i.name);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function tV(t,e){return`${t}\0${e}`}function ud(){const t=lS(),e=qa(),n=SA(),{attachApiServerToEnvironments:r}=V6();async function i({collectionId:l,apiId:c}){const u=ah(t(),l);if(!u)return;if(!u.sourceDescriptions.some(h=>h.apiId===c)){const p=n().find(g=>g.id===c)?.info.title,m=zs(c)?c:await sn.relative(`/${l}/..`,`/${c}`);e(g=>Xi(g,l,O=>O.sourceDescriptions.some(v=>v.apiId===c)?O:{...O,sourceDescriptions:[...O.sourceDescriptions,{name:_$e({apiName:p,sourceDescriptions:O.sourceDescriptions}),url:m,apiId:c}]}))}r(c)}function s(l){return ah(t(),l)}function o(l,c){e(u=>Xi(u,l,f=>({...f,sourceDescriptions:f.sourceDescriptions.filter(h=>c.name!==h.name)})))}function a(l,c){const u=new Set(c.map(f=>tV(f.workflowId??"",f.stepId)));e(f=>Xi(f,l,h=>{const p=h.workflows.map(m=>{const g=m.steps.map(O=>!u.has(tV(m.workflowId,O.stepId))||!O.operation?O:{...O,xOperation:{method:O.operation.method,url:O.operation.path},operation:null});return g.every((O,v)=>O===m.steps[v])?m:{...m,steps:g}});return p.every((m,g)=>m===h.workflows[g])?h:{...h,workflows:p}}))}return{attachApiToCollection:i,getCollection:s,removeSourceDescription:o,disconnectStepsFromSource:a}}class nV{storage;constructor(e){this.storage=e}async initialize(){await this.storage.initialize()}getAll(e){return this.storage.read(e)}getRecent(e=50,n){return this.storage.getRecent(e,n)}getById(e){return this.storage.getById(e)}addItem(e){return this.storage.addItem(e)}updateItem(e,n){return this.storage.updateItem(e,n)}deleteItem(e){return this.storage.deleteItem(e)}clear(){return this.storage.clear()}count(e){return this.storage.count(e)}}const vE=(t,e)=>e.some(n=>t instanceof n);let rV,iV;function j$e(){return rV||(rV=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function N$e(){return iV||(iV=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const yE=new WeakMap,W1=new WeakMap,yS=new WeakMap;function D$e(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(Eu(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return yS.set(e,t),e}function M$e(t){if(yE.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});yE.set(t,e)}let bE={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return yE.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Eu(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function L6(t){bE=t(bE)}function V$e(t){return N$e().includes(t)?function(...e){return t.apply(xE(this),e),Eu(this.request)}:function(...e){return Eu(t.apply(xE(this),e))}}function L$e(t){return typeof t=="function"?V$e(t):(t instanceof IDBTransaction&&M$e(t),vE(t,j$e())?new Proxy(t,bE):t)}function Eu(t){if(t instanceof IDBRequest)return D$e(t);if(W1.has(t))return W1.get(t);const e=L$e(t);return e!==t&&(W1.set(t,e),yS.set(e,t)),e}const xE=t=>yS.get(t);function z$e(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=Eu(o);return r&&o.addEventListener("upgradeneeded",l=>{r(Eu(o.result),l.oldVersion,l.newVersion,Eu(o.transaction),l)}),n&&o.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{s&&l.addEventListener("close",()=>s()),i&&l.addEventListener("versionchange",c=>i(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const X$e=["get","getKey","getAll","getAllKeys","count"],U$e=["put","add","delete","clear"],Z1=new Map;function sV(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Z1.get(e))return Z1.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=U$e.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||X$e.includes(n)))return;const s=async function(o,...a){const l=this.transaction(o,i?"readwrite":"readonly");let c=l.store;return r&&(c=c.index(a.shift())),(await Promise.all([c[n](...a),i&&l.done]))[0]};return Z1.set(e,s),s}L6(t=>({...t,get:(e,n,r)=>sV(e,n)||t.get(e,n,r),has:(e,n)=>!!sV(e,n)||t.has(e,n)}));const q$e=["continue","continuePrimaryKey","advance"],oV={},SE=new WeakMap,z6=new WeakMap,F$e={get(t,e){if(!q$e.includes(e))return t[e];let n=oV[e];return n||(n=oV[e]=function(...r){SE.set(this,z6.get(this)[e](...r))}),n}};async function*W$e(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const n=new Proxy(e,F$e);for(z6.set(n,e),yS.set(n,xE(e));e;)yield n,e=await(SE.get(n)||e.continue()),SE.delete(n)}function aV(t,e){return e===Symbol.asyncIterator&&vE(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&vE(t,[IDBIndex,IDBObjectStore])}L6(t=>({...t,get(e,n,r){return aV(e,n)?W$e:t.get(e,n,r)},has(e,n){return aV(e,n)||t.has(e,n)}}));class yQ{constructor(e,n,r){this.dbName=e,this.version=n,this.setupCallback=r}dbName;version;setupCallback;db=null;static createInstance(e,n,r){return new yQ(e,n,r)}async initialize(){this.db||(this.db=await z$e(this.dbName,this.version,{upgrade:e=>{this.setupCallback(e)}}))}async close(){this.db&&(this.db.close(),this.db=null)}}const Z$e=1;class bQ{constructor(e){this.indexedDB=e}indexedDB;static create(e){const n=`replay-history-${e}`,r=yQ.createInstance(n,Z$e,this.setupDatabase);return new bQ(r)}static setupDatabase(e){if(!e.objectStoreNames.contains("history")){const n=e.createObjectStore("history",{keyPath:"id"});n.createIndex("by-date","date"),n.createIndex("by-type","type"),n.createIndex("by-workflow","workflowId")}}get storeName(){return"history"}async getDb(){return await this.indexedDB.initialize(),this.indexedDB.db}async initialize(){await this.indexedDB.initialize()}async read(e){const r=(await this.getDb()).transaction(this.storeName,"readonly"),i=e?.type?await r.store.index("by-type").getAll(e.type):await r.store.index("by-date").getAll();return await r.done,i.sort((s,o)=>o.date-s.date)}async addItem(e){await(await this.getDb()).put(this.storeName,e)}async updateItem(e,n){const r=await this.getDb(),i=await r.get(this.storeName,e);if(i){const{id:s,type:o,...a}=n;await r.put(this.storeName,{...i,...a})}}async deleteItem(e){await(await this.getDb()).delete(this.storeName,e)}async clear(){await(await this.getDb()).clear(this.storeName)}async getById(e){return await(await this.getDb()).get(this.storeName,e)||null}async getRecent(e,n){const i=(await this.getDb()).transaction(this.storeName,"readonly"),s=n?.type?await i.store.index("by-type").getAll(n.type):await i.store.index("by-date").getAll();return await i.done,s.sort((o,a)=>a.date-o.date).slice(0,e)}async count(e){const n=await this.getDb();if(e?.type){const r=n.transaction(this.storeName,"readonly"),i=await r.store.index("by-type").count(e.type);return await r.done,i}return await n.count(this.storeName)}}class vc{static instance=null;static async initialize(e,n){this.close(),this.instance=await B$e(e,n)}static getInstance(){if(!this.instance)throw new Error("HistoryService not initialized");return this.instance}static close(){this.instance=null}}async function B$e(t,e){if(e){const{HistorySqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-HistorySqliteDBStorage-BrILW8Fu.js")),r=Cm.getInstance(),i=new n(r);return new nV(i)}else{const n=bQ.create(t.id);return new nV(n)}}const ui={all:["history"],lists:()=>[...ui.all,"list"],list:t=>[...ui.lists(),t],recent:(t,e)=>[...ui.all,"recent",t,e],detail:t=>[...ui.all,"detail",t],count:t=>[...ui.all,"count",t]};function Y$e(t){return ki.useQuery({queryKey:ui.list(t),queryFn:async()=>vc.getInstance().getAll(t)})}function X6(){const t=ki.useQueryClient();return ki.useMutation({mutationFn:async e=>{await vc.getInstance().addItem(e)},onMutate:e=>{t.setQueryData(ui.detail(e.id),e)},onSuccess:()=>{t.invalidateQueries({queryKey:ui.lists()}),t.invalidateQueries({queryKey:ui.count()})},onError:(e,n)=>{t.removeQueries({queryKey:ui.detail(n.id)}),console.error("Failed to add history item:",e)}})}function G$e(){const t=ki.useQueryClient();return ki.useMutation({mutationFn:async e=>{await vc.getInstance().deleteItem(e)},onSuccess:(e,n)=>{t.removeQueries({queryKey:ui.detail(n)}),t.invalidateQueries({queryKey:ui.lists()}),t.invalidateQueries({queryKey:ui.count()})},onError:(e,n)=>{console.error(`Failed to delete history item ${n}:`,e)}})}function H$e(){const t=ki.useQueryClient();return ki.useMutation({mutationFn:async()=>{await vc.getInstance().clear()},onSuccess:()=>{t.invalidateQueries({queryKey:ui.all})},onError:e=>{console.error("Failed to clear history:",e)}})}function J$e(t){return t?{...t,bodyNotStored:!0,body:"",arrayBuffer:new ArrayBuffer(0)}:null}function K$e(){const t=X6();return x.useCallback(({step:e,response:n})=>{const r=J$e(n),i={id:crypto.randomUUID(),date:Date.now(),type:"step",step:e,response:r,statusCode:n?.status??null};t.mutate(i)},[t])}function eAe(){const t=X6();return x.useCallback(async({workflowId:e,collectionId:n,workflow:r,workflowResult:i,success:s,durationMs:o})=>{const a=crypto.randomUUID(),l={id:a,date:Date.now(),type:"workflow",workflowId:e,collectionId:n,workflow:r,workflowResult:i,success:s,durationMs:o};try{return await t.mutateAsync(l),a}catch{return null}},[t])}function tAe(){const t=ki.useQueryClient();async function e(n){return t.ensureQueryData({queryKey:ui.detail(n),queryFn:()=>vc.getInstance().getById(n)})}return{getHistoryItem:e}}function U6(){const t=lS();return{getStep:n=>vO(t(),n)}}function nAe(t){const e=mi();return vO(e,{collectionId:t?.collectionId??null,workflowId:t?.workflowId??null,stepId:t?.stepId??null})??t?.draftStep??null}function q6(t,e){const n=t?.collectionId??null,r=t?.workflowId??null,i=t?.stepId??null,s=mi(),o=qa(),a=vO(s,{collectionId:n,workflowId:r,stepId:i});if(a)return{step:a,updateStep:c=>o(u=>cS(u,{collectionId:n,workflowId:r,stepId:i},c))};const l=t?.draftStep??null;return l?{step:l,updateStep:c=>e(u=>({...u,draftStep:u.draftStep?c(u.draftStep):u.draftStep}))}:null}function xQ(){const t=lS();return{getWorkflow:({collectionId:n,workflowId:r})=>OO(t(),{collectionId:n,workflowId:r})}}function Vr(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)}function Gd(t,e,n,r,i){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var Jc,Is,Ad,Dv,Iy;const lV="__TAURI_TO_IPC_KEY__";function F6(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}class W6{constructor(e){Jc.set(this,void 0),Is.set(this,0),Ad.set(this,[]),Dv.set(this,void 0),Gd(this,Jc,e||(()=>{})),this.id=F6(n=>{const r=n.index;if("end"in n){r==Vr(this,Is,"f")?this.cleanupCallback():Gd(this,Dv,r);return}const i=n.message;if(r==Vr(this,Is,"f")){for(Vr(this,Jc,"f").call(this,i),Gd(this,Is,Vr(this,Is,"f")+1);Vr(this,Is,"f")in Vr(this,Ad,"f");){const s=Vr(this,Ad,"f")[Vr(this,Is,"f")];Vr(this,Jc,"f").call(this,s),delete Vr(this,Ad,"f")[Vr(this,Is,"f")],Gd(this,Is,Vr(this,Is,"f")+1)}Vr(this,Is,"f")===Vr(this,Dv,"f")&&this.cleanupCallback()}else Vr(this,Ad,"f")[r]=i})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){Gd(this,Jc,e)}get onmessage(){return Vr(this,Jc,"f")}[(Jc=new WeakMap,Is=new WeakMap,Ad=new WeakMap,Dv=new WeakMap,lV)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[lV]()}}async function kn(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}class rAe{get rid(){return Vr(this,Iy,"f")}constructor(e){Iy.set(this,void 0),Gd(this,Iy,e)}async close(){return kn("plugin:resources|close",{rid:this.rid})}}Iy=new WeakMap;var wE;(function(t){t[t.Audio=1]="Audio",t[t.Cache=2]="Cache",t[t.Config=3]="Config",t[t.Data=4]="Data",t[t.LocalData=5]="LocalData",t[t.Document=6]="Document",t[t.Download=7]="Download",t[t.Picture=8]="Picture",t[t.Public=9]="Public",t[t.Video=10]="Video",t[t.Resource=11]="Resource",t[t.Temp=12]="Temp",t[t.AppConfig=13]="AppConfig",t[t.AppData=14]="AppData",t[t.AppLocalData=15]="AppLocalData",t[t.AppCache=16]="AppCache",t[t.AppLog=17]="AppLog",t[t.Desktop=18]="Desktop",t[t.Executable=19]="Executable",t[t.Font=20]="Font",t[t.Home=21]="Home",t[t.Runtime=22]="Runtime",t[t.Template=23]="Template"})(wE||(wE={}));var TE;(function(t){t[t.Start=0]="Start",t[t.Current=1]="Current",t[t.End=2]="End"})(TE||(TE={}));function SQ(t){return{isFile:t.isFile,isDirectory:t.isDirectory,isSymlink:t.isSymlink,size:t.size,mtime:t.mtime!==null?new Date(t.mtime):null,atime:t.atime!==null?new Date(t.atime):null,birthtime:t.birthtime!==null?new Date(t.birthtime):null,readonly:t.readonly,fileAttributes:t.fileAttributes,dev:t.dev,ino:t.ino,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,blksize:t.blksize,blocks:t.blocks}}class wQ extends rAe{async read(e){if(e.byteLength===0)return 0;const[n,r]=await kn("plugin:fs|read",{rid:this.rid,len:e.byteLength});return e.set(n),r===0?null:r}async seek(e,n){return await kn("plugin:fs|seek",{rid:this.rid,offset:e,whence:n})}async stat(){const e=await kn("plugin:fs|fstat",{rid:this.rid});return SQ(e)}async truncate(e){await kn("plugin:fs|ftruncate",{rid:this.rid,len:e})}async write(e){return await kn("plugin:fs|write",{rid:this.rid,data:e})}}async function iAe(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await kn("plugin:fs|create",{path:t instanceof URL?t.toString():t,options:e});return new wQ(n)}async function sAe(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await kn("plugin:fs|open",{path:t instanceof URL?t.toString():t,options:e});return new wQ(n)}async function oAe(t,e,n){if(t instanceof URL&&t.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|copy_file",{fromPath:t instanceof URL?t.toString():t,toPath:e instanceof URL?e.toString():e,options:n})}async function Z6(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|mkdir",{path:t instanceof URL?t.toString():t,options:e})}async function B6(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await kn("plugin:fs|read_dir",{path:t instanceof URL?t.toString():t,options:e})}async function Y6(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await kn("plugin:fs|read_file",{path:t instanceof URL?t.toString():t,options:e});return n instanceof ArrayBuffer?new Uint8Array(n):Uint8Array.from(n)}async function TQ(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await kn("plugin:fs|read_text_file",{path:t instanceof URL?t.toString():t,options:e})}async function aAe(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=t instanceof URL?t.toString():t;return await Promise.resolve({path:n,rid:null,async next(){this.rid===null&&(this.rid=await kn("plugin:fs|read_text_file_lines",{path:n,options:e}));const[r,i]=await kn("plugin:fs|read_text_file_lines_next",{rid:this.rid});return i&&(this.rid=null),{value:i?"":r,done:i}},[Symbol.asyncIterator](){return this}})}async function G6(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|remove",{path:t instanceof URL?t.toString():t,options:e})}async function H6(t,e,n){if(t instanceof URL&&t.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|rename",{oldPath:t instanceof URL?t.toString():t,newPath:e instanceof URL?e.toString():e,options:n})}async function lAe(t,e){const n=await kn("plugin:fs|stat",{path:t instanceof URL?t.toString():t,options:e});return SQ(n)}async function cAe(t,e){const n=await kn("plugin:fs|lstat",{path:t instanceof URL?t.toString():t,options:e});return SQ(n)}async function uAe(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|truncate",{path:t instanceof URL?t.toString():t,len:e,options:n})}async function dAe(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|write_file",e,{headers:{path:t instanceof URL?t.toString():t,options:JSON.stringify(n)}})}async function J6(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|write_text_file",{path:t instanceof URL?t.toString():t,data:e,options:n})}async function CQ(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await kn("plugin:fs|exists",{path:t instanceof URL?t.toString():t,options:e})}async function K6(t){await kn("plugin:fs|unwatch",{rid:t})}async function fAe(t,e,n){const r={recursive:!1,delayMs:2e3,...n},i=Array.isArray(t)?t:[t];for(const a of i)if(a instanceof URL&&a.protocol!=="file:")throw new TypeError("Must be a file URL.");const s=new W6;s.onmessage=e;const o=await kn("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:r,onEvent:s});return()=>{K6(o)}}async function hAe(t,e,n){const r={recursive:!1,...n,delayMs:null},i=Array.isArray(t)?t:[t];for(const a of i)if(a instanceof URL&&a.protocol!=="file:")throw new TypeError("Must be a file URL.");const s=new W6;s.onmessage=e;const o=await kn("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:r,onEvent:s});return()=>{K6(o)}}const xO=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return wE},FileHandle:wQ,get SeekMode(){return TE},copyFile:oAe,create:iAe,exists:CQ,lstat:cAe,mkdir:Z6,open:sAe,readDir:B6,readFile:Y6,readTextFile:TQ,readTextFileLines:aAe,remove:G6,rename:H6,stat:lAe,truncate:uAe,watch:fAe,watchImmediate:hAe,writeFile:dAe,writeTextFile:J6},Symbol.toStringTag,{value:"Module"}));function pAe(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function Gt(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}var In;(function(t){t[t.Audio=1]="Audio",t[t.Cache=2]="Cache",t[t.Config=3]="Config",t[t.Data=4]="Data",t[t.LocalData=5]="LocalData",t[t.Document=6]="Document",t[t.Download=7]="Download",t[t.Picture=8]="Picture",t[t.Public=9]="Public",t[t.Video=10]="Video",t[t.Resource=11]="Resource",t[t.Temp=12]="Temp",t[t.AppConfig=13]="AppConfig",t[t.AppData=14]="AppData",t[t.AppLocalData=15]="AppLocalData",t[t.AppCache=16]="AppCache",t[t.AppLog=17]="AppLog",t[t.Desktop=18]="Desktop",t[t.Executable=19]="Executable",t[t.Font=20]="Font",t[t.Home=21]="Home",t[t.Runtime=22]="Runtime",t[t.Template=23]="Template"})(In||(In={}));async function gAe(){return Gt("plugin:path|resolve_directory",{directory:In.AppConfig})}async function CE(){return Gt("plugin:path|resolve_directory",{directory:In.AppData})}async function mAe(){return Gt("plugin:path|resolve_directory",{directory:In.AppLocalData})}async function OAe(){return Gt("plugin:path|resolve_directory",{directory:In.AppCache})}async function vAe(){return Gt("plugin:path|resolve_directory",{directory:In.Audio})}async function yAe(){return Gt("plugin:path|resolve_directory",{directory:In.Cache})}async function bAe(){return Gt("plugin:path|resolve_directory",{directory:In.Config})}async function xAe(){return Gt("plugin:path|resolve_directory",{directory:In.Data})}async function eY(){return Gt("plugin:path|resolve_directory",{directory:In.Desktop})}async function SAe(){return Gt("plugin:path|resolve_directory",{directory:In.Document})}async function wAe(){return Gt("plugin:path|resolve_directory",{directory:In.Download})}async function TAe(){return Gt("plugin:path|resolve_directory",{directory:In.Executable})}async function CAe(){return Gt("plugin:path|resolve_directory",{directory:In.Font})}async function PAe(){return Gt("plugin:path|resolve_directory",{directory:In.Home})}async function kAe(){return Gt("plugin:path|resolve_directory",{directory:In.LocalData})}async function EAe(){return Gt("plugin:path|resolve_directory",{directory:In.Picture})}async function IAe(){return Gt("plugin:path|resolve_directory",{directory:In.Public})}async function $Ae(){return Gt("plugin:path|resolve_directory",{directory:In.Resource})}async function AAe(t){return Gt("plugin:path|resolve_directory",{directory:In.Resource,path:t})}async function QAe(){return Gt("plugin:path|resolve_directory",{directory:In.Runtime})}async function RAe(){return Gt("plugin:path|resolve_directory",{directory:In.Template})}async function _Ae(){return Gt("plugin:path|resolve_directory",{directory:In.Video})}async function jAe(){return Gt("plugin:path|resolve_directory",{directory:In.AppLog})}async function NAe(){return Gt("plugin:path|resolve_directory",{directory:In.Temp})}function tY(){return window.__TAURI_INTERNALS__.plugins.path.sep}function DAe(){return window.__TAURI_INTERNALS__.plugins.path.delimiter}async function nY(...t){return Gt("plugin:path|resolve",{paths:t})}async function MAe(t){return Gt("plugin:path|normalize",{path:t})}async function PQ(...t){return Gt("plugin:path|join",{paths:t})}async function rY(t){return Gt("plugin:path|dirname",{path:t})}async function iY(t){return Gt("plugin:path|extname",{path:t})}async function kQ(t,e){return Gt("plugin:path|basename",{path:t,ext:e})}async function sY(t){return Gt("plugin:path|is_absolute",{path:t})}const EQ=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return In},appCacheDir:OAe,appConfigDir:gAe,appDataDir:CE,appLocalDataDir:mAe,appLogDir:jAe,audioDir:vAe,basename:kQ,cacheDir:yAe,configDir:bAe,dataDir:xAe,delimiter:DAe,desktopDir:eY,dirname:rY,documentDir:SAe,downloadDir:wAe,executableDir:TAe,extname:iY,fontDir:CAe,homeDir:PAe,isAbsolute:sY,join:PQ,localDataDir:kAe,normalize:MAe,pictureDir:EAe,publicDir:IAe,resolve:nY,resolveResource:AAe,resourceDir:$Ae,runtimeDir:QAe,sep:tY,tempDir:NAe,templateDir:RAe,videoDir:_Ae},Symbol.toStringTag,{value:"Module"})),Ao=window.__TAURI__?.http.fetch??globalThis.fetch;function cV(t){try{const e=new URL(t);return(e.protocol==="http:"&&e.port==="80"||e.protocol==="https:"&&e.port==="443")&&(e.port=""),e.hostname=e.hostname.toLowerCase(),e.protocol+"//"+e.hostname+(e.port?":"+e.port:"")}catch(e){return console.error("Invalid URL",e),null}}function oY(t,e){let n=cV(t);const r=e.find(({host:i,port:s})=>cV(`https://${i}:${s}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}const VAe={id:"default",userFilesDir:"default",systemFilesDir:"default"},Q0=Al(Dr(VAe));Q0.debugLabel="project";function dd(){return Ir(Q0)}function PE(){return{STATUS_CODE_CHECK:"error",SCHEMA_CHECK:"error",CONTENT_TYPE_CHECK:"error"}}const LAe=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function zAe(){const{userFilesDir:t}=dd(),{certificates:e}=pi(),n=Ut(),{getCollection:r}=ud();return{execute:async(s,o,a)=>{const l=r(s),{inputs:c,servers:u}=n,f=l?.sourceDescriptions??[],h=`${t}/${s}`,[{createConfig:p},{ExternalResolver:m}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-CwHr913S.js")),Promise.resolve().then(()=>require("./replay-external-resolver-BdGx04jr.js"))]),g=new m,O=c.map(w=>JSON.stringify({[w.name]:w.value})),v=XAe(u,f),{run:b}=await Promise.resolve().then(()=>require("./replay-respect-run-BJd-iklq.js")),y=await b({files:[h],workflow:o?[o]:[],fetch:(w,S)=>{const P=LAe(w),{clientCert:k,clientKey:I}=oY(P,e);return Ao(P,{...S,clientCert:k,clientKey:I})},logger:uS,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async w=>{if(!await CQ(w))throw new Error(`File ${w} doesn't exist or isn't readable.`);try{const P=await TQ(w),k=new TextEncoder().encode(P);return new File([k],await kQ(w))}catch(P){throw new Error(`Failed to read file ${w}: ${P}`)}}},envVariables:{},config:await p({}),externalRefResolver:g,input:O,server:v,severity:JSON.stringify(a),skipLint:!0,noSecretsMasking:!0});try{await lIe(s,o,y?.[0]?.ctx)}catch(w){console.error("Failed to persist workflow step context:",w)}return y}}}function XAe(t,e){return e.map(n=>{const r=t.find(s=>s.apiId===n.apiId);if(!r)return null;let i=r.value;if(r.variables)for(const s of r.variables){const o=new RegExp(`\\{${s.name}\\}`,"g");i=i.replace(o,s.value)}return`${n.name}=${i}`}).filter(n=>n!==null)}const UAe="com.redocly.tab.openFailed";function uf(t){return{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Xe.Step,draftStep:null,response:null,requestError:null,isProcessingRequest:!1,...t}}function kE(t,e){const n=t.draftStep?.xOperation;return n?.method===e.method&&n?.url===e.url}function qAe(t,e,n){const r=t.draftStep,i=r?.xOperation;if(!r||!i)return;const s=n.url&&i.url!==n.url?n.url:null,o=i.method!==n.method?n.method:null;s===null&&o===null||e(a=>{const l=a.draftStep;return l?.xOperation?{...a,draftStep:{...l,xOperation:{...l.xOperation,...s!==null&&{url:s},...o!==null&&{method:o}},parameters:s===null?l.parameters:{...l.parameters,queryParameters:hA(bO(s),l.parameters.queryParameters)}}}:a})}function hr(){const{getTabs:t,getActiveTabIdx:e,setTabs:n,setActiveTabIdx:r,updateTabAt:i,updateTabDataAt:s}=id(),{dynamicReplayValues:o}=Wn(),{getStep:a}=U6(),{getHistoryItem:l}=tAe(),{getWorkflow:c}=xQ(),{getCollection:u}=ud(),{getApiOperation:f}=vQ(),{sendEvent:h}=et(),p=_Ee(),m=x.useCallback((R,D,L,F)=>{console.warn(`[useTabHandlers] ${R}`,F),h(UAe,[{...ye("tab",D),reason:L,...F}])},[h]),g=x.useCallback((R,D)=>{const L=t()[R];L&&L.state!==D&&i(R,F=>({...F,state:D}))},[t,i]),O=x.useCallback(R=>{r(R)},[r]),v=x.useCallback(()=>{const R=t().length;n(D=>[...D,k$e()]),r(R)},[t,n,r]),b=x.useCallback(R=>{const D=[...t().filter(F=>F.state!==Qn.Preview)];D.push(R),n(()=>D);const L=D.length-1;return r(L),L},[t,n,r]),y=x.useCallback(R=>{const D=f(R),L=IQ(R,D,o);b(L)},[b,o,f]),w=x.useCallback(R=>{const D=t().findIndex(({data:L})=>Tn(L,Xe.Step)&&L.draftStep?.operation?.apiId===R.apiId&&L.draftStep?.operation?.path===R.path&&L.draftStep?.operation?.method===R.method);return D===-1?!1:(O(D),!0)},[t,O]),S=x.useCallback((R,D)=>{const L=t(),F=G=>L.findIndex(({data:ee})=>Tn(ee,Xe.Step)&&G(ee));if(D){const G=F(ie=>ie.sourceFile===D);if(G!==-1){qAe(L[G].data,ie=>s(G,ie),R),O(G);return}const ee=F(ie=>!ie.sourceFile&&kE(ie,R));if(ee!==-1){s(ee,ie=>({...ie,sourceFile:D})),O(ee);return}}else{const G=F(ee=>kE(ee,R));if(G!==-1){O(G);return}}const Y=ja({xOperation:R,name:D??void 0});b({id:crypto.randomUUID(),state:Qn.Normal,data:uf({draftStep:Y,activeTabName:Ou(Y),sourceFile:D??null})})},[t,s,O,b]),P=x.useCallback(R=>{const D=t(),L=e(),F=D[L]?.id,Y=D.filter((ee,ie)=>ie!==R);n(()=>Y);const G=R===L||!F?-1:Y.findIndex(ee=>ee.id===F);r(G===-1?Math.max(0,R-1):G)},[t,e,r,n]),k=x.useCallback(()=>{n(()=>[]),r(0)},[r,n]);function I({collectionId:R,workflowId:D,stepId:L}){const F=t(),Y=new Set;for(let G=0;G<F.length;G++){const ee=F[G].data;switch(ee.type){case Xe.Step:ee.collectionId===R&&ee.workflowId===D&&ee.stepId===L&&Y.add(G);break;case Xe.Workflow:case Xe.WorkflowRun:ee.collectionId===R&&ee.workflowId===D&&!L&&Y.add(G);break;case Xe.Collection:ee.collectionId===R&&!D&&!L&&Y.add(G);break}}Y.size&&(n(G=>G.filter((ee,ie)=>!Y.has(ie))),r(0))}const E=x.useCallback(async R=>{const D=t().findIndex(({data:L})=>Tn(L,Xe.Step)&&L.historyId===R);if(D!==-1)r(D);else{const L=await l(R);if(!L||!$k(L)){m("Step history not found","stepHistoryTab","step_history_not_found",{historyId:R});return}const F=L.step;b({id:crypto.randomUUID(),state:Qn.Preview,data:uf({historyId:R,draftStep:structuredClone(F),response:structuredClone(L.response),activeTabName:Ou(F)})})}},[r,t,b,l,m]),Q=x.useCallback(({collectionId:R,activeTabName:D})=>{const L=t().findIndex(F=>{const Y=F.data;return Tn(Y,Xe.Collection)&&Y.collectionId===R});if(L!==-1)r(L);else{if(!u(R)){m("Collection not found","collectionTab","collection_not_found",{collectionId:R});return}b({id:crypto.randomUUID(),state:Qn.Preview,data:{collectionId:R,type:Xe.Collection,activeTabName:D??it.COLLECTION_SETTINGS}})}},[r,t,b,u,m]),N=x.useCallback(({collectionId:R,workflowId:D})=>{if(!c({collectionId:R,workflowId:D})){m("Workflow not found","workflowRunTab","workflow_not_found",{collectionId:R,workflowId:D});return}b({id:crypto.randomUUID(),state:Qn.Normal,data:{collectionId:R,workflowId:D,historyId:null,runDate:null,type:Xe.WorkflowRun,result:null,severitySettings:PE()}})},[b,c,m]),_=x.useCallback(async(R,{state:D=Qn.Preview}={})=>{const L=t().findIndex(({data:F})=>Tn(F,Xe.WorkflowRun)&&F.historyId===R);if(L!==-1)D===Qn.Normal&&t()[L].state===Qn.Preview&&g(L,Qn.Normal),r(L);else{const F=await l(R);if(!F||!Ak(F)){m("Workflow history not found","workflowHistoryTab","workflow_history_not_found",{historyId:R});return}b({id:crypto.randomUUID(),state:D,data:{collectionId:F.collectionId,workflowId:F.workflowId,historyId:R,runDate:F.date,type:Xe.WorkflowRun,result:structuredClone(F.workflowResult),severitySettings:PE(),label:Xh(F.workflow),secretValues:p().inputs.filter(Y=>Y.isSecret&&Y.value).map(Y=>String(Y.value))}})}},[r,t,b,g,l,m,p]),M=x.useCallback(({collectionId:R,workflowId:D})=>{const L=t().findIndex(({data:F})=>Tn(F,Xe.WorkflowRun)&&F.collectionId===R&&F.workflowId===D);return L===-1?!1:(t()[L].state===Qn.Preview&&g(L,Qn.Normal),O(L),!0)},[t,g,O]),z=x.useCallback(({collectionId:R,workflowId:D,activeTabName:L})=>{const F=t().findIndex(Y=>{const G=Y.data;return Tn(G,Xe.Workflow)&&G.workflowId===D&&G.collectionId===R});if(F!==-1)L&&s(F,Y=>({...Y,activeTabName:L})),r(F);else{if(!c({collectionId:R,workflowId:D})){m("Workflow not found","workflowTab","workflow_not_found",{collectionId:R,workflowId:D});return}b({id:crypto.randomUUID(),state:Qn.Preview,data:{collectionId:R,workflowId:D,type:Xe.Workflow,activeTabName:L??it.WORKFLOW_SETTINGS}})}},[r,t,s,b,c,m]),X=x.useCallback(({collectionId:R,workflowId:D,stepId:L,state:F})=>{const Y=t().findIndex(({data:G})=>Tn(G,Xe.Step)&&G.collectionId===R&&G.workflowId===D&&G.stepId===L&&G.historyId===null);if(Y!==-1)r(Y);else{const G=a({collectionId:R,workflowId:D,stepId:L});if(!G){m("Step not found","stepTab","step_not_found",{collectionId:R,workflowId:D,stepId:L});return}b({id:crypto.randomUUID(),state:F??Qn.Preview,data:uf({stepId:L,collectionId:R,workflowId:D,activeTabName:Ou(G)})})}},[r,t,a,b,m]),$=x.useCallback(({step:R})=>{b({id:crypto.randomUUID(),state:Qn.Normal,data:uf({stepId:R.stepId??null,workflowId:R.workflowId??null,draftStep:structuredClone(R),activeTabName:Ou(R)})})},[b]),U=x.useCallback((R,D)=>{if(R===D)return;const L=e(),F=[...t()],Y=F[L]?.id,[G]=F.splice(R,1);if(F.splice(D,0,G),n(()=>F),Y){const ee=F.findIndex(ie=>ie.id===Y);r(ee)}},[e,t,n,r]);return{handleNewTabOpen:v,addNewTab:b,openStepTabFromOperation:y,focusOperationTab:w,openStepTabFromXOperation:S,handleTabChange:O,handleTabClose:P,handleCloseAllTabs:k,handleCloseByDataId:I,openCollectionTab:Q,openWorkflowTab:z,openWorkflowRunTab:N,openWorkflowRunTabFromHistory:_,focusWorkflowRunTab:M,openStepTabFromHistory:E,openStepTabFromCollection:X,openStepTab:$,handleTabReorder:U,changeTabState:g}}function IQ(t,e,n){const r=ja({operation:t,apiOperation:e,dynamicReplayValues:n});return{id:crypto.randomUUID(),state:Qn.Preview,data:uf({draftStep:r,activeTabName:Ou(r)})}}function FAe(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.left>=r.left&&n.right<=r.right}const WAe=({transform:t})=>({...t,y:0}),ZAe=({transform:t,draggingNodeRect:e,containerNodeRect:n})=>!e||!n?t:{...t,x:Math.max(n.left-e.left,Math.min(t.x,n.right-e.right))},fd=(t,e="currentColor")=>t?.startsWith("--")?`var(${t})`:t||e,BAe=t=>d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",...t,children:[d.jsx("path",{d:"M10.8623 6.60461C11.0548 6.64292 11.2314 6.73734 11.3701 6.8761C11.5089 7.01487 11.6033 7.19144 11.6416 7.38391C11.6799 7.57633 11.661 7.77588 11.5859 7.95715C11.5108 8.13849 11.3829 8.29342 11.2197 8.40247C11.0566 8.51141 10.8651 8.5694 10.6689 8.56946C10.4939 8.5686 10.3221 8.52031 10.1729 8.42883L9.40625 9.19739C9.58461 9.44901 9.67969 9.75029 9.67969 10.0587C9.67965 10.3669 9.5844 10.6676 9.40625 10.9191L10.1729 11.6886C10.3221 11.5971 10.4938 11.5479 10.6689 11.547C10.865 11.5471 11.0567 11.6052 11.2197 11.714C11.3829 11.823 11.5108 11.9781 11.5859 12.1593C11.6611 12.3406 11.6799 12.541 11.6416 12.7335C11.6033 12.9259 11.5088 13.1026 11.3701 13.2413C11.2314 13.38 11.0547 13.4745 10.8623 13.5128C10.6698 13.5511 10.4704 13.5313 10.2891 13.4562C10.1078 13.3811 9.95279 13.2541 9.84375 13.0909C9.7347 12.9277 9.67578 12.7355 9.67578 12.5392C9.6767 12.3641 9.7258 12.1923 9.81738 12.0431L9.04883 11.2765C8.79719 11.4549 8.49595 11.5509 8.1875 11.5509C7.87917 11.5509 7.57871 11.4548 7.32715 11.2765L6.55762 12.0431C6.6492 12.1923 6.6983 12.3641 6.69922 12.5392C6.69922 12.7354 6.6412 12.9278 6.53223 13.0909C6.42318 13.2541 6.26728 13.3811 6.08594 13.4562C5.90468 13.5312 5.7051 13.5511 5.5127 13.5128C5.32032 13.4745 5.14359 13.38 5.00488 13.2413C4.86618 13.1026 4.77174 12.9259 4.7334 12.7335C4.69511 12.541 4.71493 12.3406 4.79004 12.1593C4.86518 11.9782 4.99222 11.8229 5.15527 11.714C5.31843 11.605 5.51083 11.547 5.70703 11.547C5.88211 11.5479 6.05389 11.597 6.20312 11.6886L6.96973 10.9191C6.79143 10.6675 6.69535 10.367 6.69531 10.0587C6.69531 9.75027 6.79134 9.44902 6.96973 9.19739L6.20312 8.42883C6.0539 8.52041 5.88211 8.56853 5.70703 8.56946C5.51075 8.56946 5.31847 8.51151 5.15527 8.40247C4.99211 8.29342 4.86514 8.13846 4.79004 7.95715C4.71493 7.77581 4.69511 7.57642 4.7334 7.38391C4.77168 7.19148 4.86618 7.01486 5.00488 6.8761C5.14358 6.7374 5.32034 6.64296 5.5127 6.60461C5.70502 6.56636 5.90473 6.58534 6.08594 6.66028C6.26728 6.73539 6.42318 6.86329 6.53223 7.02649C6.64104 7.18953 6.69917 7.38125 6.69922 7.57727C6.69836 7.7524 6.64917 7.92407 6.55762 8.07336L7.32715 8.83997C7.57865 8.66181 7.87929 8.56656 8.1875 8.56653C8.49595 8.56653 8.79719 8.66158 9.04883 8.83997L9.81738 8.07336C9.72588 7.9241 9.67664 7.75235 9.67578 7.57727C9.67583 7.38112 9.7348 7.1896 9.84375 7.02649C9.9528 6.86329 10.1077 6.73539 10.2891 6.66028C10.4703 6.58526 10.6699 6.56634 10.8623 6.60461ZM5.60938 12.0529C5.51328 12.0721 5.42476 12.1193 5.35547 12.1886C5.28617 12.2579 5.23889 12.3464 5.21973 12.4425C5.20058 12.5388 5.21049 12.6389 5.24805 12.7296C5.28559 12.8202 5.34915 12.8978 5.43066 12.9523C5.51226 13.0068 5.60889 13.0353 5.70703 13.0353C5.83843 13.0352 5.96467 12.9836 6.05762 12.8907C6.15067 12.7977 6.20312 12.6708 6.20312 12.5392C6.20305 12.4412 6.1736 12.3453 6.11914 12.2638C6.06462 12.1822 5.98712 12.1187 5.89648 12.0812C5.80581 12.0436 5.70563 12.0337 5.60938 12.0529ZM10.5723 12.0529C10.476 12.072 10.3868 12.1192 10.3174 12.1886C10.2481 12.2579 10.2008 12.3464 10.1816 12.4425C10.1625 12.5388 10.1724 12.6389 10.21 12.7296C10.2475 12.8202 10.3111 12.8978 10.3926 12.9523C10.4742 13.0068 10.5708 13.0353 10.6689 13.0353C10.8004 13.0352 10.9266 12.9836 11.0195 12.8907C11.1126 12.7977 11.165 12.6708 11.165 12.5392C11.165 12.4412 11.1355 12.3453 11.0811 12.2638C11.0265 12.1823 10.949 12.1187 10.8584 12.0812C10.7679 12.0437 10.6684 12.0338 10.5723 12.0529ZM5.80371 7.09094C5.70746 7.0718 5.60727 7.08171 5.5166 7.11926C5.42601 7.15683 5.34843 7.22033 5.29395 7.30188C5.2395 7.3834 5.21 7.47924 5.20996 7.57727C5.20996 7.70887 5.26241 7.83578 5.35547 7.92883C5.44852 8.02183 5.57548 8.07336 5.70703 8.07336C5.80501 8.07328 5.90095 8.04479 5.98242 7.99036C6.06394 7.93589 6.12747 7.85825 6.16504 7.7677C6.2026 7.67703 6.21251 7.57684 6.19336 7.48059C6.17421 7.38441 6.12694 7.29605 6.05762 7.22668C5.9883 7.15736 5.89985 7.11013 5.80371 7.09094ZM10.6689 7.08118C10.5373 7.08118 10.4104 7.13363 10.3174 7.22668C10.2245 7.31967 10.1729 7.44586 10.1729 7.57727C10.1729 7.67541 10.2013 7.77204 10.2559 7.85364C10.3104 7.9351 10.388 7.99873 10.4785 8.03625C10.5692 8.07381 10.6694 8.08372 10.7656 8.06457C10.8617 8.04544 10.9502 7.99808 11.0195 7.92883C11.0889 7.85944 11.1361 7.7702 11.1553 7.67395C11.1743 7.57784 11.1644 7.47835 11.127 7.38782C11.0894 7.29719 11.0259 7.21968 10.9443 7.16516C10.8628 7.11069 10.767 7.08123 10.6689 7.08118Z"}),d.jsx("path",{d:"M10.5 0.880005C10.9812 0.880005 11.375 1.27375 11.375 1.755V5.88489C11.375 5.95116 11.3212 6.005 11.2549 6.005H10.6201C10.5538 6.005 10.5 5.95116 10.5 5.88489V1.755H7V4.38C7 4.86125 6.60625 5.255 6.125 5.255H3.5V13.0099C3.5 13.0762 3.44616 13.13 3.37988 13.13H2.74512C2.67884 13.13 2.625 13.0762 2.625 13.0099V4.38C2.625 4.24875 2.66836 4.16086 2.75586 4.07336L5.81836 1.01086C5.90586 0.923364 5.99375 0.880005 6.125 0.880005H10.5ZM3.6748 4.38H6.125V1.92981L3.6748 4.38Z"})]}),bS=T.default(BAe)`
786
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function MIe(t,e){const n=t["?xml"];if(n&&typeof n=="object"){if(e.attributesGroupName&&n[e.attributesGroupName]){const i=n[e.attributesGroupName][e.attributeNamePrefix+"version"];if(i)return i}const r=n[e.attributeNamePrefix+"version"];if(r)return r}return"1.0"}function q1(t,e,n,r,i){return!n.sanitizeName||u6(t,{xmlVersion:i})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}Ts.prototype.build=function(t){if(this.options.preserveOrder)return QIe(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new i6,n=MIe(t,this.options);return this.j2x(t,0,e,n).val}};Ts.prototype.j2x=function(t,e,n,r){let i="",s="";if(this.options.maxNestedTags&&n.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const o=this.options.jPath?n.toString():n,a=this.checkStopNode(n);for(let l in t){if(!Object.prototype.hasOwnProperty.call(t,l))continue;const u=l===this.options.textNodeName||l===this.options.cdataPropName||l===this.options.commentPropName||this.options.attributesGroupName&&l===this.options.attributesGroupName||this.isAttribute(l)||l[0]==="?"?l:q1(l,!1,this.options,n,r);if(typeof t[l]>"u")this.isAttribute(l)&&(s+="");else if(t[l]===null)this.isAttribute(l)||u===this.options.cdataPropName||u===this.options.commentPropName?s+="":u[0]==="?"?s+=this.indentate(e)+"<"+u+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+u+"/"+this.tagEndChar;else if(t[l]instanceof Date)s+=this.buildTextValNode(t[l],u,"",e,n);else if(typeof t[l]!="object"){const f=this.isAttribute(l);if(f&&!this.ignoreAttributesFn(f,o)){const h=q1(f,!0,this.options,n,r);i+=this.buildAttrPairStr(h,""+t[l],a)}else if(!f)if(l===this.options.textNodeName){let h=this.options.tagValueProcessor(l,""+t[l]);s+=this.replaceEntitiesValue(h)}else{n.push(u);const h=this.checkStopNode(n);if(n.pop(),h){const p=""+t[l];p===""?s+=this.indentate(e)+"<"+u+this.closeTag(u)+this.tagEndChar:s+=this.indentate(e)+"<"+u+">"+p+"</"+u+this.tagEndChar}else s+=this.buildTextValNode(t[l],u,"",e,n)}}else if(Array.isArray(t[l])){const f=t[l].length;let h="",p="";for(let m=0;m<f;m++){const g=t[l][m];if(!(typeof g>"u"))if(g===null)u[0]==="?"?s+=this.indentate(e)+"<"+u+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+u+"/"+this.tagEndChar;else if(typeof g=="object")if(this.options.oneListGroup){n.push(u);const O=this.j2x(g,e+1,n,r);n.pop(),h+=O.val,this.options.attributesGroupName&&g.hasOwnProperty(this.options.attributesGroupName)&&(p+=O.attrStr)}else h+=this.processTextOrObjNode(g,u,e,n,r);else if(this.options.oneListGroup){let O=this.options.tagValueProcessor(u,g);O=this.replaceEntitiesValue(O),h+=O}else{n.push(u);const O=this.checkStopNode(n);if(n.pop(),O){const v=""+g;v===""?h+=this.indentate(e)+"<"+u+this.closeTag(u)+this.tagEndChar:h+=this.indentate(e)+"<"+u+">"+v+"</"+u+this.tagEndChar}else h+=this.buildTextValNode(g,u,"",e,n)}}this.options.oneListGroup&&(h=this.buildObjectNode(h,u,p,e)),s+=h}else if(this.options.attributesGroupName&&l===this.options.attributesGroupName){const f=Object.keys(t[l]),h=f.length;for(let p=0;p<h;p++){const m=q1(f[p],!0,this.options,n,r);i+=this.buildAttrPairStr(m,""+t[l][f[p]],a)}}else s+=this.processTextOrObjNode(t[l],u,e,n,r)}return{attrStr:i,val:s}};Ts.prototype.buildAttrPairStr=function(t,e,n){return n||(e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+lh(e)+'"'};function VIe(t,e,n,r,i){const s=this.extractAttributes(t);if(r.push(e,s),this.checkStopNode(r)){const l=this.buildRawContent(t),c=this.buildAttributesForStopNode(t);return r.pop(),this.buildObjectNode(l,e,c,n)}const a=this.j2x(t,n+1,r,i);return r.pop(),e[0]==="?"?this.buildTextValNode("",e,a.attrStr,n,r):t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,a.attrStr,n,r):this.buildObjectNode(a.val,e,a.attrStr,n)}Ts.prototype.extractAttributes=function(t){if(!t||typeof t!="object")return null;const e={};let n=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const r=t[this.options.attributesGroupName];for(let i in r){if(!Object.prototype.hasOwnProperty.call(r,i))continue;const s=i.startsWith(this.options.attributeNamePrefix)?i.substring(this.options.attributeNamePrefix.length):i;e[s]=lh(r[i]),n=!0}}else for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const i=this.isAttribute(r);i&&(e[i]=lh(t[r]),n=!0)}return n?e:null};Ts.prototype.buildRawContent=function(t){if(typeof t=="string")return t;if(typeof t!="object"||t===null)return String(t);if(t[this.options.textNodeName]!==void 0)return t[this.options.textNodeName];let e="";for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||this.isAttribute(n)||this.options.attributesGroupName&&n===this.options.attributesGroupName)continue;const r=t[n];if(n===this.options.textNodeName)e+=r;else if(Array.isArray(r)){for(let i of r)if(typeof i=="string"||typeof i=="number")e+=`<${n}>${i}</${n}>`;else if(typeof i=="object"&&i!==null){const s=this.buildRawContent(i),o=this.buildAttributesForStopNode(i);s===""?e+=`<${n}${o}/>`:e+=`<${n}${o}>${s}</${n}>`}}else if(typeof r=="object"&&r!==null){const i=this.buildRawContent(r),s=this.buildAttributesForStopNode(r);i===""?e+=`<${n}${s}/>`:e+=`<${n}${s}>${i}</${n}>`}else e+=`<${n}>${r}</${n}>`}return e};Ts.prototype.buildAttributesForStopNode=function(t){if(!t||typeof t!="object")return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const n=t[this.options.attributesGroupName];for(let r in n){if(!Object.prototype.hasOwnProperty.call(n,r))continue;const i=r.startsWith(this.options.attributeNamePrefix)?r.substring(this.options.attributeNamePrefix.length):r,s=n[r];s===!0&&this.options.suppressBooleanAttributes?e+=" "+i:e+=" "+i+'="'+s+'"'}}else for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const r=this.isAttribute(n);if(r){const i=t[n];i===!0&&this.options.suppressBooleanAttributes?e+=" "+r:e+=" "+r+'="'+i+'"'}}return e};Ts.prototype.buildObjectNode=function(t,e,n,r){if(t==="")return e[0]==="?"?this.indentate(r)+"<"+e+n+"?"+this.tagEndChar:this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar;if(e[0]==="?")return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let i="</"+e+this.tagEndChar,s="";return e[0]==="?"&&(s="?",i=""),(n||n==="")&&t.indexOf("<")===-1?this.indentate(r)+"<"+e+n+s+">"+t+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&s.length===0?this.indentate(r)+`<!--${t}-->`+this.newLine:this.indentate(r)+"<"+e+n+s+this.tagEndChar+t+this.indentate(r)+i}};Ts.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};Ts.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||this.stopNodeExpressions.length===0)return!1;for(let e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1};Ts.prototype.buildTextValNode=function(t,e,n,r,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName){const s=o6(t);return this.indentate(r)+`<![CDATA[${s}]]>`+this.newLine}else if(this.options.commentPropName!==!1&&e===this.options.commentPropName){const s=s6(t);return this.indentate(r)+`<!--${s}-->`+this.newLine}else{if(e[0]==="?")return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(e,t);return s=this.replaceEntitiesValue(s),s===""?this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+n+">"+s+"</"+e+this.tagEndChar}}};Ts.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const n=this.options.entities[e];t=t.replace(n.regex,n.val)}return t};function LIe(t){return this.options.indentBy.repeat(t)}function zIe(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}function p6(t){return t.schema}function g6(t){return p6(t)?.fields??[]}function m6(t,e){return t.flatMap(n=>{const r=p6(n),i=r?.fields||[];return i.length>0?i.flatMap(s=>BM(s.name,s.example,n.allowReserved)):BM(n.name,r?.example??n.example,n.allowReserved)})}function BM(t,e,n){if(e===void 0)return[F1(t,"",!1,n)];const r=fE(e,t);return r.length===0?[F1(t,"",!1,n)]:r.map(i=>F1(i.key,i.value,!0,n))}function fE(t,e){return t===void 0?[]:t===null?[{key:e,value:""}]:Array.isArray(t)?t.flatMap((n,r)=>n!==null&&typeof n=="object"?fE(n,`${e}[${r}]`):[{key:e,value:String(n)}]):XIe(t)?Object.entries(t).flatMap(([n,r])=>fE(r,`${e}[${n}]`)):[{key:e,value:String(t)}]}function XIe(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function F1(t,e,n,r){return{id:crypto.randomUUID(),key:t,value:n6(e),active:n,in:"query",...r&&{allowReserved:r}}}const O6={path:"path",query:"query",header:"headers",cookie:"cookie"};function uQ(t){return t!==void 0}function UIe(t,e){if(t)return nx.isDirectConfigureRequestValues(t)?t:t[e]}function YM(t,e,n){const r=n[O6[e]],i=n.envVariables,s=new Set;for(const o of t??[])(r?.[o.name]||i?.[o.name])&&s.add(o.name);return s}function $f(t,e,n){if(nx.isDirectConfigureRequestValues(n))return YM(t,e,n);const r=new Set;for(const i of Object.values(n))if(i)for(const s of YM(t,e,i))r.add(s);return r}function GM(t,e,n){const r=n.query,i=n.envVariables;for(const s of e??[]){const o=g6(s);for(const a of o)(r?.[a.name]||i?.[a.name])&&t.add(a.name);for(const a of[...Object.keys(r??{}),...Object.keys(i??{})])!r?.[a]&&!i?.[a]||o.some(l=>a===l.name||a.startsWith(`${l.name}[`))&&t.add(a)}}function v6(t,e,n){const r=[...t??[],...e??[]],i=new Set($f(r,"query",n));if(nx.isDirectConfigureRequestValues(n))return GM(i,e,n),i;for(const s of Object.values(n))s&&GM(i,e,s);return i}function dQ(t=[],e){const n={};return t.forEach(r=>{const i=String(r[e]);n[i]||(n[i]=[]),n[i].push(r)}),n}function qIe(t){return t.replace(/{/g,"{{").replace(/}/g,"}}")}var gs=(t=>(t.Query="Query",t.Header="Header",t.Cookie="Cookie",t))(gs||{});const hE={documentedOAuth2Types:[],grantType:ae.ClientCredentials,authRequestExtraParams:[],tokenRequestExtraParams:[],[ae.ClientCredentials]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[],accessToken:""},[ae.ClientCredentialsWithJwtAssertion]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[],accessToken:""},[ae.AuthorizationCode]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],codeVerifier:"",codeChallenge:"",accessToken:""},[ae.AuthorizationCodeWithPkce]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],codeVerifier:"",codeChallenge:"",accessToken:""},[ae.Implicit]:{clientId:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],accessToken:""},[ae.Password]:{username:"",password:"",clientId:"",clientSecret:"",tokenUrl:"",accessToken:"",scopes:[]}},FIe={securityType:ne.NoAuth,securitySchemeId:null,[ne.BasicAuth]:{username:"",password:""},[ne.JWT]:{token:""},[ne.DigestAuth]:{username:"",password:"",nc:"00000001",realm:"",nonce:"",opaque:"",qop:"",algorithm:"",cnonce:""},[ne.APIKey]:{location:gs.Header,name:"",key:""},[ne.OAuth2]:hE,[ne.OpenIDConnect]:{...hE,openIdConnectUrl:"",userInfoUrl:""}},WIe={clientCredentials:ae.ClientCredentials,clientCredentialsWithJwtAssertion:ae.ClientCredentialsWithJwtAssertion,authorizationCode:ae.AuthorizationCode,authorizationCodeWithPkce:ae.AuthorizationCodeWithPkce,implicit:ae.Implicit,password:ae.Password},$0="urn:ietf:params:oauth:client-assertion-type:jwt-bearer";var Xr=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(Xr||{});const ZIe={[Xr.SIMPLE]:{condition:"",type:Xr.SIMPLE},[Xr.REGEX]:{condition:"",type:Xr.REGEX,context:""},[Xr.JSONPATH]:{condition:"",type:Xr.JSONPATH,context:""},[Xr.XPATH]:{condition:"",type:Xr.XPATH,context:""}};function ch(){return structuredClone({type:Hn.Text,content:"",activeExampleName:"",formData:{"multipart/form-data":[],"application/x-www-form-urlencoded":[]},binary:null})}const BIe={method:"GET",url:"",security:[oo()],body:ch(),queryParameters:[],headers:[],cookies:[],pathParameters:[]};function y6(){return structuredClone(BIe)}function oo(){return Ra(FIe)}function b6(t){return Ra({id:crypto.randomUUID(),...ZIe[t]})}function x6(t){return!t||typeof t!="object"?[]:Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:e,value:typeof n=="string"?n:JSON.stringify(n),active:!0,type:"text",files:null}))}function pE(t){return typeof t!="string"?JSON.stringify(t,null,2):t}function S6(t){let e=t;if(typeof e=="string")try{e=JSON.parse(e)}catch{return}if(!e||typeof e!="object"||Array.isArray(e))return;const n=e;return typeof n.query=="string"?n:void 0}function Ol(t){const e=S6(t);return e?{query:e.query,variables:e.variables===void 0?"":pE(e.variables)}:{query:pE(t),variables:""}}function A0(t,e){return JSON.stringify({query:t,variables:e})}function w6(t){if(t.trim())try{const e=JSON.parse(t);return typeof e=="string"?t:e}catch{return t}}function YIe(t){const e=S6(t);return!e||typeof e.variables!="string"?t:JSON.stringify({...e,variables:w6(e.variables)},null,2)}function T6(t,e,n){for(const r of n){const i=HM(t,r),s=HM(e,r);if(typeof i=="object"&&typeof s=="object"){if(!T6(i,s,n))return!1}else if(i!==s)return!1}return!0}function HM(t,e){const n=e.split("/");let r=t;for(const i of n)if(r&&typeof r=="object"&&i in r)r=r[i];else return;return r}function GIe(t,e){return t.length===e.length&&t.sort().join()===e.sort().join()}function HIe(t,e){return t.every(n=>e.includes(n))}function JIe(t){switch(t){case"query":return gs.Query;case"cookie":return gs.Cookie;case"header":return gs.Header;default:return}}function KIe(t,e,n){const{security:r}=e,i=t?.inputs??[];if(!n)return!1;const s=hS(n),o=s.map(c=>c.securityType),a=r.map(c=>c.securityType);return GIe(o,a)?!r.every(c=>{const u=c.securityType,f=c[ne.OAuth2]?.grantType,h=o.includes(u),p=s.find(v=>v.securityType===u),m=!p||T6(c,p,t$e(u,f)),g=e$e(c,u,c[ne.OAuth2]?.grantType,i),O=!!(h&&p&&m&&g);return!n.security?.length||O}):!0}function e$e(t,e,n,r){if(e===ne.OAuth2&&(n===ae.AuthorizationCode||n===ae.AuthorizationCodeWithPkce||n===ae.Implicit)){const i=t[ne.OAuth2][n]?.availableScopes,s=fS(t[ne.OAuth2][n]?.scopes,r);return HIe(s,i)}return!0}function t$e(t,e){return t===ne.APIKey?[`${ne.APIKey}/name`,`${ne.APIKey}/location`]:t===ne.OAuth2?[`${ne.OAuth2}/grantType`,...n$e(e)]:t===ne.OpenIDConnect?[`${ne.OpenIDConnect}/openIdConnectUrl`]:[]}function n$e(t){return t===ae.ClientCredentials?[`${ne.OAuth2}/${ae.ClientCredentials}/tokenUrl`]:t===ae.Password?[`${ne.OAuth2}/${ae.Password}/tokenUrl`]:t===ae.Implicit?[`${ne.OAuth2}/${ae.Implicit}/authorizationUrl`]:t===ae.AuthorizationCode?[`${ne.OAuth2}/${ae.AuthorizationCode}/tokenUrl`,`${ne.OAuth2}/${ae.AuthorizationCode}/authorizationUrl`]:t===ae.AuthorizationCodeWithPkce?[`${ne.OAuth2}/${ae.AuthorizationCodeWithPkce}/tokenUrl`,`${ne.OAuth2}/${ae.AuthorizationCodeWithPkce}/authorizationUrl`]:[]}function r$e(t){return t.map(e=>{const n=e.map(r=>r.id).join("_");return e.map(r=>({...r,schemeId:n}))})}function i$e(t){const e=t.security||[],n=e.map(r=>{let i="";const s=[];return r.forEach((o,a)=>{i=a===0?`${o.id}`:`${i}_${o.id}`,s.push(hQ(o))}),{id:i,security:s}});return e.length?n:[]}function s$e(t,e){const n=t.security||[];return n?.length?Q6(n).map((r,i)=>hQ(r)):[]}function C6(t){if(!(t.securityType!==ne.NoAuth||!t.securitySchemeId))return t.unsupportedScheme}function hS(t){const n=(t.security||[])[0];return n?n.map(r=>hQ(r)):[oo()]}const o$e={[ne.OAuth2]:"oauth2",[ne.OpenIDConnect]:"openIdConnect",[ne.APIKey]:"apiKey",[ne.JWT]:"http-bearer"};function a$e(t){return o$e[t]}function l$e(t){const e=fQ(t);return(e?[...ls(e)][0]:void 0)??c$e(t)}function c$e(t){const e=t.securitySchemeId;if(e){if(t.securityType===ne.JWT)return e+rt.SecurityVariablesEnvSuffix.JWTToken;if(t.securityType===ne.APIKey)return e+rt.SecurityVariablesEnvSuffix.APIKey;if(t.securityType===ne.OAuth2||t.securityType===ne.OpenIDConnect)return e+rt.SecurityVariablesEnvSuffix.Token}}function u$e(t,e){const n=fQ(t);if(!n)return"";const r=[...ls(n)][0];return r?e.find(i=>i.name===r)?.value??"":n}function JM(t,e){if(t.securityType===ne.JWT)return{...t,[ne.JWT]:{...t[ne.JWT],token:e}};if(t.securityType===ne.APIKey)return{...t,[ne.APIKey]:{...t[ne.APIKey],key:e}};if(t.securityType===ne.OAuth2||t.securityType===ne.OpenIDConnect){const n=t.securityType,r=t[n],i=r.grantType;return{...t,[n]:{...r,[i]:{...r[i],accessToken:e}}}}return t}function fQ(t){if(t.securityType===ne.JWT)return t[ne.JWT].token;if(t.securityType===ne.APIKey)return t[ne.APIKey].key;if(t.securityType===ne.OAuth2){const e=t[ne.OAuth2];return e[e.grantType]?.accessToken}if(t.securityType===ne.OpenIDConnect){const e=t[ne.OpenIDConnect];return e[e.grantType]?.accessToken}}function hQ(t,e){const n={...oo(),securitySchemeId:t.id},r=pS(t);n.securityType=r,n.unsupportedScheme=r===ne.NoAuth?t.scheme||t.type:void 0;const i=t.id;if(t.id&&r!==ne.NoAuth&&(n[r].schemeName=t.id),r===ne.BasicAuth&&(n[ne.BasicAuth].username||(n[ne.BasicAuth].username=Nn(i+rt.SecurityVariablesEnvSuffix.Username)),n[ne.BasicAuth].password||(n[ne.BasicAuth].password=Nn(i+rt.SecurityVariablesEnvSuffix.Password))),r===ne.DigestAuth&&(n[ne.DigestAuth].username||(n[ne.DigestAuth].username=Nn(i+rt.SecurityVariablesEnvSuffix.Username)),n[ne.DigestAuth].password||(n[ne.DigestAuth].password=Nn(i+rt.SecurityVariablesEnvSuffix.Password))),r===ne.JWT&&!n[ne.JWT].token&&(n[ne.JWT].token=Nn(i+rt.SecurityVariablesEnvSuffix.JWTToken)),r===ne.APIKey&&!n[ne.APIKey].key){n[ne.APIKey].name=t.name||"",n[ne.APIKey].key=Nn(i+rt.SecurityVariablesEnvSuffix.APIKey);const s=JIe(t.in);s&&(n[ne.APIKey].location=s)}if(r===ne.OAuth2){const s=mQ(t),o=Nn(i+rt.SecurityVariablesEnvSuffix.Token),a=n[ne.OAuth2];a.grantType=s[0],s.forEach(l=>{l===ae.AuthorizationCode&&!a[ae.AuthorizationCode].accessToken&&(a[ae.AuthorizationCode].accessToken=o,a[ae.AuthorizationCode].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[ae.AuthorizationCode].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[ae.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[ae.AuthorizationCode].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[ae.AuthorizationCode].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[ae.AuthorizationCode].scopes=[...rc(t.flows?.authorizationCode?.scopes||{})||[]]),l===ae.AuthorizationCodeWithPkce&&!a[ae.AuthorizationCodeWithPkce].accessToken&&(a[ae.AuthorizationCodeWithPkce].accessToken=o,a[ae.AuthorizationCodeWithPkce].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[ae.AuthorizationCodeWithPkce].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[ae.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[ae.AuthorizationCodeWithPkce].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[ae.AuthorizationCodeWithPkce].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[ae.AuthorizationCodeWithPkce].scopes=[...rc(t.flows?.authorizationCode?.scopes||{})]),l===ae.ClientCredentials&&!a[ae.ClientCredentials].accessToken&&(a[ae.ClientCredentials].accessToken=o,a[ae.ClientCredentials].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[ae.ClientCredentials].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[ae.ClientCredentials].tokenUrl=t.flows?.clientCredentials?.tokenUrl||"",a[ae.ClientCredentials].scopes=[...rc(t.flows?.clientCredentials?.scopes||{})]),l===ae.ClientCredentialsWithJwtAssertion&&!a[ae.ClientCredentialsWithJwtAssertion].accessToken&&(a[ae.ClientCredentialsWithJwtAssertion].accessToken=o,a[ae.ClientCredentialsWithJwtAssertion].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[ae.ClientCredentialsWithJwtAssertion].clientAssertion=Nn(i+rt.SecurityVariablesEnvSuffix.ClientAssertion),a[ae.ClientCredentialsWithJwtAssertion].scopes=[...rc(t.flows?.clientCredentials?.scopes||{})]),l===ae.Implicit&&!a[ae.Implicit].accessToken&&(a[ae.Implicit].accessToken=o,a[ae.Implicit].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[ae.Implicit].authorizationUrl=t.flows?.implicit?.authorizationUrl||"",a[ae.Implicit].availableScopes=Object.keys(t.flows?.implicit?.scopes||{})||[],a[ae.Implicit].scopes=[...rc(t.flows?.implicit?.scopes||{})]),l===ae.Password&&!a[ae.Password].accessToken&&(a[ae.Password].accessToken=o,a[ae.Password].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[ae.Password].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[ae.Password].tokenUrl=t.flows?.password?.tokenUrl||"",a[ae.Password].scopes=[...rc(t.flows?.password?.scopes||{})])})}if(r===ne.OpenIDConnect){const s=Nn(i+rt.SecurityVariablesEnvSuffix.Token),o=n[ne.OpenIDConnect];o[ae.AuthorizationCode].accessToken||(o[ae.AuthorizationCode].accessToken=s,o[ae.AuthorizationCode].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),o[ae.AuthorizationCode].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),o[ae.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),o[ae.AuthorizationCodeWithPkce].accessToken||(o[ae.AuthorizationCodeWithPkce].accessToken=s,o[ae.AuthorizationCodeWithPkce].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),o[ae.AuthorizationCodeWithPkce].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),o[ae.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),o[ae.Implicit].accessToken||(o[ae.Implicit].accessToken=s,o[ae.Implicit].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId))}return n}function pQ(t){try{const e=JSON.parse(t);return JSON.stringify(e,null,2)}catch(e){return console.error({error:e}),t}}function P6(t,e){return t==="application/json"&&!!e}function k6(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function d$e(t){try{const e=JSON.stringify(t);return e===void 0?"undefined":e}catch{return String(t)}}function E6(t,e){return e&&e.length>0?m6(e):va(t||[],{})}function f$e(t,e,n){if(e&&e.length>0){const r=m6(e);return h$e(r,n)}return va(t||[],{boundNames:n})}function h$e(t,e){return t.map(n=>!n.key||!e.has(n.key)?n:{...n,value:`$inputs.${n.key}`,active:!0})}function p$e(t,e=!1,n="",r){const i=dQ(t.parameters,"in"),s=I6(t),o=hS(t),a=E6(i.query,i.querystring);return{id:crypto.randomUUID(),name:t.name,operationId:t.operationId,collectionPath:r,apiPath:{path:t.path,method:t.method},apiId:n,isAdditionalOperation:e,request:{pathParameters:va(i.path||[],{}),method:t.method.toLowerCase()==="x-query"?"QUERY":t.method.toLocaleUpperCase(),url:yO(qIe(t.path),a),headers:va(i.header||[],{}),queryParameters:a,cookies:va(i.cookie||[],{}),body:s,security:o},response:null}}function gQ(t,e){const n=dQ(t.parameters,"in"),r=I6(t),i=hS(t),s=va(n.path||[],{boundNames:"all"});return e?{parameters:{pathParameters:s,queryParameters:f$e(n.query,n.querystring,v6(n.query,n.querystring,e)),headers:va(n.header||[],{boundNames:$f(n.header,"header",e)}),cookies:va(n.cookie||[],{boundNames:$f(n.cookie,"cookie",e)})},requestBody:r,security:i}:{parameters:{pathParameters:s,queryParameters:E6(n.query,n.querystring),headers:va(n.header||[],{}),cookies:va(n.cookie||[],{})},requestBody:r,security:i}}function g$e(t,e){const n=new Ts({format:!0});if(typeof t=="string")return e?.includes("json")?pQ(t):t;if(typeof t=="object"&&t!==null&&e?.includes("xml")){const i=Array.isArray(t)?t:{root:t};return n.build(i)}return JSON.stringify(t,null,2)}function m$e(t){return fA.includes(t)}function I6(t){const e=t.body?.mediaTypes;if(!e||!Object.keys(e).length)return ch();const n=b$e(e,t),r=n?.name||"",i=m$e(r),s=!i&&!I7.includes(r),o=gE(n),l=o.find(({key:f})=>f===t.body?.activeExampleName)?.value??o[0]?.value,c=s&&l?g$e(l,r):"",u={"multipart/form-data":KM(e["multipart/form-data"]),"application/x-www-form-urlencoded":KM(e["application/x-www-form-urlencoded"])};if(i&&l){const f=x6(l);f.length&&(u[r]=f)}return{...ch(),activeExampleName:t.body?.activeExampleName||o[0]?.key||"",...n&&{type:n.name},content:c,formData:u}}const O$e={[Ke.GraphqlJSON]:"graphql"};function zh(t,e){const n=O$e[t];return!n||e?.[n]===!0}function $6(t,e){return zh(t,e)?dc[t]:void 0}function A6(t,e){const n=Object.fromEntries(Object.entries(dc).filter(([r])=>zh(r,e)));return t?{...v$e(t),...n}:n}function v$e(t){return Object.keys(t.body?.mediaTypes||{}).reduce((e,n)=>(e[n]={name:n,extensions:void 0},e),{})}function KM(t){return t?t.parameters?t.parameters.map(e=>({id:crypto.randomUUID(),key:e.name,value:String(e.example)||"",active:!0,type:e.inputType,files:null})):[]:[]}const y$e="Untitled example";function gE(t){const e=t?.examples;return Object.keys(e||{}).map(n=>{const r=e?.[n];return{name:(vh.isString(r?.summary)?r?.summary:r?.summary?.raw)?.trim()||n||y$e,key:n,value:e?.[n].value}})}function b$e(t,e){const n=A6(e),r=Object.keys(t).find(i=>!!n[i]);return r?t[r]:null}function x$e(t){return!t?.security?.length||!t?[]:s$e(t)}function Q6(t){const e=new Set;return t.flat().filter(n=>e.has(n.id)?!1:(e.add(n.id),!0))}function pS(t){if(t.type==="http"){const e=t.scheme?.toLowerCase();if(e==="bearer")return ne.JWT;if(e==="basic")return ne.BasicAuth;if(e==="digest")return ne.DigestAuth}else{if(t.type==="apiKey")return ne.APIKey;if(t.type==="oauth2")return ne.OAuth2;if(t.type==="openIdConnect")return ne.OpenIDConnect}return ne.NoAuth}function S$e(t,e){if(t==="clientCredentials"&&e&&"x-assertionType"in e&&e["x-assertionType"]===$0)return ae.ClientCredentialsWithJwtAssertion;if(t==="authorizationCode"&&e&&"x-usePkce"in e&&e["x-usePkce"])return ae.AuthorizationCodeWithPkce;switch(t){case"implicit":return ae.Implicit;case"password":return ae.Password;case"clientCredentials":return ae.ClientCredentials;case"authorizationCode":return ae.AuthorizationCode;default:return ae.AuthorizationCode}}function w$e(t,e){const n=t?.security;if(!n?.length)return[];const s=r$e(n).flat().filter(o=>o.schemeId===e).find(o=>pS(o)===ne.OAuth2);return mQ(s)}function mQ(t){return Object.entries(t?.flows||{}).map(([e,n])=>S$e(e,n)).filter(Boolean)}function gS(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function zs(t){try{return new URL(t),!0}catch{return!1}}function T$e(t,e){let n;if(e.startsWith("//")){const{protocol:r}=new URL(t);n=`${r||"https:"}${e}`}else if(DB(e))n=e;else if(!e.startsWith("/"))n=sE(t)+"/"+e;else{const r=new URL(t);r.pathname=e,n=r.toString()}return sE(n)}function eV(t,e){let n=t;return e.forEach(({key:r,value:i,active:s})=>{i&&s&&(n=n.replaceAll(`{${r}}`,i))}),n}function R6(t,e){let n=t;return e.forEach(({name:r,value:i})=>{i&&(n=n.replaceAll(`{${r}}`,i))}),n}function C$e(t){return t.startsWith("http://")||t.startsWith("https://")}function Nv({url:t,serverUrl:e,corsProxyUrl:n}){let r;if(C$e(t)||!e)r=t;else{const i=new URL(e);i.pathname=t,i.search="",i.hash="",r=i.toString()}return n?`${n}${r}`:r}const _6="New Step";function mE({name:t=_6,workflow:e}={}){let n=t.replaceAll(" ","-");if(!e)return n;const r=P$e(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function P$e(t){return t.steps.filter(e=>e.state!==zt.Draft).map(e=>e.stepId)}function ja({name:t=_6,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:s,dynamicReplayValues:o,xOperation:a}={}){if(!n){const c=s?gQ(s,o):null,u=[oo()];return{stepId:mE({name:t,workflow:r}),description:t,outputs:[],successCriteria:[],state:e?zt.Draft:zt.Normal,parameters:{pathParameters:[],queryParameters:a?bO(a.url):[],headers:[],cookies:[]},requestBody:ch(),xOperation:a??(i?null:{method:"GET",url:""}),security:u,operation:i??null,...c}}const l=n;return{stepId:mE({name:t,workflow:r}),description:l.description,outputs:l.outputs,successCriteria:l.successCriteria,state:e?zt.Draft:zt.Normal,parameters:l.parameters,requestBody:l.requestBody,xOperation:l.xOperation,security:l.security,operation:l.operation}}function Ac(t){return t.xOperation?.method??t.operation?.method??""}function Fu(t){return t.xOperation?.url??t.operation?.path??""}function mS(t,e,n,r,i){const{inputs:s,servers:o}=r,a=SIe(Oc("path",[Vn(e?.parameters.pathParameters,n?.components.parameters),Vn(t.parameters.pathParameters,n?.components.parameters)]),r.inputs,i),l=t.xOperation??null,c=t.operation??null;let u="",f="";if(l)f=l.method,u=eV(l.url,a);else if(c){const m=o.find(O=>O.apiId===c.apiId);f=c.method==="x-query"?"query":c.method,u=(m?.value?R6(m.value,m.variables):"")+eV(c.path,a)}const h=u.split("?")[0];return{url:If(h,s,i??{}),method:f.toUpperCase()}}function k$e(){return structuredClone({id:crypto.randomUUID(),state:Qn.Normal,data:{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Xe.Step,draftStep:ja(),response:null,activeTabIdx:0,requestError:null,isProcessingRequest:!1}})}function E$e(t){return t?.data?.type===Xe.Step}function I$e(t,e){const{collectionId:n,workflowId:r,stepId:i}=e,s=e.draftStep??null;return n&&r&&i?vO(t,{collectionId:n,workflowId:r,stepId:i})??s:s}function $$e(t,e,n,r,i,s){const o=a=>a??"";return o(t)===r&&o(e)===i&&o(n)===s}const OE="New workflow";function j6({name:t=OE,collection:e}){let r=(t.trim().replace(/[^a-zA-Z0-9\-_\s]/g,"").replace(/\s+/g," ")||OE).replaceAll(" ","-").toLowerCase();if(!e)return r;const i=A$e(e);if(i.includes(r)){let s=1;for(;i.includes(`${r}-${s}`);)s++;r=`${r}-${s}`}return r}function A$e(t){return t.workflows.filter(e=>e.state!==zt.Draft).map(e=>e.workflowId)}function OQ({name:t=OE,isDraft:e=!1,collection:n}={}){return{workflowId:j6({name:t,collection:n}),summary:t,steps:[],state:e?zt.Draft:zt.Normal,outputs:[],parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},security:[oo()]}}function Q$e(t,e,n){const r=new Set,i=e?.components.parameters,{pathParameters:s,queryParameters:o,headers:a,cookies:l}=t.parameters,c=t.outputs;for(const{value:u}of[...Vn([...s,...o,...a,...l],i),...c])for(const f of ls(u))r.add(f);return t.steps.forEach(u=>{const f=u.security;for(const b of f)switch(b.securityType){case ne.BasicAuth:case ne.DigestAuth:for(const y of[b[b.securityType].username,b[b.securityType].password])for(const w of ls(y))r.add(w);break;case ne.JWT:for(const y of ls(b[b.securityType].token))r.add(y);break;case ne.APIKey:for(const y of ls(b[b.securityType].key))r.add(y);break;case ne.OAuth2:case ne.OpenIDConnect:{const y=b[b.securityType];for(const w of ls(y[y.grantType].accessToken))r.add(w);break}}const{pathParameters:h,queryParameters:p,headers:m,cookies:g}=u.parameters,O=u.outputs;for(const{value:b}of[...Vn([...h,...p,...m,...g],i),...O])for(const y of ls(b))r.add(y);const v=u.requestBody;switch(v.type){case Ke.FormData:case Ke.UrlEncoded:{for(const{value:b}of v.formData[v.type])for(const y of ls(b))r.add(y);break}case Ke.Binary:break;case Ke.GraphqlJSON:{const{query:b,variables:y}=zh(Ke.GraphqlJSON,n)?Ol(v.content):{query:v.content,variables:""};for(const w of[b,y])for(const S of ls(w))r.add(S);break}default:for(const b of ls(v.content))r.add(b)}}),r}function N6(t,e,n,r,i){const s=Q$e(t,n,i);if(s.size===0){r(({inputs:o,...a})=>a);return}r(o=>{const a=o.inputs,l=typeof a=="object"&&a?.properties||{};return{...o,inputs:{type:"object",properties:Object.fromEntries(Array.from(s).map(c=>{const u=e.inputs.find(f=>f.name===c)?.isSecret;return[c,u?{type:"string",format:"password"}:l[c]||{type:"string"}]}))}}})}function Xh(t){return t.summary||t.workflowId||"Untitled Workflow"}function D6(t){return t.flatMap(e=>{const n=e.id,r=e.paths??{};return Object.keys(r).flatMap(i=>{const s=r[i]??{},o=Object.keys(s).filter(c=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(c.toLowerCase())).map(c=>{const u=s[c];return{apiId:n,path:i,method:c,operationId:u?.operationId||"",summary:u?.summary,isAdditionalOperation:!1}}),a=s.additionalOperations,l=a?Object.entries(a).map(([c,u])=>({apiId:n,path:i,method:c,operationId:u.operationId||"",summary:u.summary,isAdditionalOperation:!0})):[];return[...o,...l]})})}const OS=(t,e,n)=>{if(!e)return null;const{apiId:r,method:i,path:s}=e,o=t.find(l=>l.id===r);if(!o)return null;if(n)try{return n(s,i,o)??null}catch(l){console.error("Failed to convert operation to replay value",l)}const a=o.paths?.[s]?.[i];return a?{id:a.operationId??"",name:a.summary??"",method:i,path:s,href:"",operationId:a.operationId,parameters:[],servers:[],security:[]}:null};function vS(t){const e=qo(),{convertOperationToReplayValue:n}=Wn();return x.useMemo(()=>OS(e,t,n),[e,t,n])}function vQ(){const t=SA(),{convertOperationToReplayValue:e}=Wn();return{getApiOperation:x.useCallback(r=>OS(t(),r,e),[t,e])}}function M6(t){const e=(t.match(new RegExp("\\{(?<!\\{[^}]*?\\{)([^}]+)\\}","g"))||[]).map(n=>n.slice(1,-1));return Array.from(new Set(e))}function R$e(t){const e=t.servers?.[0];if(!e)return{url:"",variables:[]};const n=e.url,i=M6(n).map(s=>({name:s,value:e.variables?.[s]?.default||""}));return{url:n,variables:i}}function V6(){const t=SA(),e=so();function n(r){const i=t().find(a=>a.id===r);if(!i){console.error(`API ${r} not found`);return}const{url:s,variables:o}=R$e(i);e(a=>{let l=!1;const c=a.map(u=>u.servers.some(f=>f.apiId===r)?u:(l=!0,{...u,servers:[...u.servers,{apiId:r,value:s,variables:o}]}));return l?c:a})}return{attachApiServerToEnvironments:n}}class sn{static utils=null;static async getUtils(){return sn.utils||(sn.utils=Rn()?await Promise.resolve().then(()=>require("./replay-tauri-path-CxsepUAD.js")):{join:nc.join,resolve:nc.resolve,isAbsolute:nc.isAbsolute,relative:nc.relative,extname:nc.extname,dirname:nc.dirname}),sn.utils}static async dirname(e){return(await sn.getUtils()).dirname(e)}static async join(...e){return(await sn.getUtils()).join(...e)}static async resolve(e){return(await sn.getUtils()).resolve(e)}static async isAbsolute(e){return(await sn.getUtils()).isAbsolute(e)}static async relative(e,n){return(await sn.getUtils()).relative(e,n)}static async extname(e){return(await sn.getUtils()).extname(e)}}function _$e({apiName:t="new-api-source",sourceDescriptions:e}){let n=t.replaceAll(/[\s.]/g,"-").toLowerCase();if(!e.length)return n;const r=e.map(i=>i.name);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function tV(t,e){return`${t}\0${e}`}function ud(){const t=lS(),e=qa(),n=SA(),{attachApiServerToEnvironments:r}=V6();async function i({collectionId:l,apiId:c}){const u=ah(t(),l);if(!u)return;if(!u.sourceDescriptions.some(h=>h.apiId===c)){const p=n().find(g=>g.id===c)?.info.title,m=zs(c)?c:await sn.relative(`/${l}/..`,`/${c}`);e(g=>Xi(g,l,O=>O.sourceDescriptions.some(v=>v.apiId===c)?O:{...O,sourceDescriptions:[...O.sourceDescriptions,{name:_$e({apiName:p,sourceDescriptions:O.sourceDescriptions}),url:m,apiId:c}]}))}r(c)}function s(l){return ah(t(),l)}function o(l,c){e(u=>Xi(u,l,f=>({...f,sourceDescriptions:f.sourceDescriptions.filter(h=>c.name!==h.name)})))}function a(l,c){const u=new Set(c.map(f=>tV(f.workflowId??"",f.stepId)));e(f=>Xi(f,l,h=>{const p=h.workflows.map(m=>{const g=m.steps.map(O=>!u.has(tV(m.workflowId,O.stepId))||!O.operation?O:{...O,xOperation:{method:O.operation.method,url:O.operation.path},operation:null});return g.every((O,v)=>O===m.steps[v])?m:{...m,steps:g}});return p.every((m,g)=>m===h.workflows[g])?h:{...h,workflows:p}}))}return{attachApiToCollection:i,getCollection:s,removeSourceDescription:o,disconnectStepsFromSource:a}}class nV{storage;constructor(e){this.storage=e}async initialize(){await this.storage.initialize()}getAll(e){return this.storage.read(e)}getRecent(e=50,n){return this.storage.getRecent(e,n)}getById(e){return this.storage.getById(e)}addItem(e){return this.storage.addItem(e)}updateItem(e,n){return this.storage.updateItem(e,n)}deleteItem(e){return this.storage.deleteItem(e)}clear(){return this.storage.clear()}count(e){return this.storage.count(e)}}const vE=(t,e)=>e.some(n=>t instanceof n);let rV,iV;function j$e(){return rV||(rV=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function N$e(){return iV||(iV=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const yE=new WeakMap,W1=new WeakMap,yS=new WeakMap;function D$e(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(Eu(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return yS.set(e,t),e}function M$e(t){if(yE.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});yE.set(t,e)}let bE={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return yE.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Eu(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function L6(t){bE=t(bE)}function V$e(t){return N$e().includes(t)?function(...e){return t.apply(xE(this),e),Eu(this.request)}:function(...e){return Eu(t.apply(xE(this),e))}}function L$e(t){return typeof t=="function"?V$e(t):(t instanceof IDBTransaction&&M$e(t),vE(t,j$e())?new Proxy(t,bE):t)}function Eu(t){if(t instanceof IDBRequest)return D$e(t);if(W1.has(t))return W1.get(t);const e=L$e(t);return e!==t&&(W1.set(t,e),yS.set(e,t)),e}const xE=t=>yS.get(t);function z$e(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=Eu(o);return r&&o.addEventListener("upgradeneeded",l=>{r(Eu(o.result),l.oldVersion,l.newVersion,Eu(o.transaction),l)}),n&&o.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{s&&l.addEventListener("close",()=>s()),i&&l.addEventListener("versionchange",c=>i(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const X$e=["get","getKey","getAll","getAllKeys","count"],U$e=["put","add","delete","clear"],Z1=new Map;function sV(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Z1.get(e))return Z1.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=U$e.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||X$e.includes(n)))return;const s=async function(o,...a){const l=this.transaction(o,i?"readwrite":"readonly");let c=l.store;return r&&(c=c.index(a.shift())),(await Promise.all([c[n](...a),i&&l.done]))[0]};return Z1.set(e,s),s}L6(t=>({...t,get:(e,n,r)=>sV(e,n)||t.get(e,n,r),has:(e,n)=>!!sV(e,n)||t.has(e,n)}));const q$e=["continue","continuePrimaryKey","advance"],oV={},SE=new WeakMap,z6=new WeakMap,F$e={get(t,e){if(!q$e.includes(e))return t[e];let n=oV[e];return n||(n=oV[e]=function(...r){SE.set(this,z6.get(this)[e](...r))}),n}};async function*W$e(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const n=new Proxy(e,F$e);for(z6.set(n,e),yS.set(n,xE(e));e;)yield n,e=await(SE.get(n)||e.continue()),SE.delete(n)}function aV(t,e){return e===Symbol.asyncIterator&&vE(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&vE(t,[IDBIndex,IDBObjectStore])}L6(t=>({...t,get(e,n,r){return aV(e,n)?W$e:t.get(e,n,r)},has(e,n){return aV(e,n)||t.has(e,n)}}));class yQ{constructor(e,n,r){this.dbName=e,this.version=n,this.setupCallback=r}dbName;version;setupCallback;db=null;static createInstance(e,n,r){return new yQ(e,n,r)}async initialize(){this.db||(this.db=await z$e(this.dbName,this.version,{upgrade:e=>{this.setupCallback(e)}}))}async close(){this.db&&(this.db.close(),this.db=null)}}const Z$e=1;class bQ{constructor(e){this.indexedDB=e}indexedDB;static create(e){const n=`replay-history-${e}`,r=yQ.createInstance(n,Z$e,this.setupDatabase);return new bQ(r)}static setupDatabase(e){if(!e.objectStoreNames.contains("history")){const n=e.createObjectStore("history",{keyPath:"id"});n.createIndex("by-date","date"),n.createIndex("by-type","type"),n.createIndex("by-workflow","workflowId")}}get storeName(){return"history"}async getDb(){return await this.indexedDB.initialize(),this.indexedDB.db}async initialize(){await this.indexedDB.initialize()}async read(e){const r=(await this.getDb()).transaction(this.storeName,"readonly"),i=e?.type?await r.store.index("by-type").getAll(e.type):await r.store.index("by-date").getAll();return await r.done,i.sort((s,o)=>o.date-s.date)}async addItem(e){await(await this.getDb()).put(this.storeName,e)}async updateItem(e,n){const r=await this.getDb(),i=await r.get(this.storeName,e);if(i){const{id:s,type:o,...a}=n;await r.put(this.storeName,{...i,...a})}}async deleteItem(e){await(await this.getDb()).delete(this.storeName,e)}async clear(){await(await this.getDb()).clear(this.storeName)}async getById(e){return await(await this.getDb()).get(this.storeName,e)||null}async getRecent(e,n){const i=(await this.getDb()).transaction(this.storeName,"readonly"),s=n?.type?await i.store.index("by-type").getAll(n.type):await i.store.index("by-date").getAll();return await i.done,s.sort((o,a)=>a.date-o.date).slice(0,e)}async count(e){const n=await this.getDb();if(e?.type){const r=n.transaction(this.storeName,"readonly"),i=await r.store.index("by-type").count(e.type);return await r.done,i}return await n.count(this.storeName)}}class vc{static instance=null;static async initialize(e,n){this.close(),this.instance=await B$e(e,n)}static getInstance(){if(!this.instance)throw new Error("HistoryService not initialized");return this.instance}static close(){this.instance=null}}async function B$e(t,e){if(e){const{HistorySqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-HistorySqliteDBStorage-BrILW8Fu.js")),r=Cm.getInstance(),i=new n(r);return new nV(i)}else{const n=bQ.create(t.id);return new nV(n)}}const ui={all:["history"],lists:()=>[...ui.all,"list"],list:t=>[...ui.lists(),t],recent:(t,e)=>[...ui.all,"recent",t,e],detail:t=>[...ui.all,"detail",t],count:t=>[...ui.all,"count",t]};function Y$e(t){return ki.useQuery({queryKey:ui.list(t),queryFn:async()=>vc.getInstance().getAll(t)})}function X6(){const t=ki.useQueryClient();return ki.useMutation({mutationFn:async e=>{await vc.getInstance().addItem(e)},onMutate:e=>{t.setQueryData(ui.detail(e.id),e)},onSuccess:()=>{t.invalidateQueries({queryKey:ui.lists()}),t.invalidateQueries({queryKey:ui.count()})},onError:(e,n)=>{t.removeQueries({queryKey:ui.detail(n.id)}),console.error("Failed to add history item:",e)}})}function G$e(){const t=ki.useQueryClient();return ki.useMutation({mutationFn:async e=>{await vc.getInstance().deleteItem(e)},onSuccess:(e,n)=>{t.removeQueries({queryKey:ui.detail(n)}),t.invalidateQueries({queryKey:ui.lists()}),t.invalidateQueries({queryKey:ui.count()})},onError:(e,n)=>{console.error(`Failed to delete history item ${n}:`,e)}})}function H$e(){const t=ki.useQueryClient();return ki.useMutation({mutationFn:async()=>{await vc.getInstance().clear()},onSuccess:()=>{t.invalidateQueries({queryKey:ui.all})},onError:e=>{console.error("Failed to clear history:",e)}})}function J$e(t){return t?{...t,bodyNotStored:!0,body:"",arrayBuffer:new ArrayBuffer(0)}:null}function K$e(){const t=X6();return x.useCallback(({step:e,response:n})=>{const r=J$e(n),i={id:crypto.randomUUID(),date:Date.now(),type:"step",step:e,response:r,statusCode:n?.status??null};t.mutate(i)},[t])}function eAe(){const t=X6();return x.useCallback(async({workflowId:e,collectionId:n,workflow:r,workflowResult:i,success:s,durationMs:o})=>{const a=crypto.randomUUID(),l={id:a,date:Date.now(),type:"workflow",workflowId:e,collectionId:n,workflow:r,workflowResult:i,success:s,durationMs:o};try{return await t.mutateAsync(l),a}catch{return null}},[t])}function tAe(){const t=ki.useQueryClient();async function e(n){return t.ensureQueryData({queryKey:ui.detail(n),queryFn:()=>vc.getInstance().getById(n)})}return{getHistoryItem:e}}function U6(){const t=lS();return{getStep:n=>vO(t(),n)}}function nAe(t){const e=mi();return vO(e,{collectionId:t?.collectionId??null,workflowId:t?.workflowId??null,stepId:t?.stepId??null})??t?.draftStep??null}function q6(t,e){const n=t?.collectionId??null,r=t?.workflowId??null,i=t?.stepId??null,s=mi(),o=qa(),a=vO(s,{collectionId:n,workflowId:r,stepId:i});if(a)return{step:a,updateStep:c=>o(u=>cS(u,{collectionId:n,workflowId:r,stepId:i},c))};const l=t?.draftStep??null;return l?{step:l,updateStep:c=>e(u=>({...u,draftStep:u.draftStep?c(u.draftStep):u.draftStep}))}:null}function xQ(){const t=lS();return{getWorkflow:({collectionId:n,workflowId:r})=>OO(t(),{collectionId:n,workflowId:r})}}function Vr(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)}function Gd(t,e,n,r,i){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var Jc,Is,Ad,Dv,Iy;const lV="__TAURI_TO_IPC_KEY__";function F6(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}class W6{constructor(e){Jc.set(this,void 0),Is.set(this,0),Ad.set(this,[]),Dv.set(this,void 0),Gd(this,Jc,e||(()=>{})),this.id=F6(n=>{const r=n.index;if("end"in n){r==Vr(this,Is,"f")?this.cleanupCallback():Gd(this,Dv,r);return}const i=n.message;if(r==Vr(this,Is,"f")){for(Vr(this,Jc,"f").call(this,i),Gd(this,Is,Vr(this,Is,"f")+1);Vr(this,Is,"f")in Vr(this,Ad,"f");){const s=Vr(this,Ad,"f")[Vr(this,Is,"f")];Vr(this,Jc,"f").call(this,s),delete Vr(this,Ad,"f")[Vr(this,Is,"f")],Gd(this,Is,Vr(this,Is,"f")+1)}Vr(this,Is,"f")===Vr(this,Dv,"f")&&this.cleanupCallback()}else Vr(this,Ad,"f")[r]=i})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){Gd(this,Jc,e)}get onmessage(){return Vr(this,Jc,"f")}[(Jc=new WeakMap,Is=new WeakMap,Ad=new WeakMap,Dv=new WeakMap,lV)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[lV]()}}async function kn(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}class rAe{get rid(){return Vr(this,Iy,"f")}constructor(e){Iy.set(this,void 0),Gd(this,Iy,e)}async close(){return kn("plugin:resources|close",{rid:this.rid})}}Iy=new WeakMap;var wE;(function(t){t[t.Audio=1]="Audio",t[t.Cache=2]="Cache",t[t.Config=3]="Config",t[t.Data=4]="Data",t[t.LocalData=5]="LocalData",t[t.Document=6]="Document",t[t.Download=7]="Download",t[t.Picture=8]="Picture",t[t.Public=9]="Public",t[t.Video=10]="Video",t[t.Resource=11]="Resource",t[t.Temp=12]="Temp",t[t.AppConfig=13]="AppConfig",t[t.AppData=14]="AppData",t[t.AppLocalData=15]="AppLocalData",t[t.AppCache=16]="AppCache",t[t.AppLog=17]="AppLog",t[t.Desktop=18]="Desktop",t[t.Executable=19]="Executable",t[t.Font=20]="Font",t[t.Home=21]="Home",t[t.Runtime=22]="Runtime",t[t.Template=23]="Template"})(wE||(wE={}));var TE;(function(t){t[t.Start=0]="Start",t[t.Current=1]="Current",t[t.End=2]="End"})(TE||(TE={}));function SQ(t){return{isFile:t.isFile,isDirectory:t.isDirectory,isSymlink:t.isSymlink,size:t.size,mtime:t.mtime!==null?new Date(t.mtime):null,atime:t.atime!==null?new Date(t.atime):null,birthtime:t.birthtime!==null?new Date(t.birthtime):null,readonly:t.readonly,fileAttributes:t.fileAttributes,dev:t.dev,ino:t.ino,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,blksize:t.blksize,blocks:t.blocks}}class wQ extends rAe{async read(e){if(e.byteLength===0)return 0;const[n,r]=await kn("plugin:fs|read",{rid:this.rid,len:e.byteLength});return e.set(n),r===0?null:r}async seek(e,n){return await kn("plugin:fs|seek",{rid:this.rid,offset:e,whence:n})}async stat(){const e=await kn("plugin:fs|fstat",{rid:this.rid});return SQ(e)}async truncate(e){await kn("plugin:fs|ftruncate",{rid:this.rid,len:e})}async write(e){return await kn("plugin:fs|write",{rid:this.rid,data:e})}}async function iAe(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await kn("plugin:fs|create",{path:t instanceof URL?t.toString():t,options:e});return new wQ(n)}async function sAe(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await kn("plugin:fs|open",{path:t instanceof URL?t.toString():t,options:e});return new wQ(n)}async function oAe(t,e,n){if(t instanceof URL&&t.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|copy_file",{fromPath:t instanceof URL?t.toString():t,toPath:e instanceof URL?e.toString():e,options:n})}async function Z6(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|mkdir",{path:t instanceof URL?t.toString():t,options:e})}async function B6(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await kn("plugin:fs|read_dir",{path:t instanceof URL?t.toString():t,options:e})}async function Y6(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await kn("plugin:fs|read_file",{path:t instanceof URL?t.toString():t,options:e});return n instanceof ArrayBuffer?new Uint8Array(n):Uint8Array.from(n)}async function TQ(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await kn("plugin:fs|read_text_file",{path:t instanceof URL?t.toString():t,options:e})}async function aAe(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=t instanceof URL?t.toString():t;return await Promise.resolve({path:n,rid:null,async next(){this.rid===null&&(this.rid=await kn("plugin:fs|read_text_file_lines",{path:n,options:e}));const[r,i]=await kn("plugin:fs|read_text_file_lines_next",{rid:this.rid});return i&&(this.rid=null),{value:i?"":r,done:i}},[Symbol.asyncIterator](){return this}})}async function G6(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|remove",{path:t instanceof URL?t.toString():t,options:e})}async function H6(t,e,n){if(t instanceof URL&&t.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|rename",{oldPath:t instanceof URL?t.toString():t,newPath:e instanceof URL?e.toString():e,options:n})}async function lAe(t,e){const n=await kn("plugin:fs|stat",{path:t instanceof URL?t.toString():t,options:e});return SQ(n)}async function cAe(t,e){const n=await kn("plugin:fs|lstat",{path:t instanceof URL?t.toString():t,options:e});return SQ(n)}async function uAe(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|truncate",{path:t instanceof URL?t.toString():t,len:e,options:n})}async function dAe(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|write_file",e,{headers:{path:t instanceof URL?t.toString():t,options:JSON.stringify(n)}})}async function J6(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|write_text_file",{path:t instanceof URL?t.toString():t,data:e,options:n})}async function CQ(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await kn("plugin:fs|exists",{path:t instanceof URL?t.toString():t,options:e})}async function K6(t){await kn("plugin:fs|unwatch",{rid:t})}async function fAe(t,e,n){const r={recursive:!1,delayMs:2e3,...n},i=Array.isArray(t)?t:[t];for(const a of i)if(a instanceof URL&&a.protocol!=="file:")throw new TypeError("Must be a file URL.");const s=new W6;s.onmessage=e;const o=await kn("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:r,onEvent:s});return()=>{K6(o)}}async function hAe(t,e,n){const r={recursive:!1,...n,delayMs:null},i=Array.isArray(t)?t:[t];for(const a of i)if(a instanceof URL&&a.protocol!=="file:")throw new TypeError("Must be a file URL.");const s=new W6;s.onmessage=e;const o=await kn("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:r,onEvent:s});return()=>{K6(o)}}const xO=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return wE},FileHandle:wQ,get SeekMode(){return TE},copyFile:oAe,create:iAe,exists:CQ,lstat:cAe,mkdir:Z6,open:sAe,readDir:B6,readFile:Y6,readTextFile:TQ,readTextFileLines:aAe,remove:G6,rename:H6,stat:lAe,truncate:uAe,watch:fAe,watchImmediate:hAe,writeFile:dAe,writeTextFile:J6},Symbol.toStringTag,{value:"Module"}));function pAe(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function Gt(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}var In;(function(t){t[t.Audio=1]="Audio",t[t.Cache=2]="Cache",t[t.Config=3]="Config",t[t.Data=4]="Data",t[t.LocalData=5]="LocalData",t[t.Document=6]="Document",t[t.Download=7]="Download",t[t.Picture=8]="Picture",t[t.Public=9]="Public",t[t.Video=10]="Video",t[t.Resource=11]="Resource",t[t.Temp=12]="Temp",t[t.AppConfig=13]="AppConfig",t[t.AppData=14]="AppData",t[t.AppLocalData=15]="AppLocalData",t[t.AppCache=16]="AppCache",t[t.AppLog=17]="AppLog",t[t.Desktop=18]="Desktop",t[t.Executable=19]="Executable",t[t.Font=20]="Font",t[t.Home=21]="Home",t[t.Runtime=22]="Runtime",t[t.Template=23]="Template"})(In||(In={}));async function gAe(){return Gt("plugin:path|resolve_directory",{directory:In.AppConfig})}async function CE(){return Gt("plugin:path|resolve_directory",{directory:In.AppData})}async function mAe(){return Gt("plugin:path|resolve_directory",{directory:In.AppLocalData})}async function OAe(){return Gt("plugin:path|resolve_directory",{directory:In.AppCache})}async function vAe(){return Gt("plugin:path|resolve_directory",{directory:In.Audio})}async function yAe(){return Gt("plugin:path|resolve_directory",{directory:In.Cache})}async function bAe(){return Gt("plugin:path|resolve_directory",{directory:In.Config})}async function xAe(){return Gt("plugin:path|resolve_directory",{directory:In.Data})}async function eY(){return Gt("plugin:path|resolve_directory",{directory:In.Desktop})}async function SAe(){return Gt("plugin:path|resolve_directory",{directory:In.Document})}async function wAe(){return Gt("plugin:path|resolve_directory",{directory:In.Download})}async function TAe(){return Gt("plugin:path|resolve_directory",{directory:In.Executable})}async function CAe(){return Gt("plugin:path|resolve_directory",{directory:In.Font})}async function PAe(){return Gt("plugin:path|resolve_directory",{directory:In.Home})}async function kAe(){return Gt("plugin:path|resolve_directory",{directory:In.LocalData})}async function EAe(){return Gt("plugin:path|resolve_directory",{directory:In.Picture})}async function IAe(){return Gt("plugin:path|resolve_directory",{directory:In.Public})}async function $Ae(){return Gt("plugin:path|resolve_directory",{directory:In.Resource})}async function AAe(t){return Gt("plugin:path|resolve_directory",{directory:In.Resource,path:t})}async function QAe(){return Gt("plugin:path|resolve_directory",{directory:In.Runtime})}async function RAe(){return Gt("plugin:path|resolve_directory",{directory:In.Template})}async function _Ae(){return Gt("plugin:path|resolve_directory",{directory:In.Video})}async function jAe(){return Gt("plugin:path|resolve_directory",{directory:In.AppLog})}async function NAe(){return Gt("plugin:path|resolve_directory",{directory:In.Temp})}function tY(){return window.__TAURI_INTERNALS__.plugins.path.sep}function DAe(){return window.__TAURI_INTERNALS__.plugins.path.delimiter}async function nY(...t){return Gt("plugin:path|resolve",{paths:t})}async function MAe(t){return Gt("plugin:path|normalize",{path:t})}async function PQ(...t){return Gt("plugin:path|join",{paths:t})}async function rY(t){return Gt("plugin:path|dirname",{path:t})}async function iY(t){return Gt("plugin:path|extname",{path:t})}async function kQ(t,e){return Gt("plugin:path|basename",{path:t,ext:e})}async function sY(t){return Gt("plugin:path|is_absolute",{path:t})}const EQ=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return In},appCacheDir:OAe,appConfigDir:gAe,appDataDir:CE,appLocalDataDir:mAe,appLogDir:jAe,audioDir:vAe,basename:kQ,cacheDir:yAe,configDir:bAe,dataDir:xAe,delimiter:DAe,desktopDir:eY,dirname:rY,documentDir:SAe,downloadDir:wAe,executableDir:TAe,extname:iY,fontDir:CAe,homeDir:PAe,isAbsolute:sY,join:PQ,localDataDir:kAe,normalize:MAe,pictureDir:EAe,publicDir:IAe,resolve:nY,resolveResource:AAe,resourceDir:$Ae,runtimeDir:QAe,sep:tY,tempDir:NAe,templateDir:RAe,videoDir:_Ae},Symbol.toStringTag,{value:"Module"})),Ao=window.__TAURI__?.http.fetch??globalThis.fetch;function cV(t){try{const e=new URL(t);return(e.protocol==="http:"&&e.port==="80"||e.protocol==="https:"&&e.port==="443")&&(e.port=""),e.hostname=e.hostname.toLowerCase(),e.protocol+"//"+e.hostname+(e.port?":"+e.port:"")}catch(e){return console.error("Invalid URL",e),null}}function oY(t,e){let n=cV(t);const r=e.find(({host:i,port:s})=>cV(`https://${i}:${s}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}const VAe={id:"default",userFilesDir:"default",systemFilesDir:"default"},Q0=Al(Dr(VAe));Q0.debugLabel="project";function dd(){return Ir(Q0)}function PE(){return{STATUS_CODE_CHECK:"error",SCHEMA_CHECK:"error",CONTENT_TYPE_CHECK:"error"}}const LAe=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function zAe(){const{userFilesDir:t}=dd(),{certificates:e}=pi(),n=Ut(),{getCollection:r}=ud();return{execute:async(s,o,a)=>{const l=r(s),{inputs:c,servers:u}=n,f=l?.sourceDescriptions??[],h=`${t}/${s}`,[{createConfig:p},{ExternalResolver:m}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-CaxaTt3L.js")),Promise.resolve().then(()=>require("./replay-external-resolver-bSN_suNz.js"))]),g=new m,O=c.map(w=>JSON.stringify({[w.name]:w.value})),v=XAe(u,f),{run:b}=await Promise.resolve().then(()=>require("./replay-respect-run-4blfFaEM.js")),y=await b({files:[h],workflow:o?[o]:[],fetch:(w,S)=>{const P=LAe(w),{clientCert:k,clientKey:I}=oY(P,e);return Ao(P,{...S,clientCert:k,clientKey:I})},logger:uS,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async w=>{if(!await CQ(w))throw new Error(`File ${w} doesn't exist or isn't readable.`);try{const P=await TQ(w),k=new TextEncoder().encode(P);return new File([k],await kQ(w))}catch(P){throw new Error(`Failed to read file ${w}: ${P}`)}}},envVariables:{},config:await p({}),externalRefResolver:g,input:O,server:v,severity:JSON.stringify(a),skipLint:!0,noSecretsMasking:!0});try{await lIe(s,o,y?.[0]?.ctx)}catch(w){console.error("Failed to persist workflow step context:",w)}return y}}}function XAe(t,e){return e.map(n=>{const r=t.find(s=>s.apiId===n.apiId);if(!r)return null;let i=r.value;if(r.variables)for(const s of r.variables){const o=new RegExp(`\\{${s.name}\\}`,"g");i=i.replace(o,s.value)}return`${n.name}=${i}`}).filter(n=>n!==null)}const UAe="com.redocly.tab.openFailed";function uf(t){return{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Xe.Step,draftStep:null,response:null,requestError:null,isProcessingRequest:!1,...t}}function kE(t,e){const n=t.draftStep?.xOperation;return n?.method===e.method&&n?.url===e.url}function qAe(t,e,n){const r=t.draftStep,i=r?.xOperation;if(!r||!i)return;const s=n.url&&i.url!==n.url?n.url:null,o=i.method!==n.method?n.method:null;s===null&&o===null||e(a=>{const l=a.draftStep;return l?.xOperation?{...a,draftStep:{...l,xOperation:{...l.xOperation,...s!==null&&{url:s},...o!==null&&{method:o}},parameters:s===null?l.parameters:{...l.parameters,queryParameters:hA(bO(s),l.parameters.queryParameters)}}}:a})}function hr(){const{getTabs:t,getActiveTabIdx:e,setTabs:n,setActiveTabIdx:r,updateTabAt:i,updateTabDataAt:s}=id(),{dynamicReplayValues:o}=Wn(),{getStep:a}=U6(),{getHistoryItem:l}=tAe(),{getWorkflow:c}=xQ(),{getCollection:u}=ud(),{getApiOperation:f}=vQ(),{sendEvent:h}=et(),p=_Ee(),m=x.useCallback((R,D,L,F)=>{console.warn(`[useTabHandlers] ${R}`,F),h(UAe,[{...ye("tab",D),reason:L,...F}])},[h]),g=x.useCallback((R,D)=>{const L=t()[R];L&&L.state!==D&&i(R,F=>({...F,state:D}))},[t,i]),O=x.useCallback(R=>{r(R)},[r]),v=x.useCallback(()=>{const R=t().length;n(D=>[...D,k$e()]),r(R)},[t,n,r]),b=x.useCallback(R=>{const D=[...t().filter(F=>F.state!==Qn.Preview)];D.push(R),n(()=>D);const L=D.length-1;return r(L),L},[t,n,r]),y=x.useCallback(R=>{const D=f(R),L=IQ(R,D,o);b(L)},[b,o,f]),w=x.useCallback(R=>{const D=t().findIndex(({data:L})=>Tn(L,Xe.Step)&&L.draftStep?.operation?.apiId===R.apiId&&L.draftStep?.operation?.path===R.path&&L.draftStep?.operation?.method===R.method);return D===-1?!1:(O(D),!0)},[t,O]),S=x.useCallback((R,D)=>{const L=t(),F=G=>L.findIndex(({data:ee})=>Tn(ee,Xe.Step)&&G(ee));if(D){const G=F(ie=>ie.sourceFile===D);if(G!==-1){qAe(L[G].data,ie=>s(G,ie),R),O(G);return}const ee=F(ie=>!ie.sourceFile&&kE(ie,R));if(ee!==-1){s(ee,ie=>({...ie,sourceFile:D})),O(ee);return}}else{const G=F(ee=>kE(ee,R));if(G!==-1){O(G);return}}const Y=ja({xOperation:R,name:D??void 0});b({id:crypto.randomUUID(),state:Qn.Normal,data:uf({draftStep:Y,activeTabName:Ou(Y),sourceFile:D??null})})},[t,s,O,b]),P=x.useCallback(R=>{const D=t(),L=e(),F=D[L]?.id,Y=D.filter((ee,ie)=>ie!==R);n(()=>Y);const G=R===L||!F?-1:Y.findIndex(ee=>ee.id===F);r(G===-1?Math.max(0,R-1):G)},[t,e,r,n]),k=x.useCallback(()=>{n(()=>[]),r(0)},[r,n]);function I({collectionId:R,workflowId:D,stepId:L}){const F=t(),Y=new Set;for(let G=0;G<F.length;G++){const ee=F[G].data;switch(ee.type){case Xe.Step:ee.collectionId===R&&ee.workflowId===D&&ee.stepId===L&&Y.add(G);break;case Xe.Workflow:case Xe.WorkflowRun:ee.collectionId===R&&ee.workflowId===D&&!L&&Y.add(G);break;case Xe.Collection:ee.collectionId===R&&!D&&!L&&Y.add(G);break}}Y.size&&(n(G=>G.filter((ee,ie)=>!Y.has(ie))),r(0))}const E=x.useCallback(async R=>{const D=t().findIndex(({data:L})=>Tn(L,Xe.Step)&&L.historyId===R);if(D!==-1)r(D);else{const L=await l(R);if(!L||!$k(L)){m("Step history not found","stepHistoryTab","step_history_not_found",{historyId:R});return}const F=L.step;b({id:crypto.randomUUID(),state:Qn.Preview,data:uf({historyId:R,draftStep:structuredClone(F),response:structuredClone(L.response),activeTabName:Ou(F)})})}},[r,t,b,l,m]),Q=x.useCallback(({collectionId:R,activeTabName:D})=>{const L=t().findIndex(F=>{const Y=F.data;return Tn(Y,Xe.Collection)&&Y.collectionId===R});if(L!==-1)r(L);else{if(!u(R)){m("Collection not found","collectionTab","collection_not_found",{collectionId:R});return}b({id:crypto.randomUUID(),state:Qn.Preview,data:{collectionId:R,type:Xe.Collection,activeTabName:D??it.COLLECTION_SETTINGS}})}},[r,t,b,u,m]),N=x.useCallback(({collectionId:R,workflowId:D})=>{if(!c({collectionId:R,workflowId:D})){m("Workflow not found","workflowRunTab","workflow_not_found",{collectionId:R,workflowId:D});return}b({id:crypto.randomUUID(),state:Qn.Normal,data:{collectionId:R,workflowId:D,historyId:null,runDate:null,type:Xe.WorkflowRun,result:null,severitySettings:PE()}})},[b,c,m]),_=x.useCallback(async(R,{state:D=Qn.Preview}={})=>{const L=t().findIndex(({data:F})=>Tn(F,Xe.WorkflowRun)&&F.historyId===R);if(L!==-1)D===Qn.Normal&&t()[L].state===Qn.Preview&&g(L,Qn.Normal),r(L);else{const F=await l(R);if(!F||!Ak(F)){m("Workflow history not found","workflowHistoryTab","workflow_history_not_found",{historyId:R});return}b({id:crypto.randomUUID(),state:D,data:{collectionId:F.collectionId,workflowId:F.workflowId,historyId:R,runDate:F.date,type:Xe.WorkflowRun,result:structuredClone(F.workflowResult),severitySettings:PE(),label:Xh(F.workflow),secretValues:p().inputs.filter(Y=>Y.isSecret&&Y.value).map(Y=>String(Y.value))}})}},[r,t,b,g,l,m,p]),M=x.useCallback(({collectionId:R,workflowId:D})=>{const L=t().findIndex(({data:F})=>Tn(F,Xe.WorkflowRun)&&F.collectionId===R&&F.workflowId===D);return L===-1?!1:(t()[L].state===Qn.Preview&&g(L,Qn.Normal),O(L),!0)},[t,g,O]),z=x.useCallback(({collectionId:R,workflowId:D,activeTabName:L})=>{const F=t().findIndex(Y=>{const G=Y.data;return Tn(G,Xe.Workflow)&&G.workflowId===D&&G.collectionId===R});if(F!==-1)L&&s(F,Y=>({...Y,activeTabName:L})),r(F);else{if(!c({collectionId:R,workflowId:D})){m("Workflow not found","workflowTab","workflow_not_found",{collectionId:R,workflowId:D});return}b({id:crypto.randomUUID(),state:Qn.Preview,data:{collectionId:R,workflowId:D,type:Xe.Workflow,activeTabName:L??it.WORKFLOW_SETTINGS}})}},[r,t,s,b,c,m]),X=x.useCallback(({collectionId:R,workflowId:D,stepId:L,state:F})=>{const Y=t().findIndex(({data:G})=>Tn(G,Xe.Step)&&G.collectionId===R&&G.workflowId===D&&G.stepId===L&&G.historyId===null);if(Y!==-1)r(Y);else{const G=a({collectionId:R,workflowId:D,stepId:L});if(!G){m("Step not found","stepTab","step_not_found",{collectionId:R,workflowId:D,stepId:L});return}b({id:crypto.randomUUID(),state:F??Qn.Preview,data:uf({stepId:L,collectionId:R,workflowId:D,activeTabName:Ou(G)})})}},[r,t,a,b,m]),$=x.useCallback(({step:R})=>{b({id:crypto.randomUUID(),state:Qn.Normal,data:uf({stepId:R.stepId??null,workflowId:R.workflowId??null,draftStep:structuredClone(R),activeTabName:Ou(R)})})},[b]),U=x.useCallback((R,D)=>{if(R===D)return;const L=e(),F=[...t()],Y=F[L]?.id,[G]=F.splice(R,1);if(F.splice(D,0,G),n(()=>F),Y){const ee=F.findIndex(ie=>ie.id===Y);r(ee)}},[e,t,n,r]);return{handleNewTabOpen:v,addNewTab:b,openStepTabFromOperation:y,focusOperationTab:w,openStepTabFromXOperation:S,handleTabChange:O,handleTabClose:P,handleCloseAllTabs:k,handleCloseByDataId:I,openCollectionTab:Q,openWorkflowTab:z,openWorkflowRunTab:N,openWorkflowRunTabFromHistory:_,focusWorkflowRunTab:M,openStepTabFromHistory:E,openStepTabFromCollection:X,openStepTab:$,handleTabReorder:U,changeTabState:g}}function IQ(t,e,n){const r=ja({operation:t,apiOperation:e,dynamicReplayValues:n});return{id:crypto.randomUUID(),state:Qn.Preview,data:uf({draftStep:r,activeTabName:Ou(r)})}}function FAe(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.left>=r.left&&n.right<=r.right}const WAe=({transform:t})=>({...t,y:0}),ZAe=({transform:t,draggingNodeRect:e,containerNodeRect:n})=>!e||!n?t:{...t,x:Math.max(n.left-e.left,Math.min(t.x,n.right-e.right))},fd=(t,e="currentColor")=>t?.startsWith("--")?`var(${t})`:t||e,BAe=t=>d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",...t,children:[d.jsx("path",{d:"M10.8623 6.60461C11.0548 6.64292 11.2314 6.73734 11.3701 6.8761C11.5089 7.01487 11.6033 7.19144 11.6416 7.38391C11.6799 7.57633 11.661 7.77588 11.5859 7.95715C11.5108 8.13849 11.3829 8.29342 11.2197 8.40247C11.0566 8.51141 10.8651 8.5694 10.6689 8.56946C10.4939 8.5686 10.3221 8.52031 10.1729 8.42883L9.40625 9.19739C9.58461 9.44901 9.67969 9.75029 9.67969 10.0587C9.67965 10.3669 9.5844 10.6676 9.40625 10.9191L10.1729 11.6886C10.3221 11.5971 10.4938 11.5479 10.6689 11.547C10.865 11.5471 11.0567 11.6052 11.2197 11.714C11.3829 11.823 11.5108 11.9781 11.5859 12.1593C11.6611 12.3406 11.6799 12.541 11.6416 12.7335C11.6033 12.9259 11.5088 13.1026 11.3701 13.2413C11.2314 13.38 11.0547 13.4745 10.8623 13.5128C10.6698 13.5511 10.4704 13.5313 10.2891 13.4562C10.1078 13.3811 9.95279 13.2541 9.84375 13.0909C9.7347 12.9277 9.67578 12.7355 9.67578 12.5392C9.6767 12.3641 9.7258 12.1923 9.81738 12.0431L9.04883 11.2765C8.79719 11.4549 8.49595 11.5509 8.1875 11.5509C7.87917 11.5509 7.57871 11.4548 7.32715 11.2765L6.55762 12.0431C6.6492 12.1923 6.6983 12.3641 6.69922 12.5392C6.69922 12.7354 6.6412 12.9278 6.53223 13.0909C6.42318 13.2541 6.26728 13.3811 6.08594 13.4562C5.90468 13.5312 5.7051 13.5511 5.5127 13.5128C5.32032 13.4745 5.14359 13.38 5.00488 13.2413C4.86618 13.1026 4.77174 12.9259 4.7334 12.7335C4.69511 12.541 4.71493 12.3406 4.79004 12.1593C4.86518 11.9782 4.99222 11.8229 5.15527 11.714C5.31843 11.605 5.51083 11.547 5.70703 11.547C5.88211 11.5479 6.05389 11.597 6.20312 11.6886L6.96973 10.9191C6.79143 10.6675 6.69535 10.367 6.69531 10.0587C6.69531 9.75027 6.79134 9.44902 6.96973 9.19739L6.20312 8.42883C6.0539 8.52041 5.88211 8.56853 5.70703 8.56946C5.51075 8.56946 5.31847 8.51151 5.15527 8.40247C4.99211 8.29342 4.86514 8.13846 4.79004 7.95715C4.71493 7.77581 4.69511 7.57642 4.7334 7.38391C4.77168 7.19148 4.86618 7.01486 5.00488 6.8761C5.14358 6.7374 5.32034 6.64296 5.5127 6.60461C5.70502 6.56636 5.90473 6.58534 6.08594 6.66028C6.26728 6.73539 6.42318 6.86329 6.53223 7.02649C6.64104 7.18953 6.69917 7.38125 6.69922 7.57727C6.69836 7.7524 6.64917 7.92407 6.55762 8.07336L7.32715 8.83997C7.57865 8.66181 7.87929 8.56656 8.1875 8.56653C8.49595 8.56653 8.79719 8.66158 9.04883 8.83997L9.81738 8.07336C9.72588 7.9241 9.67664 7.75235 9.67578 7.57727C9.67583 7.38112 9.7348 7.1896 9.84375 7.02649C9.9528 6.86329 10.1077 6.73539 10.2891 6.66028C10.4703 6.58526 10.6699 6.56634 10.8623 6.60461ZM5.60938 12.0529C5.51328 12.0721 5.42476 12.1193 5.35547 12.1886C5.28617 12.2579 5.23889 12.3464 5.21973 12.4425C5.20058 12.5388 5.21049 12.6389 5.24805 12.7296C5.28559 12.8202 5.34915 12.8978 5.43066 12.9523C5.51226 13.0068 5.60889 13.0353 5.70703 13.0353C5.83843 13.0352 5.96467 12.9836 6.05762 12.8907C6.15067 12.7977 6.20312 12.6708 6.20312 12.5392C6.20305 12.4412 6.1736 12.3453 6.11914 12.2638C6.06462 12.1822 5.98712 12.1187 5.89648 12.0812C5.80581 12.0436 5.70563 12.0337 5.60938 12.0529ZM10.5723 12.0529C10.476 12.072 10.3868 12.1192 10.3174 12.1886C10.2481 12.2579 10.2008 12.3464 10.1816 12.4425C10.1625 12.5388 10.1724 12.6389 10.21 12.7296C10.2475 12.8202 10.3111 12.8978 10.3926 12.9523C10.4742 13.0068 10.5708 13.0353 10.6689 13.0353C10.8004 13.0352 10.9266 12.9836 11.0195 12.8907C11.1126 12.7977 11.165 12.6708 11.165 12.5392C11.165 12.4412 11.1355 12.3453 11.0811 12.2638C11.0265 12.1823 10.949 12.1187 10.8584 12.0812C10.7679 12.0437 10.6684 12.0338 10.5723 12.0529ZM5.80371 7.09094C5.70746 7.0718 5.60727 7.08171 5.5166 7.11926C5.42601 7.15683 5.34843 7.22033 5.29395 7.30188C5.2395 7.3834 5.21 7.47924 5.20996 7.57727C5.20996 7.70887 5.26241 7.83578 5.35547 7.92883C5.44852 8.02183 5.57548 8.07336 5.70703 8.07336C5.80501 8.07328 5.90095 8.04479 5.98242 7.99036C6.06394 7.93589 6.12747 7.85825 6.16504 7.7677C6.2026 7.67703 6.21251 7.57684 6.19336 7.48059C6.17421 7.38441 6.12694 7.29605 6.05762 7.22668C5.9883 7.15736 5.89985 7.11013 5.80371 7.09094ZM10.6689 7.08118C10.5373 7.08118 10.4104 7.13363 10.3174 7.22668C10.2245 7.31967 10.1729 7.44586 10.1729 7.57727C10.1729 7.67541 10.2013 7.77204 10.2559 7.85364C10.3104 7.9351 10.388 7.99873 10.4785 8.03625C10.5692 8.07381 10.6694 8.08372 10.7656 8.06457C10.8617 8.04544 10.9502 7.99808 11.0195 7.92883C11.0889 7.85944 11.1361 7.7702 11.1553 7.67395C11.1743 7.57784 11.1644 7.47835 11.127 7.38782C11.0894 7.29719 11.0259 7.21968 10.9443 7.16516C10.8628 7.11069 10.767 7.08123 10.6689 7.08118Z"}),d.jsx("path",{d:"M10.5 0.880005C10.9812 0.880005 11.375 1.27375 11.375 1.755V5.88489C11.375 5.95116 11.3212 6.005 11.2549 6.005H10.6201C10.5538 6.005 10.5 5.95116 10.5 5.88489V1.755H7V4.38C7 4.86125 6.60625 5.255 6.125 5.255H3.5V13.0099C3.5 13.0762 3.44616 13.13 3.37988 13.13H2.74512C2.67884 13.13 2.625 13.0762 2.625 13.0099V4.38C2.625 4.24875 2.66836 4.16086 2.75586 4.07336L5.81836 1.01086C5.90586 0.923364 5.99375 0.880005 6.125 0.880005H10.5ZM3.6748 4.38H6.125V1.92981L3.6748 4.38Z"})]}),bS=T.default(BAe)`
787
787
  path {
788
788
  fill: ${({color:t})=>fd(t)};
789
789
  }
@@ -1124,7 +1124,7 @@ ${L}`),U.pop(),`{${ee}}`}case"number":return isFinite($)?String($):y?y($):"null"
1124
1124
  display: flex;
1125
1125
  flex-direction: column;
1126
1126
  gap: var(--spacing-xs);
1127
- `;function YQe({collection:t}){return d.jsx("div",{children:"TODO: ComponentsTab"})}function gY(t){const{attachApiServerToEnvironments:e}=V6(),n=qa(),{removeSourceDescription:r,disconnectStepsFromSource:i}=ud(),s=x.useCallback(l=>{const{name:c,apiId:u,sourceUrl:f,sourceDescriptionToEdit:h,sourceDescriptionToEditIndex:p}=l,m=c.trim(),g=h!==null&&p!==null;n(O=>Xi(O,t,v=>{if(g&&h!==null&&p!==null){const b=v.sourceDescriptions[p];if(b===void 0)return v;const y=[...v.sourceDescriptions];return y[p]={...b,name:m,url:f,apiId:u},{...v,sourceDescriptions:y}}return{...v,sourceDescriptions:[...v.sourceDescriptions,{name:m,url:f,apiId:u}]}})),e(u)},[t,n,e]),o=x.useCallback(l=>{r(t,l)},[t,r]),a=x.useCallback(l=>{i(t,l)},[t,i]);return{createOrUpdateSource:s,removeSourceDescription:o,disconnectStepsFromSource:a}}async function R0(t,e){const[{bundle:n,Config:r},{ExternalResolver:i}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-CwHr913S.js")),Promise.resolve().then(()=>require("./replay-external-resolver-BdGx04jr.js"))]),s=new r({});s.getRulesForSpecVersion=()=>[];const o=await sn.dirname(t),a={config:s,base:o,externalRefResolver:new i,dereference:!0};e?a.doc={source:{absoluteRef:t},parsed:e}:a.ref=t;const{bundle:{parsed:l},fileDependencies:c}=await n(a);return{definition:l,fileDependencies:c}}const qi={FS:"fs",WEB:"web"},pV=/^[A-Za-z0-9_-]+$/,GQe="apis";function HQe(t){if(!t)return{name:"",activeTab:GQe,selectedApiId:null,url:""};const e=zs(t.url)||zs(t.apiId);return{name:t.name,activeTab:e?"url":"apis",selectedApiId:e?null:t.apiId,url:e?t.url:""}}function JQe(t,e,n){return t.length===0?null:e?n?"This name already exists":null:"Name must match [A-Za-z0-9_-]+"}function KQe({collection:t,sourceDescriptionToEdit:e,sourceDescriptionToEditIndex:n}){const r=qo(),i=wA(),{createOrUpdateSource:s}=gY(t.id),o=HQe(e),[a,l]=x.useState(o.name),[c,u]=x.useState(o.activeTab),[f,h]=x.useState(o.selectedApiId),[p,m]=x.useState(o.url),g=!!e,O=a.trim(),v=x.useMemo(()=>new Set(t.sourceDescriptions.filter((M,z)=>z!==n).map(M=>M.name)),[t.sourceDescriptions,n]),b=O.length>0&&v.has(O),y=pV.test(O),w=JQe(O,y,b),S=O.length>0&&y&&!b,P=p.trim(),k=P.length>0&&zs(P),I=P.length>0&&!k?"Please enter a valid URL":null,E=S&&(c==="apis"?!!f:!!k),Q=x.useMemo(()=>r.map(M=>({id:M.id,name:M.info.title,path:zs(M.id)?M.id:`./${M.id.replace(/^\//,"")}`})),[r]),N=x.useCallback(async()=>{const M=t.id,z=p.trim();if(c==="apis"){if(!f)return null;const $=zs(f)?f:await sn.relative(`/${M}/..`,`/${f}`);return{apiId:f,sourceUrl:$}}if(!z||!zs(z))return null;if(!r.some($=>$.id===z)){const{definition:$,fileDependencies:U}=await R0(z);i(R=>[...R,{id:z,srcType:qi.WEB,...$,...U&&{fileDependencies:U}}])}return{apiId:z,sourceUrl:z}},[c,r,i,t,f,p]),_=x.useCallback(async()=>{const M=a.trim();if(!M||!pV.test(M))return;const z=await N();if(!z)return;const{apiId:X,sourceUrl:$}=z;s({name:M,apiId:X,sourceUrl:$,sourceDescriptionToEdit:g?e:null,sourceDescriptionToEditIndex:g?n:null})},[a,s,g,N,e,n]);return{name:a,setName:l,activeTab:c,setActiveTab:u,selectedApiId:f,setSelectedApiId:h,url:p,setUrl:m,nameErrorText:w,urlErrorText:I,canSubmit:E,apiItems:Q,handleSubmit:_}}const eRe=t=>d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",...t,children:[d.jsx("path",{d:"M10.5 0.875C10.9812 0.875 11.375 1.26875 11.375 1.75V6.87988C11.375 6.94616 11.3212 7 11.2549 7H10.6201C10.5538 7 10.5 6.94616 10.5 6.87988V1.75H7V4.375C7 4.85625 6.60625 5.25 6.125 5.25H3.5V12.25H5.12402C5.19012 12.2502 5.24316 12.304 5.24316 12.3701V13.0049C5.24316 13.071 5.19012 13.1248 5.12402 13.125H3.5C3.01875 13.125 2.625 12.7312 2.625 12.25V4.375C2.625 4.24375 2.66836 4.15586 2.75586 4.06836L5.81836 1.00586C5.90586 0.91836 5.99375 0.875 6.125 0.875H10.5ZM3.6748 4.375H6.125V1.9248L3.6748 4.375Z"}),d.jsx("path",{d:"M5.94824 6.92676C6.27209 6.7761 6.63792 6.7394 6.98535 6.82227C7.33272 6.90515 7.64233 7.10322 7.86328 7.38379C8.08406 7.66425 8.20392 8.01124 8.20312 8.36816C8.20397 8.70923 8.09223 9.04201 7.88574 9.31348L8.84082 10.2686C9.11428 10.0645 9.44687 9.95442 9.78809 9.9541C10.1451 9.95374 10.4922 10.0737 10.7725 10.2949C11.0525 10.5161 11.2495 10.8256 11.332 11.1729C11.4145 11.5202 11.3774 11.8854 11.2266 12.209C11.0757 12.5325 10.82 12.7959 10.501 12.9561C10.1818 13.1162 9.81742 13.1642 9.46777 13.0918C9.11819 13.0193 8.80342 12.8304 8.57422 12.5566C8.34508 12.2829 8.21496 11.9399 8.20508 11.583C8.19522 11.2261 8.30582 10.8759 8.51953 10.5898L7.56641 9.63477C7.28031 9.84854 6.93025 9.95915 6.57324 9.94922C6.21639 9.93927 5.87331 9.80925 5.59961 9.58008C5.32584 9.35068 5.13674 9.03533 5.06445 8.68555C4.99217 8.33576 5.04075 7.97147 5.20117 7.65234C5.36158 7.33342 5.62457 7.07737 5.94824 6.92676ZM6.83789 7.25781C6.61834 7.21421 6.3904 7.2366 6.18359 7.32227C5.97685 7.40796 5.80015 7.55319 5.67578 7.73926C5.55143 7.92536 5.48544 8.14435 5.48535 8.36816C5.48535 8.66836 5.60422 8.95661 5.81641 9.16895C6.02874 9.38128 6.31691 9.50094 6.61719 9.50098C6.84098 9.50098 7.05997 9.43479 7.24609 9.31055C7.43231 9.18612 7.57738 9.00867 7.66309 8.80176C7.74879 8.59484 7.77123 8.36712 7.72754 8.14746C7.68383 7.92801 7.57615 7.72663 7.41797 7.56836C7.2596 7.40999 7.05755 7.30151 6.83789 7.25781Z"})]}),RQ=T.default(eRe)`
1127
+ `;function YQe({collection:t}){return d.jsx("div",{children:"TODO: ComponentsTab"})}function gY(t){const{attachApiServerToEnvironments:e}=V6(),n=qa(),{removeSourceDescription:r,disconnectStepsFromSource:i}=ud(),s=x.useCallback(l=>{const{name:c,apiId:u,sourceUrl:f,sourceDescriptionToEdit:h,sourceDescriptionToEditIndex:p}=l,m=c.trim(),g=h!==null&&p!==null;n(O=>Xi(O,t,v=>{if(g&&h!==null&&p!==null){const b=v.sourceDescriptions[p];if(b===void 0)return v;const y=[...v.sourceDescriptions];return y[p]={...b,name:m,url:f,apiId:u},{...v,sourceDescriptions:y}}return{...v,sourceDescriptions:[...v.sourceDescriptions,{name:m,url:f,apiId:u}]}})),e(u)},[t,n,e]),o=x.useCallback(l=>{r(t,l)},[t,r]),a=x.useCallback(l=>{i(t,l)},[t,i]);return{createOrUpdateSource:s,removeSourceDescription:o,disconnectStepsFromSource:a}}async function R0(t,e){const[{bundle:n,Config:r},{ExternalResolver:i}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-CaxaTt3L.js")),Promise.resolve().then(()=>require("./replay-external-resolver-bSN_suNz.js"))]),s=new r({});s.getRulesForSpecVersion=()=>[];const o=await sn.dirname(t),a={config:s,base:o,externalRefResolver:new i,dereference:!0};e?a.doc={source:{absoluteRef:t},parsed:e}:a.ref=t;const{bundle:{parsed:l},fileDependencies:c}=await n(a);return{definition:l,fileDependencies:c}}const qi={FS:"fs",WEB:"web"},pV=/^[A-Za-z0-9_-]+$/,GQe="apis";function HQe(t){if(!t)return{name:"",activeTab:GQe,selectedApiId:null,url:""};const e=zs(t.url)||zs(t.apiId);return{name:t.name,activeTab:e?"url":"apis",selectedApiId:e?null:t.apiId,url:e?t.url:""}}function JQe(t,e,n){return t.length===0?null:e?n?"This name already exists":null:"Name must match [A-Za-z0-9_-]+"}function KQe({collection:t,sourceDescriptionToEdit:e,sourceDescriptionToEditIndex:n}){const r=qo(),i=wA(),{createOrUpdateSource:s}=gY(t.id),o=HQe(e),[a,l]=x.useState(o.name),[c,u]=x.useState(o.activeTab),[f,h]=x.useState(o.selectedApiId),[p,m]=x.useState(o.url),g=!!e,O=a.trim(),v=x.useMemo(()=>new Set(t.sourceDescriptions.filter((M,z)=>z!==n).map(M=>M.name)),[t.sourceDescriptions,n]),b=O.length>0&&v.has(O),y=pV.test(O),w=JQe(O,y,b),S=O.length>0&&y&&!b,P=p.trim(),k=P.length>0&&zs(P),I=P.length>0&&!k?"Please enter a valid URL":null,E=S&&(c==="apis"?!!f:!!k),Q=x.useMemo(()=>r.map(M=>({id:M.id,name:M.info.title,path:zs(M.id)?M.id:`./${M.id.replace(/^\//,"")}`})),[r]),N=x.useCallback(async()=>{const M=t.id,z=p.trim();if(c==="apis"){if(!f)return null;const $=zs(f)?f:await sn.relative(`/${M}/..`,`/${f}`);return{apiId:f,sourceUrl:$}}if(!z||!zs(z))return null;if(!r.some($=>$.id===z)){const{definition:$,fileDependencies:U}=await R0(z);i(R=>[...R,{id:z,srcType:qi.WEB,...$,...U&&{fileDependencies:U}}])}return{apiId:z,sourceUrl:z}},[c,r,i,t,f,p]),_=x.useCallback(async()=>{const M=a.trim();if(!M||!pV.test(M))return;const z=await N();if(!z)return;const{apiId:X,sourceUrl:$}=z;s({name:M,apiId:X,sourceUrl:$,sourceDescriptionToEdit:g?e:null,sourceDescriptionToEditIndex:g?n:null})},[a,s,g,N,e,n]);return{name:a,setName:l,activeTab:c,setActiveTab:u,selectedApiId:f,setSelectedApiId:h,url:p,setUrl:m,nameErrorText:w,urlErrorText:I,canSubmit:E,apiItems:Q,handleSubmit:_}}const eRe=t=>d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",...t,children:[d.jsx("path",{d:"M10.5 0.875C10.9812 0.875 11.375 1.26875 11.375 1.75V6.87988C11.375 6.94616 11.3212 7 11.2549 7H10.6201C10.5538 7 10.5 6.94616 10.5 6.87988V1.75H7V4.375C7 4.85625 6.60625 5.25 6.125 5.25H3.5V12.25H5.12402C5.19012 12.2502 5.24316 12.304 5.24316 12.3701V13.0049C5.24316 13.071 5.19012 13.1248 5.12402 13.125H3.5C3.01875 13.125 2.625 12.7312 2.625 12.25V4.375C2.625 4.24375 2.66836 4.15586 2.75586 4.06836L5.81836 1.00586C5.90586 0.91836 5.99375 0.875 6.125 0.875H10.5ZM3.6748 4.375H6.125V1.9248L3.6748 4.375Z"}),d.jsx("path",{d:"M5.94824 6.92676C6.27209 6.7761 6.63792 6.7394 6.98535 6.82227C7.33272 6.90515 7.64233 7.10322 7.86328 7.38379C8.08406 7.66425 8.20392 8.01124 8.20312 8.36816C8.20397 8.70923 8.09223 9.04201 7.88574 9.31348L8.84082 10.2686C9.11428 10.0645 9.44687 9.95442 9.78809 9.9541C10.1451 9.95374 10.4922 10.0737 10.7725 10.2949C11.0525 10.5161 11.2495 10.8256 11.332 11.1729C11.4145 11.5202 11.3774 11.8854 11.2266 12.209C11.0757 12.5325 10.82 12.7959 10.501 12.9561C10.1818 13.1162 9.81742 13.1642 9.46777 13.0918C9.11819 13.0193 8.80342 12.8304 8.57422 12.5566C8.34508 12.2829 8.21496 11.9399 8.20508 11.583C8.19522 11.2261 8.30582 10.8759 8.51953 10.5898L7.56641 9.63477C7.28031 9.84854 6.93025 9.95915 6.57324 9.94922C6.21639 9.93927 5.87331 9.80925 5.59961 9.58008C5.32584 9.35068 5.13674 9.03533 5.06445 8.68555C4.99217 8.33576 5.04075 7.97147 5.20117 7.65234C5.36158 7.33342 5.62457 7.07737 5.94824 6.92676ZM6.83789 7.25781C6.61834 7.21421 6.3904 7.2366 6.18359 7.32227C5.97685 7.40796 5.80015 7.55319 5.67578 7.73926C5.55143 7.92536 5.48544 8.14435 5.48535 8.36816C5.48535 8.66836 5.60422 8.95661 5.81641 9.16895C6.02874 9.38128 6.31691 9.50094 6.61719 9.50098C6.84098 9.50098 7.05997 9.43479 7.24609 9.31055C7.43231 9.18612 7.57738 9.00867 7.66309 8.80176C7.74879 8.59484 7.77123 8.36712 7.72754 8.14746C7.68383 7.92801 7.57615 7.72663 7.41797 7.56836C7.2596 7.40999 7.05755 7.30151 6.83789 7.25781Z"})]}),RQ=T.default(eRe)`
1128
1128
  path {
1129
1129
  fill: ${({color:t})=>fd(t)};
1130
1130
  }
@@ -1598,7 +1598,7 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
1598
1598
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
1599
1599
  `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){const n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){const r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){D0(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const r=!this.onKeyLine&&this.indent===e.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let s=[];if(i&&n.sep&&!n.value){const o=[];for(let a=0;a<n.sep.length;++a){const l=n.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(s=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.value?(s.push(this.sourceToken),e.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ic(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(AG(n.key)&&!ic(n.sep,"newline")){const o=jd(n.start),a=n.key,l=n.sep;l.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(ic(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const o=jd(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?e.items.push({start:s,key:null,sep:[this.sourceToken]}):ic(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const o=this.flowScalar(this.type);i||n.value?(e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{const o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!ic(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:s});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){const n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){const r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){D0(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||ic(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){const r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{const r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){const i=Uv(r),s=jd(i);vL(e);const o=e.end.splice(1,e.end.length);o.push(this.sourceToken);const a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
1600
1600
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
1601
- `,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=Uv(e),r=jd(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=Uv(e),r=jd(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function ije(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new nje||null,prettyErrors:e}}function sje(t,e={}){const{lineCounter:n,prettyErrors:r}=ije(e),i=new rje(n?.addNewLine),s=new H2e(e);let o=null;for(const a of s.compose(i.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Fp(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(hL(t,n)),o.warnings.forEach(hL(t,n))),o}function GQ(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function QG(t){return!pn(t)||t.value==null?null:typeof t.value=="string"?t.value:GQ(t.value)?t.source??String(t.value):null}function CT(t,e){return QG(t)===e}function wg(t){return pn(t)&&t.value==null}function eu(t){return t==null||wg(t)||oi(t)||t instanceof Dt}function PT(t){return t==null||oi(t)||pn(t)&&(t.value==null||GQ(t.value))}function oje(t){return pn(t)&&typeof t.value=="string"}function xo(t,e){return oi(t.getIn(e,!0))}function aje(t){const{contents:e}=t;return e instanceof Dt&&e.items.length===0&&!e.commentBefore&&!e.comment&&!t.commentBefore&&!t.comment}const lje="<<",yL="$ref";class cje{constructor(e,n){this.providers=e,this.basePath=n}providers;basePath;sectionProblem(e){if(this.basePath.length===0){const s=e.contents;return eu(s)?s instanceof Dt?this.environmentsProblem(e,s,"environments"):null:"The environments store must be a map of environment names"}const n=this.basePath.join("."),r=this.parentProblem(e,n);if(r)return r;if(xo(e,this.basePath))return null;if(this.hasRefAbove(e))return`Replay does not follow $ref, so it cannot manage the ${n} section here`;const i=e.getIn(this.basePath,!0);return eu(i)?i instanceof Dt?this.environmentsProblem(e,i,n):null:`The ${n} section must be a map of environment names`}environmentsProblem(e,n,r){const i=this.managedKeysProblem(n,r);if(i)return i;for(const s of n.items){const o=String(s.key);if($c(o))continue;if(!eu(s.value))return`Environment ${o} in ${r} must be a map`;if(!(s.value instanceof Dt))continue;const a=this.environmentBodyProblem(e,o,s.value,r);if(a)return a}return null}environmentBodyProblem(e,n,r,i){const s=this.reservedKeysProblem(r,i);if(s)return s;const o=r.get("inputs",!0);if(!eu(o))return`The inputs of ${n} in ${i} must be a map`;if(o instanceof Dt){const l=`the inputs of ${n}`,c=this.managedKeysProblem(o,l);if(c)return c;for(const u of o.items)if(!PT(u.value)&&!(u.value instanceof Dt&&this.isMarkerNode(e,u.value)))return`Input ${String(u.key)} of ${n} in ${i} must be a single value`}const a=r.get("servers",!0);if(!eu(a))return`The servers of ${n} in ${i} must be a map`;if(a instanceof Dt){const l=`the servers of ${n}`,c=this.managedKeysProblem(a,l);if(c)return c;for(const u of a.items){const f=this.serverBodyProblem(String(u.key),u.value,n,i);if(f)return f}}return null}serverBodyProblem(e,n,r,i){if(!eu(n))return`Server ${e} of ${r} in ${i} must be a map`;if(!(n instanceof Dt))return null;const s=this.reservedKeysProblem(n,`server ${e} of ${r}`);if(s)return s;const o=n.get("value",!0);if(!PT(o))return`The value of server ${e} of ${r} in ${i} must be a single value`;const a=n.get("variables",!0);if(!eu(a))return`The variables of server ${e} of ${r} in ${i} must be a map`;if(a instanceof Dt){const l=`the variables of server ${e} of ${r}`,c=this.managedKeysProblem(a,l);if(c)return c;for(const u of a.items)if(!PT(u.value))return`Variable ${String(u.key)} of server ${e} of ${r} in ${i} must be a single value`}return null}managedKeysProblem(e,n){const r=this.reservedKeysProblem(e,n);if(r)return r;for(const i of e.items)if(!oje(i.key))return`Replay reads only string keys, and ${n} holds ${String(i.key)}`;return null}reservedKeysProblem(e,n){return e.has(lje)?`Replay cannot read a merge key, and ${n} uses one`:e.has(yL)?`Replay does not follow $ref, and ${n} uses one`:null}isMarkerNode(e,n){try{return this.providers.resolveProviderForMarker(n.toJS(e))!==null}catch{return!1}}parentProblem(e,n){for(let r=1;r<this.basePath.length;r++){const i=this.basePath.slice(0,r),s=e.getIn(i,!0);if(s==null||wg(s))return null;const o=i.join(".");if(oi(s))return`The ${o} key is an alias, so Replay cannot manage the ${n} section inside it`;if(!(s instanceof Dt))return`The ${o} key must be a map for Replay to manage the ${n} section`}return null}hasRefAbove(e){for(let n=1;n<=this.basePath.length;n++){const r=e.getIn(this.basePath.slice(0,n),!0);if(r instanceof Dt&&r.has(yL))return!0}return!1}}const uje=new Set(["inputs","servers"]),dje=new Set(["value","variables"]);class fje{constructor(e,n=[]){this.providers=e,this.basePath=n,this.validator=new cje(e,n)}providers;basePath;validator;hasSection(e){return this.basePath.length===0||e.hasIn(this.basePath)}sectionPath(...e){return[...this.basePath,...e]}leafText(e,n,r){const i=e.getIn(n,!0),s=oi(i)?i.resolve(e):i;return QG(s)??(GQ(r)?String(r):"")}extractEnvironments(e,n){const r=this.readSectionData(e);return r?Object.keys(r).filter(s=>!$c(s)).map(s=>{const o=r[s]??{},a=Object.entries(o.inputs??{}).map(([c,u])=>{const f=this.providers.resolveProviderForMarker(u);return f?{name:c,value:f.resolve(n,s,c),isSecret:!0}:{name:c,value:this.leafText(e,this.sectionPath(s,"inputs",c),u),isSecret:!1}}),l=Object.entries(o.servers??{}).map(([c,u])=>{const f=this.sectionPath(s,"servers",c);return{apiId:c,value:this.leafText(e,[...f,"value"],u?.value),variables:Object.entries(u?.variables??{}).map(([h,p])=>({name:h,value:this.leafText(e,[...f,"variables",h],p)}))}});return{name:s,inputs:a,servers:l,state:zt.Normal}}):[]}hydrateDocument(e,n,r){if(xo(e,this.basePath))return e;for(let s=1;s<=this.basePath.length;s++){const o=this.basePath.slice(0,s);wg(e.getIn(o,!0))&&e.setIn(o,this.createBlockMap(e))}const i=new Set(n.map(s=>s.name).filter(Boolean));this.deleteRemovedKeys(e,this.sectionPath(),i);for(const s of n){if(!s.name)continue;const o=this.sectionPath(s.name);xo(e,o)||(e.hasIn(o)||this.ensureBlockMap(e,o),this.syncInputs(e,s.name,s.inputs,r),this.syncServers(e,s.name,s.servers))}return this.unflowSectionAncestors(e),e}removeSection(e){if(this.basePath.length!==0){e.deleteIn(this.basePath);for(let n=this.basePath.length-1;n>0;n--){const r=this.basePath.slice(0,n),i=e.getIn(r,!0);i instanceof Dt&&i.items.length===0&&e.deleteIn(r)}}}sectionProblem(e){return this.validator.sectionProblem(e)}isSectionAliased(e){return this.basePath.length>0&&xo(e,this.basePath)}hasEnvironments(e){const n=this.basePath.length===0?e.contents:e.getIn(this.basePath,!0);return n instanceof Dt&&n.items.length>0}hasUnreadContent(e){const n=e.getIn(this.basePath,!0);return n instanceof Dt?n.items.some(r=>this.environmentHoldsUnreadContent(r.value)):!1}environmentHoldsUnreadContent(e){return oi(e)?!0:e instanceof Dt?e.items.some(n=>{const r=String(n.key);return!uje.has(r)||oi(n.value)?!0:r!=="servers"||!(n.value instanceof Dt)?!1:n.value.items.some(i=>{const s=i.value;return oi(s)?!0:s instanceof Dt?s.items.some(o=>!dje.has(String(o.key))):!1})}):!1}unflowSectionAncestors(e){for(let n=1;n<=this.basePath.length;n++){const r=e.getIn(this.basePath.slice(0,n),!0);r instanceof Dt&&r.flow&&(r.flow=!1)}}readSectionData(e){if(this.basePath.length===0){const i=e.toJS();return i==null||typeof i!="object"||Array.isArray(i)?null:i}const n=e.getIn(this.basePath,!0);if(n==null||wg(n))return null;if(!oi(n)&&!(n instanceof Dt))throw new Error(`Expected \`${this.basePath.join(".")}\` to be a map of environments`);const r=n.toJS(e);if(r==null)return null;if(typeof r!="object"||Array.isArray(r))throw new Error(`Expected \`${this.basePath.join(".")}\` to be a map of environments`);return r}syncInputs(e,n,r,i){const s=new Set(r.map(a=>a.name)),o=this.sectionPath(n,"inputs");if(!xo(e,o)){this.deleteRemovedKeys(e,o,s),r.length>0&&this.ensureBlockMap(e,o);for(const a of r){const l=[...o,a.name];if(!xo(e,l)){if(a.isSecret){const c=e.getIn(l,!0),u=c instanceof Dt?c.toJS(e):e.getIn(l),f=this.providers.resolveProviderForMarker(u);f||e.setIn(l,e.createNode(this.providers.getDefaultProvider().createMarker())),(f??this.providers.getDefaultProvider()).store(i,n,a.name,a.value);continue}CT(e.getIn(l,!0),a.value)||e.setIn(l,a.value)}}}}syncServers(e,n,r){const i=new Set(r.map(o=>o.apiId)),s=this.sectionPath(n,"servers");if(!xo(e,s)){this.deleteRemovedKeys(e,s,i),r.length>0&&this.ensureBlockMap(e,s);for(const o of r){const a=[...s,o.apiId];if(xo(e,a))continue;wg(e.getIn(a,!0))&&e.setIn(a,this.createBlockMap(e));const l=[...a,"value"];!xo(e,l)&&!CT(e.getIn(l,!0),o.value)&&e.setIn(l,o.value);const c=[...a,"variables"];if(xo(e,c))continue;const u=new Set(o.variables.map(f=>f.name));this.deleteRemovedKeys(e,c,u),o.variables.length>0&&this.ensureBlockMap(e,c);for(const f of o.variables){const h=[...c,f.name];xo(e,h)||CT(e.getIn(h,!0),f.value)||e.setIn(h,f.value)}}}}ensureBlockMap(e,n){for(let r=this.basePath.length+1;r<=n.length;r++){const i=n.slice(0,r),s=e.getIn(i,!0);if(s instanceof Dt){s.flow=!1;continue}if(oi(s))return;e.setIn(i,this.createBlockMap(e))}}createBlockMap(e){const n=e.createNode({});return n instanceof Dt&&(n.flow=!1),n}deleteRemovedKeys(e,n,r){for(const i of this.getMapKeys(e,...n))!i.trim()||$c(i)||r.has(i)||e.deleteIn([...n,i])}getMapKeys(e,...n){const r=n.length===0?e.contents:e.getIn(n,!0);return r instanceof Dt?r.items.map(i=>String(i.key)):[]}}class hje{id="local";isMarker(e){return typeof e=="object"&&e!==null&&"provider"in e&&e.provider===this.id}createMarker(){return{provider:this.id}}resolve(e,n,r){return e[n]?.[r]??""}store(e,n,r,i){e[n]||(e[n]={}),e[n][r]=i}}class pje{constructor(e,n){this.defaultProviderId=n,this.providersById=new Map(e.map(r=>[r.id,r]))}defaultProviderId;providersById;getDefaultProvider(){const e=this.providersById.get(this.defaultProviderId);if(!e)throw new Error(`Missing default secrets provider strategy: ${this.defaultProviderId}`);return e}resolveProviderForMarker(e){return this.isProviderMarker(e)?this.providersById.get(e.provider)??this.getDefaultProvider():null}isProviderMarker(e){return typeof e=="object"&&e!==null&&"provider"in e&&typeof e.provider=="string"}}class gje{constructor(e){this.storage=e}storage;async getAll(){return this.storage.getAll()}async set(e,n){await this.storage.set(e,n)}async clear(e){await this.storage.clear(e)}}class mje{notifications=new Map;async getAll(){return Array.from(this.notifications.values())}async set(e,n){const r=n.filter(s=>s.severity==="error").length,i=n.filter(s=>s.severity==="warning").length;this.notifications.set(e,{id:e,source:e,issues:n,errorCount:r,warningCount:i})}async clear(e){this.notifications.delete(e)}}const QO={all:["notifications"],lists:()=>[...QO.all,"list"]};function Oje(){return ki.useQuery({queryKey:QO.lists(),queryFn:async()=>Em.getInstance().getAll()})}function vje(){return ki.useQuery({queryKey:QO.lists(),queryFn:async()=>Em.getInstance().getAll(),select:t=>({total:t.reduce((e,n)=>e+n.issues.length,0),errorCount:t.reduce((e,n)=>e+n.errorCount,0)})})}class Em{static instance=null;static initialize(){this.close();const e=new mje;this.instance=new gje(e)}static getInstance(){if(!this.instance)throw new Error("NotificationsService not initialized");return this.instance}static close(){this.instance=null}}let kT=null;function RS(){return kT||(kT=new ki.QueryClient({defaultOptions:{queries:{staleTime:30*1e3,gcTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}})),kT}function yje(t){const e=t.match(/\bline\s+(\d+)\b/i);if(!e)return;const n=Number.parseInt(e[1],10);return Number.isNaN(n)?void 0:n}function bje(t){const e=(t instanceof Error?t.message:String(t)).trim();return[{severity:"error",message:e,line:yje(e)}]}function xje(t){return t.map(e=>({severity:"error",message:e.message.trim(),line:e.linePos?.[0]?.line}))}async function HQ(t){try{const e=Em.getInstance();await t(e),RS().invalidateQueries({queryKey:QO.all})}catch{}}async function M0(t,e){await HQ(async n=>{await n.set(t,bje(e))})}async function Sje(t,e){e.length!==0&&await HQ(async n=>{await n.set(t,xje(e))})}async function V0(t){await HQ(async e=>{await e.clear(t)})}function bL(t){return ET(t,e=>e.name).map(e=>({...e,inputs:Ek(e.inputs),servers:ET(e.servers,n=>n.apiId).map(n=>({...n,variables:ET(n.variables,r=>r.name)}))}))}function ET(t,e){const n=new Set,r=[];for(const i of t){const s=e(i);!wje(s)||n.has(s)||(n.add(s),r.push(i))}return r}function wje(t){return!!t.trim()&&!$c(t)}function Tje(t,e){return xL(t)===xL(e)}function xL(t){const e=(n,r)=>[...n].sort((i,s)=>r(i).localeCompare(r(s)));return JSON.stringify(e(t.filter(n=>n.name),n=>n.name).map(n=>[n.name,e(n.inputs,r=>r.name).map(r=>[r.name,r.value,r.isSecret]),e(n.servers,r=>r.apiId).map(r=>[r.apiId,r.value,e(r.variables,i=>i.name).map(i=>[i.name,i.value])])]))}function SL(t){if(t.length===0)return!0;if(t.length>1)return!1;const[e]=t;return e.name===_h&&e.inputs.length===0&&e.servers.length===0}class Cje{constructor(e,n,r){this.storage=e,this.localStorageSecretsProvider=n,this.candidatePaths=r.filePaths,this.basePath=r.basePath,this.rebuildWhenUnparseable=r.rebuildWhenUnparseable,this.handler=new fje(new pje([new hje],"local"),r.basePath)}storage;localStorageSecretsProvider;configError=null;handler;candidatePaths;basePath;rebuildWhenUnparseable;pendingWrite=Promise.resolve();get isSection(){return this.basePath.length>0}getConfigError(){return this.configError}async read(){const e=this.pendingWrite.then(()=>this.readSection());return this.pendingWrite=e.then(()=>{},()=>{}),e}async write(e,{willRetry:n=!1}={}){const r=this.pendingWrite.then(()=>this.writeSection(e,n));return this.pendingWrite=r.catch(()=>{}),r}async readSection(){const e=await this.loadDocumentFromStorage();if(e.status==="unreadable")return await this.blockOn(e.filePath,e.error),[];if(e.status!=="ok")return[];try{const n=await this.readSecrets(),r=this.handler.extractEnvironments(e.document,n);return await this.clearNotifications(),r}catch(n){return console.info("Error reading replay environments",n),await this.blockOn(e.filePath,Nd(n)),[]}}async writeSection(e,n){const r=await this.loadDocumentFromStorage(),i=await this.applyWrite(r,e,n);return(i==="written"||i==="unchanged"&&r.status==="ok")&&await this.clearNotifications(),i}async applyWrite(e,n,r){const i=bL(n);if(e.status==="unreadable"){if(!this.rebuildWhenUnparseable)return await this.reportUnavailable(e.filePath,e.error,"file",r),"unavailable"}else if(e.status==="invalid"&&!this.rebuildWhenUnparseable)return"blocked";const s=e.status==="ok"?e.document:null,o=await this.readSecrets();if(s&&this.isUnchanged(s,o,i))return"unchanged";if(s&&this.handler.isSectionAliased(s))return await this.blockOn(e.filePath,new Error(`The ${this.basePath.join(".")} section is an alias, so Replay cannot change it`)),"blocked";if(SL(i)){if(this.isSection){if(SL(n)){const a=await this.clearSection(e.filePath,s,r);if(a)return a}else if(!s||!this.handler.hasSection(s))return"unchanged"}else if(!s)return"unchanged"}return this.writeEnvironments(e.filePath,s,o,i,r)}async clearSection(e,n,r){if(!n||!this.handler.hasSection(n)||!this.handler.hasEnvironments(n))return"unchanged";if(this.handler.hasUnreadContent(n))return null;this.handler.removeSection(n);const i=await this.serialize(e,n,{allowEmptyFile:!0});return i===null?"blocked":this.store(e,i,r)}isUnchanged(e,n,r){try{return Tje(bL(this.handler.extractEnvironments(e,n)),r)}catch{return!1}}async writeEnvironments(e,n,r,i,s){let o;try{o=this.handler.hydrateDocument(n??new $O({}),i,r)}catch(l){return console.error(`Failed to update ${e}`,l),await this.blockOn(e,Nd(l)),"blocked"}if(this.isSection&&!this.isUnchanged(o,r,i))return await this.blockOn(e,new Error(`Replay could not save the ${this.basePath.join(".")} section as edited`)),"blocked";const a=await this.serialize(e,o);if(a===null)return"blocked";try{await this.localStorageSecretsProvider.set(JSON.stringify(r))}catch(l){return await this.reportUnavailable(e,Nd(l),"secrets",s),"unavailable"}return this.store(e,a,s)}async serialize(e,n,{allowEmptyFile:r=!1}={}){try{return r&&aje(n)?"":n.toString()}catch(i){return console.error(`Failed to serialize ${e}`,i),await this.blockOn(e,Nd(i)),null}}async store(e,n,r){try{await this.storage.set(e,n)}catch(i){return await this.reportUnavailable(e,Nd(i),"file",r),"unavailable"}return"written"}async blockOn(e,n){this.configError={filePath:e,issues:[{message:n.message}]},await M0(e,n)}async reportUnavailable(e,n,r,i){const s=r==="secrets"?"the environment secrets":e;console.error(`Failed to save ${s}`,n);const o=i?" and will retry":"";await M0(e,new Error(`Replay could not save ${s}${o}: ${n.message}`))}async loadDocumentFromStorage(){const e=await this.readActiveFile();if("error"in e)return console.error(`Failed to read ${e.filePath}`,e.error),{status:"unreadable",filePath:e.filePath,error:e.error};const{filePath:n,content:r}=e;if(!r)return this.configError=null,await this.clearNotifications(),{status:"absent",filePath:n};const i=sje(r);if(i.errors.length>0)return console.error("Environments file has YAML errors",i.errors),this.configError={filePath:n,issues:i.errors.map(o=>({message:o.message.trim(),line:o.linePos?.[0]?.line}))},await Sje(n,i.errors),{status:"invalid",filePath:n};this.configError=null;const s=this.handler.sectionProblem(i);return s?(await this.blockOn(n,new Error(s)),{status:"invalid",filePath:n}):{status:"ok",filePath:n,document:i}}async readActiveFile(){let e=null;for(const n of this.candidatePaths){let r;try{r=await this.storage.get(n)}catch(i){return{filePath:n,error:Nd(i)}}if(r)return{filePath:n,content:r};r!==null&&e===null&&(e=n)}return{filePath:e??this.candidatePaths[0],content:null}}async clearNotifications(){await Promise.all(this.candidatePaths.map(e=>V0(e)))}async readSecrets(){const e=await this.localStorageSecretsProvider.get();if(!e)return{};try{return JSON.parse(e)}catch(n){return console.error("Failed to parse replay secrets sidecar",n),{}}}}function Nd(t){return t instanceof Error?t:new Error(String(t))}const wL=[1e3,3e3,1e4];class Pje{constructor(e,n){this.storage=e,this.rebuildWhenUnparseable=n}storage;rebuildWhenUnparseable;configFileErrorAccessor=null;retryAttempt=0;retryTimer=null;writeId=0;setConfigFileErrorAccessor(e){this.configFileErrorAccessor=e}publishConfigError(){this.configFileErrorAccessor?.set(this.storage.getConfigError())}async write(e){this.cancelRetry(),this.retryAttempt=0,this.writeId+=1,await this.persist(e,this.writeId)}async persist(e,n){const r=this.retryAttempt<wL.length,i=await this.storage.write(e,{willRetry:r});n===this.writeId&&(this.reportConfigError(),i==="unavailable"&&this.scheduleRetry(e,n))}scheduleRetry(e,n){const r=wL[this.retryAttempt];r!==void 0&&(this.cancelRetry(),this.retryAttempt+=1,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.persist(e,n)},r))}cancelRetry(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null)}reportConfigError(){if(this.rebuildWhenUnparseable||!this.configFileErrorAccessor)return;const e=this.storage.getConfigError();!e&&!this.configFileErrorAccessor.get()||this.configFileErrorAccessor.set(e)}}class kje{constructor(e,n,r){this.storage=e,this.filePath=n,this.defaultValue=r}storage;filePath;defaultValue;async parse(e){return JSON.parse(e)}stringify(e){return JSON.stringify(e)}async read(){let e;try{e=await this.storage.get(this.filePath)}catch(n){return console.error(`Failed to read ${this.filePath}`,n),this.defaultValue}return e?await this.parse(e):this.defaultValue}async write(e){return this.storage.set(this.filePath,this.stringify(e))}}const NE=(t,e)=>({data:t,version:e});class RG extends kje{constructor(e,n,r,i){super(e,n,r),this.version=i}version;migrationMap={};migrate(e){if(!this.migrationMap[e.version])return NE(this.defaultValue,this.version);const n=this.migrationMap[e.version](e);return n.version===this.version?n:this.migrate(n)}async parse(e){const n=JSON.parse(e);if(n.version!==this.version){const r=this.migrate(n);return await this.write(r.data),r.data}return n.data}stringify(e){return JSON.stringify(NE(e,this.version))}}const TL={activeTabIdx:0,tabs:[]};function Eje(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===Xe.Step?{...e,data:{...e.data,draftStep:{...e.data.step,security:e.data.step.security.securities},step:void 0,hasUnsavedChanges:void 0,showUnsavedChangesModal:void 0}}:e)},version:2}}function Ije(t){const e=ch();return{...e,...t,formData:{...e.formData,...t?.formData}}}const IT=2,$je="tabs.json";class Aje extends RG{migrationMap={1:Eje};constructor(e){super(e,$je,Ra(TL),IT)}async parse(e){let n=null;try{n=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}n||(n=NE(Ra(TL),IT)),n.version!==IT&&(n=this.migrate(n));const r=await Promise.all(n.data.tabs.map(async i=>{if(i.data.type===Xe.Step){if(i.data.draftStep){i.data.draftStep.requestBody=Ije(i.data.draftStep.requestBody);const s=i.data.draftStep.requestBody.formData;s["multipart/form-data"]=await CL(s["multipart/form-data"]),s["application/x-www-form-urlencoded"]=await CL(s["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await PO(i.data.draftStep.requestBody.binary.absolutePath))}return{...i,data:{...i.data,isProcessingRequest:!1}}}return i}));return{...n.data,tabs:r}}stringify(e){const n={...e,tabs:e.tabs.map(r=>{if(r.data.type===Xe.Step){const{isProcessingRequest:i,...s}=r.data;return{...r,data:{...s,response:null}}}return r.data.type===Xe.WorkflowRun?{...r,data:{...r.data,result:null,runStatus:null,runError:null}}:r})};return super.stringify(n)}}async function CL(t){return Promise.all(t.map(async e=>{const n={...e};if(e.files){const r=e.files.map(i=>i.absolutePath).filter(i=>i!==null);n.files=await DY(r)}return n}))}const Qje=1;class _G{constructor(e,n,r,i,s,o,a){this.systemFilesStorage=e,this.userFilesStorage=n,this.project=r,this.isApiPersisted=i,this.environmentsPersistence=s,this.convertOperationToReplayValue=o,this.telemetry=a,this.localStorageSecretsProvider=new b_e(this.project.id);const l=new y_e;this.activeEnvironmentIdStorage=new RG(this.systemFilesStorage,"active_environment_id.json",_h,Qje),this.tabsStateStorage=new Aje(this.systemFilesStorage),this.environmentsStorage=new Cje(this.userFilesStorage,this.localStorageSecretsProvider,s),this.environmentsWriter=new Pje(this.environmentsStorage,s.rebuildWhenUnparseable),this.collectionsStorage=new Y_e(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new x_e(this.isApiPersisted?this.userFilesStorage:l)}systemFilesStorage;userFilesStorage;project;isApiPersisted;environmentsPersistence;convertOperationToReplayValue;telemetry;activeEnvironmentIdStorage;tabsStateStorage;environmentsStorage;collectionsStorage;apisStorage;localStorageSecretsProvider;persistExcludedIds=new Set;watchExcludedIds=new Set;environmentsWriter;setConfigFileErrorAccessor(e){this.environmentsWriter.setConfigFileErrorAccessor(e)}getEnvironmentsConfigError(){return this.environmentsStorage.getConfigError()}publishEnvironmentsConfigError(){this.environmentsWriter.publishConfigError()}writeActiveEnvironmentId(e){return this.activeEnvironmentIdStorage.write(e)}writeTabsState(e){return this.tabsStateStorage.write(e)}async writeApis(e){this.isApiPersisted&&await this.apisStorage.applyChanges(e)}async writeCollections(e){await this.collectionsStorage.applyChanges(e)}writeEnvironments(e){return this.environmentsWriter.write(e)}addPersistExcludedId(e){this.persistExcludedIds.add(e),this.userFilesStorage.setWriteExcludedKeys(new Set([...this.persistExcludedIds]))}removePersistExcludedId(e){this.persistExcludedIds.delete(e),this.userFilesStorage.setWriteExcludedKeys(new Set([...this.persistExcludedIds]))}addWatchExcludedId(e){this.watchExcludedIds.add(e)}removeWatchExcludedId(e){this.watchExcludedIds.delete(e)}isWatchExcluded(e){return this.watchExcludedIds.has(e)}}class Rje extends _G{constructor(e,n,r){const i=new IE(e.systemFilesDir),s=new IE(e.userFilesDir);super(i,s,e,!1,{filePaths:[O_e],basePath:[],rebuildWhenUnparseable:!0},n,r)}async detectProjectFiles(e){const n=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[ye("storageOperation","detectFiles","storage")],e?.parentCtx),i=(await this.userFilesStorage.ls()).filter(l=>/\.(ya?ml|json)$/.test(l)),s=[],o=[],a=new Set;return await Promise.all(i.map(async l=>{const c=await this.userFilesStorage.get(l);if(c)try{const u=Qc.load(c);if(typeof u=="object"&&u!==null)if(typeof u.openapi=="string"){const f=await sn.resolve(await sn.join(this.userFilesStorage.baseDir,l)),{definition:h}=await R0(f,u);s.push({uri:l,type:qi.FS,content:h}),await V0(l)}else typeof u.arazzo=="string"&&(o.push({uri:l,type:qi.FS,content:u}),await V0(l),u.sourceDescriptions?.forEach(f=>{const h=f.type,p=f.url,m=!h||h==="openapi",g=typeof p=="string"&&zs(p);m&&g&&a.add(p)}))}catch(u){console.info(`Error parsing YAML/JSON file ${l}:`,u),await M0(l,u)}})),n?.setAttribute("status","completed"),n?.setAttribute("filesCount",i.length),n?.setAttribute("apiFilesCount",s.length),n?.setAttribute("collectionFilesCount",o.length),n?.setAttribute("apiUrlsCount",a.size),n?.setStatus(exports.SpanStatusCode.OK),n?.end(),{apiFiles:s,collectionFiles:o,apiUrls:a}}async loadApis(e,n){const r=this.telemetry?.startSpan("com.redocly.storage.loadApis",[{...ye("storageOperation","loadApis","storage"),apiUrlsCount:e.size}],n?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async s=>{try{const{definition:o}=await R0(s);i.push({uri:s,type:qi.WEB,content:o})}catch(o){console.error(`Error parsing YAML from ${s}:`,o)}})),r?.setAttribute("status","completed"),r?.setStatus(exports.SpanStatusCode.OK),r?.end(),i}async parseApis(e,n){const r=this.telemetry?.startSpan("com.redocly.storage.parseApis",[{...ye("storageOperation","parseApis","storage"),apisCount:e.length}],n?.parentCtx),i=await this.apisStorage.parseMany(e);return r?.setAttribute("status","completed"),r?.setAttribute("parsedApisCount",i.length),r?.setStatus(exports.SpanStatusCode.OK),r?.end(),i}async parseCollections(e,n,r){const i=this.telemetry?.startSpan("com.redocly.storage.parseCollections",[{...ye("storageOperation","parseCollections","storage"),collectionsCount:e.length}],r?.parentCtx),s=await this.collectionsStorage.parseMany(e,n);return i?.setAttribute("status","completed"),i?.setAttribute("parsedCollectionsCount",s.length),i?.setStatus(exports.SpanStatusCode.OK),i?.end(),s}async read(){const e=this.telemetry?.startSpan("com.redocly.storage.read",[ye("storageOperation","read","storage")],void 0),n=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[ye("storageOperation","loadUserState","storage")],e?.parentCtx),[r,i,s]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);n?.setAttribute("status","completed"),n?.setAttribute("environmentCount",s.length),n?.setStatus(exports.SpanStatusCode.OK),n?.end();const{apiFiles:o,collectionFiles:a,apiUrls:l}=await this.detectProjectFiles(e),c=await this.loadApis(l,e),u=await this.parseApis([...o,...c],e),f=await this.parseCollections(a,u,e);return e?.setAttribute("status","completed"),e?.setStatus(exports.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:i,environments:s,apis:u,collections:f}}}function _je(t,e){const n=new Map(t.map(i=>[i.id,i])),r=new Set(e.map(i=>i.id));return{written:e.filter(i=>n.get(i.id)!==i),removed:t.filter(i=>!r.has(i.id)).map(i=>i.id)}}function jje(t,e){const n=new Map(t.map(i=>[i.id,i])),r=new Set(e.map(i=>i.id));return{written:e.filter(i=>{const s=n.get(i.id);return s!==i&&!am(s,i)}),removed:t.filter(i=>!r.has(i.id)).map(i=>i.id)}}function jG(t=!1){let e,n,r=!1,i=Promise.resolve(),s=null,o=null,a=null,l=null,c=[],u=null,f=!1,h=null,p=null,m=[],g=[];function O(k){if(v(),!e)return;m=k.get(_s),g=k.get(Co);let I=!1;c.push(k.sub(Io,()=>{r||!e||e.writeActiveEnvironmentId(k.get(Io))}),k.sub(si,()=>{r||!e||f||e.writeEnvironments(k.get(si))}),k.sub(_s,()=>{const Q=k.get(_s),N=_je(m,Q);m=Q,!(r||!e)&&e.writeApis(N)}),k.sub(Co,()=>{const Q=k.get(Co),N=jje(g,Q);g=Q,!(r||!e)&&e.writeCollections(N)}),k.sub(Zr,E),k.sub(ms,E));function E(){if(r||!e||I)return;I=!0;const Q=e;queueMicrotask(()=>{I=!1,!(r||e!==Q)&&Q.writeTabsState({activeTabIdx:k.get(ms),tabs:k.get(Zr)})})}}function v(){c.forEach(k=>k()),c=[]}function b(){l&&(l(),l=null)}async function y(k){if(!(!Rn()||!e||!a||!u||!h||!p)){await w();try{const{FileWatcher:I}=await Promise.resolve().then(()=>require("./replay-FileWatcher-U8tCGJmQ.js")),E=a.get(Q0).userFilesDir;o=new I(e,E,k,u,h,p),await o.start()}catch(I){console.error("Failed to start file watcher:",I),o=null}}}async function w(){o&&(await o.stop(),o=null)}async function S(){Rn()&&(await w(),await Gt("cleanup_all_managed_watchers"))}const P=async(k,I,E,Q)=>{r=!0;try{const{convertOperationToReplayValue:N,aiEnabled:_}=I,M=Rn();if(a=E,b(),v(),t){E.set(si,[]);return}if(M){const{TauriRootStorage:L}=await Promise.resolve().then(()=>require("./replay-TauriRootStorage-DyTqNU-0.js"));n=new L(k,N,Q),e=n}else n=void 0,e=new Rje(k,N,Q);if(M){await w();const{getSemanticSearchService:L}=await Promise.resolve().then(()=>require("./replay-index-CjqjkFv_.js"));L().setProject(k.id)}u={get:()=>E.get(si),set:L=>{f=!0;try{E.set(si,L)}finally{f=!1}}},h={get:()=>E.get(_s),set:L=>E.set(_s,L)},p={get:()=>E.get(Co),set:L=>E.set(Co,L)},e.setConfigFileErrorAccessor({get:()=>E.get(_0),set:L=>E.set(_0,L)});const{project:z,activeEnvironmentId:X,environments:$,apis:U,collections:R,tabsState:D}=await e.read();if(E.set(Q0,z),E.set(Io,X),E.set(si,$),E.set(_s,U),E.set(Co,R),E.set(Zr,D.tabs),E.set(ms,D.activeTabIdx),O(E),M&&e.publishEnvironmentsConfigError(),!M)return;if(await y(_??!1),_){const[{getSemanticSearchService:L},{createIndexSnapshotGetter:F,startPeriodicIndexRevalidation:Y}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-CjqjkFv_.js")),Promise.resolve().then(()=>require("./replay-periodic-revalidation-B6VfUGtP.js"))]),G=L();G.preloadModel().catch(()=>{}),G.reindex(F(E)).catch(ee=>{console.error("Semantic reindex failed:",ee)}),l=Y(G,E)}}finally{r=!1}};return{getTauriRootStorage:()=>n,cleanup:async()=>{s=null,b(),v(),await S()},init:async(k,I,E,Q)=>{if(s&&s.store===E&&s.projectId===k.id)return s.run;const N=i,_=(async()=>(await N,P(k,I,E,Q)))();i=_.then(()=>{},()=>{});const M={store:E,projectId:k.id,run:_};return s=M,_.catch(()=>{s===M&&(s=null)}),_}}}const Nje=jG(),NG=x.createContext(Nje),Dje=NG.Provider;function DG(){return x.useContext(NG)}const Mje="Fetching from URL...",Vje="Source updated",$T="Failed to re-fetch source";function Lje({sourceUrl:t,apiId:e}){const r=DG().getTauriRootStorage(),i=wA(),{loading:s,updateToast:o,dismissToast:a}=bI.useToast(),[l,c]=x.useState(!1),[u,f]=x.useState(!1),h=x.useRef(null);bh(x.useId(),l),x.useEffect(()=>()=>{h.current&&a(h.current)},[a]);const p=x.useCallback(O=>{c(O)},[]),m=x.useCallback(()=>{c(!1)},[]),g=x.useCallback(async()=>{if(u)return;f(!0),c(!1);const O=s(Mje);h.current=O;try{if(!r)throw new Error($T);const[v]=await r.loadAndParseApis([{absolute_path:t,relative_path:e}],void 0,!0);if(!v)throw new Error($T);i(b=>b.some(y=>y.id===e)?b.map(y=>y.id===e?v:y):[...b,v]),o(O,{type:"success",title:Vje})}catch(v){const b=v instanceof Error?v.message:$T;o(O,{type:"error",title:b})}finally{h.current===O&&(h.current=null),f(!1)}},[e,i,u,s,t,r,o]);return d.jsx(Xn,{trigger:"click",placement:"bottomRight",visible:l,onVisibleChange:p,content:d.jsx(zje,{sourceUrl:t,onClose:m,onConfirm:g}),children:d.jsx(Ln.Tooltip,{tip:"Re-fetch source",children:d.jsx(Bje,{children:d.jsx(ve.Button,{variant:"text",size:"small",icon:d.jsx(M9.RenewIcon,{size:"14px"}),disabled:u})})})})}function zje({sourceUrl:t,onClose:e,onConfirm:n}){return d.jsxs(Xje,{onClick:r=>r.stopPropagation(),children:[d.jsxs(Uje,{children:[d.jsxs(qje,{children:[d.jsx(Fje,{children:d.jsx(yl.WarningFilledIcon,{size:"16px",color:"--color-warning-base"})}),d.jsx(Or.Typography,{children:"Re-fetch source"})]}),d.jsx(Or.Typography,{lineHeight:"var(--line-height-sm)",fontSize:"var(--font-size-sm)",fontWeight:"var(--font-weight-regular)",color:"var(--text-color-secondary)",children:"Downloads the latest file from the URL and replaces the stored version."}),d.jsx(Wje,{title:t,children:t})]}),d.jsxs(Zje,{children:[d.jsx(ve.Button,{variant:"text",size:"small",onClick:e,children:"Cancel"}),d.jsx(ve.Button,{variant:"primary",size:"small",onClick:n,children:"Re-fetch"})]})]})}const Xje=T.default.div`
1601
+ `,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=Uv(e),r=jd(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=Uv(e),r=jd(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function ije(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new nje||null,prettyErrors:e}}function sje(t,e={}){const{lineCounter:n,prettyErrors:r}=ije(e),i=new rje(n?.addNewLine),s=new H2e(e);let o=null;for(const a of s.compose(i.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Fp(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(hL(t,n)),o.warnings.forEach(hL(t,n))),o}function GQ(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function QG(t){return!pn(t)||t.value==null?null:typeof t.value=="string"?t.value:GQ(t.value)?t.source??String(t.value):null}function CT(t,e){return QG(t)===e}function wg(t){return pn(t)&&t.value==null}function eu(t){return t==null||wg(t)||oi(t)||t instanceof Dt}function PT(t){return t==null||oi(t)||pn(t)&&(t.value==null||GQ(t.value))}function oje(t){return pn(t)&&typeof t.value=="string"}function xo(t,e){return oi(t.getIn(e,!0))}function aje(t){const{contents:e}=t;return e instanceof Dt&&e.items.length===0&&!e.commentBefore&&!e.comment&&!t.commentBefore&&!t.comment}const lje="<<",yL="$ref";class cje{constructor(e,n){this.providers=e,this.basePath=n}providers;basePath;sectionProblem(e){if(this.basePath.length===0){const s=e.contents;return eu(s)?s instanceof Dt?this.environmentsProblem(e,s,"environments"):null:"The environments store must be a map of environment names"}const n=this.basePath.join("."),r=this.parentProblem(e,n);if(r)return r;if(xo(e,this.basePath))return null;if(this.hasRefAbove(e))return`Replay does not follow $ref, so it cannot manage the ${n} section here`;const i=e.getIn(this.basePath,!0);return eu(i)?i instanceof Dt?this.environmentsProblem(e,i,n):null:`The ${n} section must be a map of environment names`}environmentsProblem(e,n,r){const i=this.managedKeysProblem(n,r);if(i)return i;for(const s of n.items){const o=String(s.key);if($c(o))continue;if(!eu(s.value))return`Environment ${o} in ${r} must be a map`;if(!(s.value instanceof Dt))continue;const a=this.environmentBodyProblem(e,o,s.value,r);if(a)return a}return null}environmentBodyProblem(e,n,r,i){const s=this.reservedKeysProblem(r,i);if(s)return s;const o=r.get("inputs",!0);if(!eu(o))return`The inputs of ${n} in ${i} must be a map`;if(o instanceof Dt){const l=`the inputs of ${n}`,c=this.managedKeysProblem(o,l);if(c)return c;for(const u of o.items)if(!PT(u.value)&&!(u.value instanceof Dt&&this.isMarkerNode(e,u.value)))return`Input ${String(u.key)} of ${n} in ${i} must be a single value`}const a=r.get("servers",!0);if(!eu(a))return`The servers of ${n} in ${i} must be a map`;if(a instanceof Dt){const l=`the servers of ${n}`,c=this.managedKeysProblem(a,l);if(c)return c;for(const u of a.items){const f=this.serverBodyProblem(String(u.key),u.value,n,i);if(f)return f}}return null}serverBodyProblem(e,n,r,i){if(!eu(n))return`Server ${e} of ${r} in ${i} must be a map`;if(!(n instanceof Dt))return null;const s=this.reservedKeysProblem(n,`server ${e} of ${r}`);if(s)return s;const o=n.get("value",!0);if(!PT(o))return`The value of server ${e} of ${r} in ${i} must be a single value`;const a=n.get("variables",!0);if(!eu(a))return`The variables of server ${e} of ${r} in ${i} must be a map`;if(a instanceof Dt){const l=`the variables of server ${e} of ${r}`,c=this.managedKeysProblem(a,l);if(c)return c;for(const u of a.items)if(!PT(u.value))return`Variable ${String(u.key)} of server ${e} of ${r} in ${i} must be a single value`}return null}managedKeysProblem(e,n){const r=this.reservedKeysProblem(e,n);if(r)return r;for(const i of e.items)if(!oje(i.key))return`Replay reads only string keys, and ${n} holds ${String(i.key)}`;return null}reservedKeysProblem(e,n){return e.has(lje)?`Replay cannot read a merge key, and ${n} uses one`:e.has(yL)?`Replay does not follow $ref, and ${n} uses one`:null}isMarkerNode(e,n){try{return this.providers.resolveProviderForMarker(n.toJS(e))!==null}catch{return!1}}parentProblem(e,n){for(let r=1;r<this.basePath.length;r++){const i=this.basePath.slice(0,r),s=e.getIn(i,!0);if(s==null||wg(s))return null;const o=i.join(".");if(oi(s))return`The ${o} key is an alias, so Replay cannot manage the ${n} section inside it`;if(!(s instanceof Dt))return`The ${o} key must be a map for Replay to manage the ${n} section`}return null}hasRefAbove(e){for(let n=1;n<=this.basePath.length;n++){const r=e.getIn(this.basePath.slice(0,n),!0);if(r instanceof Dt&&r.has(yL))return!0}return!1}}const uje=new Set(["inputs","servers"]),dje=new Set(["value","variables"]);class fje{constructor(e,n=[]){this.providers=e,this.basePath=n,this.validator=new cje(e,n)}providers;basePath;validator;hasSection(e){return this.basePath.length===0||e.hasIn(this.basePath)}sectionPath(...e){return[...this.basePath,...e]}leafText(e,n,r){const i=e.getIn(n,!0),s=oi(i)?i.resolve(e):i;return QG(s)??(GQ(r)?String(r):"")}extractEnvironments(e,n){const r=this.readSectionData(e);return r?Object.keys(r).filter(s=>!$c(s)).map(s=>{const o=r[s]??{},a=Object.entries(o.inputs??{}).map(([c,u])=>{const f=this.providers.resolveProviderForMarker(u);return f?{name:c,value:f.resolve(n,s,c),isSecret:!0}:{name:c,value:this.leafText(e,this.sectionPath(s,"inputs",c),u),isSecret:!1}}),l=Object.entries(o.servers??{}).map(([c,u])=>{const f=this.sectionPath(s,"servers",c);return{apiId:c,value:this.leafText(e,[...f,"value"],u?.value),variables:Object.entries(u?.variables??{}).map(([h,p])=>({name:h,value:this.leafText(e,[...f,"variables",h],p)}))}});return{name:s,inputs:a,servers:l,state:zt.Normal}}):[]}hydrateDocument(e,n,r){if(xo(e,this.basePath))return e;for(let s=1;s<=this.basePath.length;s++){const o=this.basePath.slice(0,s);wg(e.getIn(o,!0))&&e.setIn(o,this.createBlockMap(e))}const i=new Set(n.map(s=>s.name).filter(Boolean));this.deleteRemovedKeys(e,this.sectionPath(),i);for(const s of n){if(!s.name)continue;const o=this.sectionPath(s.name);xo(e,o)||(e.hasIn(o)||this.ensureBlockMap(e,o),this.syncInputs(e,s.name,s.inputs,r),this.syncServers(e,s.name,s.servers))}return this.unflowSectionAncestors(e),e}removeSection(e){if(this.basePath.length!==0){e.deleteIn(this.basePath);for(let n=this.basePath.length-1;n>0;n--){const r=this.basePath.slice(0,n),i=e.getIn(r,!0);i instanceof Dt&&i.items.length===0&&e.deleteIn(r)}}}sectionProblem(e){return this.validator.sectionProblem(e)}isSectionAliased(e){return this.basePath.length>0&&xo(e,this.basePath)}hasEnvironments(e){const n=this.basePath.length===0?e.contents:e.getIn(this.basePath,!0);return n instanceof Dt&&n.items.length>0}hasUnreadContent(e){const n=e.getIn(this.basePath,!0);return n instanceof Dt?n.items.some(r=>this.environmentHoldsUnreadContent(r.value)):!1}environmentHoldsUnreadContent(e){return oi(e)?!0:e instanceof Dt?e.items.some(n=>{const r=String(n.key);return!uje.has(r)||oi(n.value)?!0:r!=="servers"||!(n.value instanceof Dt)?!1:n.value.items.some(i=>{const s=i.value;return oi(s)?!0:s instanceof Dt?s.items.some(o=>!dje.has(String(o.key))):!1})}):!1}unflowSectionAncestors(e){for(let n=1;n<=this.basePath.length;n++){const r=e.getIn(this.basePath.slice(0,n),!0);r instanceof Dt&&r.flow&&(r.flow=!1)}}readSectionData(e){if(this.basePath.length===0){const i=e.toJS();return i==null||typeof i!="object"||Array.isArray(i)?null:i}const n=e.getIn(this.basePath,!0);if(n==null||wg(n))return null;if(!oi(n)&&!(n instanceof Dt))throw new Error(`Expected \`${this.basePath.join(".")}\` to be a map of environments`);const r=n.toJS(e);if(r==null)return null;if(typeof r!="object"||Array.isArray(r))throw new Error(`Expected \`${this.basePath.join(".")}\` to be a map of environments`);return r}syncInputs(e,n,r,i){const s=new Set(r.map(a=>a.name)),o=this.sectionPath(n,"inputs");if(!xo(e,o)){this.deleteRemovedKeys(e,o,s),r.length>0&&this.ensureBlockMap(e,o);for(const a of r){const l=[...o,a.name];if(!xo(e,l)){if(a.isSecret){const c=e.getIn(l,!0),u=c instanceof Dt?c.toJS(e):e.getIn(l),f=this.providers.resolveProviderForMarker(u);f||e.setIn(l,e.createNode(this.providers.getDefaultProvider().createMarker())),(f??this.providers.getDefaultProvider()).store(i,n,a.name,a.value);continue}CT(e.getIn(l,!0),a.value)||e.setIn(l,a.value)}}}}syncServers(e,n,r){const i=new Set(r.map(o=>o.apiId)),s=this.sectionPath(n,"servers");if(!xo(e,s)){this.deleteRemovedKeys(e,s,i),r.length>0&&this.ensureBlockMap(e,s);for(const o of r){const a=[...s,o.apiId];if(xo(e,a))continue;wg(e.getIn(a,!0))&&e.setIn(a,this.createBlockMap(e));const l=[...a,"value"];!xo(e,l)&&!CT(e.getIn(l,!0),o.value)&&e.setIn(l,o.value);const c=[...a,"variables"];if(xo(e,c))continue;const u=new Set(o.variables.map(f=>f.name));this.deleteRemovedKeys(e,c,u),o.variables.length>0&&this.ensureBlockMap(e,c);for(const f of o.variables){const h=[...c,f.name];xo(e,h)||CT(e.getIn(h,!0),f.value)||e.setIn(h,f.value)}}}}ensureBlockMap(e,n){for(let r=this.basePath.length+1;r<=n.length;r++){const i=n.slice(0,r),s=e.getIn(i,!0);if(s instanceof Dt){s.flow=!1;continue}if(oi(s))return;e.setIn(i,this.createBlockMap(e))}}createBlockMap(e){const n=e.createNode({});return n instanceof Dt&&(n.flow=!1),n}deleteRemovedKeys(e,n,r){for(const i of this.getMapKeys(e,...n))!i.trim()||$c(i)||r.has(i)||e.deleteIn([...n,i])}getMapKeys(e,...n){const r=n.length===0?e.contents:e.getIn(n,!0);return r instanceof Dt?r.items.map(i=>String(i.key)):[]}}class hje{id="local";isMarker(e){return typeof e=="object"&&e!==null&&"provider"in e&&e.provider===this.id}createMarker(){return{provider:this.id}}resolve(e,n,r){return e[n]?.[r]??""}store(e,n,r,i){e[n]||(e[n]={}),e[n][r]=i}}class pje{constructor(e,n){this.defaultProviderId=n,this.providersById=new Map(e.map(r=>[r.id,r]))}defaultProviderId;providersById;getDefaultProvider(){const e=this.providersById.get(this.defaultProviderId);if(!e)throw new Error(`Missing default secrets provider strategy: ${this.defaultProviderId}`);return e}resolveProviderForMarker(e){return this.isProviderMarker(e)?this.providersById.get(e.provider)??this.getDefaultProvider():null}isProviderMarker(e){return typeof e=="object"&&e!==null&&"provider"in e&&typeof e.provider=="string"}}class gje{constructor(e){this.storage=e}storage;async getAll(){return this.storage.getAll()}async set(e,n){await this.storage.set(e,n)}async clear(e){await this.storage.clear(e)}}class mje{notifications=new Map;async getAll(){return Array.from(this.notifications.values())}async set(e,n){const r=n.filter(s=>s.severity==="error").length,i=n.filter(s=>s.severity==="warning").length;this.notifications.set(e,{id:e,source:e,issues:n,errorCount:r,warningCount:i})}async clear(e){this.notifications.delete(e)}}const QO={all:["notifications"],lists:()=>[...QO.all,"list"]};function Oje(){return ki.useQuery({queryKey:QO.lists(),queryFn:async()=>Em.getInstance().getAll()})}function vje(){return ki.useQuery({queryKey:QO.lists(),queryFn:async()=>Em.getInstance().getAll(),select:t=>({total:t.reduce((e,n)=>e+n.issues.length,0),errorCount:t.reduce((e,n)=>e+n.errorCount,0)})})}class Em{static instance=null;static initialize(){this.close();const e=new mje;this.instance=new gje(e)}static getInstance(){if(!this.instance)throw new Error("NotificationsService not initialized");return this.instance}static close(){this.instance=null}}let kT=null;function RS(){return kT||(kT=new ki.QueryClient({defaultOptions:{queries:{staleTime:30*1e3,gcTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}})),kT}function yje(t){const e=t.match(/\bline\s+(\d+)\b/i);if(!e)return;const n=Number.parseInt(e[1],10);return Number.isNaN(n)?void 0:n}function bje(t){const e=(t instanceof Error?t.message:String(t)).trim();return[{severity:"error",message:e,line:yje(e)}]}function xje(t){return t.map(e=>({severity:"error",message:e.message.trim(),line:e.linePos?.[0]?.line}))}async function HQ(t){try{const e=Em.getInstance();await t(e),RS().invalidateQueries({queryKey:QO.all})}catch{}}async function M0(t,e){await HQ(async n=>{await n.set(t,bje(e))})}async function Sje(t,e){e.length!==0&&await HQ(async n=>{await n.set(t,xje(e))})}async function V0(t){await HQ(async e=>{await e.clear(t)})}function bL(t){return ET(t,e=>e.name).map(e=>({...e,inputs:Ek(e.inputs),servers:ET(e.servers,n=>n.apiId).map(n=>({...n,variables:ET(n.variables,r=>r.name)}))}))}function ET(t,e){const n=new Set,r=[];for(const i of t){const s=e(i);!wje(s)||n.has(s)||(n.add(s),r.push(i))}return r}function wje(t){return!!t.trim()&&!$c(t)}function Tje(t,e){return xL(t)===xL(e)}function xL(t){const e=(n,r)=>[...n].sort((i,s)=>r(i).localeCompare(r(s)));return JSON.stringify(e(t.filter(n=>n.name),n=>n.name).map(n=>[n.name,e(n.inputs,r=>r.name).map(r=>[r.name,r.value,r.isSecret]),e(n.servers,r=>r.apiId).map(r=>[r.apiId,r.value,e(r.variables,i=>i.name).map(i=>[i.name,i.value])])]))}function SL(t){if(t.length===0)return!0;if(t.length>1)return!1;const[e]=t;return e.name===_h&&e.inputs.length===0&&e.servers.length===0}class Cje{constructor(e,n,r){this.storage=e,this.localStorageSecretsProvider=n,this.candidatePaths=r.filePaths,this.basePath=r.basePath,this.rebuildWhenUnparseable=r.rebuildWhenUnparseable,this.handler=new fje(new pje([new hje],"local"),r.basePath)}storage;localStorageSecretsProvider;configError=null;handler;candidatePaths;basePath;rebuildWhenUnparseable;pendingWrite=Promise.resolve();get isSection(){return this.basePath.length>0}getConfigError(){return this.configError}async read(){const e=this.pendingWrite.then(()=>this.readSection());return this.pendingWrite=e.then(()=>{},()=>{}),e}async write(e,{willRetry:n=!1}={}){const r=this.pendingWrite.then(()=>this.writeSection(e,n));return this.pendingWrite=r.catch(()=>{}),r}async readSection(){const e=await this.loadDocumentFromStorage();if(e.status==="unreadable")return await this.blockOn(e.filePath,e.error),[];if(e.status!=="ok")return[];try{const n=await this.readSecrets(),r=this.handler.extractEnvironments(e.document,n);return await this.clearNotifications(),r}catch(n){return console.info("Error reading replay environments",n),await this.blockOn(e.filePath,Nd(n)),[]}}async writeSection(e,n){const r=await this.loadDocumentFromStorage(),i=await this.applyWrite(r,e,n);return(i==="written"||i==="unchanged"&&r.status==="ok")&&await this.clearNotifications(),i}async applyWrite(e,n,r){const i=bL(n);if(e.status==="unreadable"){if(!this.rebuildWhenUnparseable)return await this.reportUnavailable(e.filePath,e.error,"file",r),"unavailable"}else if(e.status==="invalid"&&!this.rebuildWhenUnparseable)return"blocked";const s=e.status==="ok"?e.document:null,o=await this.readSecrets();if(s&&this.isUnchanged(s,o,i))return"unchanged";if(s&&this.handler.isSectionAliased(s))return await this.blockOn(e.filePath,new Error(`The ${this.basePath.join(".")} section is an alias, so Replay cannot change it`)),"blocked";if(SL(i)){if(this.isSection){if(SL(n)){const a=await this.clearSection(e.filePath,s,r);if(a)return a}else if(!s||!this.handler.hasSection(s))return"unchanged"}else if(!s)return"unchanged"}return this.writeEnvironments(e.filePath,s,o,i,r)}async clearSection(e,n,r){if(!n||!this.handler.hasSection(n)||!this.handler.hasEnvironments(n))return"unchanged";if(this.handler.hasUnreadContent(n))return null;this.handler.removeSection(n);const i=await this.serialize(e,n,{allowEmptyFile:!0});return i===null?"blocked":this.store(e,i,r)}isUnchanged(e,n,r){try{return Tje(bL(this.handler.extractEnvironments(e,n)),r)}catch{return!1}}async writeEnvironments(e,n,r,i,s){let o;try{o=this.handler.hydrateDocument(n??new $O({}),i,r)}catch(l){return console.error(`Failed to update ${e}`,l),await this.blockOn(e,Nd(l)),"blocked"}if(this.isSection&&!this.isUnchanged(o,r,i))return await this.blockOn(e,new Error(`Replay could not save the ${this.basePath.join(".")} section as edited`)),"blocked";const a=await this.serialize(e,o);if(a===null)return"blocked";try{await this.localStorageSecretsProvider.set(JSON.stringify(r))}catch(l){return await this.reportUnavailable(e,Nd(l),"secrets",s),"unavailable"}return this.store(e,a,s)}async serialize(e,n,{allowEmptyFile:r=!1}={}){try{return r&&aje(n)?"":n.toString()}catch(i){return console.error(`Failed to serialize ${e}`,i),await this.blockOn(e,Nd(i)),null}}async store(e,n,r){try{await this.storage.set(e,n)}catch(i){return await this.reportUnavailable(e,Nd(i),"file",r),"unavailable"}return"written"}async blockOn(e,n){this.configError={filePath:e,issues:[{message:n.message}]},await M0(e,n)}async reportUnavailable(e,n,r,i){const s=r==="secrets"?"the environment secrets":e;console.error(`Failed to save ${s}`,n);const o=i?" and will retry":"";await M0(e,new Error(`Replay could not save ${s}${o}: ${n.message}`))}async loadDocumentFromStorage(){const e=await this.readActiveFile();if("error"in e)return console.error(`Failed to read ${e.filePath}`,e.error),{status:"unreadable",filePath:e.filePath,error:e.error};const{filePath:n,content:r}=e;if(!r)return this.configError=null,await this.clearNotifications(),{status:"absent",filePath:n};const i=sje(r);if(i.errors.length>0)return console.error("Environments file has YAML errors",i.errors),this.configError={filePath:n,issues:i.errors.map(o=>({message:o.message.trim(),line:o.linePos?.[0]?.line}))},await Sje(n,i.errors),{status:"invalid",filePath:n};this.configError=null;const s=this.handler.sectionProblem(i);return s?(await this.blockOn(n,new Error(s)),{status:"invalid",filePath:n}):{status:"ok",filePath:n,document:i}}async readActiveFile(){let e=null;for(const n of this.candidatePaths){let r;try{r=await this.storage.get(n)}catch(i){return{filePath:n,error:Nd(i)}}if(r)return{filePath:n,content:r};r!==null&&e===null&&(e=n)}return{filePath:e??this.candidatePaths[0],content:null}}async clearNotifications(){await Promise.all(this.candidatePaths.map(e=>V0(e)))}async readSecrets(){const e=await this.localStorageSecretsProvider.get();if(!e)return{};try{return JSON.parse(e)}catch(n){return console.error("Failed to parse replay secrets sidecar",n),{}}}}function Nd(t){return t instanceof Error?t:new Error(String(t))}const wL=[1e3,3e3,1e4];class Pje{constructor(e,n){this.storage=e,this.rebuildWhenUnparseable=n}storage;rebuildWhenUnparseable;configFileErrorAccessor=null;retryAttempt=0;retryTimer=null;writeId=0;setConfigFileErrorAccessor(e){this.configFileErrorAccessor=e}publishConfigError(){this.configFileErrorAccessor?.set(this.storage.getConfigError())}async write(e){this.cancelRetry(),this.retryAttempt=0,this.writeId+=1,await this.persist(e,this.writeId)}async persist(e,n){const r=this.retryAttempt<wL.length,i=await this.storage.write(e,{willRetry:r});n===this.writeId&&(this.reportConfigError(),i==="unavailable"&&this.scheduleRetry(e,n))}scheduleRetry(e,n){const r=wL[this.retryAttempt];r!==void 0&&(this.cancelRetry(),this.retryAttempt+=1,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.persist(e,n)},r))}cancelRetry(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null)}reportConfigError(){if(this.rebuildWhenUnparseable||!this.configFileErrorAccessor)return;const e=this.storage.getConfigError();!e&&!this.configFileErrorAccessor.get()||this.configFileErrorAccessor.set(e)}}class kje{constructor(e,n,r){this.storage=e,this.filePath=n,this.defaultValue=r}storage;filePath;defaultValue;async parse(e){return JSON.parse(e)}stringify(e){return JSON.stringify(e)}async read(){let e;try{e=await this.storage.get(this.filePath)}catch(n){return console.error(`Failed to read ${this.filePath}`,n),this.defaultValue}return e?await this.parse(e):this.defaultValue}async write(e){return this.storage.set(this.filePath,this.stringify(e))}}const NE=(t,e)=>({data:t,version:e});class RG extends kje{constructor(e,n,r,i){super(e,n,r),this.version=i}version;migrationMap={};migrate(e){if(!this.migrationMap[e.version])return NE(this.defaultValue,this.version);const n=this.migrationMap[e.version](e);return n.version===this.version?n:this.migrate(n)}async parse(e){const n=JSON.parse(e);if(n.version!==this.version){const r=this.migrate(n);return await this.write(r.data),r.data}return n.data}stringify(e){return JSON.stringify(NE(e,this.version))}}const TL={activeTabIdx:0,tabs:[]};function Eje(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===Xe.Step?{...e,data:{...e.data,draftStep:{...e.data.step,security:e.data.step.security.securities},step:void 0,hasUnsavedChanges:void 0,showUnsavedChangesModal:void 0}}:e)},version:2}}function Ije(t){const e=ch();return{...e,...t,formData:{...e.formData,...t?.formData}}}const IT=2,$je="tabs.json";class Aje extends RG{migrationMap={1:Eje};constructor(e){super(e,$je,Ra(TL),IT)}async parse(e){let n=null;try{n=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}n||(n=NE(Ra(TL),IT)),n.version!==IT&&(n=this.migrate(n));const r=await Promise.all(n.data.tabs.map(async i=>{if(i.data.type===Xe.Step){if(i.data.draftStep){i.data.draftStep.requestBody=Ije(i.data.draftStep.requestBody);const s=i.data.draftStep.requestBody.formData;s["multipart/form-data"]=await CL(s["multipart/form-data"]),s["application/x-www-form-urlencoded"]=await CL(s["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await PO(i.data.draftStep.requestBody.binary.absolutePath))}return{...i,data:{...i.data,isProcessingRequest:!1}}}return i}));return{...n.data,tabs:r}}stringify(e){const n={...e,tabs:e.tabs.map(r=>{if(r.data.type===Xe.Step){const{isProcessingRequest:i,...s}=r.data;return{...r,data:{...s,response:null}}}return r.data.type===Xe.WorkflowRun?{...r,data:{...r.data,result:null,runStatus:null,runError:null}}:r})};return super.stringify(n)}}async function CL(t){return Promise.all(t.map(async e=>{const n={...e};if(e.files){const r=e.files.map(i=>i.absolutePath).filter(i=>i!==null);n.files=await DY(r)}return n}))}const Qje=1;class _G{constructor(e,n,r,i,s,o,a){this.systemFilesStorage=e,this.userFilesStorage=n,this.project=r,this.isApiPersisted=i,this.environmentsPersistence=s,this.convertOperationToReplayValue=o,this.telemetry=a,this.localStorageSecretsProvider=new b_e(this.project.id);const l=new y_e;this.activeEnvironmentIdStorage=new RG(this.systemFilesStorage,"active_environment_id.json",_h,Qje),this.tabsStateStorage=new Aje(this.systemFilesStorage),this.environmentsStorage=new Cje(this.userFilesStorage,this.localStorageSecretsProvider,s),this.environmentsWriter=new Pje(this.environmentsStorage,s.rebuildWhenUnparseable),this.collectionsStorage=new Y_e(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new x_e(this.isApiPersisted?this.userFilesStorage:l)}systemFilesStorage;userFilesStorage;project;isApiPersisted;environmentsPersistence;convertOperationToReplayValue;telemetry;activeEnvironmentIdStorage;tabsStateStorage;environmentsStorage;collectionsStorage;apisStorage;localStorageSecretsProvider;persistExcludedIds=new Set;watchExcludedIds=new Set;environmentsWriter;setConfigFileErrorAccessor(e){this.environmentsWriter.setConfigFileErrorAccessor(e)}getEnvironmentsConfigError(){return this.environmentsStorage.getConfigError()}publishEnvironmentsConfigError(){this.environmentsWriter.publishConfigError()}writeActiveEnvironmentId(e){return this.activeEnvironmentIdStorage.write(e)}writeTabsState(e){return this.tabsStateStorage.write(e)}async writeApis(e){this.isApiPersisted&&await this.apisStorage.applyChanges(e)}async writeCollections(e){await this.collectionsStorage.applyChanges(e)}writeEnvironments(e){return this.environmentsWriter.write(e)}addPersistExcludedId(e){this.persistExcludedIds.add(e),this.userFilesStorage.setWriteExcludedKeys(new Set([...this.persistExcludedIds]))}removePersistExcludedId(e){this.persistExcludedIds.delete(e),this.userFilesStorage.setWriteExcludedKeys(new Set([...this.persistExcludedIds]))}addWatchExcludedId(e){this.watchExcludedIds.add(e)}removeWatchExcludedId(e){this.watchExcludedIds.delete(e)}isWatchExcluded(e){return this.watchExcludedIds.has(e)}}class Rje extends _G{constructor(e,n,r){const i=new IE(e.systemFilesDir),s=new IE(e.userFilesDir);super(i,s,e,!1,{filePaths:[O_e],basePath:[],rebuildWhenUnparseable:!0},n,r)}async detectProjectFiles(e){const n=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[ye("storageOperation","detectFiles","storage")],e?.parentCtx),i=(await this.userFilesStorage.ls()).filter(l=>/\.(ya?ml|json)$/.test(l)),s=[],o=[],a=new Set;return await Promise.all(i.map(async l=>{const c=await this.userFilesStorage.get(l);if(c)try{const u=Qc.load(c);if(typeof u=="object"&&u!==null)if(typeof u.openapi=="string"){const f=await sn.resolve(await sn.join(this.userFilesStorage.baseDir,l)),{definition:h}=await R0(f,u);s.push({uri:l,type:qi.FS,content:h}),await V0(l)}else typeof u.arazzo=="string"&&(o.push({uri:l,type:qi.FS,content:u}),await V0(l),u.sourceDescriptions?.forEach(f=>{const h=f.type,p=f.url,m=!h||h==="openapi",g=typeof p=="string"&&zs(p);m&&g&&a.add(p)}))}catch(u){console.info(`Error parsing YAML/JSON file ${l}:`,u),await M0(l,u)}})),n?.setAttribute("status","completed"),n?.setAttribute("filesCount",i.length),n?.setAttribute("apiFilesCount",s.length),n?.setAttribute("collectionFilesCount",o.length),n?.setAttribute("apiUrlsCount",a.size),n?.setStatus(exports.SpanStatusCode.OK),n?.end(),{apiFiles:s,collectionFiles:o,apiUrls:a}}async loadApis(e,n){const r=this.telemetry?.startSpan("com.redocly.storage.loadApis",[{...ye("storageOperation","loadApis","storage"),apiUrlsCount:e.size}],n?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async s=>{try{const{definition:o}=await R0(s);i.push({uri:s,type:qi.WEB,content:o})}catch(o){console.error(`Error parsing YAML from ${s}:`,o)}})),r?.setAttribute("status","completed"),r?.setStatus(exports.SpanStatusCode.OK),r?.end(),i}async parseApis(e,n){const r=this.telemetry?.startSpan("com.redocly.storage.parseApis",[{...ye("storageOperation","parseApis","storage"),apisCount:e.length}],n?.parentCtx),i=await this.apisStorage.parseMany(e);return r?.setAttribute("status","completed"),r?.setAttribute("parsedApisCount",i.length),r?.setStatus(exports.SpanStatusCode.OK),r?.end(),i}async parseCollections(e,n,r){const i=this.telemetry?.startSpan("com.redocly.storage.parseCollections",[{...ye("storageOperation","parseCollections","storage"),collectionsCount:e.length}],r?.parentCtx),s=await this.collectionsStorage.parseMany(e,n);return i?.setAttribute("status","completed"),i?.setAttribute("parsedCollectionsCount",s.length),i?.setStatus(exports.SpanStatusCode.OK),i?.end(),s}async read(){const e=this.telemetry?.startSpan("com.redocly.storage.read",[ye("storageOperation","read","storage")],void 0),n=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[ye("storageOperation","loadUserState","storage")],e?.parentCtx),[r,i,s]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);n?.setAttribute("status","completed"),n?.setAttribute("environmentCount",s.length),n?.setStatus(exports.SpanStatusCode.OK),n?.end();const{apiFiles:o,collectionFiles:a,apiUrls:l}=await this.detectProjectFiles(e),c=await this.loadApis(l,e),u=await this.parseApis([...o,...c],e),f=await this.parseCollections(a,u,e);return e?.setAttribute("status","completed"),e?.setStatus(exports.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:i,environments:s,apis:u,collections:f}}}function _je(t,e){const n=new Map(t.map(i=>[i.id,i])),r=new Set(e.map(i=>i.id));return{written:e.filter(i=>n.get(i.id)!==i),removed:t.filter(i=>!r.has(i.id)).map(i=>i.id)}}function jje(t,e){const n=new Map(t.map(i=>[i.id,i])),r=new Set(e.map(i=>i.id));return{written:e.filter(i=>{const s=n.get(i.id);return s!==i&&!am(s,i)}),removed:t.filter(i=>!r.has(i.id)).map(i=>i.id)}}function jG(t=!1){let e,n,r=!1,i=Promise.resolve(),s=null,o=null,a=null,l=null,c=[],u=null,f=!1,h=null,p=null,m=[],g=[];function O(k){if(v(),!e)return;m=k.get(_s),g=k.get(Co);let I=!1;c.push(k.sub(Io,()=>{r||!e||e.writeActiveEnvironmentId(k.get(Io))}),k.sub(si,()=>{r||!e||f||e.writeEnvironments(k.get(si))}),k.sub(_s,()=>{const Q=k.get(_s),N=_je(m,Q);m=Q,!(r||!e)&&e.writeApis(N)}),k.sub(Co,()=>{const Q=k.get(Co),N=jje(g,Q);g=Q,!(r||!e)&&e.writeCollections(N)}),k.sub(Zr,E),k.sub(ms,E));function E(){if(r||!e||I)return;I=!0;const Q=e;queueMicrotask(()=>{I=!1,!(r||e!==Q)&&Q.writeTabsState({activeTabIdx:k.get(ms),tabs:k.get(Zr)})})}}function v(){c.forEach(k=>k()),c=[]}function b(){l&&(l(),l=null)}async function y(k){if(!(!Rn()||!e||!a||!u||!h||!p)){await w();try{const{FileWatcher:I}=await Promise.resolve().then(()=>require("./replay-FileWatcher-DB6V5Z_m.js")),E=a.get(Q0).userFilesDir;o=new I(e,E,k,u,h,p),await o.start()}catch(I){console.error("Failed to start file watcher:",I),o=null}}}async function w(){o&&(await o.stop(),o=null)}async function S(){Rn()&&(await w(),await Gt("cleanup_all_managed_watchers"))}const P=async(k,I,E,Q)=>{r=!0;try{const{convertOperationToReplayValue:N,aiEnabled:_}=I,M=Rn();if(a=E,b(),v(),t){E.set(si,[]);return}if(M){const{TauriRootStorage:L}=await Promise.resolve().then(()=>require("./replay-TauriRootStorage-DldWoidz.js"));n=new L(k,N,Q),e=n}else n=void 0,e=new Rje(k,N,Q);if(M){await w();const{getSemanticSearchService:L}=await Promise.resolve().then(()=>require("./replay-index-Ck5-RWXm.js"));L().setProject(k.id)}u={get:()=>E.get(si),set:L=>{f=!0;try{E.set(si,L)}finally{f=!1}}},h={get:()=>E.get(_s),set:L=>E.set(_s,L)},p={get:()=>E.get(Co),set:L=>E.set(Co,L)},e.setConfigFileErrorAccessor({get:()=>E.get(_0),set:L=>E.set(_0,L)});const{project:z,activeEnvironmentId:X,environments:$,apis:U,collections:R,tabsState:D}=await e.read();if(E.set(Q0,z),E.set(Io,X),E.set(si,$),E.set(_s,U),E.set(Co,R),E.set(Zr,D.tabs),E.set(ms,D.activeTabIdx),O(E),M&&e.publishEnvironmentsConfigError(),!M)return;if(await y(_??!1),_){const[{getSemanticSearchService:L},{createIndexSnapshotGetter:F,startPeriodicIndexRevalidation:Y}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-Ck5-RWXm.js")),Promise.resolve().then(()=>require("./replay-periodic-revalidation-ChE98fdS.js"))]),G=L();G.preloadModel().catch(()=>{}),G.reindex(F(E)).catch(ee=>{console.error("Semantic reindex failed:",ee)}),l=Y(G,E)}}finally{r=!1}};return{getTauriRootStorage:()=>n,cleanup:async()=>{s=null,b(),v(),await S()},init:async(k,I,E,Q)=>{if(s&&s.store===E&&s.projectId===k.id)return s.run;const N=i,_=(async()=>(await N,P(k,I,E,Q)))();i=_.then(()=>{},()=>{});const M={store:E,projectId:k.id,run:_};return s=M,_.catch(()=>{s===M&&(s=null)}),_}}}const Nje=jG(),NG=x.createContext(Nje),Dje=NG.Provider;function DG(){return x.useContext(NG)}const Mje="Fetching from URL...",Vje="Source updated",$T="Failed to re-fetch source";function Lje({sourceUrl:t,apiId:e}){const r=DG().getTauriRootStorage(),i=wA(),{loading:s,updateToast:o,dismissToast:a}=bI.useToast(),[l,c]=x.useState(!1),[u,f]=x.useState(!1),h=x.useRef(null);bh(x.useId(),l),x.useEffect(()=>()=>{h.current&&a(h.current)},[a]);const p=x.useCallback(O=>{c(O)},[]),m=x.useCallback(()=>{c(!1)},[]),g=x.useCallback(async()=>{if(u)return;f(!0),c(!1);const O=s(Mje);h.current=O;try{if(!r)throw new Error($T);const[v]=await r.loadAndParseApis([{absolute_path:t,relative_path:e}],void 0,!0);if(!v)throw new Error($T);i(b=>b.some(y=>y.id===e)?b.map(y=>y.id===e?v:y):[...b,v]),o(O,{type:"success",title:Vje})}catch(v){const b=v instanceof Error?v.message:$T;o(O,{type:"error",title:b})}finally{h.current===O&&(h.current=null),f(!1)}},[e,i,u,s,t,r,o]);return d.jsx(Xn,{trigger:"click",placement:"bottomRight",visible:l,onVisibleChange:p,content:d.jsx(zje,{sourceUrl:t,onClose:m,onConfirm:g}),children:d.jsx(Ln.Tooltip,{tip:"Re-fetch source",children:d.jsx(Bje,{children:d.jsx(ve.Button,{variant:"text",size:"small",icon:d.jsx(M9.RenewIcon,{size:"14px"}),disabled:u})})})})}function zje({sourceUrl:t,onClose:e,onConfirm:n}){return d.jsxs(Xje,{onClick:r=>r.stopPropagation(),children:[d.jsxs(Uje,{children:[d.jsxs(qje,{children:[d.jsx(Fje,{children:d.jsx(yl.WarningFilledIcon,{size:"16px",color:"--color-warning-base"})}),d.jsx(Or.Typography,{children:"Re-fetch source"})]}),d.jsx(Or.Typography,{lineHeight:"var(--line-height-sm)",fontSize:"var(--font-size-sm)",fontWeight:"var(--font-weight-regular)",color:"var(--text-color-secondary)",children:"Downloads the latest file from the URL and replaces the stored version."}),d.jsx(Wje,{title:t,children:t})]}),d.jsxs(Zje,{children:[d.jsx(ve.Button,{variant:"text",size:"small",onClick:e,children:"Cancel"}),d.jsx(ve.Button,{variant:"primary",size:"small",onClick:n,children:"Re-fetch"})]})]})}const Xje=T.default.div`
1602
1602
  display: flex;
1603
1603
  flex-direction: column;
1604
1604
  gap: var(--spacing-xxs);
@@ -2634,7 +2634,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
2634
2634
  border-top: none;
2635
2635
  overflow: auto;
2636
2636
  }
2637
- `;function Jze(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function JS(t,...e){if(!Jze(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function t4(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Kze(t,e){JS(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function jm(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function iC(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function ia(t,e){return t<<32-e|t>>>e}function eXe(t,e){return t<<e|t>>>32-e>>>0}const tXe=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",nXe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Nm(t){if(JS(t),tXe)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=nXe[t[n]];return e}function rXe(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function FH(t){return typeof t=="string"&&(t=rXe(t)),JS(t),t}class iXe{}function WH(t){const e=r=>t().update(FH(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function sXe(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(n>>i&s),a=Number(n&s),l=r?4:0,c=r?0:4;t.setUint32(e+l,o,r),t.setUint32(e+c,a,r)}function BE(t,e,n){return t&e^~t&n}function oXe(t,e,n){return t&e^t&n^e&n}class ZH extends iXe{constructor(e,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(e),this.view=iC(this.buffer)}update(e){t4(this),e=FH(e),JS(e);const{view:n,buffer:r,blockLen:i}=this,s=e.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const l=iC(e);for(;i<=s-o;o+=i)this.process(l,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){t4(this),Kze(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,jm(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let f=o;f<i;f++)n[f]=0;sXe(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=iC(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=l/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<c;f++)a.setUint32(4*f,u[f],s)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:s,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=s,e.length=i,e.pos=a,i%n&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const Yl=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),aXe=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),lXe=Math.pow(2,32),cXe=Array.from({length:64},(t,e)=>Math.floor(lXe*Math.abs(Math.sin(e+1)))),Kv=aXe.slice(0,4),sC=new Uint32Array(16);class uXe extends ZH{constructor(){super(64,16,8,!0),this.A=Kv[0]|0,this.B=Kv[1]|0,this.C=Kv[2]|0,this.D=Kv[3]|0}get(){const{A:e,B:n,C:r,D:i}=this;return[e,n,r,i]}set(e,n,r,i){this.A=e|0,this.B=n|0,this.C=r|0,this.D=i|0}process(e,n){for(let a=0;a<16;a++,n+=4)sC[a]=e.getUint32(n,!0);let{A:r,B:i,C:s,D:o}=this;for(let a=0;a<64;a++){let l,c,u;a<16?(l=BE(i,s,o),c=a,u=[7,12,17,22]):a<32?(l=BE(o,i,s),c=(5*a+1)%16,u=[5,9,14,20]):a<48?(l=i^s^o,c=(3*a+5)%16,u=[4,11,16,23]):(l=s^(i|~o),c=7*a%16,u=[6,10,15,21]),l=l+r+cXe[a]+sC[c],r=o,o=s,s=i,i=i+eXe(l,u[a%4])}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,this.set(r,i,s,o)}roundClean(){jm(sC)}destroy(){this.set(0,0,0,0),jm(this.buffer)}}const KS=WH(()=>new uXe),dXe=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Gl=new Uint32Array(64);class fXe extends ZH{constructor(e=32){super(64,e,8,!1),this.A=Yl[0]|0,this.B=Yl[1]|0,this.C=Yl[2]|0,this.D=Yl[3]|0,this.E=Yl[4]|0,this.F=Yl[5]|0,this.G=Yl[6]|0,this.H=Yl[7]|0}get(){const{A:e,B:n,C:r,D:i,E:s,F:o,G:a,H:l}=this;return[e,n,r,i,s,o,a,l]}set(e,n,r,i,s,o,a,l){this.A=e|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=l|0}process(e,n){for(let f=0;f<16;f++,n+=4)Gl[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const h=Gl[f-15],p=Gl[f-2],m=ia(h,7)^ia(h,18)^h>>>3,g=ia(p,17)^ia(p,19)^p>>>10;Gl[f]=g+Gl[f-7]+m+Gl[f-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:l,G:c,H:u}=this;for(let f=0;f<64;f++){const h=ia(a,6)^ia(a,11)^ia(a,25),p=u+h+BE(a,l,c)+dXe[f]+Gl[f]|0,g=(ia(r,2)^ia(r,13)^ia(r,22))+oXe(r,i,s)|0;u=c,c=l,l=a,a=o+p|0,o=s,s=i,i=r,r=p+g|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,i,s,o,a,l,c,u)}roundClean(){jm(Gl)}destroy(){this.set(0,0,0,0,0,0,0,0),jm(this.buffer)}}const BH=WH(()=>new fXe);function hXe(t){const e=t.substring(7).split(", "),n={};for(const r of e){const[i,s]=r.split("=");n[i]=s.replace(/"/g,"")}return n}function pXe(t,e,n,r,i={}){const{inputs:s}=r,{requestBody:{content:o}}=t,{url:a,method:l}=mS(t,e,n,r,i),c=[...e?.security||[],...t.security].findLast(I=>I.securityType===ne.DigestAuth);if(!c)return"";const{username:u,password:f,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,opaque:b}=c[ne.DigestAuth],y=If(u,s,i),{pathname:w,search:S}=new URL(a),P=S?`${w}${S}`:w,k=gXe({username:y,password:If(f,s,i),uri:P,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,method:l,bodyContent:If(o,s,i)});return`Digest username="${y}", realm="${h}", nonce="${p}", uri="${P}", qop=${O}, nc=${v}, cnonce="${m}", response="${k}", algorithm=${g}${b?`, opaque="${b}"`:""}`}function gXe(t){const{username:e,password:n,realm:r,nonce:i,cnonce:s,algorithm:o,qop:a,nc:l,uri:c,method:u,bodyContent:f}=t,h=mXe(o),p=o?.endsWith("-sess")?h(`${h(`${e}:${r}:${n}`)}:${i}:${s}`):h(`${e}:${r}:${n}`),m=a?.includes("auth-int")?h(`${u}:${c}:${h(f)}`):h(`${u}:${c}`);return h(`${p}:${i}:${l}:${s}:${a}:${m}`).toString()}function mXe(t){return t?.replace("-sess","")==="SHA-256"?e=>Nm(BH(e)):e=>Nm(KS(e))}function YE(t){return new TextEncoder().encode(t)}function OXe(t){const e=new ArrayBuffer(t.length),n=new Uint8Array(e);for(let r=0,i=t.length;r<i;r++)n[r]=t.charCodeAt(r);return e}function vXe(t){return btoa(String.fromCharCode(...YE(t)))}function n4(t){return btoa(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function yXe(t){return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}async function bXe(t){const e=new TextEncoder().encode(t);return crypto?.subtle.digest("SHA-256",e)}function xXe(t){if(t)return btoa(String.fromCharCode.apply(null,new Uint8Array(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(new RegExp("(?<!=)=+$"),"")}function SXe(t){try{const n=new URL(t).hostname;return n==="localhost"||n==="127.0.0.1"}catch{return!1}}function Z0(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function wXe(t){return t?t.split(";").map(r=>r.trim()).map(r=>{const i=r.indexOf("="),s=r.slice(0,i).trim(),o=r.slice(i+1).trim();return[s,o]}):[]}const TXe=["json","xml","html","text"],CXe=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function oC(t,e){return t.get(e)??t.get(e.toLowerCase())}function PXe(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function kXe(t){if(!t)return;const e=t.match(/filename\*=(?:UTF-8'')?([^;\n]+)/i);if(e?.[1])try{return decodeURIComponent(e[1].replace(/(^")|("$)/g,"").trim())}catch{return e[1].replace(/(^")|("$)/g,"").trim()}const n=t.match(/filename=([^;\n]+)/i);if(n?.[1])return n[1].replace(/(^")|("$)/g,"").trim()}function EXe(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function IXe(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return CXe.some(r=>n.includes(r))?!0:n.startsWith("application/")?!TXe.some(r=>n.includes(r)):!1}async function $Xe(t,e){const n=oC(t.headers,"content-type")?.split(";")[0].trim(),r=oC(t.headers,"content-disposition"),i=PXe(oC(t.headers,"content-length")),s=IXe(n,r),o=wXe(document.cookie);if(s){const h={fileName:kXe(r)||EXe(t.url)||"response",contentType:n,contentLength:i,status:"pending"};return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:new ArrayBuffer(0),body:"",duration:e,cookies:o,size:i??0,download:h,bodyNotStored:!0,url:t.url}}const l=await t.clone().arrayBuffer(),c=new TextDecoder().decode(l),u=new Uint8Array(l).length;return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:l,body:c,duration:e,cookies:o,size:u,url:t.url}}const AXe=":/?#[]@!$&'()*+,;=",QXe=new Set(["!","'","(",")","*"]);function RXe(t){return QXe.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function r4(t,e=!1){let n=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return n;const r=[...AXe].map(i=>({char:i,encoded:RXe(i)}));for(const{char:i,encoded:s}of r)n=n.split(s).join(i);return n}function _Xe(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function jXe(t,e){const{exists:n}=await Promise.resolve().then(()=>xO),{join:r}=await Promise.resolve().then(()=>EQ),{baseName:i,extension:s}=_Xe(e);let o=0;for(;;){const a=o===0?"":` (${o})`,l=`${i}${a}${s}`,c=await r(t,l);if(!await n(c))return c;o+=1}}function NXe(t){return t.split(new RegExp("(\\{(?<!\\{[^}]*?\\{)[^}]+\\}|\\/)","g")).filter(e=>e!=="")}const Yp=new Map;function DXe(t){Yp.get(t)?.abort()}function YH(t){return t?t instanceof FormData||t instanceof URLSearchParams?t.entries().next().done===!0:!1:!0}function MXe(t){if(!YH(t))return t}function GH(t,e){if(!e)return"same-origin";try{const n=new URL(e).origin;return new URL(gS(t)).origin===n?"include":"same-origin"}catch{return"same-origin"}}async function wR({collections:t,selectedEnvironment:e,step:n,onStepChange:r,settings:i,workflow:s,onWorkflowChange:o,collection:a,signal:l}){const{corsProxyUrl:c,credentialOrigin:u,certificates:f,features:h}=i,p=await dS(t,a?.id,s?.workflowId,lQ(n,s,a,e)),{url:m,method:g}=mS(n,s??void 0,a??void 0,e,p),O=c||"",v=eJ(n,s,a,e,p),b=HXe(m,u),y=JXe({proxyUrl:O,resolvedUrl:m,ignoreProxy:b,queryParameters:v}),w=await LXe(n,s??void 0,y,u,l);let S=n,P=s??void 0;const k=a??void 0;w?.target==="step"?(S=ey(S,w),r(U=>ey(U,w))):w?.target==="workflow"&&P&&(P=ey(P,w),o?.(U=>ey(U,w)));const I=ew(S,P,k,e,p,h),E=MXe(PR(S,e,p,h)),{clientCert:Q,clientKey:N}=oY(m,f),_=gS(y),M=g.toUpperCase(),z=!Th.includes(M),X=z?"POST":M,$=z?{...I,"X-HTTP-Method-Override":M}:I;return{urlWithProxyAndProtocol:_,fetchMethod:X,fetchHeaders:$,body:E,credentials:GH(_,u),mode:Z0(_)?"same-origin":"cors",clientCert:Q,clientKey:N,resolvedUrl:m}}function TR(t,e){return{signal:e,method:t.fetchMethod,headers:t.fetchHeaders,body:t.body,mode:t.mode,credentials:t.credentials,clientCert:t.clientCert,clientKey:t.clientKey}}async function HH(t,e,n,r,i,s){const{tabId:o,updateData:a}=t,l=Ra(e.step);a(h=>({...h,isProcessingRequest:!0})),Yp.get(o)?.abort();const c=new AbortController;Yp.set(o,c);const{signal:u}=c,f=()=>Yp.get(o)===c;try{const h=await wR({selectedEnvironment:r,settings:n,signal:u,...e}),p=Date.now(),m=await Ao(h.urlWithProxyAndProtocol,TR(h,u)),g=Date.now()-p,O=await $Xe(m,g);if(!f())return;a(b=>({...b,requestError:null,response:O}));const v=Ra(O);i?.(l,v),s?.({outcome:"success",status:O.status,duration:O.duration,size:O.size})}catch(h){if(!f()||(a(p=>({...p,response:null})),h.name==="AbortError"))return;a(p=>({...p,requestError:h.message||String(h)})),i?.(l,null),s?.({outcome:"error",error:h.message||String(h)})}finally{f()&&(Yp.delete(o),a(h=>({...h,isProcessingRequest:!1})))}}async function VXe({selectedEnvironment:t,settings:e,fileName:n,onProgress:r,...i}){const s=await wR({selectedEnvironment:t,settings:e,...i}),o=TR(s),a=Rn(),l=n||"response";let c=null;if(a){const{open:b}=await Promise.resolve().then(()=>require("./replay-index-v2Pf8Cco.js")),y=await b({directory:!0,multiple:!1});if(!y)return;const w=Array.isArray(y)?y[0]:y;c=await jXe(w,l)}const u=await Ao(s.urlWithProxyAndProtocol,o),f=u.headers.get("content-length"),h=f?Number.parseInt(f,10):void 0,p=Number.isFinite(h)?h:void 0,m=u.headers.get("content-type")??void 0;let g;if(u.body?.getReader){const b=u.body.getReader(),y=[];let w=0;for(;;){const{done:S,value:P}=await b.read();if(S)break;if(P){const k=new Uint8Array(P.byteLength);k.set(P),y.push(k.buffer),w+=P.byteLength,r?.({receivedBytes:w,totalBytes:p,done:!1})}}g=new Blob(y,{type:m}),r?.({receivedBytes:w,totalBytes:p,done:!0})}else g=await u.blob(),r?.({receivedBytes:g.size,totalBytes:p,done:!0});if(a){const{writeFile:b}=await Promise.resolve().then(()=>xO),y=new Uint8Array(await g.arrayBuffer());if(!c)return;await b(c,y);return}const O=window.URL.createObjectURL(g),v=document.createElement("a");v.href=O,v.download=l,v.rel="noopener",v.click(),window.URL.revokeObjectURL(O)}function ey(t,e){return{...t,security:t.security.map((n,r)=>r===e.index?{...n,[ne.DigestAuth]:{...n[ne.DigestAuth],...e.fields}}:n)}}async function LXe(t,e,n,r,i){const s=Ac(t),o=e?.security??[],l=[...o,...t.security].findLastIndex(p=>p.securityType===ne.DigestAuth);if(l===-1)return null;const c=gS(n),u=await Ao(c,{signal:i,method:s.toUpperCase(),credentials:GH(c,r),mode:Z0(c)?"same-origin":"cors"}),f=hXe(u.headers.get("WWW-Authenticate")||""),h=l<o.length;return{target:h?"workflow":"step",index:h?l:l-o.length,fields:{nonce:f.nonce,realm:f.realm,qop:f.qop,algorithm:f.algorithm,opaque:f.opaque,cnonce:crypto.randomUUID(),nc:"00000001"}}}function zXe(t,e,n,r,i){return[...e?.security||[],...t.security].map(s=>{switch(s.securityType){case ne.BasicAuth:{const o=s[ne.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+vXe(`${_r(o.username,r,i)}:${_r(o.password,r,i)}`),active:!0,in:"header"}}case ne.DigestAuth:return{id:"",key:"Authorization",value:pXe(t,e,n,r,i),active:!0,in:"header"};case ne.JWT:return{id:"",key:"Authorization",value:"Bearer "+s[ne.JWT].token,active:!0,in:"header"};case ne.OAuth2:{const{grantType:o}=s[ne.OAuth2],{accessToken:a}=s[ne.OAuth2][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case ne.OpenIDConnect:{const{grantType:o}=s[ne.OpenIDConnect],{accessToken:a}=s[ne.OpenIDConnect][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case ne.APIKey:{const o=s[ne.APIKey];return o.location===gs.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(s=>!!s)}function XXe(t,e,n){const{operation:r,requestBody:i,parameters:s}=e,{headers:o,cookies:a,queryParameters:l}=s;if(!n)return!0;const c=n.parameters??[],u=c.filter(w=>w.in==="query"),f=c.filter(w=>w.in==="header"),h=c.filter(w=>w.in==="cookie"),p=r?.path!==n.path,m=n.method.toLowerCase()!==r?.method.toLowerCase(),g=n.body?.mediaTypes&&n.body?.mediaTypes?.[i.type]===void 0,O=!f.every(w=>o.some(S=>!Pu(S)&&S.key===w.name)),v=!h.every(w=>a.some(S=>!Pu(S)&&S.key===w.name)),b=!u.every(w=>l.some(S=>!Pu(S)&&S.key===w.name)),y=KIe(t,e,n);return!p&&!m&&!g&&!O&&!v&&!b&&!y}function CR(t,e,n={},r){const{requestBody:i}=t,o=Ac(t).toUpperCase();if(o==="GET"||o==="HEAD"||o==="OPTIONS")return null;try{if(i.type===Ke.FormData)return FXe(t,e,n);if(i.type===Ke.UrlEncoded)return qXe(t,e,n);if(i.type===Ke.Binary)return i.binary;if(i.type===Ke.GraphqlJSON&&zh(Ke.GraphqlJSON,r)){const a=Ol(i.content),l=_r(a.query,e,n),c=w6(_r(a.variables,e,n));return!l.trim()&&c===void 0?"":JSON.stringify({query:l,variables:c})}return _r(i.content,e,n)}catch(a){console.error(a)}}function PR(t,e,n={},r){const{requestBody:i}=t,s=CR(t,e,n,r);if(s===null)return null;switch(i.type){default:return s;case Ke.FormData:return WXe(s);case Ke.UrlEncoded:return UXe(s);case Ke.Binary:return i.binary?.file??null}}function UXe(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function qXe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData[Ke.UrlEncoded];return iJ(s).forEach(o=>{const a=_r(o.value,e,n);i.push({key:_r(o.key,e,n),value:a,type:"text"})}),i}function FXe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData[Ke.FormData];return iJ(s).forEach(({type:o,files:a,value:l,key:c})=>{const u=_r(c,e,n);if(o==="file"&&a)for(const f of a)i.push({key:u,value:f,type:o});else if(l){const f=_r(l,e,n);i.push({key:u,value:f,type:o})}}),i}function WXe(t){const e=new FormData;return t.forEach(({key:n,value:r,type:i})=>{i==="file"?e.append(n,r.file):r&&e.append(n,r)}),e}function JH(t,e,n){return t.filter(r=>{const{securityType:i,[ne.APIKey]:s}=r;return i===ne.APIKey&&s.location===e&&!!s.name}).map(r=>{const{[ne.APIKey]:i}=r;return{id:"",key:i.name,value:i.key,active:!0,in:n}})}function i4(t=[]){return JH(t,gs.Query,"query")}function KH(t,e,n){const r=n?.components.parameters;return Oc("query",[i4(e?.security),i4(t.security),Vn(e?.parameters.queryParameters,r),Vn(t.parameters.queryParameters,r)])}function eJ(t,e,n,r,i={}){return KH(t,e,n).map(o=>{const a=_r(o.value,r,i),l=r4(a,o.allowReserved);return`${r4(o.key)}=${l}`}).join("&")}function tJ(t,e,n,r,i={}){return KH(t,e,n).reduce((o,a)=>{const l=_r(a.value,r,i),c=_r(a.key,r,i);return o[c]=l,o},{})}function nJ(t){const e=t.split("?")[0],n=NXe(e),r=/^\{[^\s]+\}$/,i=n.filter(s=>r.test(s)).map(s=>s.slice(1,-1));return new Set(i)}function ew(t,e,n,r,i={},s){const o=GXe(t,r,i,s),a=zXe(t,e,n,r,i),l=ZXe(t,e,n,r,i),c=n?.components.parameters;return Oc("header",[o,a,l,Vn(e?.parameters.headers,c),Vn(t.parameters.headers,c)]).reduce((h,{key:p,value:m})=>(h[p]=_r(m,r,i),h),{})}function ZXe(t,e,n,r,i={}){const o=rJ(t,e,n).map(a=>`${a.key}=${_r(a.value,r,i)}`).join("; ");return o?[{id:"",key:"Cookie",value:o,active:!0,in:"header"},{id:"",key:"X-Redocly-Cookie",value:o,active:!0,in:"header"}]:[]}function BXe(t,e,n,r,i={}){return rJ(t,e,n).reduce((o,a)=>{const l=_r(a.value,r,i);return{...o,[_r(a.key,r,i)]:l}},{})}function s4(t=[]){return JH(t,gs.Cookie,"cookie")}function rJ(t,e,n){const r=n?.components.parameters;return Oc("cookie",[s4(e?.security),s4(t.security),Vn(e?.parameters.cookies,r),Vn(t.parameters.cookies,r)])}function iJ(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}const YXe={[Ke.GraphqlJSON]:Ke.JSON};function sJ(t,e){return(zh(t,e)?YXe[t]:void 0)??t}function GXe(t,e,n={},r){return new Set([Ke.FormData]).has(t.requestBody.type)?[]:YH(PR(t,e,n,r))?[]:[{id:"",key:"Content-Type",value:sJ(t.requestBody.type,r),active:!0,in:"header"}]}function _r(t,e,n={}){return If(t,e?.inputs,n)}function HXe(t,e){return SXe(t)||Z0(t)||!!(e&&Z0(gS(t),e))}function JXe({proxyUrl:t,resolvedUrl:e,ignoreProxy:n,queryParameters:r=""}){const i=t!=="/"?sE(t):t;let s;return n||!i?s=e:s=`${i}/${e}`,r&&(s+=`?${r}`),s}const KXe=({step:t,collectionId:e,workflowId:n})=>{const r=lS(),i=zc({collectionId:e??null,workflowId:n??null}),s=mO(e??null),o=Ut(),a=o,l=pi(),{features:c}=l,u=x.useMemo(()=>lQ(t,i,s,o),[t,i,s,o]),f=JSON.stringify(u),[h,p]=x.useState({});x.useEffect(()=>{let w=!1;return dS(r(),e??void 0,n??void 0,u).then(S=>{w||p(S)}),()=>{w=!0}},[r,e,n,f]);const{url:m,method:g}=mS(t,i??void 0,s??void 0,o,h),O=eJ(t,i,s,a,h),v=eUe(t,i??void 0,s??void 0,a,h,c);let b=m+(O?`?${O}`:"");!b.startsWith("http://")&&!b.startsWith("https://")&&(b=`https://${b}`);const y=tUe(t,a,h,c);return{httpVersion:"HTTP/1.1",cookies:[],url:b,method:g,headers:v,postData:y}};function eUe(t,e,n,r,i,s){const o=ew(t,e??void 0,n??void 0,r,i,s);return Object.entries(o).filter(([l])=>l!=="X-Redocly-Cookie").map(([l,c])=>({name:l,value:c}))}function tUe(t,e,n,r){const i=CR(t,e,n,r),s=nUe(sJ(t.requestBody.type,r));if(i!==null)switch(s){case"multipart/form-data":{const a=i.map(({key:l,value:c})=>{if(typeof c=="string")return{name:l,value:c};const u=c,f=u?.absolutePath;return{name:l,fileName:f??void 0,contentType:u?u.file.type??"application/octet-stream":void 0}});return{mimeType:s,params:a}}case"application/x-www-form-urlencoded":{const a=i.map(({key:l,value:c})=>({name:l,value:c}));return{mimeType:s,params:a}}case"application/octet-stream":{const a=i?.absolutePath;return{mimeType:s,text:a?`@${a}`:void 0}}default:return{mimeType:s,text:i}}}function nUe(t){return t?t==="JSON"?"application/json":t:"text/plain"}const rUe=({onClose:t})=>{const{step:e,workflow:n,collection:r}=Gi(),i=Ut(),s=KXe({step:e,collectionId:r?.id,workflowId:n?.workflowId}),o=x.useMemo(()=>{const{inputs:a}=i;return a.filter(l=>l.isSecret&&l.value).map(l=>l.value)},[i]);return d.jsx(iUe,{title:"Generate code",isOpen:!0,onClose:t,content:d.jsx(Wze,{har:s,secretValues:o})})},iUe=T.default(no)`
2637
+ `;function Jze(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function JS(t,...e){if(!Jze(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function t4(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Kze(t,e){JS(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function jm(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function iC(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function ia(t,e){return t<<32-e|t>>>e}function eXe(t,e){return t<<e|t>>>32-e>>>0}const tXe=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",nXe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Nm(t){if(JS(t),tXe)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=nXe[t[n]];return e}function rXe(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function FH(t){return typeof t=="string"&&(t=rXe(t)),JS(t),t}class iXe{}function WH(t){const e=r=>t().update(FH(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function sXe(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(n>>i&s),a=Number(n&s),l=r?4:0,c=r?0:4;t.setUint32(e+l,o,r),t.setUint32(e+c,a,r)}function BE(t,e,n){return t&e^~t&n}function oXe(t,e,n){return t&e^t&n^e&n}class ZH extends iXe{constructor(e,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(e),this.view=iC(this.buffer)}update(e){t4(this),e=FH(e),JS(e);const{view:n,buffer:r,blockLen:i}=this,s=e.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const l=iC(e);for(;i<=s-o;o+=i)this.process(l,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){t4(this),Kze(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,jm(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let f=o;f<i;f++)n[f]=0;sXe(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=iC(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=l/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<c;f++)a.setUint32(4*f,u[f],s)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:s,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=s,e.length=i,e.pos=a,i%n&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const Yl=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),aXe=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),lXe=Math.pow(2,32),cXe=Array.from({length:64},(t,e)=>Math.floor(lXe*Math.abs(Math.sin(e+1)))),Kv=aXe.slice(0,4),sC=new Uint32Array(16);class uXe extends ZH{constructor(){super(64,16,8,!0),this.A=Kv[0]|0,this.B=Kv[1]|0,this.C=Kv[2]|0,this.D=Kv[3]|0}get(){const{A:e,B:n,C:r,D:i}=this;return[e,n,r,i]}set(e,n,r,i){this.A=e|0,this.B=n|0,this.C=r|0,this.D=i|0}process(e,n){for(let a=0;a<16;a++,n+=4)sC[a]=e.getUint32(n,!0);let{A:r,B:i,C:s,D:o}=this;for(let a=0;a<64;a++){let l,c,u;a<16?(l=BE(i,s,o),c=a,u=[7,12,17,22]):a<32?(l=BE(o,i,s),c=(5*a+1)%16,u=[5,9,14,20]):a<48?(l=i^s^o,c=(3*a+5)%16,u=[4,11,16,23]):(l=s^(i|~o),c=7*a%16,u=[6,10,15,21]),l=l+r+cXe[a]+sC[c],r=o,o=s,s=i,i=i+eXe(l,u[a%4])}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,this.set(r,i,s,o)}roundClean(){jm(sC)}destroy(){this.set(0,0,0,0),jm(this.buffer)}}const KS=WH(()=>new uXe),dXe=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Gl=new Uint32Array(64);class fXe extends ZH{constructor(e=32){super(64,e,8,!1),this.A=Yl[0]|0,this.B=Yl[1]|0,this.C=Yl[2]|0,this.D=Yl[3]|0,this.E=Yl[4]|0,this.F=Yl[5]|0,this.G=Yl[6]|0,this.H=Yl[7]|0}get(){const{A:e,B:n,C:r,D:i,E:s,F:o,G:a,H:l}=this;return[e,n,r,i,s,o,a,l]}set(e,n,r,i,s,o,a,l){this.A=e|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=l|0}process(e,n){for(let f=0;f<16;f++,n+=4)Gl[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const h=Gl[f-15],p=Gl[f-2],m=ia(h,7)^ia(h,18)^h>>>3,g=ia(p,17)^ia(p,19)^p>>>10;Gl[f]=g+Gl[f-7]+m+Gl[f-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:l,G:c,H:u}=this;for(let f=0;f<64;f++){const h=ia(a,6)^ia(a,11)^ia(a,25),p=u+h+BE(a,l,c)+dXe[f]+Gl[f]|0,g=(ia(r,2)^ia(r,13)^ia(r,22))+oXe(r,i,s)|0;u=c,c=l,l=a,a=o+p|0,o=s,s=i,i=r,r=p+g|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,i,s,o,a,l,c,u)}roundClean(){jm(Gl)}destroy(){this.set(0,0,0,0,0,0,0,0),jm(this.buffer)}}const BH=WH(()=>new fXe);function hXe(t){const e=t.substring(7).split(", "),n={};for(const r of e){const[i,s]=r.split("=");n[i]=s.replace(/"/g,"")}return n}function pXe(t,e,n,r,i={}){const{inputs:s}=r,{requestBody:{content:o}}=t,{url:a,method:l}=mS(t,e,n,r,i),c=[...e?.security||[],...t.security].findLast(I=>I.securityType===ne.DigestAuth);if(!c)return"";const{username:u,password:f,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,opaque:b}=c[ne.DigestAuth],y=If(u,s,i),{pathname:w,search:S}=new URL(a),P=S?`${w}${S}`:w,k=gXe({username:y,password:If(f,s,i),uri:P,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,method:l,bodyContent:If(o,s,i)});return`Digest username="${y}", realm="${h}", nonce="${p}", uri="${P}", qop=${O}, nc=${v}, cnonce="${m}", response="${k}", algorithm=${g}${b?`, opaque="${b}"`:""}`}function gXe(t){const{username:e,password:n,realm:r,nonce:i,cnonce:s,algorithm:o,qop:a,nc:l,uri:c,method:u,bodyContent:f}=t,h=mXe(o),p=o?.endsWith("-sess")?h(`${h(`${e}:${r}:${n}`)}:${i}:${s}`):h(`${e}:${r}:${n}`),m=a?.includes("auth-int")?h(`${u}:${c}:${h(f)}`):h(`${u}:${c}`);return h(`${p}:${i}:${l}:${s}:${a}:${m}`).toString()}function mXe(t){return t?.replace("-sess","")==="SHA-256"?e=>Nm(BH(e)):e=>Nm(KS(e))}function YE(t){return new TextEncoder().encode(t)}function OXe(t){const e=new ArrayBuffer(t.length),n=new Uint8Array(e);for(let r=0,i=t.length;r<i;r++)n[r]=t.charCodeAt(r);return e}function vXe(t){return btoa(String.fromCharCode(...YE(t)))}function n4(t){return btoa(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function yXe(t){return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}async function bXe(t){const e=new TextEncoder().encode(t);return crypto?.subtle.digest("SHA-256",e)}function xXe(t){if(t)return btoa(String.fromCharCode.apply(null,new Uint8Array(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(new RegExp("(?<!=)=+$"),"")}function SXe(t){try{const n=new URL(t).hostname;return n==="localhost"||n==="127.0.0.1"}catch{return!1}}function Z0(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function wXe(t){return t?t.split(";").map(r=>r.trim()).map(r=>{const i=r.indexOf("="),s=r.slice(0,i).trim(),o=r.slice(i+1).trim();return[s,o]}):[]}const TXe=["json","xml","html","text"],CXe=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function oC(t,e){return t.get(e)??t.get(e.toLowerCase())}function PXe(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function kXe(t){if(!t)return;const e=t.match(/filename\*=(?:UTF-8'')?([^;\n]+)/i);if(e?.[1])try{return decodeURIComponent(e[1].replace(/(^")|("$)/g,"").trim())}catch{return e[1].replace(/(^")|("$)/g,"").trim()}const n=t.match(/filename=([^;\n]+)/i);if(n?.[1])return n[1].replace(/(^")|("$)/g,"").trim()}function EXe(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function IXe(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return CXe.some(r=>n.includes(r))?!0:n.startsWith("application/")?!TXe.some(r=>n.includes(r)):!1}async function $Xe(t,e){const n=oC(t.headers,"content-type")?.split(";")[0].trim(),r=oC(t.headers,"content-disposition"),i=PXe(oC(t.headers,"content-length")),s=IXe(n,r),o=wXe(document.cookie);if(s){const h={fileName:kXe(r)||EXe(t.url)||"response",contentType:n,contentLength:i,status:"pending"};return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:new ArrayBuffer(0),body:"",duration:e,cookies:o,size:i??0,download:h,bodyNotStored:!0,url:t.url}}const l=await t.clone().arrayBuffer(),c=new TextDecoder().decode(l),u=new Uint8Array(l).length;return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:l,body:c,duration:e,cookies:o,size:u,url:t.url}}const AXe=":/?#[]@!$&'()*+,;=",QXe=new Set(["!","'","(",")","*"]);function RXe(t){return QXe.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function r4(t,e=!1){let n=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return n;const r=[...AXe].map(i=>({char:i,encoded:RXe(i)}));for(const{char:i,encoded:s}of r)n=n.split(s).join(i);return n}function _Xe(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function jXe(t,e){const{exists:n}=await Promise.resolve().then(()=>xO),{join:r}=await Promise.resolve().then(()=>EQ),{baseName:i,extension:s}=_Xe(e);let o=0;for(;;){const a=o===0?"":` (${o})`,l=`${i}${a}${s}`,c=await r(t,l);if(!await n(c))return c;o+=1}}function NXe(t){return t.split(new RegExp("(\\{(?<!\\{[^}]*?\\{)[^}]+\\}|\\/)","g")).filter(e=>e!=="")}const Yp=new Map;function DXe(t){Yp.get(t)?.abort()}function YH(t){return t?t instanceof FormData||t instanceof URLSearchParams?t.entries().next().done===!0:!1:!0}function MXe(t){if(!YH(t))return t}function GH(t,e){if(!e)return"same-origin";try{const n=new URL(e).origin;return new URL(gS(t)).origin===n?"include":"same-origin"}catch{return"same-origin"}}async function wR({collections:t,selectedEnvironment:e,step:n,onStepChange:r,settings:i,workflow:s,onWorkflowChange:o,collection:a,signal:l}){const{corsProxyUrl:c,credentialOrigin:u,certificates:f,features:h}=i,p=await dS(t,a?.id,s?.workflowId,lQ(n,s,a,e)),{url:m,method:g}=mS(n,s??void 0,a??void 0,e,p),O=c||"",v=eJ(n,s,a,e,p),b=HXe(m,u),y=JXe({proxyUrl:O,resolvedUrl:m,ignoreProxy:b,queryParameters:v}),w=await LXe(n,s??void 0,y,u,l);let S=n,P=s??void 0;const k=a??void 0;w?.target==="step"?(S=ey(S,w),r(U=>ey(U,w))):w?.target==="workflow"&&P&&(P=ey(P,w),o?.(U=>ey(U,w)));const I=ew(S,P,k,e,p,h),E=MXe(PR(S,e,p,h)),{clientCert:Q,clientKey:N}=oY(m,f),_=gS(y),M=g.toUpperCase(),z=!Th.includes(M),X=z?"POST":M,$=z?{...I,"X-HTTP-Method-Override":M}:I;return{urlWithProxyAndProtocol:_,fetchMethod:X,fetchHeaders:$,body:E,credentials:GH(_,u),mode:Z0(_)?"same-origin":"cors",clientCert:Q,clientKey:N,resolvedUrl:m}}function TR(t,e){return{signal:e,method:t.fetchMethod,headers:t.fetchHeaders,body:t.body,mode:t.mode,credentials:t.credentials,clientCert:t.clientCert,clientKey:t.clientKey}}async function HH(t,e,n,r,i,s){const{tabId:o,updateData:a}=t,l=Ra(e.step);a(h=>({...h,isProcessingRequest:!0})),Yp.get(o)?.abort();const c=new AbortController;Yp.set(o,c);const{signal:u}=c,f=()=>Yp.get(o)===c;try{const h=await wR({selectedEnvironment:r,settings:n,signal:u,...e}),p=Date.now(),m=await Ao(h.urlWithProxyAndProtocol,TR(h,u)),g=Date.now()-p,O=await $Xe(m,g);if(!f())return;a(b=>({...b,requestError:null,response:O}));const v=Ra(O);i?.(l,v),s?.({outcome:"success",status:O.status,duration:O.duration,size:O.size})}catch(h){if(!f()||(a(p=>({...p,response:null})),h.name==="AbortError"))return;a(p=>({...p,requestError:h.message||String(h)})),i?.(l,null),s?.({outcome:"error",error:h.message||String(h)})}finally{f()&&(Yp.delete(o),a(h=>({...h,isProcessingRequest:!1})))}}async function VXe({selectedEnvironment:t,settings:e,fileName:n,onProgress:r,...i}){const s=await wR({selectedEnvironment:t,settings:e,...i}),o=TR(s),a=Rn(),l=n||"response";let c=null;if(a){const{open:b}=await Promise.resolve().then(()=>require("./replay-index-BbQ0oJ7O.js")),y=await b({directory:!0,multiple:!1});if(!y)return;const w=Array.isArray(y)?y[0]:y;c=await jXe(w,l)}const u=await Ao(s.urlWithProxyAndProtocol,o),f=u.headers.get("content-length"),h=f?Number.parseInt(f,10):void 0,p=Number.isFinite(h)?h:void 0,m=u.headers.get("content-type")??void 0;let g;if(u.body?.getReader){const b=u.body.getReader(),y=[];let w=0;for(;;){const{done:S,value:P}=await b.read();if(S)break;if(P){const k=new Uint8Array(P.byteLength);k.set(P),y.push(k.buffer),w+=P.byteLength,r?.({receivedBytes:w,totalBytes:p,done:!1})}}g=new Blob(y,{type:m}),r?.({receivedBytes:w,totalBytes:p,done:!0})}else g=await u.blob(),r?.({receivedBytes:g.size,totalBytes:p,done:!0});if(a){const{writeFile:b}=await Promise.resolve().then(()=>xO),y=new Uint8Array(await g.arrayBuffer());if(!c)return;await b(c,y);return}const O=window.URL.createObjectURL(g),v=document.createElement("a");v.href=O,v.download=l,v.rel="noopener",v.click(),window.URL.revokeObjectURL(O)}function ey(t,e){return{...t,security:t.security.map((n,r)=>r===e.index?{...n,[ne.DigestAuth]:{...n[ne.DigestAuth],...e.fields}}:n)}}async function LXe(t,e,n,r,i){const s=Ac(t),o=e?.security??[],l=[...o,...t.security].findLastIndex(p=>p.securityType===ne.DigestAuth);if(l===-1)return null;const c=gS(n),u=await Ao(c,{signal:i,method:s.toUpperCase(),credentials:GH(c,r),mode:Z0(c)?"same-origin":"cors"}),f=hXe(u.headers.get("WWW-Authenticate")||""),h=l<o.length;return{target:h?"workflow":"step",index:h?l:l-o.length,fields:{nonce:f.nonce,realm:f.realm,qop:f.qop,algorithm:f.algorithm,opaque:f.opaque,cnonce:crypto.randomUUID(),nc:"00000001"}}}function zXe(t,e,n,r,i){return[...e?.security||[],...t.security].map(s=>{switch(s.securityType){case ne.BasicAuth:{const o=s[ne.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+vXe(`${_r(o.username,r,i)}:${_r(o.password,r,i)}`),active:!0,in:"header"}}case ne.DigestAuth:return{id:"",key:"Authorization",value:pXe(t,e,n,r,i),active:!0,in:"header"};case ne.JWT:return{id:"",key:"Authorization",value:"Bearer "+s[ne.JWT].token,active:!0,in:"header"};case ne.OAuth2:{const{grantType:o}=s[ne.OAuth2],{accessToken:a}=s[ne.OAuth2][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case ne.OpenIDConnect:{const{grantType:o}=s[ne.OpenIDConnect],{accessToken:a}=s[ne.OpenIDConnect][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case ne.APIKey:{const o=s[ne.APIKey];return o.location===gs.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(s=>!!s)}function XXe(t,e,n){const{operation:r,requestBody:i,parameters:s}=e,{headers:o,cookies:a,queryParameters:l}=s;if(!n)return!0;const c=n.parameters??[],u=c.filter(w=>w.in==="query"),f=c.filter(w=>w.in==="header"),h=c.filter(w=>w.in==="cookie"),p=r?.path!==n.path,m=n.method.toLowerCase()!==r?.method.toLowerCase(),g=n.body?.mediaTypes&&n.body?.mediaTypes?.[i.type]===void 0,O=!f.every(w=>o.some(S=>!Pu(S)&&S.key===w.name)),v=!h.every(w=>a.some(S=>!Pu(S)&&S.key===w.name)),b=!u.every(w=>l.some(S=>!Pu(S)&&S.key===w.name)),y=KIe(t,e,n);return!p&&!m&&!g&&!O&&!v&&!b&&!y}function CR(t,e,n={},r){const{requestBody:i}=t,o=Ac(t).toUpperCase();if(o==="GET"||o==="HEAD"||o==="OPTIONS")return null;try{if(i.type===Ke.FormData)return FXe(t,e,n);if(i.type===Ke.UrlEncoded)return qXe(t,e,n);if(i.type===Ke.Binary)return i.binary;if(i.type===Ke.GraphqlJSON&&zh(Ke.GraphqlJSON,r)){const a=Ol(i.content),l=_r(a.query,e,n),c=w6(_r(a.variables,e,n));return!l.trim()&&c===void 0?"":JSON.stringify({query:l,variables:c})}return _r(i.content,e,n)}catch(a){console.error(a)}}function PR(t,e,n={},r){const{requestBody:i}=t,s=CR(t,e,n,r);if(s===null)return null;switch(i.type){default:return s;case Ke.FormData:return WXe(s);case Ke.UrlEncoded:return UXe(s);case Ke.Binary:return i.binary?.file??null}}function UXe(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function qXe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData[Ke.UrlEncoded];return iJ(s).forEach(o=>{const a=_r(o.value,e,n);i.push({key:_r(o.key,e,n),value:a,type:"text"})}),i}function FXe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData[Ke.FormData];return iJ(s).forEach(({type:o,files:a,value:l,key:c})=>{const u=_r(c,e,n);if(o==="file"&&a)for(const f of a)i.push({key:u,value:f,type:o});else if(l){const f=_r(l,e,n);i.push({key:u,value:f,type:o})}}),i}function WXe(t){const e=new FormData;return t.forEach(({key:n,value:r,type:i})=>{i==="file"?e.append(n,r.file):r&&e.append(n,r)}),e}function JH(t,e,n){return t.filter(r=>{const{securityType:i,[ne.APIKey]:s}=r;return i===ne.APIKey&&s.location===e&&!!s.name}).map(r=>{const{[ne.APIKey]:i}=r;return{id:"",key:i.name,value:i.key,active:!0,in:n}})}function i4(t=[]){return JH(t,gs.Query,"query")}function KH(t,e,n){const r=n?.components.parameters;return Oc("query",[i4(e?.security),i4(t.security),Vn(e?.parameters.queryParameters,r),Vn(t.parameters.queryParameters,r)])}function eJ(t,e,n,r,i={}){return KH(t,e,n).map(o=>{const a=_r(o.value,r,i),l=r4(a,o.allowReserved);return`${r4(o.key)}=${l}`}).join("&")}function tJ(t,e,n,r,i={}){return KH(t,e,n).reduce((o,a)=>{const l=_r(a.value,r,i),c=_r(a.key,r,i);return o[c]=l,o},{})}function nJ(t){const e=t.split("?")[0],n=NXe(e),r=/^\{[^\s]+\}$/,i=n.filter(s=>r.test(s)).map(s=>s.slice(1,-1));return new Set(i)}function ew(t,e,n,r,i={},s){const o=GXe(t,r,i,s),a=zXe(t,e,n,r,i),l=ZXe(t,e,n,r,i),c=n?.components.parameters;return Oc("header",[o,a,l,Vn(e?.parameters.headers,c),Vn(t.parameters.headers,c)]).reduce((h,{key:p,value:m})=>(h[p]=_r(m,r,i),h),{})}function ZXe(t,e,n,r,i={}){const o=rJ(t,e,n).map(a=>`${a.key}=${_r(a.value,r,i)}`).join("; ");return o?[{id:"",key:"Cookie",value:o,active:!0,in:"header"},{id:"",key:"X-Redocly-Cookie",value:o,active:!0,in:"header"}]:[]}function BXe(t,e,n,r,i={}){return rJ(t,e,n).reduce((o,a)=>{const l=_r(a.value,r,i);return{...o,[_r(a.key,r,i)]:l}},{})}function s4(t=[]){return JH(t,gs.Cookie,"cookie")}function rJ(t,e,n){const r=n?.components.parameters;return Oc("cookie",[s4(e?.security),s4(t.security),Vn(e?.parameters.cookies,r),Vn(t.parameters.cookies,r)])}function iJ(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}const YXe={[Ke.GraphqlJSON]:Ke.JSON};function sJ(t,e){return(zh(t,e)?YXe[t]:void 0)??t}function GXe(t,e,n={},r){return new Set([Ke.FormData]).has(t.requestBody.type)?[]:YH(PR(t,e,n,r))?[]:[{id:"",key:"Content-Type",value:sJ(t.requestBody.type,r),active:!0,in:"header"}]}function _r(t,e,n={}){return If(t,e?.inputs,n)}function HXe(t,e){return SXe(t)||Z0(t)||!!(e&&Z0(gS(t),e))}function JXe({proxyUrl:t,resolvedUrl:e,ignoreProxy:n,queryParameters:r=""}){const i=t!=="/"?sE(t):t;let s;return n||!i?s=e:s=`${i}/${e}`,r&&(s+=`?${r}`),s}const KXe=({step:t,collectionId:e,workflowId:n})=>{const r=lS(),i=zc({collectionId:e??null,workflowId:n??null}),s=mO(e??null),o=Ut(),a=o,l=pi(),{features:c}=l,u=x.useMemo(()=>lQ(t,i,s,o),[t,i,s,o]),f=JSON.stringify(u),[h,p]=x.useState({});x.useEffect(()=>{let w=!1;return dS(r(),e??void 0,n??void 0,u).then(S=>{w||p(S)}),()=>{w=!0}},[r,e,n,f]);const{url:m,method:g}=mS(t,i??void 0,s??void 0,o,h),O=eJ(t,i,s,a,h),v=eUe(t,i??void 0,s??void 0,a,h,c);let b=m+(O?`?${O}`:"");!b.startsWith("http://")&&!b.startsWith("https://")&&(b=`https://${b}`);const y=tUe(t,a,h,c);return{httpVersion:"HTTP/1.1",cookies:[],url:b,method:g,headers:v,postData:y}};function eUe(t,e,n,r,i,s){const o=ew(t,e??void 0,n??void 0,r,i,s);return Object.entries(o).filter(([l])=>l!=="X-Redocly-Cookie").map(([l,c])=>({name:l,value:c}))}function tUe(t,e,n,r){const i=CR(t,e,n,r),s=nUe(sJ(t.requestBody.type,r));if(i!==null)switch(s){case"multipart/form-data":{const a=i.map(({key:l,value:c})=>{if(typeof c=="string")return{name:l,value:c};const u=c,f=u?.absolutePath;return{name:l,fileName:f??void 0,contentType:u?u.file.type??"application/octet-stream":void 0}});return{mimeType:s,params:a}}case"application/x-www-form-urlencoded":{const a=i.map(({key:l,value:c})=>({name:l,value:c}));return{mimeType:s,params:a}}case"application/octet-stream":{const a=i?.absolutePath;return{mimeType:s,text:a?`@${a}`:void 0}}default:return{mimeType:s,text:i}}}function nUe(t){return t?t==="JSON"?"application/json":t:"text/plain"}const rUe=({onClose:t})=>{const{step:e,workflow:n,collection:r}=Gi(),i=Ut(),s=KXe({step:e,collectionId:r?.id,workflowId:n?.workflowId}),o=x.useMemo(()=>{const{inputs:a}=i;return a.filter(l=>l.isSecret&&l.value).map(l=>l.value)},[i]);return d.jsx(iUe,{title:"Generate code",isOpen:!0,onClose:t,content:d.jsx(Wze,{har:s,secretValues:o})})},iUe=T.default(no)`
2638
2638
  & > div {
2639
2639
  width: calc(100%);
2640
2640
  max-width: 920px;
@@ -3796,7 +3796,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
3796
3796
  font-size: var(--font-size-base);
3797
3797
  font-weight: var(--font-weight-regular);
3798
3798
  line-height: var(--line-height-base);
3799
- `,gWe=["text","file"];function mWe({onParameterChange:t,files:e}){const n=x.useRef(null),r=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(Rn())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-v2Pf8Cco.js")),l=await a({multiple:!0});if(!l)return;const u=(Array.isArray(l)?l:[l]).map(PO),h=(await Promise.all(u)).filter(p=>p!==null);t(h)}catch(a){console.error("Failed to open file dialog or read file:",a)}else n.current?.click()},s=x.useCallback(()=>{t(null)},[t]),o=x.useMemo(()=>{if(!e)return null;if(e.length===1)return d.jsx(h4,{icon:d.jsx(Fi.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsx(p4,{children:e[0].file.name})});if(e.length>1)return d.jsx(h4,{icon:d.jsx(Fi.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsxs(p4,{children:[e.length," files"]})})},[e,s]);return d.jsx(OWe,{children:d.jsxs(vWe,{children:[d.jsx(yWe,{children:o||d.jsx(SWe,{children:"Add files here"})}),d.jsxs(bWe,{children:[d.jsx(xWe,{onClick:i,variant:"secondary",size:"small","data-testid":"add-button",icon:d.jsx(Nr.AddIcon,{color:"--button-content-color"})}),d.jsx("input",{"data-testid":"file-input",hidden:!0,ref:n,type:"file",multiple:!0,accept:"files/*",onChange:r})]})]})})}const OWe=T.default.div`
3799
+ `,gWe=["text","file"];function mWe({onParameterChange:t,files:e}){const n=x.useRef(null),r=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(Rn())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-BbQ0oJ7O.js")),l=await a({multiple:!0});if(!l)return;const u=(Array.isArray(l)?l:[l]).map(PO),h=(await Promise.all(u)).filter(p=>p!==null);t(h)}catch(a){console.error("Failed to open file dialog or read file:",a)}else n.current?.click()},s=x.useCallback(()=>{t(null)},[t]),o=x.useMemo(()=>{if(!e)return null;if(e.length===1)return d.jsx(h4,{icon:d.jsx(Fi.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsx(p4,{children:e[0].file.name})});if(e.length>1)return d.jsx(h4,{icon:d.jsx(Fi.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsxs(p4,{children:[e.length," files"]})})},[e,s]);return d.jsx(OWe,{children:d.jsxs(vWe,{children:[d.jsx(yWe,{children:o||d.jsx(SWe,{children:"Add files here"})}),d.jsxs(bWe,{children:[d.jsx(xWe,{onClick:i,variant:"secondary",size:"small","data-testid":"add-button",icon:d.jsx(Nr.AddIcon,{color:"--button-content-color"})}),d.jsx("input",{"data-testid":"file-input",hidden:!0,ref:n,type:"file",multiple:!0,accept:"files/*",onChange:r})]})]})})}const OWe=T.default.div`
3800
3800
  position: relative;
3801
3801
  display: flex;
3802
3802
  flex-grow: 1;
@@ -3935,7 +3935,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
3935
3935
  `,_We=T.default.div`
3936
3936
  display: flex;
3937
3937
  justify-content: center;
3938
- `,ZJ=t=>t==="file"?d.jsx(X9.FileIcon,{size:"14px"}):d.jsx(Eee.CharacterIcon,{size:"14px"}),jWe=gWe.map(t=>({label:d.jsxs(wWe,{children:[ZJ(t),d.jsx(QWe,{children:t})]}),value:t}));function g4({isLast:t,index:e,parameter:n,onKeyChange:r,onValueChange:i,onActiveChange:s,onTypeChange:o,onFilesChange:a,environment:l,keyName:c,enableInputTypeSelection:u,autoCompleteOptions:f,actions:h}){const{value:p,key:m,active:g,type:O,files:v}=n,b=t?"form-data-name-ghost":`form-data-name-${e}`,y=t?"form-data-value-ghost":`form-data-value-${e}`,w=t?"form-data-checkbox-ghost":`form-data-checkbox-${e}`;return d.jsxs(kWe,{children:[d.jsx(EWe,{children:!t&&d.jsxs(d.Fragment,{children:[d.jsx(IWe,{"data-testid":w,type:"checkbox",checked:g,onChange:({target:S})=>s(S.checked)}),d.jsx($We,{checked:g})]})}),d.jsx(Be,{}),d.jsxs(d.Fragment,{children:[d.jsx(jt,{dataTestId:b,placeholder:`${t?"New ":""}${c}`,value:m,environment:l,onChange:r}),u&&d.jsx(_We,{children:d.jsx(RWe,{options:jWe,value:{label:ZJ(O),value:O,active:!0},onChange:({value:S})=>o(S),withArrow:!1,size:"small"})})]}),d.jsx(Be,{}),O==="file"?d.jsx(mWe,{files:v,onParameterChange:a}):d.jsx(jt,{dataTestId:y,placeholder:"Value",value:p,environment:l,options:f,onChange:i}),d.jsx(Be,{}),d.jsx(AWe,{children:!t&&h(e)})]})}function NWe({title:t,enableInputTypeSelection:e=!1,onParameterChange:n,actions:r,formElements:i,onFormElementsChange:s,keyName:o,environment:a,createEmptyParameter:l}){const c=Hi(),{ghost:u,updateGhost:f,promoteGhost:h}=RJ({createEmptyParameter:l,onPromote:g=>{s?.(O=>[...O,g]),n?.()}});function p(g,O){s?.(v=>v.map((b,y)=>y===g?{...b,...O}:b)),n?.()}const m={environment:a,keyName:o,enableInputTypeSelection:e,autoCompleteOptions:c,actions:r};return d.jsxs(TWe,{children:[t&&d.jsx(CWe,{children:t}),d.jsx(PWe,{children:[...i.map((g,O)=>d.jsx(g4,{isLast:!1,index:O,parameter:g,onKeyChange:v=>p(O,{key:v}),onValueChange:v=>p(O,{value:v}),onActiveChange:v=>p(O,{active:v}),onTypeChange:v=>p(O,{type:v}),onFilesChange:v=>p(O,{files:v}),...m},g.id)),l?d.jsx(g4,{isLast:!0,index:i.length,parameter:u,onKeyChange:g=>h({key:g}),onValueChange:g=>h({value:g}),onActiveChange:g=>f({active:g}),onTypeChange:g=>f({type:g}),onFilesChange:g=>h({files:g}),...m},u.id):null]})]})}function DWe({formElements:t,onFormElementsChange:e,type:n}){const r=Ut();function i(s){e(o=>o.filter((a,l)=>l!==s))}return d.jsx(NWe,{keyName:"Param",formElements:t,onFormElementsChange:e,environment:r,enableInputTypeSelection:n!==Ke.UrlEncoded,createEmptyParameter:bIe,actions:s=>d.jsx(Ss,{onClick:()=>i(s),variant:"text",icon:d.jsx(rr.TrashCanIcon,{})})})}const MWe=({binary:t,onBinaryChange:e})=>{const[n,r]=x.useState(!1),i=x.useRef(null),s=l=>{const c=l.target.files?.[0];if(c){r(!0);const u=new FileReader;u.onload=()=>{r(!1),e({absolutePath:null,file:c})},u.readAsDataURL(c)}},o=async()=>{if(Rn())try{const{open:l}=await Promise.resolve().then(()=>require("./replay-index-v2Pf8Cco.js")),c=await l();if(!c)return;const u=await PO(c);e(u)}catch(l){console.error("Failed to open file dialog or read file:",l)}else i.current?.click()},a=()=>{e(null)};return n?d.jsx(cC,{children:d.jsxs(VWe,{children:[d.jsx(tx.Spinner,{}),"Loading..."]})}):t&&t.file?.name?d.jsx(cC,{children:d.jsxs(LWe,{children:[d.jsxs(zWe,{children:[d.jsx($ee.DocumentBlankIcon,{size:"16px"}),d.jsx(XWe,{children:t.file?.name})]}),d.jsx(Ss,{onClick:a,icon:d.jsx(rr.TrashCanIcon,{})})]})}):d.jsx(cC,{children:d.jsx(BJ,{children:!t&&d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"file",hidden:!0,ref:i,onChange:s}),d.jsx(ve.Button,{type:"button",variant:"text",onClick:o,icon:d.jsx(Iee.CloudUploadIcon,{}),children:"Upload file"})]})})})},cC=T.default(KA)`
3938
+ `,ZJ=t=>t==="file"?d.jsx(X9.FileIcon,{size:"14px"}):d.jsx(Eee.CharacterIcon,{size:"14px"}),jWe=gWe.map(t=>({label:d.jsxs(wWe,{children:[ZJ(t),d.jsx(QWe,{children:t})]}),value:t}));function g4({isLast:t,index:e,parameter:n,onKeyChange:r,onValueChange:i,onActiveChange:s,onTypeChange:o,onFilesChange:a,environment:l,keyName:c,enableInputTypeSelection:u,autoCompleteOptions:f,actions:h}){const{value:p,key:m,active:g,type:O,files:v}=n,b=t?"form-data-name-ghost":`form-data-name-${e}`,y=t?"form-data-value-ghost":`form-data-value-${e}`,w=t?"form-data-checkbox-ghost":`form-data-checkbox-${e}`;return d.jsxs(kWe,{children:[d.jsx(EWe,{children:!t&&d.jsxs(d.Fragment,{children:[d.jsx(IWe,{"data-testid":w,type:"checkbox",checked:g,onChange:({target:S})=>s(S.checked)}),d.jsx($We,{checked:g})]})}),d.jsx(Be,{}),d.jsxs(d.Fragment,{children:[d.jsx(jt,{dataTestId:b,placeholder:`${t?"New ":""}${c}`,value:m,environment:l,onChange:r}),u&&d.jsx(_We,{children:d.jsx(RWe,{options:jWe,value:{label:ZJ(O),value:O,active:!0},onChange:({value:S})=>o(S),withArrow:!1,size:"small"})})]}),d.jsx(Be,{}),O==="file"?d.jsx(mWe,{files:v,onParameterChange:a}):d.jsx(jt,{dataTestId:y,placeholder:"Value",value:p,environment:l,options:f,onChange:i}),d.jsx(Be,{}),d.jsx(AWe,{children:!t&&h(e)})]})}function NWe({title:t,enableInputTypeSelection:e=!1,onParameterChange:n,actions:r,formElements:i,onFormElementsChange:s,keyName:o,environment:a,createEmptyParameter:l}){const c=Hi(),{ghost:u,updateGhost:f,promoteGhost:h}=RJ({createEmptyParameter:l,onPromote:g=>{s?.(O=>[...O,g]),n?.()}});function p(g,O){s?.(v=>v.map((b,y)=>y===g?{...b,...O}:b)),n?.()}const m={environment:a,keyName:o,enableInputTypeSelection:e,autoCompleteOptions:c,actions:r};return d.jsxs(TWe,{children:[t&&d.jsx(CWe,{children:t}),d.jsx(PWe,{children:[...i.map((g,O)=>d.jsx(g4,{isLast:!1,index:O,parameter:g,onKeyChange:v=>p(O,{key:v}),onValueChange:v=>p(O,{value:v}),onActiveChange:v=>p(O,{active:v}),onTypeChange:v=>p(O,{type:v}),onFilesChange:v=>p(O,{files:v}),...m},g.id)),l?d.jsx(g4,{isLast:!0,index:i.length,parameter:u,onKeyChange:g=>h({key:g}),onValueChange:g=>h({value:g}),onActiveChange:g=>f({active:g}),onTypeChange:g=>f({type:g}),onFilesChange:g=>h({files:g}),...m},u.id):null]})]})}function DWe({formElements:t,onFormElementsChange:e,type:n}){const r=Ut();function i(s){e(o=>o.filter((a,l)=>l!==s))}return d.jsx(NWe,{keyName:"Param",formElements:t,onFormElementsChange:e,environment:r,enableInputTypeSelection:n!==Ke.UrlEncoded,createEmptyParameter:bIe,actions:s=>d.jsx(Ss,{onClick:()=>i(s),variant:"text",icon:d.jsx(rr.TrashCanIcon,{})})})}const MWe=({binary:t,onBinaryChange:e})=>{const[n,r]=x.useState(!1),i=x.useRef(null),s=l=>{const c=l.target.files?.[0];if(c){r(!0);const u=new FileReader;u.onload=()=>{r(!1),e({absolutePath:null,file:c})},u.readAsDataURL(c)}},o=async()=>{if(Rn())try{const{open:l}=await Promise.resolve().then(()=>require("./replay-index-BbQ0oJ7O.js")),c=await l();if(!c)return;const u=await PO(c);e(u)}catch(l){console.error("Failed to open file dialog or read file:",l)}else i.current?.click()},a=()=>{e(null)};return n?d.jsx(cC,{children:d.jsxs(VWe,{children:[d.jsx(tx.Spinner,{}),"Loading..."]})}):t&&t.file?.name?d.jsx(cC,{children:d.jsxs(LWe,{children:[d.jsxs(zWe,{children:[d.jsx($ee.DocumentBlankIcon,{size:"16px"}),d.jsx(XWe,{children:t.file?.name})]}),d.jsx(Ss,{onClick:a,icon:d.jsx(rr.TrashCanIcon,{})})]})}):d.jsx(cC,{children:d.jsx(BJ,{children:!t&&d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"file",hidden:!0,ref:i,onChange:s}),d.jsx(ve.Button,{type:"button",variant:"text",onClick:o,icon:d.jsx(Iee.CloudUploadIcon,{}),children:"Upload file"})]})})})},cC=T.default(KA)`
3939
3939
  align-items: flex-start;
3940
3940
  `,BJ=T.default.div`
3941
3941
  display: flex;
@@ -4016,7 +4016,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
4016
4016
  `,y4=T.default.div`
4017
4017
  flex: 1;
4018
4018
  min-height: 0;
4019
- `;function c7e(t){const{body:e,onBodyChange:n,apiOperation:r}=t,{content:i,type:s}=e,{features:o}=Wn(),a=$6(s,o);return d.jsx(KA,{children:d.jsx(to,{dataTestId:"request-body-tab-codemirror",value:i,apiOperation:r,onChange:l=>n(c=>({...c,content:l})),extensions:a?.extensions,stateExtensions:a?.stateExtensions})})}function KJ({onBodyChange:t,apply:e}){return d.jsx(ve.Button,{variant:"text",size:"small",icon:d.jsx(Aee.MagicWandIcon,{size:"14px",color:"--button-content-color"}),onClick:()=>t(e),children:"Prettify"})}function u7e(t){const{tabId:e}=t,{step:n}=Gi(),r=YJ(e),i=JJ(e),s=!!Fu(n),a=r?.status==="loading"?tx.Spinner:SI.DownloadIcon,l=s?"--button-content-color":"--dropdown-menu-item-color-disabled";return d.jsx(Ku.DropdownMenuItem,{content:"Fetch schema",prefix:d.jsx(a,{size:"14px",color:l}),disabled:!s,onAction:s?i:void 0})}async function d7e(t){return Rn()?f7e(t):h7e(t)}async function f7e(t){const[{open:e},{readTextFile:n},{basename:r}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-v2Pf8Cco.js")),Promise.resolve().then(()=>xO),Promise.resolve().then(()=>EQ)]),i=await e({multiple:!1,directory:!1,filters:[{name:"GraphQL schema",extensions:t.extensions}]});if(!i)return null;const[s,o]=await Promise.all([n(i),r(i)]);return{name:o,text:s}}function h7e(t){const e=document.createElement("input");return e.type="file",e.accept=t.extensions.map(n=>`.${n}`).join(","),e.style.display="none",document.body.appendChild(e),new Promise((n,r)=>{const i=s=>{e.remove(),s()};e.addEventListener("change",()=>{const s=e.files?.[0];if(!s){i(()=>n(null));return}s.text().then(o=>i(()=>n({name:s.name,text:o}))).catch(()=>i(()=>r(new Error("Failed to read the selected file."))))}),e.addEventListener("cancel",()=>i(()=>n(null))),e.click()})}const p7e=["graphql","graphqls","gql","json"];function g7e(t){const{tabId:e}=t,n=GJ(),{showSchemaLoaded:r,showSchemaFailed:i}=HJ(),s=(a,l)=>{const c=a instanceof Error?a.message:l;eI(e),n(e,()=>({status:"error",error:c})),i(c)},o=async()=>{let a;try{a=await d7e({extensions:p7e})}catch(l){s(l,"Failed to read the schema file.");return}if(a){eI(e),n(e,()=>({status:"loading"}));try{const l=t7e(a.text);n(e,()=>({status:"ready",introspection:l})),r(a.name)}catch(l){s(l,"Failed to load the schema file.")}}};return d.jsx(Ku.DropdownMenuItem,{content:"Load schema file",prefix:d.jsx(X9.FileIcon,{size:"14px",color:"--button-content-color"}),onAction:o})}function m7e(t){return d.jsx(Bi.Dropdown,{alignment:"end",trigger:d.jsx(ve.Button,{size:"small",variant:"text","aria-label":"Schema options",icon:d.jsx(vI.OverflowMenuHorizontalIcon,{size:"14px",color:"--button-content-color"})}),children:d.jsxs(Yi.DropdownMenu,{children:[d.jsx(u7e,{tabId:t.tabId}),d.jsx(g7e,{tabId:t.tabId})]})})}const O7e={matches:t=>fA.includes(t),applyExample:(t,e)=>{const n=()=>x6(e);return i5(t,t.type,n)},Editor:({body:t,onBodyChange:e})=>d.jsx(DWe,{type:t.type,formElements:t.formData[t.type],onFormElementsChange:n=>e(r=>i5(r,t.type,n))})},v7e={matches:t=>I7.includes(t),Editor:({body:t,onBodyChange:e})=>d.jsx(MWe,{binary:t.binary,onBinaryChange:n=>e(r=>({...r,binary:n}))})},y7e={matches:t=>Ke.GraphqlJSON===t,applyExample:(t,e)=>{const{query:n,variables:r}=Ol(e);return{...t,content:A0(n,r)}},prepareForTypeChange:t=>({...t,content:YIe(t.content)}),ToolbarActions:({body:t,onBodyChange:e,tabId:n})=>{const{query:r,variables:i}=Ol(t.content),s=GWe(t.type,r),o=P6(Ke.JSON,i),a=l=>{const c=Ol(l.content);return{...l,content:A0(s?JWe(c.query):c.query,o?pQ(c.variables):c.variables)}};return d.jsxs(d.Fragment,{children:[(s||o)&&d.jsx(KJ,{onBodyChange:e,apply:a}),d.jsx(FJ,{}),d.jsx(m7e,{tabId:n})]})},Editor:a7e},b7e={applyExample:(t,e)=>({...t,content:pE(e)}),ToolbarActions:({body:t,onBodyChange:e})=>d.jsx(d.Fragment,{children:P6(t.type,t.content)&&d.jsx(KJ,{onBodyChange:e,apply:n=>({...n,content:pQ(n.content)})})}),Editor:c7e},x7e=[O7e,v7e,y7e],S7e=b7e;function Gp(t,e){return x7e.find(r=>r.matches(t)&&zh(t,e))??S7e}function w7e(t){const{apiOperation:e,type:n,activeExampleName:r,onBodyChange:i}=t,s=x.useMemo(()=>Object.keys(e?.body?.mediaTypes||{}),[e?.body?.mediaTypes]),{features:o}=Wn(),a=x.useMemo(()=>oWe(e,o),[e,o]),l=x.useMemo(()=>kR(s,a),[a,s]),c=x.useMemo(()=>a.find(({value:v})=>v===n)??WJ(n,o),[a,n,o]),u=x.useMemo(()=>gE(e?.body?.mediaTypes?.[n]),[n,e]),f=!!Gp(n,o).applyExample,h=x.useMemo(()=>f?u.map(({key:v,name:b})=>({label:b,value:v})):[],[u,f]),p=x.useMemo(()=>h.find(v=>v.value===r),[h,r]),{sendEvent:m}=et();return{contentTypes:l,activeContentType:c,onContentTypeChange:({value:v})=>{const[b]=gE(e?.body?.mediaTypes?.[v]),y=String(v),w=Gp(y,o),S=w.applyExample;i(P=>{const k=Gp(P.type,o),E={...k!==w&&k.prepareForTypeChange?k.prepareForTypeChange(P):P,type:y};return!b||!S?E:S({...E,activeExampleName:b.key},b.value)}),m("com.redocly.change.occurred",[{...ye("select","requestBodyType"),context:"type",source:"request_body",value:y}])},examples:h,activeExample:p,onExampleChange:v=>{const b=String(v.value),y=u.find(w=>w.key===b);y&&(i(w=>{const S=Gp(w.type,o).applyExample;return S?S({...w,activeExampleName:y.key},y.value):w}),m("com.redocly.change.occurred",[{...ye("select","requestBodyExample"),context:"example",source:"request_body",value:y.name}]))}}}function T7e(t){const{body:e,onBodyChange:n,apiOperation:r,tabId:i}=t,s=w7e({apiOperation:r,onBodyChange:n,type:e.type,activeExampleName:e.activeExampleName}),{features:o}=Wn(),{Editor:a,ToolbarActions:l}=Gp(e.type,o);return d.jsx(aWe,{contentTypes:s.contentTypes,activeContentType:s.activeContentType,onContentTypeChange:s.onContentTypeChange,examples:s.examples,activeExample:s.activeExample,onExampleChange:s.onExampleChange,actions:l&&d.jsx(l,{body:e,onBodyChange:n,apiOperation:r,tabId:i}),children:d.jsx(a,{body:e,onBodyChange:n,apiOperation:r,tabId:i})})}const C7e=({activeTabName:t,onChange:e})=>{const{isMobile:n}=ao(),{isDraft:r}=Gi(),i=$7(r);if(!n)return null;const s=i.find(({name:o})=>o===t);return d.jsx(k7e,{children:d.jsx(P7e,{dataTestId:"request-tab-change-select",options:i.map(({name:o})=>({element:o,label:o,value:o})),value:s?.name,onChange:o=>e(o)})})},P7e=T.default(rd.Select)`
4019
+ `;function c7e(t){const{body:e,onBodyChange:n,apiOperation:r}=t,{content:i,type:s}=e,{features:o}=Wn(),a=$6(s,o);return d.jsx(KA,{children:d.jsx(to,{dataTestId:"request-body-tab-codemirror",value:i,apiOperation:r,onChange:l=>n(c=>({...c,content:l})),extensions:a?.extensions,stateExtensions:a?.stateExtensions})})}function KJ({onBodyChange:t,apply:e}){return d.jsx(ve.Button,{variant:"text",size:"small",icon:d.jsx(Aee.MagicWandIcon,{size:"14px",color:"--button-content-color"}),onClick:()=>t(e),children:"Prettify"})}function u7e(t){const{tabId:e}=t,{step:n}=Gi(),r=YJ(e),i=JJ(e),s=!!Fu(n),a=r?.status==="loading"?tx.Spinner:SI.DownloadIcon,l=s?"--button-content-color":"--dropdown-menu-item-color-disabled";return d.jsx(Ku.DropdownMenuItem,{content:"Fetch schema",prefix:d.jsx(a,{size:"14px",color:l}),disabled:!s,onAction:s?i:void 0})}async function d7e(t){return Rn()?f7e(t):h7e(t)}async function f7e(t){const[{open:e},{readTextFile:n},{basename:r}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-BbQ0oJ7O.js")),Promise.resolve().then(()=>xO),Promise.resolve().then(()=>EQ)]),i=await e({multiple:!1,directory:!1,filters:[{name:"GraphQL schema",extensions:t.extensions}]});if(!i)return null;const[s,o]=await Promise.all([n(i),r(i)]);return{name:o,text:s}}function h7e(t){const e=document.createElement("input");return e.type="file",e.accept=t.extensions.map(n=>`.${n}`).join(","),e.style.display="none",document.body.appendChild(e),new Promise((n,r)=>{const i=s=>{e.remove(),s()};e.addEventListener("change",()=>{const s=e.files?.[0];if(!s){i(()=>n(null));return}s.text().then(o=>i(()=>n({name:s.name,text:o}))).catch(()=>i(()=>r(new Error("Failed to read the selected file."))))}),e.addEventListener("cancel",()=>i(()=>n(null))),e.click()})}const p7e=["graphql","graphqls","gql","json"];function g7e(t){const{tabId:e}=t,n=GJ(),{showSchemaLoaded:r,showSchemaFailed:i}=HJ(),s=(a,l)=>{const c=a instanceof Error?a.message:l;eI(e),n(e,()=>({status:"error",error:c})),i(c)},o=async()=>{let a;try{a=await d7e({extensions:p7e})}catch(l){s(l,"Failed to read the schema file.");return}if(a){eI(e),n(e,()=>({status:"loading"}));try{const l=t7e(a.text);n(e,()=>({status:"ready",introspection:l})),r(a.name)}catch(l){s(l,"Failed to load the schema file.")}}};return d.jsx(Ku.DropdownMenuItem,{content:"Load schema file",prefix:d.jsx(X9.FileIcon,{size:"14px",color:"--button-content-color"}),onAction:o})}function m7e(t){return d.jsx(Bi.Dropdown,{alignment:"end",trigger:d.jsx(ve.Button,{size:"small",variant:"text","aria-label":"Schema options",icon:d.jsx(vI.OverflowMenuHorizontalIcon,{size:"14px",color:"--button-content-color"})}),children:d.jsxs(Yi.DropdownMenu,{children:[d.jsx(u7e,{tabId:t.tabId}),d.jsx(g7e,{tabId:t.tabId})]})})}const O7e={matches:t=>fA.includes(t),applyExample:(t,e)=>{const n=()=>x6(e);return i5(t,t.type,n)},Editor:({body:t,onBodyChange:e})=>d.jsx(DWe,{type:t.type,formElements:t.formData[t.type],onFormElementsChange:n=>e(r=>i5(r,t.type,n))})},v7e={matches:t=>I7.includes(t),Editor:({body:t,onBodyChange:e})=>d.jsx(MWe,{binary:t.binary,onBinaryChange:n=>e(r=>({...r,binary:n}))})},y7e={matches:t=>Ke.GraphqlJSON===t,applyExample:(t,e)=>{const{query:n,variables:r}=Ol(e);return{...t,content:A0(n,r)}},prepareForTypeChange:t=>({...t,content:YIe(t.content)}),ToolbarActions:({body:t,onBodyChange:e,tabId:n})=>{const{query:r,variables:i}=Ol(t.content),s=GWe(t.type,r),o=P6(Ke.JSON,i),a=l=>{const c=Ol(l.content);return{...l,content:A0(s?JWe(c.query):c.query,o?pQ(c.variables):c.variables)}};return d.jsxs(d.Fragment,{children:[(s||o)&&d.jsx(KJ,{onBodyChange:e,apply:a}),d.jsx(FJ,{}),d.jsx(m7e,{tabId:n})]})},Editor:a7e},b7e={applyExample:(t,e)=>({...t,content:pE(e)}),ToolbarActions:({body:t,onBodyChange:e})=>d.jsx(d.Fragment,{children:P6(t.type,t.content)&&d.jsx(KJ,{onBodyChange:e,apply:n=>({...n,content:pQ(n.content)})})}),Editor:c7e},x7e=[O7e,v7e,y7e],S7e=b7e;function Gp(t,e){return x7e.find(r=>r.matches(t)&&zh(t,e))??S7e}function w7e(t){const{apiOperation:e,type:n,activeExampleName:r,onBodyChange:i}=t,s=x.useMemo(()=>Object.keys(e?.body?.mediaTypes||{}),[e?.body?.mediaTypes]),{features:o}=Wn(),a=x.useMemo(()=>oWe(e,o),[e,o]),l=x.useMemo(()=>kR(s,a),[a,s]),c=x.useMemo(()=>a.find(({value:v})=>v===n)??WJ(n,o),[a,n,o]),u=x.useMemo(()=>gE(e?.body?.mediaTypes?.[n]),[n,e]),f=!!Gp(n,o).applyExample,h=x.useMemo(()=>f?u.map(({key:v,name:b})=>({label:b,value:v})):[],[u,f]),p=x.useMemo(()=>h.find(v=>v.value===r),[h,r]),{sendEvent:m}=et();return{contentTypes:l,activeContentType:c,onContentTypeChange:({value:v})=>{const[b]=gE(e?.body?.mediaTypes?.[v]),y=String(v),w=Gp(y,o),S=w.applyExample;i(P=>{const k=Gp(P.type,o),E={...k!==w&&k.prepareForTypeChange?k.prepareForTypeChange(P):P,type:y};return!b||!S?E:S({...E,activeExampleName:b.key},b.value)}),m("com.redocly.change.occurred",[{...ye("select","requestBodyType"),context:"type",source:"request_body",value:y}])},examples:h,activeExample:p,onExampleChange:v=>{const b=String(v.value),y=u.find(w=>w.key===b);y&&(i(w=>{const S=Gp(w.type,o).applyExample;return S?S({...w,activeExampleName:y.key},y.value):w}),m("com.redocly.change.occurred",[{...ye("select","requestBodyExample"),context:"example",source:"request_body",value:y.name}]))}}}function T7e(t){const{body:e,onBodyChange:n,apiOperation:r,tabId:i}=t,s=w7e({apiOperation:r,onBodyChange:n,type:e.type,activeExampleName:e.activeExampleName}),{features:o}=Wn(),{Editor:a,ToolbarActions:l}=Gp(e.type,o);return d.jsx(aWe,{contentTypes:s.contentTypes,activeContentType:s.activeContentType,onContentTypeChange:s.onContentTypeChange,examples:s.examples,activeExample:s.activeExample,onExampleChange:s.onExampleChange,actions:l&&d.jsx(l,{body:e,onBodyChange:n,apiOperation:r,tabId:i}),children:d.jsx(a,{body:e,onBodyChange:n,apiOperation:r,tabId:i})})}const C7e=({activeTabName:t,onChange:e})=>{const{isMobile:n}=ao(),{isDraft:r}=Gi(),i=$7(r);if(!n)return null;const s=i.find(({name:o})=>o===t);return d.jsx(k7e,{children:d.jsx(P7e,{dataTestId:"request-tab-change-select",options:i.map(({name:o})=>({element:o,label:o,value:o})),value:s?.name,onChange:o=>e(o)})})},P7e=T.default(rd.Select)`
4020
4020
  border-radius: var(--border-radius-md);
4021
4021
  background-color: var(--bg-color-active);
4022
4022
  `,k7e=T.default.div`
@@ -4072,7 +4072,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
4072
4072
  font-size: var(--font-size-base);
4073
4073
  font-weight: var(--font-weight-medium);
4074
4074
  padding: var(--spacing-xs);
4075
- `;function z7e(t=32){let e="";for(;e.length<t;)e+=Math.random().toString(32).substring(2);return e.substring(0,t)}async function tI(t,e,n){const r=typeof t=="string"?t:t.toString();if(Rn()){const{openUrl:i}=await Promise.resolve().then(()=>require("./replay-index-DSQ-8F3e.js"));await i(r);return}window.open(r,e,n)}const b4="/_auth/oauth2-redirect.html";let rw=class Hp{static async authorizeImplicit({authorizationUrl:e,clientId:n,scopes:r,extraAuthParams:i={},routingBasePath:s="/",redirectUri:o,successCallback:a,errorCallback:l}){const c=x4({date:new Date().toString()});try{const u=new URL(e),f=s==="/"?"":s,h=`${window.location.origin}${f}${b4}`;u.searchParams.set("client_id",n),u.searchParams.set("redirect_uri",o||h),u.searchParams.set("response_type","token"),u.searchParams.set("state",c),Array.isArray(r)&&u.searchParams.set("scope",r.join(" "));for(const p in i)u.searchParams.set(p,i[p]);window.redirectOAuth2={flow:"implicit",data:{authorizationUrl:e,clientId:n,scopes:r},state:c,successCallback:p=>{a(p),Hp.clearRedirectData("implicit")},errorCallback:p=>{l(p),Hp.clearRedirectData("implicit")}},await tI(u.toString())}catch(u){l(il.OAuth2Error.fromError(u))}}static async authorizeAuthorizationCode({authorizationUrl:e,tokenUrl:n,serverUrl:r,clientId:i,clientSecret:s,codeVerifier:o,codeChallenge:a,scopes:l,extraAuthParams:c={},extraTokenHeaders:u={},extraTokenBody:f={},extraTokenParams:h={},routingBasePath:p="/",redirectUri:m,withPkce:g,successCallback:O,errorCallback:v}){try{const b=Nv({url:e,serverUrl:r}),y=new URL(b),w=Nv({url:n,serverUrl:r}),S=new URL(w),P=p==="/"?"":p,k=`${window.location.origin}${P}${b4}`,I=x4({date:new Date().toString()});y.searchParams.set("client_id",i),y.searchParams.set("redirect_uri",m||k),y.searchParams.set("response_type","code"),y.searchParams.set("state",I),Array.isArray(l)&&y.searchParams.set("scope",l.join(" ")),g&&(!a&&!o&&(o=q7e(),a=await X7e(o)),a&&(y.searchParams.set("code_challenge",a),y.searchParams.set("code_challenge_method","S256")));for(const E in c)y.searchParams.set(E,c[E]);for(const E in h)S.searchParams.set(E,h[E]);window.redirectOAuth2={flow:"authorizationCode",data:{authorizationUrl:e,clientId:i,scopes:l},state:I,successCallback:async({auth_code:E})=>{const Q=Ra({client_id:i,client_secret:s,...o&&{code_verifier:o},code:E,grant_type:"authorization_code",redirect_uri:m||k,...f});try{const N=await Ao(S,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...u},body:new URLSearchParams(Q).toString()});await uC(N,O,v)}catch(N){v(il.OAuth2Error.fromError(N))}Hp.clearRedirectData("authorizationCode")},errorCallback:E=>{v(il.OAuth2Error.fromError(E)),Hp.clearRedirectData("authorizationCode")}},await tI(y.toString())}catch(b){v(il.OAuth2Error.fromError(b))}}static clearRedirectData(e){window.redirectOAuth2={flow:e,data:{authorizationUrl:"",clientId:"",scopes:[]},state:"",successCallback:()=>{},errorCallback:()=>{}}}static async authorizeClientCredentials({tokenUrl:e,clientId:n,clientSecret:r,scopes:i=[],extraTokenParams:s={},extraTokenHeaders:o={},extraTokenBody:a={},corsProxyUrl:l,serverUrl:c,assertionType:u,clientAssertion:f,successCallback:h,errorCallback:p}){try{const m=u===$0,g={client_id:n,client_secret:r,grant_type:"client_credentials",scope:Array.isArray(i)&&i.length?i.join(" "):void 0,...m&&{client_assertion_type:u,client_assertion:f},...a},O=Nv({url:e,serverUrl:c,corsProxyUrl:l}),v=new URL(O);for(const y in s)v.searchParams.set(y,s[y]);const b=await Ao(O,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...o},body:new URLSearchParams(zD(g)).toString()});await uC(b,h,p)}catch(m){p(il.OAuth2Error.fromError(m))}}static async authorizePasswordGrant({username:e,password:n,tokenUrl:r,clientId:i,clientSecret:s,scopes:o=[],extraTokenParams:a={},extraTokenHeaders:l={},extraTokenBody:c={},corsProxyUrl:u,serverUrl:f,successCallback:h,errorCallback:p}){try{const m={client_id:i,client_secret:s,grant_type:"password",username:e,password:n,scope:Array.isArray(o)&&o.length?o.join(" "):void 0,...c},g=Nv({url:r,serverUrl:f,corsProxyUrl:u}),O=new URL(g);for(const b in a)O.searchParams.set(b,a[b]);const v=await Ao(g,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...l},body:new URLSearchParams(zD(m)).toString()});await uC(v,h,p)}catch(m){p(il.OAuth2Error.fromError(m))}}};function x4(t){const e={randomStr:z7e(),...t};return btoa(encodeURIComponent(JSON.stringify(e)))}async function uC(t,e,n){if(t.ok){const r=await t.json();if(r.error){n(il.OAuth2Error.fromJsonData(r));return}e(r)}else{if((t.headers.get("Content-Type")||"").indexOf("json")>-1){const s=await t.json();n(il.OAuth2Error.fromJsonData(s));return}n(il.OAuth2Error.fromTextData(await t.text()))}}async function X7e(t){return xXe(await bXe(t))}function U7e(t){return("0"+t.toString(16)).slice(-2)}function q7e(){const t=new Uint32Array(28);return crypto.getRandomValues(t),Array.from(t,U7e).join("")}function iw({scopes:t,onScopesChange:e,environment:n}){const r=i=>{e(s=>s.filter((o,a)=>a!==i))};return d.jsx(F7e,{children:d.jsx(W7e,{keyName:"Scopes",elements:t,onElementsChange:i=>e(s=>i(s)),createEmptyParameter:yIe,environment:n,actions:i=>d.jsx(Ss,{onClick:()=>r(i),variant:"text",icon:d.jsx(rr.TrashCanIcon,{})}),singleValue:!0,hideOuterBorders:!0,valuePlaceholder:"New scope item"})})}const F7e=T.default.div`
4075
+ `;function z7e(t=32){let e="";for(;e.length<t;)e+=Math.random().toString(32).substring(2);return e.substring(0,t)}async function tI(t,e,n){const r=typeof t=="string"?t:t.toString();if(Rn()){const{openUrl:i}=await Promise.resolve().then(()=>require("./replay-index-CtzJut8U.js"));await i(r);return}window.open(r,e,n)}const b4="/_auth/oauth2-redirect.html";let rw=class Hp{static async authorizeImplicit({authorizationUrl:e,clientId:n,scopes:r,extraAuthParams:i={},routingBasePath:s="/",redirectUri:o,successCallback:a,errorCallback:l}){const c=x4({date:new Date().toString()});try{const u=new URL(e),f=s==="/"?"":s,h=`${window.location.origin}${f}${b4}`;u.searchParams.set("client_id",n),u.searchParams.set("redirect_uri",o||h),u.searchParams.set("response_type","token"),u.searchParams.set("state",c),Array.isArray(r)&&u.searchParams.set("scope",r.join(" "));for(const p in i)u.searchParams.set(p,i[p]);window.redirectOAuth2={flow:"implicit",data:{authorizationUrl:e,clientId:n,scopes:r},state:c,successCallback:p=>{a(p),Hp.clearRedirectData("implicit")},errorCallback:p=>{l(p),Hp.clearRedirectData("implicit")}},await tI(u.toString())}catch(u){l(il.OAuth2Error.fromError(u))}}static async authorizeAuthorizationCode({authorizationUrl:e,tokenUrl:n,serverUrl:r,clientId:i,clientSecret:s,codeVerifier:o,codeChallenge:a,scopes:l,extraAuthParams:c={},extraTokenHeaders:u={},extraTokenBody:f={},extraTokenParams:h={},routingBasePath:p="/",redirectUri:m,withPkce:g,successCallback:O,errorCallback:v}){try{const b=Nv({url:e,serverUrl:r}),y=new URL(b),w=Nv({url:n,serverUrl:r}),S=new URL(w),P=p==="/"?"":p,k=`${window.location.origin}${P}${b4}`,I=x4({date:new Date().toString()});y.searchParams.set("client_id",i),y.searchParams.set("redirect_uri",m||k),y.searchParams.set("response_type","code"),y.searchParams.set("state",I),Array.isArray(l)&&y.searchParams.set("scope",l.join(" ")),g&&(!a&&!o&&(o=q7e(),a=await X7e(o)),a&&(y.searchParams.set("code_challenge",a),y.searchParams.set("code_challenge_method","S256")));for(const E in c)y.searchParams.set(E,c[E]);for(const E in h)S.searchParams.set(E,h[E]);window.redirectOAuth2={flow:"authorizationCode",data:{authorizationUrl:e,clientId:i,scopes:l},state:I,successCallback:async({auth_code:E})=>{const Q=Ra({client_id:i,client_secret:s,...o&&{code_verifier:o},code:E,grant_type:"authorization_code",redirect_uri:m||k,...f});try{const N=await Ao(S,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...u},body:new URLSearchParams(Q).toString()});await uC(N,O,v)}catch(N){v(il.OAuth2Error.fromError(N))}Hp.clearRedirectData("authorizationCode")},errorCallback:E=>{v(il.OAuth2Error.fromError(E)),Hp.clearRedirectData("authorizationCode")}},await tI(y.toString())}catch(b){v(il.OAuth2Error.fromError(b))}}static clearRedirectData(e){window.redirectOAuth2={flow:e,data:{authorizationUrl:"",clientId:"",scopes:[]},state:"",successCallback:()=>{},errorCallback:()=>{}}}static async authorizeClientCredentials({tokenUrl:e,clientId:n,clientSecret:r,scopes:i=[],extraTokenParams:s={},extraTokenHeaders:o={},extraTokenBody:a={},corsProxyUrl:l,serverUrl:c,assertionType:u,clientAssertion:f,successCallback:h,errorCallback:p}){try{const m=u===$0,g={client_id:n,client_secret:r,grant_type:"client_credentials",scope:Array.isArray(i)&&i.length?i.join(" "):void 0,...m&&{client_assertion_type:u,client_assertion:f},...a},O=Nv({url:e,serverUrl:c,corsProxyUrl:l}),v=new URL(O);for(const y in s)v.searchParams.set(y,s[y]);const b=await Ao(O,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...o},body:new URLSearchParams(zD(g)).toString()});await uC(b,h,p)}catch(m){p(il.OAuth2Error.fromError(m))}}static async authorizePasswordGrant({username:e,password:n,tokenUrl:r,clientId:i,clientSecret:s,scopes:o=[],extraTokenParams:a={},extraTokenHeaders:l={},extraTokenBody:c={},corsProxyUrl:u,serverUrl:f,successCallback:h,errorCallback:p}){try{const m={client_id:i,client_secret:s,grant_type:"password",username:e,password:n,scope:Array.isArray(o)&&o.length?o.join(" "):void 0,...c},g=Nv({url:r,serverUrl:f,corsProxyUrl:u}),O=new URL(g);for(const b in a)O.searchParams.set(b,a[b]);const v=await Ao(g,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...l},body:new URLSearchParams(zD(m)).toString()});await uC(v,h,p)}catch(m){p(il.OAuth2Error.fromError(m))}}};function x4(t){const e={randomStr:z7e(),...t};return btoa(encodeURIComponent(JSON.stringify(e)))}async function uC(t,e,n){if(t.ok){const r=await t.json();if(r.error){n(il.OAuth2Error.fromJsonData(r));return}e(r)}else{if((t.headers.get("Content-Type")||"").indexOf("json")>-1){const s=await t.json();n(il.OAuth2Error.fromJsonData(s));return}n(il.OAuth2Error.fromTextData(await t.text()))}}async function X7e(t){return xXe(await bXe(t))}function U7e(t){return("0"+t.toString(16)).slice(-2)}function q7e(){const t=new Uint32Array(28);return crypto.getRandomValues(t),Array.from(t,U7e).join("")}function iw({scopes:t,onScopesChange:e,environment:n}){const r=i=>{e(s=>s.filter((o,a)=>a!==i))};return d.jsx(F7e,{children:d.jsx(W7e,{keyName:"Scopes",elements:t,onElementsChange:i=>e(s=>i(s)),createEmptyParameter:yIe,environment:n,actions:i=>d.jsx(Ss,{onClick:()=>r(i),variant:"text",icon:d.jsx(rr.TrashCanIcon,{})}),singleValue:!0,hideOuterBorders:!0,valuePlaceholder:"New scope item"})})}const F7e=T.default.div`
4076
4076
  width: 100%;
4077
4077
 
4078
4078
  > div {
@@ -6285,7 +6285,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
6285
6285
  display: inline-block;
6286
6286
  color: var(--text-color-secondary);
6287
6287
  margin-left: var(--spacing-xs);
6288
- `,cJe="request",uJe=new Set(["replay:","redocly-replay:"]),dJe=8*1024,fJe=4*1024,uI=1024,hJe=new Set([Hn.JSON,Hn.XML,Hn.HTML,Hn.Text]);function dI(t){return iQ(t).length>0}function pJe(t,e,n){return{id:crypto.randomUUID(),key:e,value:n,in:t,active:!0}}function GK(t,e){return!t||t.length>uI||e.length>uI||dI(e)}function OC(t,e,n){const r=[];for(const[i,s]of t){if(!i.startsWith(e))continue;const o=i.slice(e.length);if(GK(o,s))return null;r.push(pJe(n,o,s))}return r}function gJe(t){if(t.length>dJe)return null;let e;try{e=new URL(t)}catch{return null}if(!uJe.has(e.protocol)||e.hostname.toLowerCase()!==cJe)return null;const n=e.searchParams,r=n.get("url");if(!r||dI(r))return null;let i;try{i=new URL(r)}catch{return null}if(i.protocol!=="http:"&&i.protocol!=="https:")return null;const s=(n.get("method")||"GET").toUpperCase();if(!Th.includes(s))return null;const o=OC(n,"header.","header"),a=OC(n,"query.","query"),l=OC(n,"cookie.","cookie");if(!o||!a||!l)return null;const c=bO(r);if(c.some(p=>GK(p.key,p.value)))return null;const u=n.get("body");if(u!==null&&(u.length>fJe||dI(u)))return null;const f=n.get("contentType")?.trim();if(f&&!hJe.has(f))return null;const h=n.get("env")?.trim();return h&&h.length>uI?null:{xOperation:{method:s,url:r},headers:o,queryParameters:[...c,...a],cookies:l,...u!==null&&{body:{content:u,...f&&{type:f}}},...h&&{environment:h}}}function mJe(t){return t.stepId===null&&t.collectionId===null&&t.workflowId===null&&t.historyId===null&&!t.sourceFile}function OJe({onEnvironmentNotFound:t}={}){const{getTabs:e,setActiveTabIdx:n,updateTabDataAt:r}=id(),{addNewTab:i}=hr(),s=Ua(),o=Lh();return x.useCallback(a=>{const l=e().findIndex(({data:u})=>Tn(u,Xe.Step)&&mJe(u)&&kE(u,a.xOperation));let c;if(l!==-1)c=l,n(c);else{const u=ja({xOperation:a.xOperation});c=i({id:crypto.randomUUID(),state:Qn.Normal,data:uf({draftStep:u,activeTabName:Ou(u)})})}e()[c]&&r(c,u=>{const f={...u,response:null,requestError:null,isProcessingRequest:!1};if(!f.draftStep)return f;const h=ch();return{...f,draftStep:{...f.draftStep,parameters:{...f.draftStep.parameters,headers:a.headers,queryParameters:a.queryParameters,cookies:a.cookies},requestBody:a.body?{...h,content:a.body.content,...a.body.type&&{type:a.body.type}}:h}}}),a.environment&&(s.some(f=>f.name===a.environment)?o(a.environment):t?.(a.environment))},[e,n,r,i,s,o,t])}const vJe="com.redocly.deepLink.opened";let u9=!1;function yJe(){const{warning:t}=bI.useToast(),e=et(),n=OJe({onEnvironmentNotFound:i=>t(`Environment "${i}" not found`)}),r=x.useRef(n);r.current=n,x.useEffect(()=>{let i,s=!1;const o=a=>{const l=a[0]&&gJe(a[0]);l&&(r.current(l),e.sendEvent(vJe,[{...ye("deepLink","request"),scheme:a[0].startsWith("redocly-replay:")?"redocly-replay":"replay"}]))};return(async()=>{const{onOpenUrl:a,getCurrent:l}=await Promise.resolve().then(()=>require("./replay-index-_0zkzi7P.js")),c=await a(o);if(s){c();return}if(i=c,!u9){const u=await l();if(s)return;u9=!0,u?.[0]&&o(u)}})(),()=>{s=!0,i?.()}},[])}function bJe(t){const e=t||"default";return{id:Nm(KS(e)),systemFilesDir:Ck.join("/replay",e),userFilesDir:Ck.join("/projects",e)}}async function xJe(t){if(!t)throw new Error("Tauri project: userFilesDir is required");const e=Nm(KS(t)),n=await SJe(),r=await PQ(n,"replay",e);return{id:e,systemFilesDir:r,userFilesDir:t}}async function SJe(){if(!iE)return CE();try{return await eY()}catch{return CE()}}function ry(t,e){if(e.size===0)return t;let n=t;for(let r=0;r<t.length;r++){const i=t[r];!uO(i)||!i.key||!e.has(i.key)||(n===t&&(n=[...t]),n[r]={...i,value:`$inputs.${i.key}`,active:!0})}return n}function HK(t,e,n){if(typeof e=="string"){const s=Ks(e);return s&&n.has(s)?e:t}if(!e||typeof e!="object"||Array.isArray(e)||!t||typeof t!="object"||Array.isArray(t))return t;const r=t;let i=r;for(const[s,o]of Object.entries(e)){const a=HK(r[s],o,n);a!==r[s]&&(i===r&&(i={...r}),i[s]=a)}return i}function wJe(t,e,n){if(n.size===0)return t;let r=t;for(const i of e){if(!i.securitySchemeId)continue;const s=t.findIndex(a=>a.securitySchemeId===i.securitySchemeId);if(s===-1)continue;const o=HK(r[s],i,n);o!==r[s]&&(r===t&&(r=[...t]),r[s]=o)}return r}function TJe(t,e,n){const r=dQ(e.parameters,"in"),{pathParameters:i,queryParameters:s,headers:o,cookies:a}=t.parameters;return{...t,parameters:{...t.parameters,pathParameters:ry(i,$f(r.path,"path",n)),queryParameters:ry(s,v6(r.query,r.querystring,n)),headers:ry(o,$f(r.header,"header",n)),cookies:ry(a,$f(r.cookie,"cookie",n))},security:wJe(t.security,hS(e),lBe(e,n))}}function JK(t,e){const n=`apis/${t.info.title}`.replace(/\s+/g,"-").toLowerCase(),r=a=>`${a}.yaml`,i=a=>e.some(l=>l.id===r(a));if(!i(n))return r(n);let s=1,o=`${n}-${s}`;for(;i(o);)s++,o=`${n}-${s}`;return r(o)}const CJe=(t,e,n)=>t.find(r=>{if(e&&r.operationId===e)return!0;if(n&&r.apiPath){const{path:i,method:s}=LY({operationPath:n,parsedSourceDescriptions:[]});return r.apiPath.path===i&&r.apiPath.method===s}return!1});function PJe(t,e,n){if(!t||!t.paths||Object.keys(t.paths).length===0)return{operations:null,error:0};const{operations:r}=kJe(t,e,n);return{operations:r}}function kJe(t,e,n){const r=[];for(const[i,s]of Object.entries(t.paths)){for(const[o,a]of Object.entries(s))o!=="parameters"&&o!=="servers"&&o!=="description"&&o!=="summary"&&o!=="additionalOperations"&&(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(c=>{const{operation:u}=d9(i,o,t,c,e,!1,n);u&&r.push(u)});if(s.additionalOperations)for(const[o,a]of Object.entries(s.additionalOperations))(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(c=>{const{operation:u}=d9(i,o,t,c,e,!0,n);u&&r.push(u)})}return{operations:r}}function d9(t,e,n,r,i,s,o){if(!o)return{operation:null};const a=o(t,e,n);if(!a)return{operation:null};const l=`${n.info.title}/${r}/${a.name}`;return{operation:p$e(a,s,i,l)}}function EJe(t){return"kind"in t&&"definition"in t}function IJe(t,e,n){if(t)return EJe(t)?t:{kind:"openapi",definition:{document:t},operation:$Je(e,n)}}function $Je(t,e){if(t&&e)return{operationId:t,pointer:e};if(t)return{operationId:t};if(e)return{pointer:e}}function f9(t,e,n){return t==="openapi"?AJe(e,n):(console.error(`Replay does not support the API kind "${String(t)}".`),null)}function AJe(t,e){try{const n=JK(t,[]),{operations:r}=PJe(t,n,e);return r?.length?{apiId:n,document:t,operations:r,convertOperation:e}:null}catch(n){return console.error("Replay cannot read the OpenAPI document of `api`.",n),null}}function h9(t,e){const n=CJe(t.operations,e?.operationId,e?.pointer),{path:r,method:i}=n?.apiPath??{};return!n||!r||!i?null:{requestOperation:n,path:r,method:i,openApiOperation:t.convertOperation?.(r,i,t.document)}}function QJe({store:t,selectedEnvironment:e,selectedEnvironmentSeq:n}){const r=x.useRef({seq:n,name:e});x.useEffect(()=>{!e||!(n===void 0?e!==r.current.name:n!==r.current.seq)||(r.current={seq:n,name:e},t.set(Io,e))},[t,e,n])}let Yy=performance.now();function RJe(){Yy=performance.now()}const qd=t=>Math.max(0,Math.round(t));function _Je({loadTiming:t,firstRenderTime:e,operationsCount:n}){const{sendEvent:r}=et();x.useEffect(()=>{if(!t)return;const i=performance.now();let s=document.visibilityState==="hidden";const o=()=>{document.visibilityState==="hidden"&&(s=!0)};document.addEventListener("visibilitychange",o);let a;const l=requestAnimationFrame(()=>{a=setTimeout(()=>{if(document.removeEventListener("visibilitychange",o),s)return;const c=performance.now(),{startTime:u,definitionReadyTime:f=u}=t,h=Math.max(Yy,f);r("com.redocly.app.loaded",[{...ye("app","replayApp"),duration_ms:qd(c-u),definition_ms:qd(f-u),chunk_ms:qd(Yy-f),mount_ms:qd(e-h),init_ms:qd(i-e),render_ms:qd(c-i),cold:Yy>u,operations_count:n}])},0)});return()=>{cancelAnimationFrame(l),clearTimeout(a),document.removeEventListener("visibilitychange",o)}},[])}class jJe{storage;constructor(e){this.storage=e}findAll(){return this.storage.findAll()}findOne(e){return this.storage.findOne(e)}upsert(e){return this.storage.upsert(e)}remove(e){return this.storage.remove(e)}findRecentChatsPage(e){return this.storage.findRecentChatsPage(e)}}class fI{static instance=null;static async initialize(e,n){this.close(),this.instance=await NJe(e,n)}static getInstance(){if(!this.instance)throw new Error("AiChatService not initialized");return this.instance}static close(){this.instance=null}}async function NJe(t,e){if(e){const{AiChatSqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-AiChatSqliteDBStorage-CRdPx5Sa.js")),r=Cm.getInstance(),i=new n(r);return new jJe(i)}else throw new Error("Not implemented")}const Fd="ai-chat",vC="detail",DJe="title",p9="infinite-history",KK={all:()=>[Fd],details:()=>[Fd,vC],detail:t=>[Fd,vC,t],detailTitle:t=>[Fd,vC,t,DJe],infiniteHistories:()=>[Fd,p9],infiniteHistory:t=>[Fd,p9,t]};function MJe(t){return{data:t.data.map(e=>({...e,step:{...e.step,security:e.step.security.securities}})),version:2}}const VJe=2;function LJe(t){const e=JSON.parse(t);let n;return e.version===1?n=MJe(e):n=e,n.version!==VJe&&console.warn(`Unknown history version ${n.version}, attempting migration anyway`),n.data.map(r=>({...r,type:"step"}))}const yC="history.json",zJe="history.json.backup";class XJe{static async migrateFromStorage(e,n,r){try{const i=await e.get(yC);if(!i||i.trim()==="")return{migrated:!1,itemCount:0};const s=LJe(i);if(s.length===0)return console.log(`No history items found in ${r}`),{migrated:!1,itemCount:0};await this.bulkInsert(n,s);try{await e.rename(yC,zJe)}catch{await e.remove(yC)}return console.log(`Migrated ${s.length} history items from ${r}`),{migrated:!0,itemCount:s.length}}catch(i){const s=i instanceof Error?i.message:"Unknown error";return console.error(`History migration from ${r} failed:`,s),{migrated:!1,itemCount:0,error:s}}}static async bulkInsert(e,n){for(let i=0;i<n.length;i+=100){const s=n.slice(i,i+100);await Promise.all(s.map(o=>e.addItem(o)))}}static async migrate(e,n,r){if(r){const{TauriFileSystemAdapter:i}=await Promise.resolve().then(()=>require("./replay-TauriFileSystemAdapter-LMZ5eRoj.js")),s=new i(e.systemFilesDir);return this.migrateFromStorage(s,n,"JSON file")}else{const i=new IE(e.systemFilesDir);return this.migrateFromStorage(i,n,"localStorage")}}}const a_=t=>d.jsx(UJe,{...t},t.settings.storageKey),UJe=({children:t,settings:e,api:n,activeOperationId:r,activeOperationPointer:i,onLoad:s,loadTiming:o,selectedEnvironmentSeq:a})=>{const[l]=x.useState(()=>performance.now()),c=DG(),u=et(),f=ki.useQueryClient(),[h]=x.useState(kI),p=IJe(n,r,i),m=x.useRef(e);m.current=e;const g=x.useRef(!1);x.useEffect(()=>(g.current=!1,()=>{g.current=!0}),[]);async function O(){const z=Rn()?await xJe(m.current.storageKey):bJe(m.current.storageKey);if(m.current.layout!=="preview"&&Rn()&&Em.initialize(),await c.init(z,m.current,h,u),m.current.layout!=="preview"){if(g.current)return;if(Rn()){const $=`${z.systemFilesDir}/replay.db`;await Cm.initialize($),await fI.initialize(z,Rn())}if(g.current)return;await vc.initialize(z,Rn()),await $o.initialize(Rn());try{await $o.getInstance()?.pruneOlderThan(Date.now()-aIe)}catch($){console.error("Failed to prune step context:",$)}if(g.current)return;try{const $=await XJe.migrate(z,vc.getInstance(),Rn());$.migrated&&u.sendEvent("com.redocly.history.migration",[{...ye("migration","historyMigration","storage"),status:"success",itemCount:$.itemCount}])}catch($){console.error("History migration failed:",$),u.sendEvent("com.redocly.history.migration",[{...ye("migration","historyMigration","storage"),status:"error",error:$ instanceof Error?$.message:"Unknown error"}])}}X(),h.get(si).length===0&&h.set(si,cA);function X(){if(!p)return;const{convertOperationToReplayValue:$,dynamicReplayValues:U}=m.current,R=f9(p.kind,p.definition.document,$);if(!R)return;const{apiId:D,operations:L}=R;if(!L[0].collectionPath?.split("/")?.[0])return;h.set(_s,[{id:D,srcType:qi.FS,...R.document}]),h.set(ER,D);const Y=h9(R,p.operation);if(!Y)return;const{requestOperation:G,path:ee,method:ie,openApiOperation:q}=Y;q&&g9(h,D,q,m.current),ZJe(h,{apiId:D,path:ee,method:ie,operationId:G.operationId,isAdditionalOperation:G.isAdditionalOperation},q,U)}}const[v]=x.useState(()=>O());x.useEffect(()=>{if(e.layout!=="preview")return f.invalidateQueries({queryKey:ui.all}),f.invalidateQueries({queryKey:KK.all()}),f.invalidateQueries({queryKey:QO.all}),()=>{vc.close(),fI.close(),Em.close(),$o.close(),Rn()&&Cm.close().catch(z=>{console.error("Failed to close SqliteDBConnection:",z)})}},[e.layout,f]),QJe({store:h,selectedEnvironment:e.selectedEnvironment,selectedEnvironmentSeq:a});const b=p?.kind,y=p?.definition.document,w=e.convertOperationToReplayValue,S=x.useMemo(()=>b&&y&&w?f9(b,y,w):null,[b,y,w]),P=p?.operation?.operationId,k=p?.operation?.pointer,{predefinedEnvValues:I,dynamicReplayValues:E,gateEnvironments:Q,allowedEnvironments:N,selectedEnvironment:_}=e;x.useEffect(()=>{if(!S)return;const z=h9(S,{operationId:P,pointer:k});z?.openApiOperation&&g9(h,S.apiId,z.openApiOperation,{predefinedEnvValues:I,dynamicReplayValues:E,gateEnvironments:Q,allowedEnvironments:N,selectedEnvironment:_})},[h,S,P,k,I,E,Q,N,_]);const M=e.layout==="preview"?null:d.jsx(oJe,{projectPath:e.storageKey});return d.jsx(x.Suspense,{fallback:M,children:d.jsx(qJe,{initStore:v,store:h,settings:e,api:n,onLoad:s,loadTiming:o,firstRenderTime:l,operationsCount:S?.operations.length??0,children:t})})};function qJe({initStore:t,store:e,children:n,settings:r,api:i,onLoad:s,loadTiming:o,firstRenderTime:a,operationsCount:l}){x.use(t),_Je({loadTiming:o,firstRenderTime:a,operationsCount:l});const c=Xre(r,i);return x.useEffect(()=>{s?.()},[]),d.jsx($te,{store:e,children:d.jsxs(FJe,{settings:c,apiId:r.apiId,children:[Rn()&&d.jsx(WJe,{}),n]})})}function FJe({settings:t,apiId:e,children:n}){jte([[rg,t],[yg,e]]);const r=Do();return x.useEffect(()=>{am(r.get(rg),t)||r.set(rg,t)},[r,t]),x.useEffect(()=>{r.get(yg)!==e&&r.set(yg,e)},[r,e]),d.jsx(d.Fragment,{children:n})}function WJe(){return yJe(),null}const g9=(t,e,n,r)=>{const i=t.get(si),{environments:s,generatedInputs:o,synthesizedEnvironmentNames:a}=hBe(e,n,i,r.predefinedEnvValues,r.dynamicReplayValues,r.gateEnvironments);m9(t.get(Y0),o)||t.set(Y0,o);const{newEnvironments:l,predefinedEnvironmentNames:c,activeEnvName:u}=pBe({envs:s,synthesizedEnvironmentNames:a,existingEnvironments:i,allowedEnvironments:r.allowedEnvironments,selectedEnvironment:r.selectedEnvironment,activeEnvironmentId:t.get(Io)});m9(t.get(B0),c)||t.set(B0,c),am(l,t.get(si))||t.set(si,l),t.set(Io,u)},m9=(t,e)=>t.size===e.size&&[...t].every(n=>e.has(n)),ZJe=(t,e,n,r)=>{const i=t.get(Zr).findIndex(({data:s})=>Tn(s,Xe.Step)&&s.draftStep?.operation?.apiId===e.apiId&&s.draftStep?.operation?.path===e.path&&s.draftStep?.operation?.method===e.method);if(i!==-1)n&&r&&t.set(Zr,s=>Ig(s,i,o=>o.draftStep?{...o,draftStep:TJe(o.draftStep,n,r)}:o)),t.set(ms,i);else{const s=IQ(e,n,r),o=[...t.get(Zr),{...s,state:Qn.Normal}];t.set(Zr,o),t.set(ms,o.length-1)}};function BJe(t){const e=x.useMemo(()=>jG(!0),[]);return d.jsx(ki.QueryClientProvider,{client:RS(),children:d.jsx(n_,{children:d.jsx(Dje,{value:e,children:d.jsx(dx.Provider,{value:t.settings,children:d.jsx(a_,{...t,selectedEnvironmentSeq:void 0,children:d.jsx(LK,{onError:n=>console.error(n),children:d.jsx(YJe,{})})})})})})})}function YJe(){return d.jsx(x.StrictMode,{children:d.jsxs(GJe,{children:[d.jsx(HJe,{children:d.jsx(o_,{})}),d.jsx(kg,{hideTabs:!0}),d.jsx(XK,{})]})})}const GJe=T.default.div`
6288
+ `,cJe="request",uJe=new Set(["replay:","redocly-replay:"]),dJe=8*1024,fJe=4*1024,uI=1024,hJe=new Set([Hn.JSON,Hn.XML,Hn.HTML,Hn.Text]);function dI(t){return iQ(t).length>0}function pJe(t,e,n){return{id:crypto.randomUUID(),key:e,value:n,in:t,active:!0}}function GK(t,e){return!t||t.length>uI||e.length>uI||dI(e)}function OC(t,e,n){const r=[];for(const[i,s]of t){if(!i.startsWith(e))continue;const o=i.slice(e.length);if(GK(o,s))return null;r.push(pJe(n,o,s))}return r}function gJe(t){if(t.length>dJe)return null;let e;try{e=new URL(t)}catch{return null}if(!uJe.has(e.protocol)||e.hostname.toLowerCase()!==cJe)return null;const n=e.searchParams,r=n.get("url");if(!r||dI(r))return null;let i;try{i=new URL(r)}catch{return null}if(i.protocol!=="http:"&&i.protocol!=="https:")return null;const s=(n.get("method")||"GET").toUpperCase();if(!Th.includes(s))return null;const o=OC(n,"header.","header"),a=OC(n,"query.","query"),l=OC(n,"cookie.","cookie");if(!o||!a||!l)return null;const c=bO(r);if(c.some(p=>GK(p.key,p.value)))return null;const u=n.get("body");if(u!==null&&(u.length>fJe||dI(u)))return null;const f=n.get("contentType")?.trim();if(f&&!hJe.has(f))return null;const h=n.get("env")?.trim();return h&&h.length>uI?null:{xOperation:{method:s,url:r},headers:o,queryParameters:[...c,...a],cookies:l,...u!==null&&{body:{content:u,...f&&{type:f}}},...h&&{environment:h}}}function mJe(t){return t.stepId===null&&t.collectionId===null&&t.workflowId===null&&t.historyId===null&&!t.sourceFile}function OJe({onEnvironmentNotFound:t}={}){const{getTabs:e,setActiveTabIdx:n,updateTabDataAt:r}=id(),{addNewTab:i}=hr(),s=Ua(),o=Lh();return x.useCallback(a=>{const l=e().findIndex(({data:u})=>Tn(u,Xe.Step)&&mJe(u)&&kE(u,a.xOperation));let c;if(l!==-1)c=l,n(c);else{const u=ja({xOperation:a.xOperation});c=i({id:crypto.randomUUID(),state:Qn.Normal,data:uf({draftStep:u,activeTabName:Ou(u)})})}e()[c]&&r(c,u=>{const f={...u,response:null,requestError:null,isProcessingRequest:!1};if(!f.draftStep)return f;const h=ch();return{...f,draftStep:{...f.draftStep,parameters:{...f.draftStep.parameters,headers:a.headers,queryParameters:a.queryParameters,cookies:a.cookies},requestBody:a.body?{...h,content:a.body.content,...a.body.type&&{type:a.body.type}}:h}}}),a.environment&&(s.some(f=>f.name===a.environment)?o(a.environment):t?.(a.environment))},[e,n,r,i,s,o,t])}const vJe="com.redocly.deepLink.opened";let u9=!1;function yJe(){const{warning:t}=bI.useToast(),e=et(),n=OJe({onEnvironmentNotFound:i=>t(`Environment "${i}" not found`)}),r=x.useRef(n);r.current=n,x.useEffect(()=>{let i,s=!1;const o=a=>{const l=a[0]&&gJe(a[0]);l&&(r.current(l),e.sendEvent(vJe,[{...ye("deepLink","request"),scheme:a[0].startsWith("redocly-replay:")?"redocly-replay":"replay"}]))};return(async()=>{const{onOpenUrl:a,getCurrent:l}=await Promise.resolve().then(()=>require("./replay-index-DAbsE71J.js")),c=await a(o);if(s){c();return}if(i=c,!u9){const u=await l();if(s)return;u9=!0,u?.[0]&&o(u)}})(),()=>{s=!0,i?.()}},[])}function bJe(t){const e=t||"default";return{id:Nm(KS(e)),systemFilesDir:Ck.join("/replay",e),userFilesDir:Ck.join("/projects",e)}}async function xJe(t){if(!t)throw new Error("Tauri project: userFilesDir is required");const e=Nm(KS(t)),n=await SJe(),r=await PQ(n,"replay",e);return{id:e,systemFilesDir:r,userFilesDir:t}}async function SJe(){if(!iE)return CE();try{return await eY()}catch{return CE()}}function ry(t,e){if(e.size===0)return t;let n=t;for(let r=0;r<t.length;r++){const i=t[r];!uO(i)||!i.key||!e.has(i.key)||(n===t&&(n=[...t]),n[r]={...i,value:`$inputs.${i.key}`,active:!0})}return n}function HK(t,e,n){if(typeof e=="string"){const s=Ks(e);return s&&n.has(s)?e:t}if(!e||typeof e!="object"||Array.isArray(e)||!t||typeof t!="object"||Array.isArray(t))return t;const r=t;let i=r;for(const[s,o]of Object.entries(e)){const a=HK(r[s],o,n);a!==r[s]&&(i===r&&(i={...r}),i[s]=a)}return i}function wJe(t,e,n){if(n.size===0)return t;let r=t;for(const i of e){if(!i.securitySchemeId)continue;const s=t.findIndex(a=>a.securitySchemeId===i.securitySchemeId);if(s===-1)continue;const o=HK(r[s],i,n);o!==r[s]&&(r===t&&(r=[...t]),r[s]=o)}return r}function TJe(t,e,n){const r=dQ(e.parameters,"in"),{pathParameters:i,queryParameters:s,headers:o,cookies:a}=t.parameters;return{...t,parameters:{...t.parameters,pathParameters:ry(i,$f(r.path,"path",n)),queryParameters:ry(s,v6(r.query,r.querystring,n)),headers:ry(o,$f(r.header,"header",n)),cookies:ry(a,$f(r.cookie,"cookie",n))},security:wJe(t.security,hS(e),lBe(e,n))}}function JK(t,e){const n=`apis/${t.info.title}`.replace(/\s+/g,"-").toLowerCase(),r=a=>`${a}.yaml`,i=a=>e.some(l=>l.id===r(a));if(!i(n))return r(n);let s=1,o=`${n}-${s}`;for(;i(o);)s++,o=`${n}-${s}`;return r(o)}const CJe=(t,e,n)=>t.find(r=>{if(e&&r.operationId===e)return!0;if(n&&r.apiPath){const{path:i,method:s}=LY({operationPath:n,parsedSourceDescriptions:[]});return r.apiPath.path===i&&r.apiPath.method===s}return!1});function PJe(t,e,n){if(!t||!t.paths||Object.keys(t.paths).length===0)return{operations:null,error:0};const{operations:r}=kJe(t,e,n);return{operations:r}}function kJe(t,e,n){const r=[];for(const[i,s]of Object.entries(t.paths)){for(const[o,a]of Object.entries(s))o!=="parameters"&&o!=="servers"&&o!=="description"&&o!=="summary"&&o!=="additionalOperations"&&(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(c=>{const{operation:u}=d9(i,o,t,c,e,!1,n);u&&r.push(u)});if(s.additionalOperations)for(const[o,a]of Object.entries(s.additionalOperations))(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(c=>{const{operation:u}=d9(i,o,t,c,e,!0,n);u&&r.push(u)})}return{operations:r}}function d9(t,e,n,r,i,s,o){if(!o)return{operation:null};const a=o(t,e,n);if(!a)return{operation:null};const l=`${n.info.title}/${r}/${a.name}`;return{operation:p$e(a,s,i,l)}}function EJe(t){return"kind"in t&&"definition"in t}function IJe(t,e,n){if(t)return EJe(t)?t:{kind:"openapi",definition:{document:t},operation:$Je(e,n)}}function $Je(t,e){if(t&&e)return{operationId:t,pointer:e};if(t)return{operationId:t};if(e)return{pointer:e}}function f9(t,e,n){return t==="openapi"?AJe(e,n):(console.error(`Replay does not support the API kind "${String(t)}".`),null)}function AJe(t,e){try{const n=JK(t,[]),{operations:r}=PJe(t,n,e);return r?.length?{apiId:n,document:t,operations:r,convertOperation:e}:null}catch(n){return console.error("Replay cannot read the OpenAPI document of `api`.",n),null}}function h9(t,e){const n=CJe(t.operations,e?.operationId,e?.pointer),{path:r,method:i}=n?.apiPath??{};return!n||!r||!i?null:{requestOperation:n,path:r,method:i,openApiOperation:t.convertOperation?.(r,i,t.document)}}function QJe({store:t,selectedEnvironment:e,selectedEnvironmentSeq:n}){const r=x.useRef({seq:n,name:e});x.useEffect(()=>{!e||!(n===void 0?e!==r.current.name:n!==r.current.seq)||(r.current={seq:n,name:e},t.set(Io,e))},[t,e,n])}let Yy=performance.now();function RJe(){Yy=performance.now()}const qd=t=>Math.max(0,Math.round(t));function _Je({loadTiming:t,firstRenderTime:e,operationsCount:n}){const{sendEvent:r}=et();x.useEffect(()=>{if(!t)return;const i=performance.now();let s=document.visibilityState==="hidden";const o=()=>{document.visibilityState==="hidden"&&(s=!0)};document.addEventListener("visibilitychange",o);let a;const l=requestAnimationFrame(()=>{a=setTimeout(()=>{if(document.removeEventListener("visibilitychange",o),s)return;const c=performance.now(),{startTime:u,definitionReadyTime:f=u}=t,h=Math.max(Yy,f);r("com.redocly.app.loaded",[{...ye("app","replayApp"),duration_ms:qd(c-u),definition_ms:qd(f-u),chunk_ms:qd(Yy-f),mount_ms:qd(e-h),init_ms:qd(i-e),render_ms:qd(c-i),cold:Yy>u,operations_count:n}])},0)});return()=>{cancelAnimationFrame(l),clearTimeout(a),document.removeEventListener("visibilitychange",o)}},[])}class jJe{storage;constructor(e){this.storage=e}findAll(){return this.storage.findAll()}findOne(e){return this.storage.findOne(e)}upsert(e){return this.storage.upsert(e)}remove(e){return this.storage.remove(e)}findRecentChatsPage(e){return this.storage.findRecentChatsPage(e)}}class fI{static instance=null;static async initialize(e,n){this.close(),this.instance=await NJe(e,n)}static getInstance(){if(!this.instance)throw new Error("AiChatService not initialized");return this.instance}static close(){this.instance=null}}async function NJe(t,e){if(e){const{AiChatSqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-AiChatSqliteDBStorage-BiW2AzpT.js")),r=Cm.getInstance(),i=new n(r);return new jJe(i)}else throw new Error("Not implemented")}const Fd="ai-chat",vC="detail",DJe="title",p9="infinite-history",KK={all:()=>[Fd],details:()=>[Fd,vC],detail:t=>[Fd,vC,t],detailTitle:t=>[Fd,vC,t,DJe],infiniteHistories:()=>[Fd,p9],infiniteHistory:t=>[Fd,p9,t]};function MJe(t){return{data:t.data.map(e=>({...e,step:{...e.step,security:e.step.security.securities}})),version:2}}const VJe=2;function LJe(t){const e=JSON.parse(t);let n;return e.version===1?n=MJe(e):n=e,n.version!==VJe&&console.warn(`Unknown history version ${n.version}, attempting migration anyway`),n.data.map(r=>({...r,type:"step"}))}const yC="history.json",zJe="history.json.backup";class XJe{static async migrateFromStorage(e,n,r){try{const i=await e.get(yC);if(!i||i.trim()==="")return{migrated:!1,itemCount:0};const s=LJe(i);if(s.length===0)return console.log(`No history items found in ${r}`),{migrated:!1,itemCount:0};await this.bulkInsert(n,s);try{await e.rename(yC,zJe)}catch{await e.remove(yC)}return console.log(`Migrated ${s.length} history items from ${r}`),{migrated:!0,itemCount:s.length}}catch(i){const s=i instanceof Error?i.message:"Unknown error";return console.error(`History migration from ${r} failed:`,s),{migrated:!1,itemCount:0,error:s}}}static async bulkInsert(e,n){for(let i=0;i<n.length;i+=100){const s=n.slice(i,i+100);await Promise.all(s.map(o=>e.addItem(o)))}}static async migrate(e,n,r){if(r){const{TauriFileSystemAdapter:i}=await Promise.resolve().then(()=>require("./replay-TauriFileSystemAdapter-jXGkDtit.js")),s=new i(e.systemFilesDir);return this.migrateFromStorage(s,n,"JSON file")}else{const i=new IE(e.systemFilesDir);return this.migrateFromStorage(i,n,"localStorage")}}}const a_=t=>d.jsx(UJe,{...t},t.settings.storageKey),UJe=({children:t,settings:e,api:n,activeOperationId:r,activeOperationPointer:i,onLoad:s,loadTiming:o,selectedEnvironmentSeq:a})=>{const[l]=x.useState(()=>performance.now()),c=DG(),u=et(),f=ki.useQueryClient(),[h]=x.useState(kI),p=IJe(n,r,i),m=x.useRef(e);m.current=e;const g=x.useRef(!1);x.useEffect(()=>(g.current=!1,()=>{g.current=!0}),[]);async function O(){const z=Rn()?await xJe(m.current.storageKey):bJe(m.current.storageKey);if(m.current.layout!=="preview"&&Rn()&&Em.initialize(),await c.init(z,m.current,h,u),m.current.layout!=="preview"){if(g.current)return;if(Rn()){const $=`${z.systemFilesDir}/replay.db`;await Cm.initialize($),await fI.initialize(z,Rn())}if(g.current)return;await vc.initialize(z,Rn()),await $o.initialize(Rn());try{await $o.getInstance()?.pruneOlderThan(Date.now()-aIe)}catch($){console.error("Failed to prune step context:",$)}if(g.current)return;try{const $=await XJe.migrate(z,vc.getInstance(),Rn());$.migrated&&u.sendEvent("com.redocly.history.migration",[{...ye("migration","historyMigration","storage"),status:"success",itemCount:$.itemCount}])}catch($){console.error("History migration failed:",$),u.sendEvent("com.redocly.history.migration",[{...ye("migration","historyMigration","storage"),status:"error",error:$ instanceof Error?$.message:"Unknown error"}])}}X(),h.get(si).length===0&&h.set(si,cA);function X(){if(!p)return;const{convertOperationToReplayValue:$,dynamicReplayValues:U}=m.current,R=f9(p.kind,p.definition.document,$);if(!R)return;const{apiId:D,operations:L}=R;if(!L[0].collectionPath?.split("/")?.[0])return;h.set(_s,[{id:D,srcType:qi.FS,...R.document}]),h.set(ER,D);const Y=h9(R,p.operation);if(!Y)return;const{requestOperation:G,path:ee,method:ie,openApiOperation:q}=Y;q&&g9(h,D,q,m.current),ZJe(h,{apiId:D,path:ee,method:ie,operationId:G.operationId,isAdditionalOperation:G.isAdditionalOperation},q,U)}}const[v]=x.useState(()=>O());x.useEffect(()=>{if(e.layout!=="preview")return f.invalidateQueries({queryKey:ui.all}),f.invalidateQueries({queryKey:KK.all()}),f.invalidateQueries({queryKey:QO.all}),()=>{vc.close(),fI.close(),Em.close(),$o.close(),Rn()&&Cm.close().catch(z=>{console.error("Failed to close SqliteDBConnection:",z)})}},[e.layout,f]),QJe({store:h,selectedEnvironment:e.selectedEnvironment,selectedEnvironmentSeq:a});const b=p?.kind,y=p?.definition.document,w=e.convertOperationToReplayValue,S=x.useMemo(()=>b&&y&&w?f9(b,y,w):null,[b,y,w]),P=p?.operation?.operationId,k=p?.operation?.pointer,{predefinedEnvValues:I,dynamicReplayValues:E,gateEnvironments:Q,allowedEnvironments:N,selectedEnvironment:_}=e;x.useEffect(()=>{if(!S)return;const z=h9(S,{operationId:P,pointer:k});z?.openApiOperation&&g9(h,S.apiId,z.openApiOperation,{predefinedEnvValues:I,dynamicReplayValues:E,gateEnvironments:Q,allowedEnvironments:N,selectedEnvironment:_})},[h,S,P,k,I,E,Q,N,_]);const M=e.layout==="preview"?null:d.jsx(oJe,{projectPath:e.storageKey});return d.jsx(x.Suspense,{fallback:M,children:d.jsx(qJe,{initStore:v,store:h,settings:e,api:n,onLoad:s,loadTiming:o,firstRenderTime:l,operationsCount:S?.operations.length??0,children:t})})};function qJe({initStore:t,store:e,children:n,settings:r,api:i,onLoad:s,loadTiming:o,firstRenderTime:a,operationsCount:l}){x.use(t),_Je({loadTiming:o,firstRenderTime:a,operationsCount:l});const c=Xre(r,i);return x.useEffect(()=>{s?.()},[]),d.jsx($te,{store:e,children:d.jsxs(FJe,{settings:c,apiId:r.apiId,children:[Rn()&&d.jsx(WJe,{}),n]})})}function FJe({settings:t,apiId:e,children:n}){jte([[rg,t],[yg,e]]);const r=Do();return x.useEffect(()=>{am(r.get(rg),t)||r.set(rg,t)},[r,t]),x.useEffect(()=>{r.get(yg)!==e&&r.set(yg,e)},[r,e]),d.jsx(d.Fragment,{children:n})}function WJe(){return yJe(),null}const g9=(t,e,n,r)=>{const i=t.get(si),{environments:s,generatedInputs:o,synthesizedEnvironmentNames:a}=hBe(e,n,i,r.predefinedEnvValues,r.dynamicReplayValues,r.gateEnvironments);m9(t.get(Y0),o)||t.set(Y0,o);const{newEnvironments:l,predefinedEnvironmentNames:c,activeEnvName:u}=pBe({envs:s,synthesizedEnvironmentNames:a,existingEnvironments:i,allowedEnvironments:r.allowedEnvironments,selectedEnvironment:r.selectedEnvironment,activeEnvironmentId:t.get(Io)});m9(t.get(B0),c)||t.set(B0,c),am(l,t.get(si))||t.set(si,l),t.set(Io,u)},m9=(t,e)=>t.size===e.size&&[...t].every(n=>e.has(n)),ZJe=(t,e,n,r)=>{const i=t.get(Zr).findIndex(({data:s})=>Tn(s,Xe.Step)&&s.draftStep?.operation?.apiId===e.apiId&&s.draftStep?.operation?.path===e.path&&s.draftStep?.operation?.method===e.method);if(i!==-1)n&&r&&t.set(Zr,s=>Ig(s,i,o=>o.draftStep?{...o,draftStep:TJe(o.draftStep,n,r)}:o)),t.set(ms,i);else{const s=IQ(e,n,r),o=[...t.get(Zr),{...s,state:Qn.Normal}];t.set(Zr,o),t.set(ms,o.length-1)}};function BJe(t){const e=x.useMemo(()=>jG(!0),[]);return d.jsx(ki.QueryClientProvider,{client:RS(),children:d.jsx(n_,{children:d.jsx(Dje,{value:e,children:d.jsx(dx.Provider,{value:t.settings,children:d.jsx(a_,{...t,selectedEnvironmentSeq:void 0,children:d.jsx(LK,{onError:n=>console.error(n),children:d.jsx(YJe,{})})})})})})})}function YJe(){return d.jsx(x.StrictMode,{children:d.jsxs(GJe,{children:[d.jsx(HJe,{children:d.jsx(o_,{})}),d.jsx(kg,{hideTabs:!0}),d.jsx(XK,{})]})})}const GJe=T.default.div`
6289
6289
  display: flex;
6290
6290
  flex-direction: column;
6291
6291
  max-height: 80vh;
@@ -6676,7 +6676,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
6676
6676
  `,oet=T.default.div`
6677
6677
  display: flex;
6678
6678
  gap: var(--spacing-xs);
6679
- `;async function u_(t,e,n){try{const{join:r,dirname:i}=await Promise.resolve().then(()=>EQ),{exists:s}=await Promise.resolve().then(()=>xO),{revealItemInDir:o,openPath:a}=await Promise.resolve().then(()=>require("./replay-index-DSQ-8F3e.js")),l=await r(t,e);if(n||!await s(l)){const c=await i(l);await a(c);return}await o(l)}catch(r){throw console.error("Failed to reveal item in folder:",r),r}}function aet({node:t}){const e=t.data.type==="api"&&t.data.api.srcType===qi.WEB,n=dd(),r=x.useMemo(()=>Rn(),[]),{sendEvent:i}=et();if(e)return null;const s=()=>{t.tree.delete(t.id)},o=async()=>{try{if(t.data.type==="api"){const a=t.data.api.id,l=n.userFilesDir;await u_(l,a),i("com.redocly.node.management",[{...ye("api","apiNode"),action:"reveal_in_folder",node_type:"api",name:a}])}}catch(a){console.error("Failed to reveal API in folder:",a)}};return d.jsx(cet,{onClick:a=>a.stopPropagation(),children:d.jsx(Xn,{content:"More actions",placement:"topRight",children:d.jsx(Bi.Dropdown,{trigger:d.jsx(ve.Button,{variant:"text",size:"small",icon:d.jsx(yh.OverflowMenuVerticalIcon,{})}),alignment:"end",children:d.jsxs(Yi.DropdownMenu,{children:[r&&d.jsxs(br,{onClick:o,children:[d.jsx(TI.FolderIcon,{size:"14px"}),"Reveal in folder"]}),d.jsxs(br,{onClick:s,children:[d.jsx(rr.TrashCanIcon,{size:"14px"}),"Delete"]})]})})})})}const cet=T.default.div`
6679
+ `;async function u_(t,e,n){try{const{join:r,dirname:i}=await Promise.resolve().then(()=>EQ),{exists:s}=await Promise.resolve().then(()=>xO),{revealItemInDir:o,openPath:a}=await Promise.resolve().then(()=>require("./replay-index-CtzJut8U.js")),l=await r(t,e);if(n||!await s(l)){const c=await i(l);await a(c);return}await o(l)}catch(r){throw console.error("Failed to reveal item in folder:",r),r}}function aet({node:t}){const e=t.data.type==="api"&&t.data.api.srcType===qi.WEB,n=dd(),r=x.useMemo(()=>Rn(),[]),{sendEvent:i}=et();if(e)return null;const s=()=>{t.tree.delete(t.id)},o=async()=>{try{if(t.data.type==="api"){const a=t.data.api.id,l=n.userFilesDir;await u_(l,a),i("com.redocly.node.management",[{...ye("api","apiNode"),action:"reveal_in_folder",node_type:"api",name:a}])}}catch(a){console.error("Failed to reveal API in folder:",a)}};return d.jsx(cet,{onClick:a=>a.stopPropagation(),children:d.jsx(Xn,{content:"More actions",placement:"topRight",children:d.jsx(Bi.Dropdown,{trigger:d.jsx(ve.Button,{variant:"text",size:"small",icon:d.jsx(yh.OverflowMenuVerticalIcon,{})}),alignment:"end",children:d.jsxs(Yi.DropdownMenu,{children:[r&&d.jsxs(br,{onClick:o,children:[d.jsx(TI.FolderIcon,{size:"14px"}),"Reveal in folder"]}),d.jsxs(br,{onClick:s,children:[d.jsx(rr.TrashCanIcon,{size:"14px"}),"Delete"]})]})})})})}const cet=T.default.div`
6680
6680
  display: flex;
6681
6681
  gap: var(--spacing-xxs);
6682
6682
  `;function uet({onImport:t}){return d.jsxs(det,{children:[d.jsx(fet,{children:"No OpenAPI files were imported yet"}),d.jsx(het,{children:d.jsx(ve.Button,{icon:d.jsx(SI.DownloadIcon,{}),onClick:t,children:"Import OpenAPI file"})})]})}const det=T.default.div`
@@ -7050,7 +7050,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
7050
7050
  gap: var(--spacing-sm);
7051
7051
  flex: 1;
7052
7052
  justify-content: flex-end;
7053
- `;function int({children:t}){const[e,n]=x.useState(new Set),r=x.useCallback(o=>{n(a=>{const l=new Set(a);return l.add(o),l})},[]),i=x.useCallback(o=>{n(a=>{const l=new Set(a);return l.delete(o),l})},[]),s=x.useMemo(()=>({hasActiveOverlay:e.size>0,registerOverlay:r,unregisterOverlay:i}),[e.size,r,i]);return d.jsx(CI.Provider,{value:s,children:t})}function snt({children:t,renderProjectSelect:e}){return d.jsx(eee.Provider,{value:{renderProjectSelect:e},children:t})}function ont({error:t}){const{userFilesDir:e}=dd(),n=x.useCallback(async()=>{try{const{openPath:r}=await Promise.resolve().then(()=>require("./replay-index-DSQ-8F3e.js")),i=await sn.join(e,t.filePath);await r(i)}catch(r){console.error(`Failed to open ${t.filePath}:`,r)}},[e,t.filePath]);return d.jsx(ant,{"data-testid":"replay-config-error",children:d.jsxs(lnt,{children:[d.jsx(yl.WarningFilledIcon,{size:"24px",color:"--color-warning-base"}),d.jsxs(cnt,{children:[d.jsxs(unt,{children:["Replay cannot use ",t.filePath]}),d.jsx(dnt,{children:"Replay keeps its environments in the replay section of this file. Until this is resolved it will not change the file, so the rest of your project configuration stays intact."}),t.issues.length>0&&d.jsx(fnt,{"data-testid":"replay-config-error-issues",children:t.issues.map((r,i)=>d.jsxs(hnt,{children:[r.line!==void 0&&d.jsxs(pnt,{children:["Line ",r.line]}),d.jsx(gnt,{children:r.message})]},`${r.line??"unknown"}-${i}`))}),d.jsx(ve.Button,{"data-testid":"replay-config-error-open",variant:"secondary",size:"small",icon:d.jsx(jr.EditIcon,{}),iconPosition:"left",onClick:n,children:"Open in editor"}),d.jsx(mnt,{children:"Replay picks up the fix as soon as you save."})]})]})})}const ant=T.default.div`
7053
+ `;function int({children:t}){const[e,n]=x.useState(new Set),r=x.useCallback(o=>{n(a=>{const l=new Set(a);return l.add(o),l})},[]),i=x.useCallback(o=>{n(a=>{const l=new Set(a);return l.delete(o),l})},[]),s=x.useMemo(()=>({hasActiveOverlay:e.size>0,registerOverlay:r,unregisterOverlay:i}),[e.size,r,i]);return d.jsx(CI.Provider,{value:s,children:t})}function snt({children:t,renderProjectSelect:e}){return d.jsx(eee.Provider,{value:{renderProjectSelect:e},children:t})}function ont({error:t}){const{userFilesDir:e}=dd(),n=x.useCallback(async()=>{try{const{openPath:r}=await Promise.resolve().then(()=>require("./replay-index-CtzJut8U.js")),i=await sn.join(e,t.filePath);await r(i)}catch(r){console.error(`Failed to open ${t.filePath}:`,r)}},[e,t.filePath]);return d.jsx(ant,{"data-testid":"replay-config-error",children:d.jsxs(lnt,{children:[d.jsx(yl.WarningFilledIcon,{size:"24px",color:"--color-warning-base"}),d.jsxs(cnt,{children:[d.jsxs(unt,{children:["Replay cannot use ",t.filePath]}),d.jsx(dnt,{children:"Replay keeps its environments in the replay section of this file. Until this is resolved it will not change the file, so the rest of your project configuration stays intact."}),t.issues.length>0&&d.jsx(fnt,{"data-testid":"replay-config-error-issues",children:t.issues.map((r,i)=>d.jsxs(hnt,{children:[r.line!==void 0&&d.jsxs(pnt,{children:["Line ",r.line]}),d.jsx(gnt,{children:r.message})]},`${r.line??"unknown"}-${i}`))}),d.jsx(ve.Button,{"data-testid":"replay-config-error-open",variant:"secondary",size:"small",icon:d.jsx(jr.EditIcon,{}),iconPosition:"left",onClick:n,children:"Open in editor"}),d.jsx(mnt,{children:"Replay picks up the fix as soon as you save."})]})]})})}const ant=T.default.div`
7054
7054
  display: flex;
7055
7055
  flex: 1;
7056
7056
  justify-content: center;
@@ -7170,7 +7170,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
7170
7170
  border-right: ${({$isOverlayLayout:t})=>t?"1px solid var(--border-color-secondary)":"none"};
7171
7171
  width: 100%;
7172
7172
  user-select: none;
7173
- `;function E9({children:t}){const e=Vh(),{sendEvent:n}=et(),{tabsParams:r}=cw(e,!1),[i,s]=x.useState(r[0]?.key||null),o=x.useCallback(l=>{s(l),n("com.redocly.tab.change",[{...ye("tab","sidePanelTab"),source:"side_panel",name:l}])},[n]),a={tabsParams:r,activeTab:i,onTabChange:o};return d.jsx(dee.Provider,{value:a,children:t})}function xnt(){const[t,e]=x.useState(()=>{const n=document.documentElement.clientWidth;return I9(n)});return x.useEffect(()=>{const n=()=>{const r=document.documentElement.clientWidth;e(I9(r))};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t}function I9(t){return t>=1512?24:t>=1280?28:t>=1024?32:35}const Snt={isOpen:!1,openPanel:()=>{},closePanel:()=>{}},hee=x.createContext(Snt);function pee(){return x.useContext(hee)}const wnt=x.lazy(()=>Promise.resolve().then(()=>require("./replay-AiPanel--HMLwr6r.js")).then(t=>({default:t.AiPanel}))),Tnt=20,Cnt=25,Pnt=40;function knt({panel:t,panelProps:e}){const[n,r]=x.useState(!1),{layout:i,aiEnabled:s}=Wn(),o=xnt(),{isOpen:a,openPanel:l,closePanel:c}=pee(),{panelProps:u,panel:f}=VS(!a),h=s===!0,p=i==="overlay",{onCollapse:m,onExpand:g,...O}=u;return x.useEffect(()=>{a&&f.isCollapsed&&f.expand(),!a&&!f.isCollapsed&&f.collapse()},[f,a]),i==="preview"?d.jsx(kg,{hideTabs:!0}):p?d.jsx(E9,{children:d.jsxs($9,{direction:"horizontal",autoSaveId:"replay-layout-overlay",children:[d.jsx(Ep,{id:"main-panel",defaultSize:75,minSize:55,$isResizing:n,children:d.jsx(kg,{})}),d.jsx(jf,{direction:"vertical",onDragging:r}),d.jsx(Ep,{id:"content-panel",defaultSize:30,minSize:o,...e,$isResizing:n,children:d.jsx(k9,{isOverlayLayout:p})}),d.jsx(C9,{panel:t,isOverlayLayout:p})]})}):d.jsx(E9,{children:d.jsxs($9,{direction:"horizontal",autoSaveId:"replay-layout",children:[d.jsx(C9,{panel:t,isOverlayLayout:p}),d.jsx(Ep,{id:"content-panel",defaultSize:30,minSize:o,...e,$isResizing:n,children:d.jsx(k9,{isOverlayLayout:p})}),d.jsx(jf,{direction:"vertical",onDragging:r}),d.jsx(Ep,{id:"main-panel",defaultSize:70,minSize:Pnt,$isResizing:n,children:d.jsx(kg,{})}),h&&d.jsxs(d.Fragment,{children:[d.jsx(jf,{direction:"vertical",onDragging:r}),d.jsx(Ep,{...O,id:"ai-panel",defaultSize:a?Cnt:0,collapsedSize:0,minSize:Tnt,maxSize:50,$isResizing:n,onCollapse:()=>{m?.(),c()},onExpand:()=>{g?.(),l()},children:d.jsx(x.Suspense,{fallback:null,children:d.jsx(wnt,{})})})]})]})})}const $9=T.default(RO)`
7173
+ `;function E9({children:t}){const e=Vh(),{sendEvent:n}=et(),{tabsParams:r}=cw(e,!1),[i,s]=x.useState(r[0]?.key||null),o=x.useCallback(l=>{s(l),n("com.redocly.tab.change",[{...ye("tab","sidePanelTab"),source:"side_panel",name:l}])},[n]),a={tabsParams:r,activeTab:i,onTabChange:o};return d.jsx(dee.Provider,{value:a,children:t})}function xnt(){const[t,e]=x.useState(()=>{const n=document.documentElement.clientWidth;return I9(n)});return x.useEffect(()=>{const n=()=>{const r=document.documentElement.clientWidth;e(I9(r))};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t}function I9(t){return t>=1512?24:t>=1280?28:t>=1024?32:35}const Snt={isOpen:!1,openPanel:()=>{},closePanel:()=>{}},hee=x.createContext(Snt);function pee(){return x.useContext(hee)}const wnt=x.lazy(()=>Promise.resolve().then(()=>require("./replay-AiPanel-J_LTAvrH.js")).then(t=>({default:t.AiPanel}))),Tnt=20,Cnt=25,Pnt=40;function knt({panel:t,panelProps:e}){const[n,r]=x.useState(!1),{layout:i,aiEnabled:s}=Wn(),o=xnt(),{isOpen:a,openPanel:l,closePanel:c}=pee(),{panelProps:u,panel:f}=VS(!a),h=s===!0,p=i==="overlay",{onCollapse:m,onExpand:g,...O}=u;return x.useEffect(()=>{a&&f.isCollapsed&&f.expand(),!a&&!f.isCollapsed&&f.collapse()},[f,a]),i==="preview"?d.jsx(kg,{hideTabs:!0}):p?d.jsx(E9,{children:d.jsxs($9,{direction:"horizontal",autoSaveId:"replay-layout-overlay",children:[d.jsx(Ep,{id:"main-panel",defaultSize:75,minSize:55,$isResizing:n,children:d.jsx(kg,{})}),d.jsx(jf,{direction:"vertical",onDragging:r}),d.jsx(Ep,{id:"content-panel",defaultSize:30,minSize:o,...e,$isResizing:n,children:d.jsx(k9,{isOverlayLayout:p})}),d.jsx(C9,{panel:t,isOverlayLayout:p})]})}):d.jsx(E9,{children:d.jsxs($9,{direction:"horizontal",autoSaveId:"replay-layout",children:[d.jsx(C9,{panel:t,isOverlayLayout:p}),d.jsx(Ep,{id:"content-panel",defaultSize:30,minSize:o,...e,$isResizing:n,children:d.jsx(k9,{isOverlayLayout:p})}),d.jsx(jf,{direction:"vertical",onDragging:r}),d.jsx(Ep,{id:"main-panel",defaultSize:70,minSize:Pnt,$isResizing:n,children:d.jsx(kg,{})}),h&&d.jsxs(d.Fragment,{children:[d.jsx(jf,{direction:"vertical",onDragging:r}),d.jsx(Ep,{...O,id:"ai-panel",defaultSize:a?Cnt:0,collapsedSize:0,minSize:Tnt,maxSize:50,$isResizing:n,onCollapse:()=>{m?.(),c()},onExpand:()=>{g?.(),l()},children:d.jsx(x.Suspense,{fallback:null,children:d.jsx(wnt,{})})})]})]})})}const $9=T.default(RO)`
7174
7174
  padding: 0 var(--spacing-xs);
7175
7175
  `,Ep=T.default(Zu)`
7176
7176
  transition-property: ${t=>t.$isResizing?"none":"flex-grow"};
@@ -7180,7 +7180,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
7180
7180
  @media (prefers-reduced-motion: reduce) {
7181
7181
  transition-duration: 0s;
7182
7182
  }
7183
- `,Ent=x.lazy(()=>Promise.resolve().then(()=>require("./replay-AiChatProvider-DpL4VGOi.js")).then(t=>({default:t.AiChatProvider}))),Int=({className:t,renderProjectSelect:e})=>{const{isMobile:n,closeButton:r}=ao(),i=VS(!1),{layout:s,aiEnabled:o}=Wn(),a=vY(),l=s==="preview",c=o===!0,u=a?d.jsx(ont,{error:a}):null,f=n?u||d.jsx(Ytt,{}):d.jsxs(d.Fragment,{children:[!l&&d.jsx(tKe,{}),u||d.jsx(knt,{panel:i.panel,panelProps:i.panelProps})]});return d.jsxs(d.Fragment,{children:[!n&&!l&&r,d.jsxs(Ant,{className:t,isPreviewLayout:l,children:[d.jsx(LK,{onError:h=>console.error(h),children:d.jsx(int,{children:d.jsx(snt,{renderProjectSelect:e,children:c?d.jsx(x.Suspense,{fallback:null,children:d.jsx(Ent,{children:f})}):f})})}),d.jsx(XK,{})]})]})};function gee({className:t,renderProjectSelect:e}){return d.jsx(Int,{className:t,renderProjectSelect:e})}function $nt({className:t,renderProjectSelect:e}){return d.jsx(uee,{children:d.jsx(gee,{className:t,renderProjectSelect:e})})}const Ant=T.default.div`
7183
+ `,Ent=x.lazy(()=>Promise.resolve().then(()=>require("./replay-AiChatProvider-DiP6ztPt.js")).then(t=>({default:t.AiChatProvider}))),Int=({className:t,renderProjectSelect:e})=>{const{isMobile:n,closeButton:r}=ao(),i=VS(!1),{layout:s,aiEnabled:o}=Wn(),a=vY(),l=s==="preview",c=o===!0,u=a?d.jsx(ont,{error:a}):null,f=n?u||d.jsx(Ytt,{}):d.jsxs(d.Fragment,{children:[!l&&d.jsx(tKe,{}),u||d.jsx(knt,{panel:i.panel,panelProps:i.panelProps})]});return d.jsxs(d.Fragment,{children:[!n&&!l&&r,d.jsxs(Ant,{className:t,isPreviewLayout:l,children:[d.jsx(LK,{onError:h=>console.error(h),children:d.jsx(int,{children:d.jsx(snt,{renderProjectSelect:e,children:c?d.jsx(x.Suspense,{fallback:null,children:d.jsx(Ent,{children:f})}):f})})}),d.jsx(XK,{})]})]})};function gee({className:t,renderProjectSelect:e}){return d.jsx(Int,{className:t,renderProjectSelect:e})}function $nt({className:t,renderProjectSelect:e}){return d.jsx(uee,{children:d.jsx(gee,{className:t,renderProjectSelect:e})})}const Ant=T.default.div`
7184
7184
  display: flex;
7185
7185
  flex-direction: column;
7186
7186
  height: 100vh;
@@ -7216,4 +7216,4 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
7216
7216
  @media (max-width: ${fi}px) {
7217
7217
  width: 100vw;
7218
7218
  }
7219
- `;async function Fnt(t,e,n,r){const{validateApiKey:i}=await Promise.resolve().then(()=>require("./replay-validate-key-BFMbrrwB.js"));return i(t,e,n,r)}async function Wnt(){return(await Promise.resolve().then(()=>require("./replay-agent-loop-DNUWb1DF.js"))).AgentLoop}RJe();exports.AI_PROVIDERS=dY;exports.AiChatContext=hY;exports.AiChatServiceFactory=fI;exports.AiPanelContext=hee;exports.Builder=Ts;exports.CriterionType=Xr;exports.DEFAULT_ENVIRONMENTS=cA;exports.DEFAULT_MAX_RETRIES=OQe;exports.DEFAULT_MAX_STEPS=mQe;exports.Divider=dt;exports.EmbeddedReplay=BJe;exports.GRANT_TYPE_MAP=WIe;exports.GraphQLError=be;exports.ItemState=zt;exports.JsonPointerLib=fm;exports.MAX_OUTPUT_TOKENS_FOR_VALIDATION=yQe;exports.Markdown=VH;exports.Modal=no;exports.OAUTH2_SECURITY=hE;exports.PathUtils=sn;exports.REDOCLY_CONFIG_FILE_NAMES=p_e;exports.REPLAY_CHANGE_PREVIEW_SNAPSHOT_KEY=xQe;exports.REPLAY_ENVIRONMENTS_SECTION_PATH=v_e;exports.REPLAY_MESSAGE_METADATA_NS=bQe;exports.REQUEST_METHODS=Th;exports.REUNITE_AI_PROVIDER=$Q;exports.REUNITE_MODEL_OPTION=EE;exports.Replay=znt;exports.ReplayOverlay=Unt;exports.RootStorage=_G;exports.SECRET_MASK=SR;exports.SecurityFlows=ae;exports.SecurityTypes=ne;exports.Source=VI;exports.SourceType=qi;exports.StyledSpinner=JA;exports.TAB_NAMES=it;exports.TOOL_CALL_MESSAGES_TO_KEEP=vQe;exports.TabDataType=Xe;exports.TabState=Qn;exports.TelemetryClient=NB;exports.TextContentType=Hn;exports.VerticalDivider=Be;exports.activeEnvironmentIdAtom=Io;exports.activeTabAtom=EI;exports.activeTabIdxAtom=ms;exports.aiChatKeys=KK;exports.apiUrlToApiId=VY;exports.apisAtom=_s;exports.applyThemeToDOM=sze;exports.bgRed=Dye;exports.blue=_ye;exports.bold=Eye;exports.buildASTSchema=AX;exports.bytesToHex=Nm;exports.clearNotificationsForSource=V0;exports.cloneObject=Ra;exports.collectionsAtom=Co;exports.context=$a;exports.createResource=ye;exports.createTabFromOperation=IQ;exports.dayjs=VO;exports.defaultAiChatContextValue=fY;exports.dim=Iye;exports.dirname=rY;exports.environmentsAtom=si;exports.evaluateRuntimeExpression=Ic;exports.evaluateRuntimeExpressionPayload=pg;exports.exists=CQ;exports.extname=iY;exports.fetch=Ao;exports.findCollection=ah;exports.findStep=vO;exports.findWorkflow=OO;exports.getAPIKeyLocation=XY;exports.getActiveTab=tz;exports.getActiveTabIndex=Lte;exports.getApiOperationFromStore=OS;exports.getCurrentTheme=BS;exports.getDefaultExportFromCjs=Rl;exports.getEmptyCriterionObject=b6;exports.getEmptyRequestParameter=E0;exports.getEmptySingleSecurity=oo;exports.getLocation=cb;exports.getNewCollection=rR;exports.getNewStep=ja;exports.getNewWorkflow=OQ;exports.getOperationsList=D6;exports.getSelectedEnvironment=cd;exports.getStepFailures=E6e;exports.getStepForActiveStepTab=I$e;exports.getStepMethod=Ac;exports.getStepUrl=Fu;exports.getValueFromContext=um;exports.getWorkflowRunVerdict=WR;exports.gray=Nye;exports.green=Qye;exports.hasAllStepPassed=FR;exports.inverse=Aye;exports.invoke=kn;exports.invoke$1=Gt;exports.isAbsolute=sY;exports.isAbsoluteUrl=DB;exports.isInlineRequestParameter=uO;exports.isPlainObject=Rh;exports.isRedoclyConfigFile=m_e;exports.isReservedEnvironmentFileKey=$c;exports.isStepTab=E$e;exports.isTabType=Tn;exports.isTauriApp=Rn;exports.isWebUrl=zs;exports.join=PQ;exports.loadAgentLoop=Wnt;exports.loadAndBundleDefinition=R0;exports.makeProviderRecord=SQe;exports.makeRequest=HH;exports.markdownParserMarked=MH;exports.maskSecretsInText=Bh;exports.md5=KS;exports.mergeUrlParametersWithPreviousParameters=hA;exports.mkdir=Z6;exports.module=o7;exports.parse=Ph;exports.path=Ck;exports.pathBrowserifyExports=nc;exports.readDir=B6;exports.readTextFile=TQ;exports.red=yi;exports.remove=G6;exports.removeCollection=ZB;exports.removeStep=cE;exports.removeWorkflow=lE;exports.rename=H6;exports.reportParseError=M0;exports.requireFastDeepEqual=l7;exports.resolve=nY;exports.resolvePath=Bye;exports.resolveTheme=ize;exports.resolveWorkflowReference=f7;exports.sep=tY;exports.sha256=BH;exports.stringToQueryParameters=bO;exports.tabStepUidsMatch=$$e;exports.tabsAtom=Zr;exports.toCompactJson=d$e;exports.trace=hs;exports.transformCallback=pAe;exports.transformCallback$1=F6;exports.tty=a7;exports.ulid=xm;exports.underline=$ye;exports.updateCollection=Xi;exports.updateStep=cS;exports.updateTabDataAt=zte;exports.updateTabDataById=Xte;exports.updateWorkflow=Ns;exports.useActiveTab=Ql;exports.useAiChatContext=wO;exports.useAiPanel=pee;exports.useApiOperationGetter=vQ;exports.useApis=qo;exports.useAtomValue=Ir;exports.useCollectionActions=ud;exports.useCollections=mi;exports.useRunWorkflow=wK;exports.useSettings=pi;exports.useSettingsContext=Wn;exports.useStore=Do;exports.useTabHandlers=hr;exports.useTelemetry=et;exports.useTelemetryClient=TEe;exports.validateApiKey=Fnt;exports.validateEnvironmentName=s_;exports.validateSchema=YI;exports.visit=kh;exports.visitInParallel=zI;exports.white=jye;exports.writeTextFile=J6;exports.yaml=Qc;exports.yellow=Rye;
7219
+ `;async function Fnt(t,e,n,r){const{validateApiKey:i}=await Promise.resolve().then(()=>require("./replay-validate-key-Btx97_od.js"));return i(t,e,n,r)}async function Wnt(){return(await Promise.resolve().then(()=>require("./replay-agent-loop-CSkpuh-a.js"))).AgentLoop}RJe();exports.AI_PROVIDERS=dY;exports.AiChatContext=hY;exports.AiChatServiceFactory=fI;exports.AiPanelContext=hee;exports.Builder=Ts;exports.CriterionType=Xr;exports.DEFAULT_ENVIRONMENTS=cA;exports.DEFAULT_MAX_RETRIES=OQe;exports.DEFAULT_MAX_STEPS=mQe;exports.Divider=dt;exports.EmbeddedReplay=BJe;exports.GRANT_TYPE_MAP=WIe;exports.GraphQLError=be;exports.ItemState=zt;exports.JsonPointerLib=fm;exports.MAX_OUTPUT_TOKENS_FOR_VALIDATION=yQe;exports.Markdown=VH;exports.Modal=no;exports.OAUTH2_SECURITY=hE;exports.PathUtils=sn;exports.REDOCLY_CONFIG_FILE_NAMES=p_e;exports.REPLAY_CHANGE_PREVIEW_SNAPSHOT_KEY=xQe;exports.REPLAY_ENVIRONMENTS_SECTION_PATH=v_e;exports.REPLAY_MESSAGE_METADATA_NS=bQe;exports.REQUEST_METHODS=Th;exports.REUNITE_AI_PROVIDER=$Q;exports.REUNITE_MODEL_OPTION=EE;exports.Replay=znt;exports.ReplayOverlay=Unt;exports.RootStorage=_G;exports.SECRET_MASK=SR;exports.SecurityFlows=ae;exports.SecurityTypes=ne;exports.Source=VI;exports.SourceType=qi;exports.StyledSpinner=JA;exports.TAB_NAMES=it;exports.TOOL_CALL_MESSAGES_TO_KEEP=vQe;exports.TabDataType=Xe;exports.TabState=Qn;exports.TelemetryClient=NB;exports.TextContentType=Hn;exports.VerticalDivider=Be;exports.activeEnvironmentIdAtom=Io;exports.activeTabAtom=EI;exports.activeTabIdxAtom=ms;exports.aiChatKeys=KK;exports.apiUrlToApiId=VY;exports.apisAtom=_s;exports.applyThemeToDOM=sze;exports.bgRed=Dye;exports.blue=_ye;exports.bold=Eye;exports.buildASTSchema=AX;exports.bytesToHex=Nm;exports.clearNotificationsForSource=V0;exports.cloneObject=Ra;exports.collectionsAtom=Co;exports.context=$a;exports.createResource=ye;exports.createTabFromOperation=IQ;exports.dayjs=VO;exports.defaultAiChatContextValue=fY;exports.dim=Iye;exports.dirname=rY;exports.environmentsAtom=si;exports.evaluateRuntimeExpression=Ic;exports.evaluateRuntimeExpressionPayload=pg;exports.exists=CQ;exports.extname=iY;exports.fetch=Ao;exports.findCollection=ah;exports.findStep=vO;exports.findWorkflow=OO;exports.getAPIKeyLocation=XY;exports.getActiveTab=tz;exports.getActiveTabIndex=Lte;exports.getApiOperationFromStore=OS;exports.getCurrentTheme=BS;exports.getDefaultExportFromCjs=Rl;exports.getEmptyCriterionObject=b6;exports.getEmptyRequestParameter=E0;exports.getEmptySingleSecurity=oo;exports.getLocation=cb;exports.getNewCollection=rR;exports.getNewStep=ja;exports.getNewWorkflow=OQ;exports.getOperationsList=D6;exports.getSelectedEnvironment=cd;exports.getStepFailures=E6e;exports.getStepForActiveStepTab=I$e;exports.getStepMethod=Ac;exports.getStepUrl=Fu;exports.getValueFromContext=um;exports.getWorkflowRunVerdict=WR;exports.gray=Nye;exports.green=Qye;exports.hasAllStepPassed=FR;exports.inverse=Aye;exports.invoke=kn;exports.invoke$1=Gt;exports.isAbsolute=sY;exports.isAbsoluteUrl=DB;exports.isInlineRequestParameter=uO;exports.isPlainObject=Rh;exports.isRedoclyConfigFile=m_e;exports.isReservedEnvironmentFileKey=$c;exports.isStepTab=E$e;exports.isTabType=Tn;exports.isTauriApp=Rn;exports.isWebUrl=zs;exports.join=PQ;exports.loadAgentLoop=Wnt;exports.loadAndBundleDefinition=R0;exports.makeProviderRecord=SQe;exports.makeRequest=HH;exports.markdownParserMarked=MH;exports.maskSecretsInText=Bh;exports.md5=KS;exports.mergeUrlParametersWithPreviousParameters=hA;exports.mkdir=Z6;exports.module=o7;exports.parse=Ph;exports.path=Ck;exports.pathBrowserifyExports=nc;exports.readDir=B6;exports.readTextFile=TQ;exports.red=yi;exports.remove=G6;exports.removeCollection=ZB;exports.removeStep=cE;exports.removeWorkflow=lE;exports.rename=H6;exports.reportParseError=M0;exports.requireFastDeepEqual=l7;exports.resolve=nY;exports.resolvePath=Bye;exports.resolveTheme=ize;exports.resolveWorkflowReference=f7;exports.sep=tY;exports.sha256=BH;exports.stringToQueryParameters=bO;exports.tabStepUidsMatch=$$e;exports.tabsAtom=Zr;exports.toCompactJson=d$e;exports.trace=hs;exports.transformCallback=pAe;exports.transformCallback$1=F6;exports.tty=a7;exports.ulid=xm;exports.underline=$ye;exports.updateCollection=Xi;exports.updateStep=cS;exports.updateTabDataAt=zte;exports.updateTabDataById=Xte;exports.updateWorkflow=Ns;exports.useActiveTab=Ql;exports.useAiChatContext=wO;exports.useAiPanel=pee;exports.useApiOperationGetter=vQ;exports.useApis=qo;exports.useAtomValue=Ir;exports.useCollectionActions=ud;exports.useCollections=mi;exports.useRunWorkflow=wK;exports.useSettings=pi;exports.useSettingsContext=Wn;exports.useStore=Do;exports.useTabHandlers=hr;exports.useTelemetry=et;exports.useTelemetryClient=TEe;exports.validateApiKey=Fnt;exports.validateEnvironmentName=s_;exports.validateSchema=YI;exports.visit=kh;exports.visitInParallel=zI;exports.white=jye;exports.writeTextFile=J6;exports.yaml=Qc;exports.yellow=Rye;