@redocly/replay 0.30.0-next.1 → 0.30.0-next.2

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 (59) hide show
  1. package/dist/{replay-AiChatProvider-BY1M1rCj.js → replay-AiChatProvider-0MlUvuGe.js} +6 -6
  2. package/dist/{replay-AiChatProvider-DBLnNCF8.js → replay-AiChatProvider-B2P9I5ug.js} +1 -1
  3. package/dist/{replay-AiChatSqliteDBStorage-BW2-RW_n.js → replay-AiChatSqliteDBStorage-B6euQ3b3.js} +1 -1
  4. package/dist/{replay-AiChatSqliteDBStorage-B978zufl.js → replay-AiChatSqliteDBStorage-DN3HPpIj.js} +1 -1
  5. package/dist/{replay-AiPanel-Cc1hhJJ-.js → replay-AiPanel-B1UfwbH9.js} +4 -4
  6. package/dist/{replay-AiPanel-8K1Nn8fs.js → replay-AiPanel-DLwB7Rrw.js} +1 -1
  7. package/dist/{replay-FileWatcher-DpvlfPhp.js → replay-FileWatcher-BezlpQyJ.js} +1 -1
  8. package/dist/{replay-FileWatcher-mQb0WIRZ.js → replay-FileWatcher-CVKLX2eZ.js} +2 -2
  9. package/dist/{replay-SemanticSearchService-Q083tFCJ.js → replay-SemanticSearchService-BLyt9-0h.js} +1 -1
  10. package/dist/{replay-SemanticSearchService-D4-a07SY.js → replay-SemanticSearchService-ZR8AVcxo.js} +1 -1
  11. package/dist/{replay-SqliteDBStorage-CGB2CnXm.js → replay-SqliteDBStorage-B0H2-Lz2.js} +1 -1
  12. package/dist/{replay-SqliteDBStorage-BdEDqBaQ.js → replay-SqliteDBStorage-DHHzPb7X.js} +1 -1
  13. package/dist/{replay-TauriFileSystemAdapter-BlpeI6I1.js → replay-TauriFileSystemAdapter-COpUfLCW.js} +1 -1
  14. package/dist/{replay-TauriFileSystemAdapter-DrnMzlvI.js → replay-TauriFileSystemAdapter-CkaGV5Gd.js} +1 -1
  15. package/dist/{replay-TauriRootStorage-PRPSPxCM.js → replay-TauriRootStorage-BkeH9lMX.js} +1 -1
  16. package/dist/{replay-TauriRootStorage-CY9J7SvB.js → replay-TauriRootStorage-CnE5o2PW.js} +2 -2
  17. package/dist/{replay-agent-loop-DUaYektB.js → replay-agent-loop-D5KhxDSr.js} +3 -3
  18. package/dist/{replay-agent-loop-DOsYsIM_.js → replay-agent-loop-Z0kCw9Qe.js} +1 -1
  19. package/dist/{replay-ai-chat-mappers-BS6gpCNe.js → replay-ai-chat-mappers-C0-fByZi.js} +1 -1
  20. package/dist/{replay-ai-chat-mappers-DawVbG8E.js → replay-ai-chat-mappers-DWTYtRox.js} +1 -1
  21. package/dist/{replay-create-model-CS4PGJpF.js → replay-create-model-Ct4zmmz0.js} +3 -3
  22. package/dist/{replay-create-model-D9OW8YQ7.js → replay-create-model-DF1ANReX.js} +3 -3
  23. package/dist/{replay-db-YMhgrG6n.js → replay-db-DC9n1TUO.js} +1 -1
  24. package/dist/{replay-db-BPQqGDf6.js → replay-db-z-hahA_U.js} +1 -1
  25. package/dist/{replay-external-resolver-BuY7tjwA.js → replay-external-resolver-DKDcfTBb.js} +1 -1
  26. package/dist/{replay-external-resolver-C8RUKQAF.js → replay-external-resolver-zilF6Y7i.js} +2 -2
  27. package/dist/{replay-index-D01cQRy8.js → replay-index-AdklFuB4.js} +5 -5
  28. package/dist/{replay-index-j2-k1BLA.js → replay-index-BG6d2dGi.js} +1 -1
  29. package/dist/{replay-index-BYt60V1u.js → replay-index-Bd9z2h9g.js} +1 -1
  30. package/dist/{replay-index-DuaHxlY6.js → replay-index-CJwhVhXZ.js} +1 -1
  31. package/dist/{replay-index-DajpN2Kv.js → replay-index-CbF5pwt2.js} +1 -1
  32. package/dist/{replay-index-UCGdLDWp.js → replay-index-D4p_CBhN.js} +1 -1
  33. package/dist/{replay-index-BEVJgOvG.js → replay-index-DHAWtsCb.js} +1 -1
  34. package/dist/{replay-index-CR-63S4F.js → replay-index-DVkfkNqt.js} +16 -16
  35. package/dist/{replay-index-B1ISf2Pd.js → replay-index-DXD-sXPY.js} +1 -1
  36. package/dist/replay-index-Snh4Z-N1.js +4 -0
  37. package/dist/{replay-index-CUoi3zH7.js → replay-index-hKq2X34E.js} +1 -1
  38. package/dist/{replay-index-BrETb_LJ.js → replay-index-lU_aszzK.js} +27 -27
  39. package/dist/{replay-lint-C1ehvXFt.js → replay-lint-BPlv1-Rm.js} +5 -4
  40. package/dist/{replay-lint-BHA72Tm6.js → replay-lint-BpueGyWj.js} +4 -4
  41. package/dist/{replay-lint-graphql-Dujr-fEy.js → replay-lint-graphql-C0_JMlpO.js} +1 -1
  42. package/dist/{replay-lint-graphql-ClVK-Q9m.js → replay-lint-graphql-pK-1R8VS.js} +2 -2
  43. package/dist/{replay-periodic-revalidation-DWUDnmI5.js → replay-periodic-revalidation-Bu_KusjB.js} +1 -1
  44. package/dist/{replay-periodic-revalidation-CQucebne.js → replay-periodic-revalidation-DIONsjKq.js} +1 -1
  45. package/dist/{replay-resolve-DQkGMS79.js → replay-resolve-D5HsOgyB.js} +1 -1
  46. package/dist/{replay-resolve-lOnMmrS0.js → replay-resolve-DDmWLwbh.js} +1 -1
  47. package/dist/{replay-respect-run-VZCFofle.js → replay-respect-run-ClSyJINq.js} +1 -1
  48. package/dist/{replay-respect-run-CFRoqQim.js → replay-respect-run-Dy7mWOei.js} +3 -3
  49. package/dist/{replay-tauri-path-DYdSowVf.js → replay-tauri-path-Dch_ayrN.js} +1 -1
  50. package/dist/{replay-tauri-path-DZEIwFxv.js → replay-tauri-path-rJ8_CtSa.js} +2 -2
  51. package/dist/{replay-useAiChatQueries-C7kgDcqd.js → replay-useAiChatQueries-CCBaQcYH.js} +4 -4
  52. package/dist/{replay-useAiChatQueries-Ad3LDWfS.js → replay-useAiChatQueries-DMTs6IZT.js} +1 -1
  53. package/dist/{replay-validate-key-Ck5j2ty0.js → replay-validate-key--x5qy2Rk.js} +2 -2
  54. package/dist/{replay-validate-key-BewHEjjp.js → replay-validate-key-DbIGv2l3.js} +1 -1
  55. package/dist/replay.cjs +1 -1
  56. package/dist/replay.d.ts +1 -1
  57. package/dist/replay.js +1 -1
  58. package/package.json +4 -4
  59. package/dist/replay-index-Dc7Zy4VK.js +0 -4
@@ -523,7 +523,7 @@ ${M}`,ie=Math.min(A.length,E);let le=0;for(;le<ie-1;le++){const ae=R(String(le),
523
523
  ${D}`,U.pop(),`[${H}]`}let F=Object.keys(A);const W=F.length;if(W===0)return"{}";if(I<U.length+1)return'"[Object]"';M+=N;const G=`,
524
524
  ${M}`;let ee="",ne="",q=Math.min(W,E);l(A)&&(ee+=c(A,G,E),F=F.slice(A.length),q-=A.length,ne=G),P&&(F=o(F,k)),U.push(A);for(let H=0;H<q;H++){const J=F[H],ie=R(J,A[J],U,N,M);ie!==void 0&&(ee+=`${ne}${s(J)}: ${ie}`,ne=G)}if(W>E){const H=W-E;ee+=`${ne}"...": "${m(H)} not stringified"`,ne=G}return ne!==""&&(ee=`
525
525
  ${M}${ee}
526
- ${D}`),U.pop(),`{${ee}}`}case"number":return isFinite(A)?String(A):y?y(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(A);default:return y?y(A):void 0}}function V(X,A,U){switch(typeof A){case"string":return s(A);case"object":{if(A===null)return"null";if(typeof A.toJSON=="function"){if(A=A.toJSON(X),typeof A!="object")return V(X,A,U);if(A===null)return"null"}if(U.indexOf(A)!==-1)return w;let N="";const M=A.length!==void 0;if(M&&Array.isArray(A)){if(A.length===0)return"[]";if(I<U.length+1)return'"[Array]"';U.push(A);const ee=Math.min(A.length,E);let ne=0;for(;ne<ee-1;ne++){const H=V(String(ne),A[ne],U);N+=H!==void 0?H:"null",N+=","}const q=V(String(ne),A[ne],U);if(N+=q!==void 0?q:"null",A.length-1>E){const H=A.length-E-1;N+=`,"... ${m(H)} not stringified"`}return U.pop(),`[${N}]`}let D=Object.keys(A);const F=D.length;if(F===0)return"{}";if(I<U.length+1)return'"[Object]"';let W="",G=Math.min(F,E);M&&l(A)&&(N+=c(A,",",E),D=D.slice(A.length),G-=A.length,W=","),P&&(D=o(D,k)),U.push(A);for(let ee=0;ee<G;ee++){const ne=D[ee],q=V(ne,A[ne],U);q!==void 0&&(N+=`${W}${s(ne)}:${q}`,W=",")}if(F>E){const ee=F-E;N+=`${W}"...":"${m(ee)} not stringified"`}return U.pop(),`{${N}}`}case"number":return isFinite(A)?String(A):y?y(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(A);default:return y?y(A):void 0}}function z(X,A,U){if(arguments.length>1){let N="";if(typeof U=="number"?N=" ".repeat(Math.min(U,10)):typeof U=="string"&&(N=U.slice(0,10)),A!=null){if(typeof A=="function")return Q("",{"":X},[],A,N,"");if(Array.isArray(A))return j("",X,[],g(A),N,"")}if(N.length!==0)return R("",X,[],N,"")}return V("",X,[])}return z}})(Vv,Vv.exports)),Vv.exports}var GEe=YEe();const HEe=jl(GEe),JEe=HEe.configure;class km{static maxErrorTextChars=4096;static stringify=JEe({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=km.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(km.toErrorEvent(e,n))}}class iQ{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new rQ,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 km(n=>{this.sendToOtelService({type:n.type,data:n.payload})}).enable())}withTracer(e){const n=new iQ;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 OCe({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=km.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)}sendParameterEditedMessage(e,n){this.send("com.redocly.parameter.edited",e,n)}}const cE=process.env.NODE_ENV==="development",rV=process.env.NODE_ENV==="production",KEe="0.30.0-next.1",eIe={version:KEe},tIe={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"urn:redocly:replay:app",origin:"replayUi"},iV="desktop";class s6{_client;_scopedClients=new Map;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new iQ}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(()=>({...tIe,...e,env:rV?"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||iV,s=r.enableErrorInstrumentation??i==="desktop",o={serviceName:"replay",serviceVersion:eIe.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:rV,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||iV;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}));cE&&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 cE&&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 A0=new s6;function Ke(){const{telemetry:t}=Fn(),e=A0.getScopedClient(t),n=t?.cloudEventData;return b.useEffect(()=>{n&&A0.setCloudEventData(n)},[n]),e}const nIe=({awaitInit:t=!0}={})=>{const[e,n]=b.useState(void 0);return b.useEffect(()=>{(async()=>{const i=t?await A0.awaitInit():A0;n(i)})()},[t]),e};function o6(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function uE(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function a6(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function Qn(){return!!window?.__TAURI__}function ye(t,e,n="ui"){let r=`urn:redocly:replay:${n}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!Qn()&&(r=a6(window.location.href)),{object:t,id:e,uri:r}}const fi=800,ws=T.default(be.Button).attrs({variant:"text",size:"small",tone:"danger"})`
526
+ ${D}`),U.pop(),`{${ee}}`}case"number":return isFinite(A)?String(A):y?y(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(A);default:return y?y(A):void 0}}function V(X,A,U){switch(typeof A){case"string":return s(A);case"object":{if(A===null)return"null";if(typeof A.toJSON=="function"){if(A=A.toJSON(X),typeof A!="object")return V(X,A,U);if(A===null)return"null"}if(U.indexOf(A)!==-1)return w;let N="";const M=A.length!==void 0;if(M&&Array.isArray(A)){if(A.length===0)return"[]";if(I<U.length+1)return'"[Array]"';U.push(A);const ee=Math.min(A.length,E);let ne=0;for(;ne<ee-1;ne++){const H=V(String(ne),A[ne],U);N+=H!==void 0?H:"null",N+=","}const q=V(String(ne),A[ne],U);if(N+=q!==void 0?q:"null",A.length-1>E){const H=A.length-E-1;N+=`,"... ${m(H)} not stringified"`}return U.pop(),`[${N}]`}let D=Object.keys(A);const F=D.length;if(F===0)return"{}";if(I<U.length+1)return'"[Object]"';let W="",G=Math.min(F,E);M&&l(A)&&(N+=c(A,",",E),D=D.slice(A.length),G-=A.length,W=","),P&&(D=o(D,k)),U.push(A);for(let ee=0;ee<G;ee++){const ne=D[ee],q=V(ne,A[ne],U);q!==void 0&&(N+=`${W}${s(ne)}:${q}`,W=",")}if(F>E){const ee=F-E;N+=`${W}"...":"${m(ee)} not stringified"`}return U.pop(),`{${N}}`}case"number":return isFinite(A)?String(A):y?y(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(A);default:return y?y(A):void 0}}function z(X,A,U){if(arguments.length>1){let N="";if(typeof U=="number"?N=" ".repeat(Math.min(U,10)):typeof U=="string"&&(N=U.slice(0,10)),A!=null){if(typeof A=="function")return Q("",{"":X},[],A,N,"");if(Array.isArray(A))return j("",X,[],g(A),N,"")}if(N.length!==0)return R("",X,[],N,"")}return V("",X,[])}return z}})(Vv,Vv.exports)),Vv.exports}var GEe=YEe();const HEe=jl(GEe),JEe=HEe.configure;class km{static maxErrorTextChars=4096;static stringify=JEe({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=km.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(km.toErrorEvent(e,n))}}class iQ{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new rQ,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 km(n=>{this.sendToOtelService({type:n.type,data:n.payload})}).enable())}withTracer(e){const n=new iQ;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 OCe({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=km.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)}sendParameterEditedMessage(e,n){this.send("com.redocly.parameter.edited",e,n)}}const cE=process.env.NODE_ENV==="development",rV=process.env.NODE_ENV==="production",KEe="0.30.0-next.2",eIe={version:KEe},tIe={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"urn:redocly:replay:app",origin:"replayUi"},iV="desktop";class s6{_client;_scopedClients=new Map;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new iQ}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(()=>({...tIe,...e,env:rV?"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||iV,s=r.enableErrorInstrumentation??i==="desktop",o={serviceName:"replay",serviceVersion:eIe.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:rV,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||iV;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}));cE&&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 cE&&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 A0=new s6;function Ke(){const{telemetry:t}=Fn(),e=A0.getScopedClient(t),n=t?.cloudEventData;return b.useEffect(()=>{n&&A0.setCloudEventData(n)},[n]),e}const nIe=({awaitInit:t=!0}={})=>{const[e,n]=b.useState(void 0);return b.useEffect(()=>{(async()=>{const i=t?await A0.awaitInit():A0;n(i)})()},[t]),e};function o6(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function uE(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function a6(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function Qn(){return!!window?.__TAURI__}function ye(t,e,n="ui"){let r=`urn:redocly:replay:${n}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!Qn()&&(r=a6(window.location.href)),{object:t,id:e,uri:r}}const fi=800,ws=T.default(be.Button).attrs({variant:"text",size:"small",tone:"danger"})`
527
527
  border: none;
528
528
  margin: 0;
529
529
 
@@ -780,10 +780,10 @@ ${D}`),U.pop(),`{${ee}}`}case"number":return isFinite(A)?String(A):y?y(A):"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=hQ(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(d=>d.name===l),u=t.slice(i,c?o:a);if(i=a,c){n.add(l);const d=_n(c.value,e,n);return n.delete(l),[u.length?u:null,d||t.slice(o,a)]}return[u.length?u:null]});return t.slice(i).length&&s.push(t.slice(i)),s.join("")};function EIe(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function IIe(t,e){const n=p6(t);if(!n.length)return f.jsx(aV,{children:t});let r=0;const i=n.flatMap(({start:s,end:o})=>{const a=t.slice(r,s),l=EIe(t.slice(s,o),e);return r=o,[a.length?a:null,l]});return t.slice(r).length&&i.push(t.slice(r)),f.jsx(aV,{children:i.join("")})}const Po=Rl(Dr([]));Po.debugLabel="collections";function mi(){return Ir(Po)}function pS(){const t=Mo();return b.useCallback(()=>t.get(Po),[t])}function yO(t){const e=mi();return ph(e,t)}function Xc(t){const e=mi();return bO(e,t)}function qa(){const t=xl(Po);return b.useCallback(e=>t(n=>e(n)),[t])}function $Ie(t){const e=qa();return b.useCallback(n=>e(r=>Ui(r,t,n)),[e,t])}function g6(t){const e=qa(),{collectionId:n,workflowId:r}=t;return b.useCallback(i=>e(s=>Ds(s,{collectionId:n,workflowId:r},i)),[e,n,r])}function AIe(t){const e=qa(),{collectionId:n,workflowId:r,stepId:i}=t;return b.useCallback(s=>e(o=>gS(o,{collectionId:n,workflowId:r,stepId:i},s)),[e,n,r,i])}function ph(t,e){return t.find(n=>n.id===e)??null}function bO(t,{collectionId:e,workflowId:n}){return ph(t,e)?.workflows.find(i=>i.workflowId===n)??null}function xO(t,{collectionId:e,workflowId:n,stepId:r}){return bO(t,{collectionId:e,workflowId:n})?.steps.find(s=>s.stepId===r)??null}function Ui(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 Ds(t,{collectionId:e,workflowId:n},r){return Ui(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 gS(t,{collectionId:e,workflowId:n,stepId:r},i){return Ds(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 m6(t,e){const n=t.findIndex(r=>r.id===e);return n===-1?t:t.filter((r,i)=>i!==n)}function hE(t,{collectionId:e,workflowId:n}){return Ui(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 pE(t,{collectionId:e,workflowId:n,stepId:r}){return Ds(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 QIe{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 Em{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-BdEDqBaQ.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 mS={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t};function xu(t){if(t!==void 0)try{return JSON.parse(JSON.stringify(t))}catch{return}}function RIe(t,e){if(typeof t!="string"||t===""||!(!e||/json/i.test(e)))return t;try{return JSON.parse(t)}catch{return t}}function _Ie(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:RIe(t.body,n),header:e,contentType:n,time:t.duration}}async function pQ(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(()=>Mbe);for(const{key:i,value:s,active:o}of t)if(!(!i||!s||!o))try{n[i]=r(s,e,mS)}catch{}return n}function jIe(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:xu(i?.request)??null,response:xu(i?.response)??null,outputs:xu(i?.outputs)??{}}))}let O6=0;const gE=new Set;function NIe(){O6+=1;for(const t of gE)t()}function DIe(){return O6}function MIe(t){return gE.add(t),()=>{gE.delete(t)}}const VIe=10080*60*1e3;async function gQ(t){const e=Ao.getInstance();if(e&&!(!t.collectionId||!t.workflowId||!t.stepId))try{await e.upsert({id:uh(),date:Date.now(),...t}),NIe()}catch(n){console.error("Failed to persist step context:",n)}}async function LIe(t,e,n){if(Ao.getInstance())for(const i of jIe(n,e))await gQ({collectionId:t,workflowId:e,...i})}class Ao{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=Em.getInstance(),i=new n(r);this.instance=new QIe(i)}static getInstance(){return this.instance}static close(){this.instance=null}}const zIe={__replayClearedOutput:!0};function v6(t){return typeof t=="object"&&t!==null&&t.__replayClearedOutput===!0}async function y6(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 pQ(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))v6(i[o])&&delete i[o];n[r.stepId]={request:r.request??void 0,response:r.response??void 0,outputs:i}}return n}function b6(t){if(t!==void 0)return typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t)}const XIe=/\{\$steps\.[^}\s]+\}|^\$steps\.[^}\s]+$/g;function mQ(t){const e=new RegExp(XIe),n=[];let r;for(;(r=e.exec(t))!==null;)n.push({start:r.index,end:r.index+r[0].length});return n}const UIe=/^\{?\$steps\.([^.{}\s]+)\.(outputs|request|response)\.([^{}\s#]+)(?:#\/([^{}\s]*))?\}?$/;function x6(t){const e=UIe.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 qIe(t,e){const n=FIe.exec(t);if(!n)return;const[,r,i,s,o]=n;if(!!r!=!!o)return;let a;try{a=Ac(`${r}${i}${o}`,{$steps:e},mS)}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 b6(l)}function S6(t,e){if(!t||!t.includes("$steps"))return t;const n=mQ(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=qIe(s,e);if(c!==void 0)l=c;else try{const u=b6(Ac(s,{$steps:e},mS));u!==void 0&&(l=u)}catch{}i.push(l),r=a}return i.push(t.slice(r)),i.join("")}function w6(t,e,n){const r=bO(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 pQ([e],{$response:t.response,$request:t.request??void 0});return e.key in n?{hasValue:!0,value:n[e.key]}:{hasValue:!1}}async function WIe(t,e){if(!e)return!1;const n=t.outputs?.[e.key];if(n===void 0||v6(n))return!1;const r=await T6(t,e);return r.hasValue?JSON.stringify(r.value)!==JSON.stringify(n):!1}async function ZIe(t,e){return e?(await T6(t,e)).hasValue:!1}const BIe=/\$steps\.([^.\s"'}]+)\./g;function YIe(t){if(!t||!t.includes("$steps."))return[];const e=new Set;for(const n of t.matchAll(BIe))e.add(n[1]);return[...e]}function OQ(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 YIe(i.join("\0"))}async function OS(t,e,n,r){const i=Ao.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 y6(o,w6(t,e,n)):{}}function Qf(t,e,n){return S6(_n(t,e),n)}const GIe=/[\n\r\t]/g;function C6(t){return t.replace(GIe,"").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?"":C6(String(n.example));return{id:crypto.randomUUID(),key:n.name,value:i,active:r||i!=="",in:n.in,...n.allowReserved&&{allowReserved:n.allowReserved}}})}function SO(t,e){const[n]=t.split("?"),r=e.filter(i=>i.active).map(i=>`${i.key}=${i.value}`).join("&");return`${n}${r?`?${r}`:""}`}function wO(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 P6(){return{id:crypto.randomUUID(),...pO}}function HIe(){return{id:crypto.randomUUID(),...pO,description:""}}function R0(t){return{...pO,id:crypto.randomUUID(),in:t}}function JIe(){return{id:crypto.randomUUID(),...pO,type:"text",files:null}}function KIe(){return{id:crypto.randomUUID(),...pO,sendIn:di.URL}}function B1(t){return t.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function vS(t,e){return t.filter(n=>n.active&&n.value).map(({value:n})=>(e?_n(n,e):n).trim())}function yc(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 e$e(t,e,n){return t.map(({value:r,...i})=>({...i,value:Qf(r,e,n??{})}))}function t$e(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(ku(r)){const i=t$e(r.reference,e);i&&n.push({...i,active:r.active,value:r.value||i.value})}else n.push(r);return n}function sc(t){return Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:n}))}class _0{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(":"),d=a.substring(0,u).trim(),h=a.substring(u+1).trim();["first","last","odd","even"].includes(h)||/^nth\(\d+\)$/.test(h)?(l=d,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 n$e{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 k6{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new n$e(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 d=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:d,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 E6(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function I6(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function gh(t){return String(t).replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const $6=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",r$e=$6+"\\-\\.\\d·̀-ͯ‿-⁀",A6=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",i$e=A6+"\\-\\.\\d·̀-ͯ҇‿-⁀",Q6=(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)}},s$e=Q6($6,r$e),o$e=Q6(A6,i$e,"u"),a$e=(t="1.0")=>t==="1.1"?o$e:s$e,R6=(t,{xmlVersion:e="1.0"}={})=>a$e(e).qName.test(t),l$e=`
783
+ `,_n=(t,e,n=new Set)=>{const r=hQ(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(d=>d.name===l),u=t.slice(i,c?o:a);if(i=a,c){n.add(l);const d=_n(c.value,e,n);return n.delete(l),[u.length?u:null,d||t.slice(o,a)]}return[u.length?u:null]});return t.slice(i).length&&s.push(t.slice(i)),s.join("")};function EIe(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function IIe(t,e){const n=p6(t);if(!n.length)return f.jsx(aV,{children:t});let r=0;const i=n.flatMap(({start:s,end:o})=>{const a=t.slice(r,s),l=EIe(t.slice(s,o),e);return r=o,[a.length?a:null,l]});return t.slice(r).length&&i.push(t.slice(r)),f.jsx(aV,{children:i.join("")})}const Po=Rl(Dr([]));Po.debugLabel="collections";function mi(){return Ir(Po)}function pS(){const t=Mo();return b.useCallback(()=>t.get(Po),[t])}function yO(t){const e=mi();return ph(e,t)}function Xc(t){const e=mi();return bO(e,t)}function qa(){const t=xl(Po);return b.useCallback(e=>t(n=>e(n)),[t])}function $Ie(t){const e=qa();return b.useCallback(n=>e(r=>Ui(r,t,n)),[e,t])}function g6(t){const e=qa(),{collectionId:n,workflowId:r}=t;return b.useCallback(i=>e(s=>Ds(s,{collectionId:n,workflowId:r},i)),[e,n,r])}function AIe(t){const e=qa(),{collectionId:n,workflowId:r,stepId:i}=t;return b.useCallback(s=>e(o=>gS(o,{collectionId:n,workflowId:r,stepId:i},s)),[e,n,r,i])}function ph(t,e){return t.find(n=>n.id===e)??null}function bO(t,{collectionId:e,workflowId:n}){return ph(t,e)?.workflows.find(i=>i.workflowId===n)??null}function xO(t,{collectionId:e,workflowId:n,stepId:r}){return bO(t,{collectionId:e,workflowId:n})?.steps.find(s=>s.stepId===r)??null}function Ui(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 Ds(t,{collectionId:e,workflowId:n},r){return Ui(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 gS(t,{collectionId:e,workflowId:n,stepId:r},i){return Ds(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 m6(t,e){const n=t.findIndex(r=>r.id===e);return n===-1?t:t.filter((r,i)=>i!==n)}function hE(t,{collectionId:e,workflowId:n}){return Ui(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 pE(t,{collectionId:e,workflowId:n,stepId:r}){return Ds(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 QIe{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 Em{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-DHHzPb7X.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 mS={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t};function xu(t){if(t!==void 0)try{return JSON.parse(JSON.stringify(t))}catch{return}}function RIe(t,e){if(typeof t!="string"||t===""||!(!e||/json/i.test(e)))return t;try{return JSON.parse(t)}catch{return t}}function _Ie(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:RIe(t.body,n),header:e,contentType:n,time:t.duration}}async function pQ(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(()=>Mbe);for(const{key:i,value:s,active:o}of t)if(!(!i||!s||!o))try{n[i]=r(s,e,mS)}catch{}return n}function jIe(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:xu(i?.request)??null,response:xu(i?.response)??null,outputs:xu(i?.outputs)??{}}))}let O6=0;const gE=new Set;function NIe(){O6+=1;for(const t of gE)t()}function DIe(){return O6}function MIe(t){return gE.add(t),()=>{gE.delete(t)}}const VIe=10080*60*1e3;async function gQ(t){const e=Ao.getInstance();if(e&&!(!t.collectionId||!t.workflowId||!t.stepId))try{await e.upsert({id:uh(),date:Date.now(),...t}),NIe()}catch(n){console.error("Failed to persist step context:",n)}}async function LIe(t,e,n){if(Ao.getInstance())for(const i of jIe(n,e))await gQ({collectionId:t,workflowId:e,...i})}class Ao{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=Em.getInstance(),i=new n(r);this.instance=new QIe(i)}static getInstance(){return this.instance}static close(){this.instance=null}}const zIe={__replayClearedOutput:!0};function v6(t){return typeof t=="object"&&t!==null&&t.__replayClearedOutput===!0}async function y6(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 pQ(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))v6(i[o])&&delete i[o];n[r.stepId]={request:r.request??void 0,response:r.response??void 0,outputs:i}}return n}function b6(t){if(t!==void 0)return typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t)}const XIe=/\{\$steps\.[^}\s]+\}|^\$steps\.[^}\s]+$/g;function mQ(t){const e=new RegExp(XIe),n=[];let r;for(;(r=e.exec(t))!==null;)n.push({start:r.index,end:r.index+r[0].length});return n}const UIe=/^\{?\$steps\.([^.{}\s]+)\.(outputs|request|response)\.([^{}\s#]+)(?:#\/([^{}\s]*))?\}?$/;function x6(t){const e=UIe.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 qIe(t,e){const n=FIe.exec(t);if(!n)return;const[,r,i,s,o]=n;if(!!r!=!!o)return;let a;try{a=Ac(`${r}${i}${o}`,{$steps:e},mS)}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 b6(l)}function S6(t,e){if(!t||!t.includes("$steps"))return t;const n=mQ(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=qIe(s,e);if(c!==void 0)l=c;else try{const u=b6(Ac(s,{$steps:e},mS));u!==void 0&&(l=u)}catch{}i.push(l),r=a}return i.push(t.slice(r)),i.join("")}function w6(t,e,n){const r=bO(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 pQ([e],{$response:t.response,$request:t.request??void 0});return e.key in n?{hasValue:!0,value:n[e.key]}:{hasValue:!1}}async function WIe(t,e){if(!e)return!1;const n=t.outputs?.[e.key];if(n===void 0||v6(n))return!1;const r=await T6(t,e);return r.hasValue?JSON.stringify(r.value)!==JSON.stringify(n):!1}async function ZIe(t,e){return e?(await T6(t,e)).hasValue:!1}const BIe=/\$steps\.([^.\s"'}]+)\./g;function YIe(t){if(!t||!t.includes("$steps."))return[];const e=new Set;for(const n of t.matchAll(BIe))e.add(n[1]);return[...e]}function OQ(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 YIe(i.join("\0"))}async function OS(t,e,n,r){const i=Ao.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 y6(o,w6(t,e,n)):{}}function Qf(t,e,n){return S6(_n(t,e),n)}const GIe=/[\n\r\t]/g;function C6(t){return t.replace(GIe,"").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?"":C6(String(n.example));return{id:crypto.randomUUID(),key:n.name,value:i,active:r||i!=="",in:n.in,...n.allowReserved&&{allowReserved:n.allowReserved}}})}function SO(t,e){const[n]=t.split("?"),r=e.filter(i=>i.active).map(i=>`${i.key}=${i.value}`).join("&");return`${n}${r?`?${r}`:""}`}function wO(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 P6(){return{id:crypto.randomUUID(),...pO}}function HIe(){return{id:crypto.randomUUID(),...pO,description:""}}function R0(t){return{...pO,id:crypto.randomUUID(),in:t}}function JIe(){return{id:crypto.randomUUID(),...pO,type:"text",files:null}}function KIe(){return{id:crypto.randomUUID(),...pO,sendIn:di.URL}}function B1(t){return t.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function vS(t,e){return t.filter(n=>n.active&&n.value).map(({value:n})=>(e?_n(n,e):n).trim())}function yc(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 e$e(t,e,n){return t.map(({value:r,...i})=>({...i,value:Qf(r,e,n??{})}))}function t$e(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(ku(r)){const i=t$e(r.reference,e);i&&n.push({...i,active:r.active,value:r.value||i.value})}else n.push(r);return n}function sc(t){return Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:n}))}class _0{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(":"),d=a.substring(0,u).trim(),h=a.substring(u+1).trim();["first","last","odd","even"].includes(h)||/^nth\(\d+\)$/.test(h)?(l=d,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 n$e{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 k6{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new n$e(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 d=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:d,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 E6(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function I6(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function gh(t){return String(t).replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const $6=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",r$e=$6+"\\-\\.\\d·̀-ͯ‿-⁀",A6=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",i$e=A6+"\\-\\.\\d·̀-ͯ҇‿-⁀",Q6=(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)}},s$e=Q6($6,r$e),o$e=Q6(A6,i$e,"u"),a$e=(t="1.0")=>t==="1.1"?o$e:s$e,R6=(t,{xmlVersion:e="1.0"}={})=>a$e(e).qName.test(t),l$e=`
784
784
  `;function c$e(t,e){if(!Array.isArray(t)||t.length===0)return"1.0";const n=t[0];if(vQ(n)==="?xml"){const i=n[":@"];if(i){const s=e.attributeNamePrefix+"version";if(i[s])return i[s]}}return"1.0"}function _6(t,e,n,r,i){return!n.sanitizeName||R6(t,{xmlVersion:i})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}function u$e(t,e){let n="";e.format&&(n=l$e);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 _0(a)):a instanceof _0&&r.push(a)}const i=c$e(t,e),s=new k6;return j6(t,e,n,s,r,i)}function j6(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=mE(l,e),l}return""}for(let l=0;l<t.length;l++){const c=t[l],u=vQ(c);if(u===void 0)continue;const h=u===e.textNodeName||u===e.cdataPropName||u===e.commentPropName||u[0]==="?"?u:_6(u,!1,e,r,s),p=d$e(c[":@"],e);r.push(h,p);const m=h$e(r,i);if(h===e.textNodeName){let y=c[u];m||(y=e.tagValueProcessor(h,y),y=mE(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=I6(y);o+=`<![CDATA[${w}]]>`,a=!1,r.pop();continue}else if(h===e.commentPropName){const y=c[u][0][e.textNodeName],w=E6(y);o+=n+`<!--${w}-->`,a=!0,r.pop();continue}else if(h[0]==="?"){const y=lV(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=lV(c[":@"],e,m,r,s),v=n+`<${h}${O}`;let x;m?x=N6(c[u],e):x=j6(c[u],e,g,r,i,s),e.unpairedTags.indexOf(h)!==-1?e.suppressUnpairedNode?o+=v+">":o+=v+"/>":(!x||x.length===0)&&e.suppressEmptyNode?o+=v+"/>":x&&x.endsWith(">")?o+=v+`>${x}${n}</${h}>`:(o+=v+">",x&&n!==""&&(x.includes("/>")||x.includes("</"))?o+=n+e.indentBy+x+n:o+=x,o+=`</${h}>`),a=!0,r.pop()}return o}function d$e(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]=gh(t[i]),r=!0}return r?n:null}function N6(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=vQ(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=f$e(i[":@"],e),a=N6(i[s],e);!a||a.length===0?n+=`<${s}${o}/>`:n+=`<${s}${o}>${a}</${s}>`}}}return n}function f$e(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)}="${gh(i)}"`}return n}function vQ(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 lV(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:_6(a,!0,e,r,i);let c;n?c=t[o]:(c=e.attributeValueProcessor(o,t[o]),c=mE(c,e)),c===!0&&e.suppressBooleanAttributes?s+=` ${l}`:s+=` ${l}="${gh(c)}"`}return s}function h$e(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 mE(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 p$e(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 g$e={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 Hi(t){if(this.options=Object.assign({},g$e,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 _0(n)):n instanceof _0&&this.stopNodeExpressions.push(n)}this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=p$e(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=y$e),this.processTextOrObjNode=O$e,this.options.format?(this.indentate=v$e,this.tagEndChar=`>
785
785
  `,this.newLine=`
786
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function m$e(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 Y1(t,e,n,r,i){return!n.sanitizeName||R6(t,{xmlVersion:i})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}Hi.prototype.build=function(t){if(this.options.preserveOrder)return u$e(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new k6,n=m$e(t,this.options);return this.j2x(t,0,e,n).val}};Hi.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:Y1(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 d=this.isAttribute(l);if(d&&!this.ignoreAttributesFn(d,o)){const h=Y1(d,!0,this.options,n,r);i+=this.buildAttrPairStr(h,""+t[l],a)}else if(!d)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 d=t[l].length;let h="",p="";for(let m=0;m<d;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 d=Object.keys(t[l]),h=d.length;for(let p=0;p<h;p++){const m=Y1(d[p],!0,this.options,n,r);i+=this.buildAttrPairStr(m,""+t[l][d[p]],a)}}else s+=this.processTextOrObjNode(t[l],u,e,n,r)}return{attrStr:i,val:s}};Hi.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+'="'+gh(e)+'"'};function O$e(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)}Hi.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]=gh(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]=gh(t[r]),n=!0)}return n?e:null};Hi.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};Hi.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};Hi.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}};Hi.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};Hi.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};Hi.prototype.buildTextValNode=function(t,e,n,r,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName){const s=I6(t);return this.indentate(r)+`<![CDATA[${s}]]>`+this.newLine}else if(this.options.commentPropName!==!1&&e===this.options.commentPropName){const s=E6(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}}};Hi.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 v$e(t){return this.options.indentBy.repeat(t)}function y$e(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}function D6(t){return t.schema}function M6(t){return D6(t)?.fields??[]}function V6(t,e){return t.flatMap(n=>{const r=D6(n),i=r?.fields||[];return i.length>0?i.flatMap(s=>cV(s.name,s.example,n.allowReserved)):cV(n.name,r?.example??n.example,n.allowReserved)})}function cV(t,e,n){if(e===void 0)return[G1(t,"",!1,n)];const r=OE(e,t);return r.length===0?[G1(t,"",!1,n)]:r.map(i=>G1(i.key,i.value,!0,n))}function OE(t,e){return t===void 0?[]:t===null?[{key:e,value:""}]:Array.isArray(t)?t.flatMap((n,r)=>n!==null&&typeof n=="object"?OE(n,`${e}[${r}]`):[{key:e,value:String(n)}]):b$e(t)?Object.entries(t).flatMap(([n,r])=>OE(r,`${e}[${n}]`)):[{key:e,value:String(t)}]}function b$e(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function G1(t,e,n,r){return{id:crypto.randomUUID(),key:t,value:C6(e),active:n,in:"query",...r&&{allowReserved:r}}}const L6={path:"path",query:"query",header:"headers",cookie:"cookie"};function yQ(t){return t!==void 0}function x$e(t,e){if(t)return lx.isDirectConfigureRequestValues(t)?t:t[e]}function uV(t,e,n){const r=n[L6[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 Rf(t,e,n){if(lx.isDirectConfigureRequestValues(n))return uV(t,e,n);const r=new Set;for(const i of Object.values(n))if(i)for(const s of uV(t,e,i))r.add(s);return r}function dV(t,e,n){const r=n.query,i=n.envVariables;for(const s of e??[]){const o=M6(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 z6(t,e,n){const r=[...t??[],...e??[]],i=new Set(Rf(r,"query",n));if(lx.isDirectConfigureRequestValues(n))return dV(i,e,n),i;for(const s of Object.values(n))s&&dV(i,e,s);return i}function bQ(t=[],e){const n={};return t.forEach(r=>{const i=String(r[e]);n[i]||(n[i]=[]),n[i].push(r)}),n}function S$e(t){return t.replace(/{/g,"{{").replace(/}/g,"}}")}var ms=(t=>(t.Query="Query",t.Header="Header",t.Cookie="Cookie",t))(ms||{});const vE={documentedOAuth2Types:[],grantType:oe.ClientCredentials,authRequestExtraParams:[],tokenRequestExtraParams:[],[oe.ClientCredentials]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[],accessToken:""},[oe.ClientCredentialsWithJwtAssertion]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[],accessToken:""},[oe.AuthorizationCode]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],codeVerifier:"",codeChallenge:"",accessToken:""},[oe.AuthorizationCodeWithPkce]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],codeVerifier:"",codeChallenge:"",accessToken:""},[oe.Implicit]:{clientId:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],accessToken:""},[oe.Password]:{username:"",password:"",clientId:"",clientSecret:"",tokenUrl:"",accessToken:"",scopes:[]}},w$e={securityType:te.NoAuth,securitySchemeId:null,[te.BasicAuth]:{username:"",password:""},[te.JWT]:{token:""},[te.DigestAuth]:{username:"",password:"",nc:"00000001",realm:"",nonce:"",opaque:"",qop:"",algorithm:"",cnonce:""},[te.APIKey]:{location:ms.Header,name:"",key:""},[te.OAuth2]:vE,[te.OpenIDConnect]:{...vE,openIdConnectUrl:"",userInfoUrl:""}},T$e={clientCredentials:oe.ClientCredentials,clientCredentialsWithJwtAssertion:oe.ClientCredentialsWithJwtAssertion,authorizationCode:oe.AuthorizationCode,authorizationCodeWithPkce:oe.AuthorizationCodeWithPkce,implicit:oe.Implicit,password:oe.Password},j0="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 C$e={[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 mh(){return structuredClone({type:Hn.Text,content:"",activeExampleName:"",formData:{"multipart/form-data":[],"application/x-www-form-urlencoded":[]},binary:null})}const P$e={method:"GET",url:"",security:[ao()],body:mh(),queryParameters:[],headers:[],cookies:[],pathParameters:[]};function X6(){return structuredClone(P$e)}function ao(){return _a(w$e)}function U6(t){return _a({id:crypto.randomUUID(),...C$e[t]})}const k$e=new Hi({cdataPropName:"#cdata"}),E$e=/^[^\\/]+\.[a-z0-9]{1,5}$/i,F6=/^text\/|json|xml|x-www-form-urlencoded/i,I$e=new Set(["$ref","allOf"]);function $$e(t,e,n,r){const i=Qa(r)?r:void 0,s=R$e(i,t);return n&&z$e(n)?Q$e(t,e,n,s,i):A$e(t,e,n,s,i)}function A$e(t,e,n,r,i){const s=W6(r,e,i),o=(n?.contentType??"").split(",").map(h=>h.trim()).filter(Boolean),a=o.find(h=>!h.split(";")[0].includes("*")),l=a??o[0],c=Array.isArray(e)?e:[e],u=c.filter(h=>L$e(h,l)),d=B6(n);if(s.binary==="encoded"){const h=M$e(d,s.contentEncoding);return u.map(p=>({key:t,value:_f(p),file:!1,contentType:a??"application/octet-stream",headers:h}))}return Z6(s,c)||o.length>0&&!F6.test(o[0])?c.map(h=>{const p={key:t,value:_f(h),file:!0};return a&&(p.contentType=a),d&&(p.headers=d),p}):u.map(h=>{const p=o.length===0&&(Y6(h)||s.type==="object"||s.type==="array"||s.type===void 0&&typeof h=="string"&&G6(h)),m=a??(p?"application/json":void 0),g={key:t,value:X$e(h,l,s.xmlName??t),file:!1};return m&&(g.contentType=m),d&&(g.headers=d),g})}function Q$e(t,e,n,r,i){const s=n.style??"form",o=n.explode??s==="form",a=B6(n),l=(m,g)=>({key:m,value:_f(g),file:!1,...a&&{headers:a}}),c=V$e(e);if(c===void 0)return[];const u=Array.isArray(c)?c:[c],d=Z6(W6(r,c,i),u);if(Array.isArray(c)&&o&&s!=="deepObject")return c.map(m=>({...l(t,m),file:d}));if(!Y6(c))return[{...l(t,c),file:d}];const h=s==="spaceDelimited"?" ":s==="pipeDelimited"?"|":",";if(Array.isArray(c))return[l(t,c.map(_f).join(h))];const p=Object.entries(c);return s==="deepObject"?p.map(([m,g])=>l(`${t}[${m}]`,g)):o?p.map(([m,g])=>l(m,g)):[l(t,p.flatMap(([m,g])=>[m,_f(g)]).join(h))]}function R$e(t,e){return q6(xQ(t,t).members.map(n=>Qa(n.properties)?n.properties[e]:void 0))}function _$e(t,e){return q6(xQ(t,e).members.map(n=>n.items))}function q6(t){const e=t.filter(Qa);return e.length>1?{allOf:e}:e[0]}function W6(t,e,n){const r=fV(t,n);return Array.isArray(e)||r.type==="array"?fV(_$e(t,n),n):r}function Z6(t,e){return t.binary==="raw"||t.emptySchema===!0&&e.every(j$e)}function j$e(t){return t==null||t===""||typeof t=="string"&&E$e.test(t)}function fV(t,e){if(!t)return{};const{members:n,unresolved:r}=xQ(t,e),i=n.map(u=>D$e(u.type)).find(Boolean),s=n.map(u=>Qa(u.xml)?u.xml.name:void 0).find(u=>typeof u=="string"&&u!==""),o=n.map(u=>u.contentEncoding).find(u=>typeof u=="string")??(n.some(u=>u.format==="byte")?"base64":void 0);if(o&&o.toLowerCase()!=="binary")return{type:i,xmlName:s,binary:"encoded",contentEncoding:o};const a=n.map(u=>u.contentMediaType).find(u=>typeof u=="string"),l=o!==void 0||n.some(u=>u.format==="binary")||a!==void 0&&!F6.test(a),c=!r&&n.every(u=>Object.keys(u).every(d=>I$e.has(d)));return{type:i,xmlName:s,...l?{binary:"raw"}:c&&{emptySchema:!0}}}function xQ(t,e){const n=[];let r=!1;const i=s=>{if(!(!Qa(s)||n.includes(s))){if(n.push(s),typeof s.$ref=="string"){const o=N$e(e,s.$ref);o?i(o):r=!0}Array.isArray(s.allOf)&&s.allOf.forEach(i)}};return i(t),{members:n,unresolved:r}}function N$e(t,e){const n="#/components/schemas/";if(!e.startsWith(n))return;const r=Qa(t?.components)?t.components.schemas:void 0,i=Qa(r)?r[oh.unescape(e.slice(n.length))]:void 0;return Qa(i)?i:void 0}function D$e(t){return typeof t=="string"?t:Array.isArray(t)?t.find(e=>typeof e=="string"&&e!=="null"):void 0}function Qa(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function B6(t){const e=Object.entries(t?.headers??{});return e.length>0?Object.fromEntries(e):void 0}function M$e(t,e){const n=t??{};return Object.keys(n).some(r=>r.toLowerCase()==="content-transfer-encoding")?n:{...n,"Content-Transfer-Encoding":e}}function Y6(t){return typeof t=="object"&&t!==null}function V$e(t){const e=Array.isArray(t)?t.filter(Ry):Qa(t)?Object.fromEntries(Object.entries(t).filter(([,n])=>Ry(n))):t;return Ry(e)&&!(typeof e=="object"&&Object.keys(e).length===0)?e:void 0}function L$e(t,e){return Ry(t)||e!==void 0&&/json/i.test(e)}function Ry(t){return t!=null}function z$e(t){return t.style!==void 0||t.explode!==void 0||t.allowReserved!==void 0}function _f(t){return t==null?"":typeof t=="string"?t:JSON.stringify(t)}function X$e(t,e,n){return Qa(t)&&e&&/xml/i.test(e)?k$e.build({[n]:t}):e&&/json/i.test(e)?typeof t=="string"&&G6(t)?t:JSON.stringify(t)??"":_f(t)}function G6(t){try{const e=JSON.parse(t);return typeof e=="object"&&e!==null}catch{return!1}}function H6(t,e,n,r){if(!t||typeof t!="object")return[];const i=e===Ge.FormData;return Object.entries(t).flatMap(([s,o])=>$$e(s,o,n?.[s],r).map(a=>({id:crypto.randomUUID(),key:a.key,value:a.value,active:!0,type:i&&a.file?"file":"text",files:null,...i&&a.contentType&&{contentType:a.contentType},...i&&a.headers&&{headers:a.headers}})))}function yE(t){return typeof t!="string"?JSON.stringify(t,null,2):t}function J6(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 vl(t){const e=J6(t);return e?{query:e.query,variables:e.variables===void 0?"":yE(e.variables)}:{query:yE(t),variables:""}}function N0(t,e){return JSON.stringify({query:t,variables:e})}function K6(t){if(t.trim())try{const e=JSON.parse(t);return typeof e=="string"?t:e}catch{return t}}function U$e(t){const e=J6(t);return!e||typeof e.variables!="string"?t:JSON.stringify({...e,variables:K6(e.variables)},null,2)}function eY(t,e,n){for(const r of n){const i=hV(t,r),s=hV(e,r);if(typeof i=="object"&&typeof s=="object"){if(!eY(i,s,n))return!1}else if(i!==s)return!1}return!0}function hV(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 F$e(t,e){return t.length===e.length&&t.sort().join()===e.sort().join()}function q$e(t,e){return t.every(n=>e.includes(n))}function W$e(t){switch(t){case"query":return ms.Query;case"cookie":return ms.Cookie;case"header":return ms.Header;default:return}}function Z$e(t,e,n){const{security:r}=e,i=t?.inputs??[];if(!n)return!1;const s=yS(n),o=s.map(c=>c.securityType),a=r.map(c=>c.securityType);return F$e(o,a)?!r.every(c=>{const u=c.securityType,d=c[te.OAuth2]?.grantType,h=o.includes(u),p=s.find(v=>v.securityType===u),m=!p||eY(c,p,Y$e(u,d)),g=B$e(c,u,c[te.OAuth2]?.grantType,i),O=!!(h&&p&&m&&g);return!n.security?.length||O}):!0}function B$e(t,e,n,r){if(e===te.OAuth2&&(n===oe.AuthorizationCode||n===oe.AuthorizationCodeWithPkce||n===oe.Implicit)){const i=t[te.OAuth2][n]?.availableScopes,s=vS(t[te.OAuth2][n]?.scopes,r);return q$e(s,i)}return!0}function Y$e(t,e){return t===te.APIKey?[`${te.APIKey}/name`,`${te.APIKey}/location`]:t===te.OAuth2?[`${te.OAuth2}/grantType`,...G$e(e)]:t===te.OpenIDConnect?[`${te.OpenIDConnect}/openIdConnectUrl`]:[]}function G$e(t){return t===oe.ClientCredentials?[`${te.OAuth2}/${oe.ClientCredentials}/tokenUrl`]:t===oe.Password?[`${te.OAuth2}/${oe.Password}/tokenUrl`]:t===oe.Implicit?[`${te.OAuth2}/${oe.Implicit}/authorizationUrl`]:t===oe.AuthorizationCode?[`${te.OAuth2}/${oe.AuthorizationCode}/tokenUrl`,`${te.OAuth2}/${oe.AuthorizationCode}/authorizationUrl`]:t===oe.AuthorizationCodeWithPkce?[`${te.OAuth2}/${oe.AuthorizationCodeWithPkce}/tokenUrl`,`${te.OAuth2}/${oe.AuthorizationCodeWithPkce}/authorizationUrl`]:[]}function H$e(t){return t.map(e=>{const n=e.map(r=>r.id).join("_");return e.map(r=>({...r,schemeId:n}))})}function J$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(wQ(o))}),{id:i,security:s}});return e.length?n:[]}function K$e(t,e){const n=t.security||[];return n?.length?lY(n).map((r,i)=>wQ(r)):[]}function tY(t){if(!(t.securityType!==te.NoAuth||!t.securitySchemeId))return t.unsupportedScheme}function yS(t){const n=(t.security||[])[0];return n?n.map(r=>wQ(r)):[ao()]}const eAe={[te.OAuth2]:"oauth2",[te.OpenIDConnect]:"openIdConnect",[te.APIKey]:"apiKey",[te.JWT]:"http-bearer"};function tAe(t){return eAe[t]}function nAe(t){const e=SQ(t);return(e?[...cs(e)][0]:void 0)??rAe(t)}function rAe(t){const e=t.securitySchemeId;if(e){if(t.securityType===te.JWT)return e+rt.SecurityVariablesEnvSuffix.JWTToken;if(t.securityType===te.APIKey)return e+rt.SecurityVariablesEnvSuffix.APIKey;if(t.securityType===te.OAuth2||t.securityType===te.OpenIDConnect)return e+rt.SecurityVariablesEnvSuffix.Token}}function iAe(t,e){const n=SQ(t);if(!n)return"";const r=[...cs(n)][0];return r?e.find(i=>i.name===r)?.value??"":n}function pV(t,e){if(t.securityType===te.JWT)return{...t,[te.JWT]:{...t[te.JWT],token:e}};if(t.securityType===te.APIKey)return{...t,[te.APIKey]:{...t[te.APIKey],key:e}};if(t.securityType===te.OAuth2||t.securityType===te.OpenIDConnect){const n=t.securityType,r=t[n],i=r.grantType;return{...t,[n]:{...r,[i]:{...r[i],accessToken:e}}}}return t}function SQ(t){if(t.securityType===te.JWT)return t[te.JWT].token;if(t.securityType===te.APIKey)return t[te.APIKey].key;if(t.securityType===te.OAuth2){const e=t[te.OAuth2];return e[e.grantType]?.accessToken}if(t.securityType===te.OpenIDConnect){const e=t[te.OpenIDConnect];return e[e.grantType]?.accessToken}}function wQ(t,e){const n={...ao(),securitySchemeId:t.id},r=bS(t);n.securityType=r,n.unsupportedScheme=r===te.NoAuth?t.scheme||t.type:void 0;const i=t.id;if(t.id&&r!==te.NoAuth&&(n[r].schemeName=t.id),r===te.BasicAuth&&(n[te.BasicAuth].username||(n[te.BasicAuth].username=Nn(i+rt.SecurityVariablesEnvSuffix.Username)),n[te.BasicAuth].password||(n[te.BasicAuth].password=Nn(i+rt.SecurityVariablesEnvSuffix.Password))),r===te.DigestAuth&&(n[te.DigestAuth].username||(n[te.DigestAuth].username=Nn(i+rt.SecurityVariablesEnvSuffix.Username)),n[te.DigestAuth].password||(n[te.DigestAuth].password=Nn(i+rt.SecurityVariablesEnvSuffix.Password))),r===te.JWT&&!n[te.JWT].token&&(n[te.JWT].token=Nn(i+rt.SecurityVariablesEnvSuffix.JWTToken)),r===te.APIKey&&!n[te.APIKey].key){n[te.APIKey].name=t.name||"",n[te.APIKey].key=Nn(i+rt.SecurityVariablesEnvSuffix.APIKey);const s=W$e(t.in);s&&(n[te.APIKey].location=s)}if(r===te.OAuth2){const s=PQ(t),o=Nn(i+rt.SecurityVariablesEnvSuffix.Token),a=n[te.OAuth2];a.grantType=s[0],s.forEach(l=>{l===oe.AuthorizationCode&&!a[oe.AuthorizationCode].accessToken&&(a[oe.AuthorizationCode].accessToken=o,a[oe.AuthorizationCode].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.AuthorizationCode].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[oe.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[oe.AuthorizationCode].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[oe.AuthorizationCode].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[oe.AuthorizationCode].scopes=[...sc(t.flows?.authorizationCode?.scopes||{})||[]]),l===oe.AuthorizationCodeWithPkce&&!a[oe.AuthorizationCodeWithPkce].accessToken&&(a[oe.AuthorizationCodeWithPkce].accessToken=o,a[oe.AuthorizationCodeWithPkce].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.AuthorizationCodeWithPkce].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[oe.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[oe.AuthorizationCodeWithPkce].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[oe.AuthorizationCodeWithPkce].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[oe.AuthorizationCodeWithPkce].scopes=[...sc(t.flows?.authorizationCode?.scopes||{})]),l===oe.ClientCredentials&&!a[oe.ClientCredentials].accessToken&&(a[oe.ClientCredentials].accessToken=o,a[oe.ClientCredentials].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.ClientCredentials].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[oe.ClientCredentials].tokenUrl=t.flows?.clientCredentials?.tokenUrl||"",a[oe.ClientCredentials].scopes=[...sc(t.flows?.clientCredentials?.scopes||{})]),l===oe.ClientCredentialsWithJwtAssertion&&!a[oe.ClientCredentialsWithJwtAssertion].accessToken&&(a[oe.ClientCredentialsWithJwtAssertion].accessToken=o,a[oe.ClientCredentialsWithJwtAssertion].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.ClientCredentialsWithJwtAssertion].clientAssertion=Nn(i+rt.SecurityVariablesEnvSuffix.ClientAssertion),a[oe.ClientCredentialsWithJwtAssertion].scopes=[...sc(t.flows?.clientCredentials?.scopes||{})]),l===oe.Implicit&&!a[oe.Implicit].accessToken&&(a[oe.Implicit].accessToken=o,a[oe.Implicit].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.Implicit].authorizationUrl=t.flows?.implicit?.authorizationUrl||"",a[oe.Implicit].availableScopes=Object.keys(t.flows?.implicit?.scopes||{})||[],a[oe.Implicit].scopes=[...sc(t.flows?.implicit?.scopes||{})]),l===oe.Password&&!a[oe.Password].accessToken&&(a[oe.Password].accessToken=o,a[oe.Password].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.Password].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[oe.Password].tokenUrl=t.flows?.password?.tokenUrl||"",a[oe.Password].scopes=[...sc(t.flows?.password?.scopes||{})])})}if(r===te.OpenIDConnect){const s=Nn(i+rt.SecurityVariablesEnvSuffix.Token),o=n[te.OpenIDConnect];o[oe.AuthorizationCode].accessToken||(o[oe.AuthorizationCode].accessToken=s,o[oe.AuthorizationCode].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),o[oe.AuthorizationCode].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),o[oe.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),o[oe.AuthorizationCodeWithPkce].accessToken||(o[oe.AuthorizationCodeWithPkce].accessToken=s,o[oe.AuthorizationCodeWithPkce].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),o[oe.AuthorizationCodeWithPkce].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),o[oe.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),o[oe.Implicit].accessToken||(o[oe.Implicit].accessToken=s,o[oe.Implicit].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId))}return n}function TQ(t){try{const e=JSON.parse(t);return JSON.stringify(e,null,2)}catch(e){return console.error({error:e}),t}}function nY(t,e){return t==="application/json"&&!!e}function rY(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function sAe(t){try{const e=JSON.stringify(t);return e===void 0?"undefined":e}catch{return String(t)}}function iY(t,e){return e&&e.length>0?V6(e):va(t||[],{})}function oAe(t,e,n){if(e&&e.length>0){const r=V6(e);return aAe(r,n)}return va(t||[],{boundNames:n})}function aAe(t,e){return t.map(n=>!n.key||!e.has(n.key)?n:{...n,value:`$inputs.${n.key}`,active:!0})}function lAe(t,e=!1,n="",r){const i=bQ(t.parameters,"in"),s=sY(t),o=yS(t),a=iY(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:SO(S$e(t.path),a),headers:va(i.header||[],{}),queryParameters:a,cookies:va(i.cookie||[],{}),body:s,security:o},response:null}}function CQ(t,e){const n=bQ(t.parameters,"in"),r=sY(t),i=yS(t),s=va(n.path||[],{boundNames:"all"});return e?{parameters:{pathParameters:s,queryParameters:oAe(n.query,n.querystring,z6(n.query,n.querystring,e)),headers:va(n.header||[],{boundNames:Rf(n.header,"header",e)}),cookies:va(n.cookie||[],{boundNames:Rf(n.cookie,"cookie",e)})},requestBody:r,security:i}:{parameters:{pathParameters:s,queryParameters:iY(n.query,n.querystring),headers:va(n.header||[],{}),cookies:va(n.cookie||[],{})},requestBody:r,security:i}}function cAe(t,e){const n=new Hi({format:!0});if(typeof t=="string")return e?.includes("json")?TQ(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 uAe(t){return xA.includes(t)}function sY(t){const e=t.body?.mediaTypes;if(!e||!Object.keys(e).length)return mh();const n=pAe(e,t),r=n?.name||"",i=uAe(r),s=!i&&!J7.includes(r),o=bE(n),l=o.find(({key:d})=>d===t.body?.activeExampleName)?.value??o[0]?.value,c=s&&l?cAe(l,r):"",u={"multipart/form-data":gV(e["multipart/form-data"]),"application/x-www-form-urlencoded":gV(e["application/x-www-form-urlencoded"])};if(i&&l){const d=H6(l,r,n?.encoding,n?.schema);d.length&&(u[r]=d)}return{...mh(),activeExampleName:t.body?.activeExampleName||o[0]?.key||"",...n&&{type:n.name},content:c,formData:u}}const dAe={[Ge.GraphqlJSON]:"graphql"};function Zh(t,e){const n=dAe[t];return!n||e?.[n]===!0}function oY(t,e){return Zh(t,e)?hc[t]:void 0}function aY(t,e){const n=Object.fromEntries(Object.entries(hc).filter(([r])=>Zh(r,e)));return t?{...fAe(t),...n}:n}function fAe(t){return Object.keys(t.body?.mediaTypes||{}).reduce((e,n)=>(e[n]={name:n,extensions:void 0},e),{})}function gV(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 hAe="Untitled example";function bE(t){const e=t?.examples;return Object.keys(e||{}).map(n=>{const r=e?.[n];return{name:(Ch.isString(r?.summary)?r?.summary:r?.summary?.raw)?.trim()||n||hAe,key:n,value:e?.[n].value}})}function pAe(t,e){const n=aY(e),r=Object.keys(t).find(i=>!!n[i]);return r?t[r]:null}function gAe(t){return!t?.security?.length||!t?[]:K$e(t)}function lY(t){const e=new Set;return t.flat().filter(n=>e.has(n.id)?!1:(e.add(n.id),!0))}function bS(t){if(t.type==="http"){const e=t.scheme?.toLowerCase();if(e==="bearer")return te.JWT;if(e==="basic")return te.BasicAuth;if(e==="digest")return te.DigestAuth}else{if(t.type==="apiKey")return te.APIKey;if(t.type==="oauth2")return te.OAuth2;if(t.type==="openIdConnect")return te.OpenIDConnect}return te.NoAuth}function mAe(t,e){if(t==="clientCredentials"&&e&&"x-assertionType"in e&&e["x-assertionType"]===j0)return oe.ClientCredentialsWithJwtAssertion;if(t==="authorizationCode"&&e&&"x-usePkce"in e&&e["x-usePkce"])return oe.AuthorizationCodeWithPkce;switch(t){case"implicit":return oe.Implicit;case"password":return oe.Password;case"clientCredentials":return oe.ClientCredentials;case"authorizationCode":return oe.AuthorizationCode;default:return oe.AuthorizationCode}}function OAe(t,e){const n=t?.security;if(!n?.length)return[];const s=H$e(n).flat().filter(o=>o.schemeId===e).find(o=>bS(o)===te.OAuth2);return PQ(s)}function PQ(t){return Object.entries(t?.flows||{}).map(([e,n])=>mAe(e,n)).filter(Boolean)}function xS(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function Xs(t){try{return new URL(t),!0}catch{return!1}}function vAe(t,e){let n;if(e.startsWith("//")){const{protocol:r}=new URL(t);n=`${r||"https:"}${e}`}else if(o6(e))n=e;else if(!e.startsWith("/"))n=uE(t)+"/"+e;else{const r=new URL(t);r.pathname=e,n=r.toString()}return uE(n)}function mV(t,e){let n=t;return e.forEach(({key:r,value:i,active:s})=>{i&&s&&(n=n.replaceAll(`{${r}}`,i))}),n}function cY(t,e){let n=t;return e.forEach(({name:r,value:i})=>{i&&(n=n.replaceAll(`{${r}}`,i))}),n}function yAe(t){return t.startsWith("http://")||t.startsWith("https://")}function Lv({url:t,serverUrl:e,corsProxyUrl:n}){let r;if(yAe(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 uY="New Step";function xE({name:t=uY,workflow:e}={}){let n=t.replaceAll(" ","-");if(!e)return n;const r=bAe(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function bAe(t){return t.steps.filter(e=>e.state!==Xt.Draft).map(e=>e.stepId)}function Na({name:t=uY,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:s,dynamicReplayValues:o,xOperation:a}={}){if(!n){const l=s?CQ(s,o):null,c=[ao()];return{stepId:xE({name:t,workflow:r}),description:t,outputs:[],successCriteria:[],state:e?Xt.Draft:Xt.Normal,parameters:{pathParameters:[],queryParameters:a?wO(a.url):[],headers:[],cookies:[]},requestBody:mh(),xOperation:a??(i?null:{method:"GET",url:""}),security:c,operation:i??null,...l}}return{stepId:xE({name:t,workflow:r}),description:n.description,outputs:n.outputs,successCriteria:n.successCriteria,state:e?Xt.Draft:Xt.Normal,parameters:n.parameters,requestBody:n.requestBody,xOperation:n.xOperation,security:n.security,operation:n.operation}}function Rc(t){return t.xOperation?.method??t.operation?.method??""}function Wu(t){return t.xOperation?.url??t.operation?.path??""}function SE({operation:t,requestBody:e}){return t?t.path==="/"&&e.type===Ge.GraphqlJSON?"":t.path:""}function SS(t,e,n,r,i){const{inputs:s,servers:o}=r,a=e$e(yc("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="",d="";if(l)d=l.method,u=mV(l.url,a);else if(c){const m=o.find(O=>O.apiId===c.apiId);d=c.method==="x-query"?"query":c.method,u=(m?.value?cY(m.value,m.variables):"")+mV(SE(t),a)}const h=u.split("?")[0];return{url:Qf(h,s,i??{}),method:d.toUpperCase()}}function xAe(){return structuredClone({id:crypto.randomUUID(),state:An.Normal,data:{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Ue.Step,draftStep:Na(),response:null,activeTabIdx:0,requestError:null,isProcessingRequest:!1}})}function SAe(t){return t?.data?.type===Ue.Step}function wAe(t,e){const{collectionId:n,workflowId:r,stepId:i}=e,s=e.draftStep??null;return n&&r&&i?xO(t,{collectionId:n,workflowId:r,stepId:i})??s:s}function TAe(t,e,n,r,i,s){const o=a=>a??"";return o(t)===r&&o(e)===i&&o(n)===s}const wE="New workflow";function dY({name:t=wE,collection:e}){let r=(t.trim().replace(/[^a-zA-Z0-9\-_\s]/g,"").replace(/\s+/g," ")||wE).replaceAll(" ","-").toLowerCase();if(!e)return r;const i=CAe(e);if(i.includes(r)){let s=1;for(;i.includes(`${r}-${s}`);)s++;r=`${r}-${s}`}return r}function CAe(t){return t.workflows.filter(e=>e.state!==Xt.Draft).map(e=>e.workflowId)}function kQ({name:t=wE,isDraft:e=!1,collection:n}={}){return{workflowId:dY({name:t,collection:n}),summary:t,steps:[],state:e?Xt.Draft:Xt.Normal,outputs:[],parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},security:[ao()]}}function PAe(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 d of cs(u))r.add(d);return t.steps.forEach(u=>{const d=u.security;for(const x of d)switch(x.securityType){case te.BasicAuth:case te.DigestAuth:for(const y of[x[x.securityType].username,x[x.securityType].password])for(const w of cs(y))r.add(w);break;case te.JWT:for(const y of cs(x[x.securityType].token))r.add(y);break;case te.APIKey:for(const y of cs(x[x.securityType].key))r.add(y);break;case te.OAuth2:case te.OpenIDConnect:{const y=x[x.securityType];for(const w of cs(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:x}of[...Vn([...h,...p,...m,...g],i),...O])for(const y of cs(x))r.add(y);const v=u.requestBody;switch(v.type){case Ge.FormData:case Ge.UrlEncoded:{for(const{value:x}of v.formData[v.type])for(const y of cs(x))r.add(y);break}case Ge.Binary:break;case Ge.GraphqlJSON:{const{query:x,variables:y}=Zh(Ge.GraphqlJSON,n)?vl(v.content):{query:v.content,variables:""};for(const w of[x,y])for(const S of cs(w))r.add(S);break}default:for(const x of cs(v.content))r.add(x)}}),r}function fY(t,e,n,r,i){const s=PAe(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(d=>d.name===c)?.isSecret;return[c,u?{type:"string",format:"password"}:l[c]||{type:"string"}]}))}}})}function Bh(t){return t.summary||t.workflowId||"Untitled Workflow"}function hY(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 wS=(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,e.operationId)??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 TS(t){const e=qo(),{convertOperationToReplayValue:n}=Fn();return b.useMemo(()=>wS(e,t,n),[e,t,n])}function EQ(){const t=AA(),{convertOperationToReplayValue:e}=Fn();return{getApiOperation:b.useCallback(r=>wS(t(),r,e),[t,e])}}function pY(t){const e=(t.match(new RegExp("\\{(?<!\\{[^}]*?\\{)([^}]+)\\}","g"))||[]).map(n=>n.slice(1,-1));return Array.from(new Set(e))}function kAe(t){const e=t.servers?.[0];if(!e)return{url:"",variables:[]};const n=e.url,i=pY(n).map(s=>({name:s,value:e.variables?.[s]?.default||""}));return{url:n,variables:i}}function gY(){const t=AA(),e=oo();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}=kAe(i);e(a=>{let l=!1;const c=a.map(u=>u.servers.some(d=>d.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=Qn()?await Promise.resolve().then(()=>require("./replay-tauri-path-DYdSowVf.js")):{join:ic.join,resolve:ic.resolve,isAbsolute:ic.isAbsolute,relative:ic.relative,extname:ic.extname,dirname:ic.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 EAe({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 OV(t,e){return`${t}\0${e}`}function fd(){const t=pS(),e=qa(),n=AA(),{attachApiServerToEnvironments:r}=gY();async function i({collectionId:l,apiId:c}){const u=ph(t(),l);if(!u)return;if(!u.sourceDescriptions.some(h=>h.apiId===c)){const p=n().find(g=>g.id===c)?.info.title,m=Xs(c)?c:await sn.relative(`/${l}/..`,`/${c}`);e(g=>Ui(g,l,O=>O.sourceDescriptions.some(v=>v.apiId===c)?O:{...O,sourceDescriptions:[...O.sourceDescriptions,{name:EAe({apiName:p,sourceDescriptions:O.sourceDescriptions}),url:m,apiId:c}]}))}r(c)}function s(l){return ph(t(),l)}function o(l,c){e(u=>Ui(u,l,d=>({...d,sourceDescriptions:d.sourceDescriptions.filter(h=>c.name!==h.name)})))}function a(l,c){const u=new Set(c.map(d=>OV(d.workflowId??"",d.stepId)));e(d=>Ui(d,l,h=>{const p=h.workflows.map(m=>{const g=m.steps.map(O=>!u.has(OV(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 IAe{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 TE=(t,e)=>e.some(n=>t instanceof n);let vV,yV;function $Ae(){return vV||(vV=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function AAe(){return yV||(yV=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const CE=new WeakMap,H1=new WeakMap,CS=new WeakMap;function QAe(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(Iu(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return CS.set(e,t),e}function RAe(t){if(CE.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)});CE.set(t,e)}let PE={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return CE.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Iu(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 mY(t){PE=t(PE)}function _Ae(t){return AAe().includes(t)?function(...e){return t.apply(kE(this),e),Iu(this.request)}:function(...e){return Iu(t.apply(kE(this),e))}}function jAe(t){return typeof t=="function"?_Ae(t):(t instanceof IDBTransaction&&RAe(t),TE(t,$Ae())?new Proxy(t,PE):t)}function Iu(t){if(t instanceof IDBRequest)return QAe(t);if(H1.has(t))return H1.get(t);const e=jAe(t);return e!==t&&(H1.set(t,e),CS.set(e,t)),e}const kE=t=>CS.get(t);function NAe(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=Iu(o);return r&&o.addEventListener("upgradeneeded",l=>{r(Iu(o.result),l.oldVersion,l.newVersion,Iu(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 DAe=["get","getKey","getAll","getAllKeys","count"],MAe=["put","add","delete","clear"],J1=new Map;function bV(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(J1.get(e))return J1.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=MAe.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||DAe.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 J1.set(e,s),s}mY(t=>({...t,get:(e,n,r)=>bV(e,n)||t.get(e,n,r),has:(e,n)=>!!bV(e,n)||t.has(e,n)}));const VAe=["continue","continuePrimaryKey","advance"],xV={},EE=new WeakMap,OY=new WeakMap,LAe={get(t,e){if(!VAe.includes(e))return t[e];let n=xV[e];return n||(n=xV[e]=function(...r){EE.set(this,OY.get(this)[e](...r))}),n}};async function*zAe(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const n=new Proxy(e,LAe);for(OY.set(n,e),CS.set(n,kE(e));e;)yield n,e=await(EE.get(n)||e.continue()),EE.delete(n)}function SV(t,e){return e===Symbol.asyncIterator&&TE(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&TE(t,[IDBIndex,IDBObjectStore])}mY(t=>({...t,get(e,n,r){return SV(e,n)?zAe:t.get(e,n,r)},has(e,n){return SV(e,n)||t.has(e,n)}}));class IQ{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 IQ(e,n,r)}async initialize(){this.db||(this.db=await NAe(this.dbName,this.version,{upgrade:e=>{this.setupCallback(e)}}))}async close(){this.db&&(this.db.close(),this.db=null)}}const XAe=1;class $Q{constructor(e){this.indexedDB=e}indexedDB;static create(e){const n=`replay-history-${e}`,r=IQ.createInstance(n,XAe,this.setupDatabase);return new $Q(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 bc{static instance=null;static async initialize(e,n){this.close(),this.instance=await UAe(e,n)}static getInstance(){if(!this.instance)throw new Error("HistoryService not initialized");return this.instance}static close(){this.instance=null}}async function UAe(t,e){let n;if(e){const{HistorySqliteDBStorage:r}=await Promise.resolve().then(()=>require("./replay-HistorySqliteDBStorage-BrILW8Fu.js")),i=Em.getInstance();n=new r(i)}else n=$Q.create(t.id);return new IAe(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 FAe(t){return ki.useQuery({queryKey:ui.list(t),queryFn:async()=>bc.getInstance().getAll(t)})}function vY(){const t=ki.useQueryClient();return ki.useMutation({mutationFn:async e=>{await bc.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 qAe(){const t=ki.useQueryClient();return ki.useMutation({mutationFn:async e=>{await bc.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 WAe(){const t=ki.useQueryClient();return ki.useMutation({mutationFn:async()=>{await bc.getInstance().clear()},onSuccess:()=>{t.invalidateQueries({queryKey:ui.all})},onError:e=>{console.error("Failed to clear history:",e)}})}function ZAe(t){return t?{...t,bodyNotStored:!0,body:"",arrayBuffer:new ArrayBuffer(0)}:null}function BAe(){const t=vY();return b.useCallback(({step:e,response:n})=>{const r=ZAe(n),i={id:crypto.randomUUID(),date:Date.now(),type:"step",step:e,response:r,statusCode:n?.status??null};t.mutate(i)},[t])}function YAe(){const t=vY();return b.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 GAe(){const t=ki.useQueryClient();async function e(n){return t.ensureQueryData({queryKey:ui.detail(n),queryFn:()=>bc.getInstance().getById(n)})}return{getHistoryItem:e}}function yY(){const t=pS();return{getStep:n=>xO(t(),n)}}function HAe(t){const e=mi();return xO(e,{collectionId:t?.collectionId??null,workflowId:t?.workflowId??null,stepId:t?.stepId??null})??t?.draftStep??null}function bY(t,e){const n=t?.collectionId??null,r=t?.workflowId??null,i=t?.stepId??null,s=mi(),o=qa(),a=xO(s,{collectionId:n,workflowId:r,stepId:i});if(a)return{step:a,updateStep:c=>o(u=>gS(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 AQ(){const t=pS();return{getWorkflow:({collectionId:n,workflowId:r})=>bO(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 Jd(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 Kc,Is,Rd,zv,_y;const wV="__TAURI_TO_IPC_KEY__";function xY(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}class SY{constructor(e){Kc.set(this,void 0),Is.set(this,0),Rd.set(this,[]),zv.set(this,void 0),Jd(this,Kc,e||(()=>{})),this.id=xY(n=>{const r=n.index;if("end"in n){r==Vr(this,Is,"f")?this.cleanupCallback():Jd(this,zv,r);return}const i=n.message;if(r==Vr(this,Is,"f")){for(Vr(this,Kc,"f").call(this,i),Jd(this,Is,Vr(this,Is,"f")+1);Vr(this,Is,"f")in Vr(this,Rd,"f");){const s=Vr(this,Rd,"f")[Vr(this,Is,"f")];Vr(this,Kc,"f").call(this,s),delete Vr(this,Rd,"f")[Vr(this,Is,"f")],Jd(this,Is,Vr(this,Is,"f")+1)}Vr(this,Is,"f")===Vr(this,zv,"f")&&this.cleanupCallback()}else Vr(this,Rd,"f")[r]=i})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){Jd(this,Kc,e)}get onmessage(){return Vr(this,Kc,"f")}[(Kc=new WeakMap,Is=new WeakMap,Rd=new WeakMap,zv=new WeakMap,wV)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[wV]()}}async function Pn(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}class JAe{get rid(){return Vr(this,_y,"f")}constructor(e){_y.set(this,void 0),Jd(this,_y,e)}async close(){return Pn("plugin:resources|close",{rid:this.rid})}}_y=new WeakMap;var IE;(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"})(IE||(IE={}));var $E;(function(t){t[t.Start=0]="Start",t[t.Current=1]="Current",t[t.End=2]="End"})($E||($E={}));function QQ(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 RQ extends JAe{async read(e){if(e.byteLength===0)return 0;const[n,r]=await Pn("plugin:fs|read",{rid:this.rid,len:e.byteLength});return e.set(n),r===0?null:r}async seek(e,n){return await Pn("plugin:fs|seek",{rid:this.rid,offset:e,whence:n})}async stat(){const e=await Pn("plugin:fs|fstat",{rid:this.rid});return QQ(e)}async truncate(e){await Pn("plugin:fs|ftruncate",{rid:this.rid,len:e})}async write(e){return await Pn("plugin:fs|write",{rid:this.rid,data:e})}}async function KAe(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await Pn("plugin:fs|create",{path:t instanceof URL?t.toString():t,options:e});return new RQ(n)}async function eQe(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await Pn("plugin:fs|open",{path:t instanceof URL?t.toString():t,options:e});return new RQ(n)}async function tQe(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 Pn("plugin:fs|copy_file",{fromPath:t instanceof URL?t.toString():t,toPath:e instanceof URL?e.toString():e,options:n})}async function wY(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Pn("plugin:fs|mkdir",{path:t instanceof URL?t.toString():t,options:e})}async function TY(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await Pn("plugin:fs|read_dir",{path:t instanceof URL?t.toString():t,options:e})}async function CY(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await Pn("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 _Q(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await Pn("plugin:fs|read_text_file",{path:t instanceof URL?t.toString():t,options:e})}async function nQe(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 Pn("plugin:fs|read_text_file_lines",{path:n,options:e}));const[r,i]=await Pn("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 PY(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Pn("plugin:fs|remove",{path:t instanceof URL?t.toString():t,options:e})}async function kY(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 Pn("plugin:fs|rename",{oldPath:t instanceof URL?t.toString():t,newPath:e instanceof URL?e.toString():e,options:n})}async function rQe(t,e){const n=await Pn("plugin:fs|stat",{path:t instanceof URL?t.toString():t,options:e});return QQ(n)}async function iQe(t,e){const n=await Pn("plugin:fs|lstat",{path:t instanceof URL?t.toString():t,options:e});return QQ(n)}async function sQe(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Pn("plugin:fs|truncate",{path:t instanceof URL?t.toString():t,len:e,options:n})}async function oQe(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Pn("plugin:fs|write_file",e,{headers:{path:t instanceof URL?t.toString():t,options:JSON.stringify(n)}})}async function EY(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Pn("plugin:fs|write_text_file",{path:t instanceof URL?t.toString():t,data:e,options:n})}async function jQ(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await Pn("plugin:fs|exists",{path:t instanceof URL?t.toString():t,options:e})}async function IY(t){await Pn("plugin:fs|unwatch",{rid:t})}async function aQe(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 SY;s.onmessage=e;const o=await Pn("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:r,onEvent:s});return()=>{IY(o)}}async function lQe(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 SY;s.onmessage=e;const o=await Pn("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:r,onEvent:s});return()=>{IY(o)}}const TO=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return IE},FileHandle:RQ,get SeekMode(){return $E},copyFile:tQe,create:KAe,exists:jQ,lstat:iQe,mkdir:wY,open:eQe,readDir:TY,readFile:CY,readTextFile:_Q,readTextFileLines:nQe,remove:PY,rename:kY,stat:rQe,truncate:sQe,watch:aQe,watchImmediate:lQe,writeFile:oQe,writeTextFile:EY},Symbol.toStringTag,{value:"Module"}));function cQe(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function Yt(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}var En;(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"})(En||(En={}));async function uQe(){return Yt("plugin:path|resolve_directory",{directory:En.AppConfig})}async function AE(){return Yt("plugin:path|resolve_directory",{directory:En.AppData})}async function dQe(){return Yt("plugin:path|resolve_directory",{directory:En.AppLocalData})}async function fQe(){return Yt("plugin:path|resolve_directory",{directory:En.AppCache})}async function hQe(){return Yt("plugin:path|resolve_directory",{directory:En.Audio})}async function pQe(){return Yt("plugin:path|resolve_directory",{directory:En.Cache})}async function gQe(){return Yt("plugin:path|resolve_directory",{directory:En.Config})}async function mQe(){return Yt("plugin:path|resolve_directory",{directory:En.Data})}async function $Y(){return Yt("plugin:path|resolve_directory",{directory:En.Desktop})}async function OQe(){return Yt("plugin:path|resolve_directory",{directory:En.Document})}async function vQe(){return Yt("plugin:path|resolve_directory",{directory:En.Download})}async function yQe(){return Yt("plugin:path|resolve_directory",{directory:En.Executable})}async function bQe(){return Yt("plugin:path|resolve_directory",{directory:En.Font})}async function xQe(){return Yt("plugin:path|resolve_directory",{directory:En.Home})}async function SQe(){return Yt("plugin:path|resolve_directory",{directory:En.LocalData})}async function wQe(){return Yt("plugin:path|resolve_directory",{directory:En.Picture})}async function TQe(){return Yt("plugin:path|resolve_directory",{directory:En.Public})}async function CQe(){return Yt("plugin:path|resolve_directory",{directory:En.Resource})}async function PQe(t){return Yt("plugin:path|resolve_directory",{directory:En.Resource,path:t})}async function kQe(){return Yt("plugin:path|resolve_directory",{directory:En.Runtime})}async function EQe(){return Yt("plugin:path|resolve_directory",{directory:En.Template})}async function IQe(){return Yt("plugin:path|resolve_directory",{directory:En.Video})}async function $Qe(){return Yt("plugin:path|resolve_directory",{directory:En.AppLog})}async function AQe(){return Yt("plugin:path|resolve_directory",{directory:En.Temp})}function AY(){return window.__TAURI_INTERNALS__.plugins.path.sep}function QQe(){return window.__TAURI_INTERNALS__.plugins.path.delimiter}async function QY(...t){return Yt("plugin:path|resolve",{paths:t})}async function RQe(t){return Yt("plugin:path|normalize",{path:t})}async function NQ(...t){return Yt("plugin:path|join",{paths:t})}async function RY(t){return Yt("plugin:path|dirname",{path:t})}async function _Y(t){return Yt("plugin:path|extname",{path:t})}async function DQ(t,e){return Yt("plugin:path|basename",{path:t,ext:e})}async function jY(t){return Yt("plugin:path|is_absolute",{path:t})}const MQ=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return En},appCacheDir:fQe,appConfigDir:uQe,appDataDir:AE,appLocalDataDir:dQe,appLogDir:$Qe,audioDir:hQe,basename:DQ,cacheDir:pQe,configDir:gQe,dataDir:mQe,delimiter:QQe,desktopDir:$Y,dirname:RY,documentDir:OQe,downloadDir:vQe,executableDir:yQe,extname:_Y,fontDir:bQe,homeDir:xQe,isAbsolute:jY,join:NQ,localDataDir:SQe,normalize:RQe,pictureDir:wQe,publicDir:TQe,resolve:QY,resolveResource:PQe,resourceDir:CQe,runtimeDir:kQe,sep:AY,tempDir:AQe,templateDir:EQe,videoDir:IQe},Symbol.toStringTag,{value:"Module"})),Qo=window.__TAURI__?.http.fetch??globalThis.fetch;function TV(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 NY(t,e){const n=TV(t),r=e.find(({host:i,port:s})=>TV(`https://${i}:${s}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}const _Qe={id:"default",userFilesDir:"default",systemFilesDir:"default"},D0=Rl(Dr(_Qe));D0.debugLabel="project";function hd(){return Ir(D0)}function QE(){return{STATUS_CODE_CHECK:"error",SCHEMA_CHECK:"error",CONTENT_TYPE_CHECK:"error"}}const jQe=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function NQe(){const{userFilesDir:t}=hd(),{certificates:e}=pi(),n=Ft(),{getCollection:r}=fd();return{execute:async(s,o,a)=>{const l=r(s),{inputs:c,servers:u}=n,d=l?.sourceDescriptions??[],h=`${t}/${s}`,[{createConfig:p},{ExternalResolver:m}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-DajpN2Kv.js")),Promise.resolve().then(()=>require("./replay-external-resolver-BuY7tjwA.js"))]),g=new m,O=c.map(w=>JSON.stringify({[w.name]:w.value})),v=DQe(u,d),{run:x}=await Promise.resolve().then(()=>require("./replay-respect-run-VZCFofle.js")),y=await x({files:[h],workflow:o?[o]:[],fetch:(w,S)=>{const P=jQe(w),{clientCert:k,clientKey:I}=NY(P,e);return Qo(P,{...S,clientCert:k,clientKey:I})},logger:mS,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async w=>{if(!await jQ(w))throw new Error(`File ${w} doesn't exist or isn't readable.`);try{const P=await _Q(w),k=new TextEncoder().encode(P);return new File([k],await DQ(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 DQe(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 MQe="com.redocly.tab.openFailed";function hf(t){return{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Ue.Step,draftStep:null,response:null,requestError:null,isProcessingRequest:!1,...t}}function RE(t,e){const n=t.draftStep?.xOperation;return n?.method===e.method&&n?.url===e.url}function VQe(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:SA(wO(s),l.parameters.queryParameters)}}}:a})}function hr(){const{getTabs:t,getActiveTabIdx:e,setTabs:n,setActiveTabIdx:r,updateTabAt:i,updateTabDataAt:s}=sd(),{dynamicReplayValues:o}=Fn(),{getStep:a}=yY(),{getHistoryItem:l}=GAe(),{getWorkflow:c}=AQ(),{getCollection:u}=fd(),{getApiOperation:d}=EQ(),{sendEvent:h}=Ke(),p=fIe(),m=b.useCallback((N,M,D,F)=>{console.warn(`[useTabHandlers] ${N}`,F),h(MQe,[{...ye("tab",M),reason:D,...F}])},[h]),g=b.useCallback((N,M)=>{const D=t()[N];D&&D.state!==M&&i(N,F=>({...F,state:M}))},[t,i]),O=b.useCallback(N=>{r(N)},[r]),v=b.useCallback(()=>{const N=t().length;n(M=>[...M,xAe()]),r(N)},[t,n,r]),x=b.useCallback(N=>{const M=[...t().filter(F=>F.state!==An.Preview)];M.push(N),n(()=>M);const D=M.length-1;return r(D),D},[t,n,r]),y=b.useCallback(N=>{const M=d(N),D=VQ(N,M,o);x(D)},[x,o,d]),w=b.useCallback(N=>{const M=t().findIndex(({data:D})=>T9(D,N));return M===-1?!1:(O(M),!0)},[t,O]),S=b.useCallback((N,M)=>{const D=t(),F=G=>D.findIndex(({data:ee})=>Rn(ee,Ue.Step)&&G(ee));if(M){const G=F(ne=>ne.sourceFile===M);if(G!==-1){VQe(D[G].data,ne=>s(G,ne),N),O(G);return}const ee=F(ne=>!ne.sourceFile&&RE(ne,N));if(ee!==-1){s(ee,ne=>({...ne,sourceFile:M})),O(ee);return}}else{const G=F(ee=>RE(ee,N));if(G!==-1){O(G);return}}const W=Na({xOperation:N,name:M??void 0});x({id:crypto.randomUUID(),state:An.Normal,data:hf({draftStep:W,activeTabName:vu(W),sourceFile:M??null})})},[t,s,O,x]),P=b.useCallback(N=>{const M=t(),D=e(),F=M[D]?.id,W=M.filter((ee,ne)=>ne!==N);n(()=>W);const G=N===D||!F?-1:W.findIndex(ee=>ee.id===F);r(G===-1?Math.max(0,N-1):G)},[t,e,r,n]),k=b.useCallback(()=>{n(()=>[]),r(0)},[r,n]);function I({collectionId:N,workflowId:M,stepId:D}){const F=t(),W=new Set;for(let G=0;G<F.length;G++){const ee=F[G].data;switch(ee.type){case Ue.Step:ee.collectionId===N&&ee.workflowId===M&&ee.stepId===D&&W.add(G);break;case Ue.Workflow:case Ue.WorkflowRun:ee.collectionId===N&&ee.workflowId===M&&!D&&W.add(G);break;case Ue.Collection:ee.collectionId===N&&!M&&!D&&W.add(G);break}}W.size&&(n(G=>G.filter((ee,ne)=>!W.has(ne))),r(0))}const E=b.useCallback(async N=>{const M=t().findIndex(({data:D})=>Rn(D,Ue.Step)&&D.historyId===N);if(M!==-1)r(M);else{const D=await l(N);if(!D||!jk(D)){m("Step history not found","stepHistoryTab","step_history_not_found",{historyId:N});return}const F=D.step;x({id:crypto.randomUUID(),state:An.Preview,data:hf({historyId:N,draftStep:structuredClone(F),response:structuredClone(D.response),activeTabName:vu(F)})})}},[r,t,x,l,m]),Q=b.useCallback(({collectionId:N,activeTabName:M})=>{const D=t().findIndex(F=>{const W=F.data;return Rn(W,Ue.Collection)&&W.collectionId===N});if(D!==-1)r(D);else{if(!u(N)){m("Collection not found","collectionTab","collection_not_found",{collectionId:N});return}x({id:crypto.randomUUID(),state:An.Preview,data:{collectionId:N,type:Ue.Collection,activeTabName:M??it.COLLECTION_SETTINGS}})}},[r,t,x,u,m]),j=b.useCallback(({collectionId:N,workflowId:M})=>{if(!c({collectionId:N,workflowId:M})){m("Workflow not found","workflowRunTab","workflow_not_found",{collectionId:N,workflowId:M});return}x({id:crypto.randomUUID(),state:An.Normal,data:{collectionId:N,workflowId:M,historyId:null,runDate:null,type:Ue.WorkflowRun,result:null,severitySettings:QE()}})},[x,c,m]),R=b.useCallback(async(N,{state:M=An.Preview}={})=>{const D=t().findIndex(({data:F})=>Rn(F,Ue.WorkflowRun)&&F.historyId===N);if(D!==-1)M===An.Normal&&t()[D].state===An.Preview&&g(D,An.Normal),r(D);else{const F=await l(N);if(!F||!Nk(F)){m("Workflow history not found","workflowHistoryTab","workflow_history_not_found",{historyId:N});return}x({id:crypto.randomUUID(),state:M,data:{collectionId:F.collectionId,workflowId:F.workflowId,historyId:N,runDate:F.date,type:Ue.WorkflowRun,result:structuredClone(F.workflowResult),severitySettings:QE(),label:Bh(F.workflow),secretValues:p().inputs.filter(W=>W.isSecret&&W.value).map(W=>String(W.value))}})}},[r,t,x,g,l,m,p]),V=b.useCallback(({collectionId:N,workflowId:M})=>{const D=t().findIndex(({data:F})=>Rn(F,Ue.WorkflowRun)&&F.collectionId===N&&F.workflowId===M);return D===-1?!1:(t()[D].state===An.Preview&&g(D,An.Normal),O(D),!0)},[t,g,O]),z=b.useCallback(({collectionId:N,workflowId:M,activeTabName:D})=>{const F=t().findIndex(W=>{const G=W.data;return Rn(G,Ue.Workflow)&&G.workflowId===M&&G.collectionId===N});if(F!==-1)D&&s(F,W=>({...W,activeTabName:D})),r(F);else{if(!c({collectionId:N,workflowId:M})){m("Workflow not found","workflowTab","workflow_not_found",{collectionId:N,workflowId:M});return}x({id:crypto.randomUUID(),state:An.Preview,data:{collectionId:N,workflowId:M,type:Ue.Workflow,activeTabName:D??it.WORKFLOW_SETTINGS}})}},[r,t,s,x,c,m]),X=b.useCallback(({collectionId:N,workflowId:M,stepId:D,state:F})=>{const W=t().findIndex(({data:G})=>Rn(G,Ue.Step)&&G.collectionId===N&&G.workflowId===M&&G.stepId===D&&G.historyId===null);if(W!==-1)r(W);else{const G=a({collectionId:N,workflowId:M,stepId:D});if(!G){m("Step not found","stepTab","step_not_found",{collectionId:N,workflowId:M,stepId:D});return}x({id:crypto.randomUUID(),state:F??An.Preview,data:hf({stepId:D,collectionId:N,workflowId:M,activeTabName:vu(G)})})}},[r,t,a,x,m]),A=b.useCallback(({step:N})=>{x({id:crypto.randomUUID(),state:An.Normal,data:hf({stepId:N.stepId??null,workflowId:N.workflowId??null,draftStep:structuredClone(N),activeTabName:vu(N)})})},[x]),U=b.useCallback((N,M)=>{if(N===M)return;const D=e(),F=[...t()],W=F[D]?.id,[G]=F.splice(N,1);if(F.splice(M,0,G),n(()=>F),W){const ee=F.findIndex(ne=>ne.id===W);r(ee)}},[e,t,n,r]);return{handleNewTabOpen:v,addNewTab:x,openStepTabFromOperation:y,focusOperationTab:w,openStepTabFromXOperation:S,handleTabChange:O,handleTabClose:P,handleCloseAllTabs:k,handleCloseByDataId:I,openCollectionTab:Q,openWorkflowTab:z,openWorkflowRunTab:j,openWorkflowRunTabFromHistory:R,focusWorkflowRunTab:V,openStepTabFromHistory:E,openStepTabFromCollection:X,openStepTab:A,handleTabReorder:U,changeTabState:g}}function VQ(t,e,n){const r=Na({operation:t,apiOperation:e,dynamicReplayValues:n});return{id:crypto.randomUUID(),state:An.Preview,data:hf({draftStep:r,activeTabName:vu(r)})}}function LQe(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.left>=r.left&&n.right<=r.right}const zQe=({transform:t})=>({...t,y:0}),XQe=({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))},pd=(t,e="currentColor")=>t?.startsWith("--")?`var(${t})`:t||e,UQe=t=>f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",...t,children:[f.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"}),f.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"})]}),PS=T.default(UQe)`
786
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function m$e(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 Y1(t,e,n,r,i){return!n.sanitizeName||R6(t,{xmlVersion:i})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}Hi.prototype.build=function(t){if(this.options.preserveOrder)return u$e(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new k6,n=m$e(t,this.options);return this.j2x(t,0,e,n).val}};Hi.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:Y1(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 d=this.isAttribute(l);if(d&&!this.ignoreAttributesFn(d,o)){const h=Y1(d,!0,this.options,n,r);i+=this.buildAttrPairStr(h,""+t[l],a)}else if(!d)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 d=t[l].length;let h="",p="";for(let m=0;m<d;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 d=Object.keys(t[l]),h=d.length;for(let p=0;p<h;p++){const m=Y1(d[p],!0,this.options,n,r);i+=this.buildAttrPairStr(m,""+t[l][d[p]],a)}}else s+=this.processTextOrObjNode(t[l],u,e,n,r)}return{attrStr:i,val:s}};Hi.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+'="'+gh(e)+'"'};function O$e(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)}Hi.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]=gh(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]=gh(t[r]),n=!0)}return n?e:null};Hi.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};Hi.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};Hi.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}};Hi.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};Hi.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};Hi.prototype.buildTextValNode=function(t,e,n,r,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName){const s=I6(t);return this.indentate(r)+`<![CDATA[${s}]]>`+this.newLine}else if(this.options.commentPropName!==!1&&e===this.options.commentPropName){const s=E6(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}}};Hi.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 v$e(t){return this.options.indentBy.repeat(t)}function y$e(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}function D6(t){return t.schema}function M6(t){return D6(t)?.fields??[]}function V6(t,e){return t.flatMap(n=>{const r=D6(n),i=r?.fields||[];return i.length>0?i.flatMap(s=>cV(s.name,s.example,n.allowReserved)):cV(n.name,r?.example??n.example,n.allowReserved)})}function cV(t,e,n){if(e===void 0)return[G1(t,"",!1,n)];const r=OE(e,t);return r.length===0?[G1(t,"",!1,n)]:r.map(i=>G1(i.key,i.value,!0,n))}function OE(t,e){return t===void 0?[]:t===null?[{key:e,value:""}]:Array.isArray(t)?t.flatMap((n,r)=>n!==null&&typeof n=="object"?OE(n,`${e}[${r}]`):[{key:e,value:String(n)}]):b$e(t)?Object.entries(t).flatMap(([n,r])=>OE(r,`${e}[${n}]`)):[{key:e,value:String(t)}]}function b$e(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function G1(t,e,n,r){return{id:crypto.randomUUID(),key:t,value:C6(e),active:n,in:"query",...r&&{allowReserved:r}}}const L6={path:"path",query:"query",header:"headers",cookie:"cookie"};function yQ(t){return t!==void 0}function x$e(t,e){if(t)return lx.isDirectConfigureRequestValues(t)?t:t[e]}function uV(t,e,n){const r=n[L6[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 Rf(t,e,n){if(lx.isDirectConfigureRequestValues(n))return uV(t,e,n);const r=new Set;for(const i of Object.values(n))if(i)for(const s of uV(t,e,i))r.add(s);return r}function dV(t,e,n){const r=n.query,i=n.envVariables;for(const s of e??[]){const o=M6(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 z6(t,e,n){const r=[...t??[],...e??[]],i=new Set(Rf(r,"query",n));if(lx.isDirectConfigureRequestValues(n))return dV(i,e,n),i;for(const s of Object.values(n))s&&dV(i,e,s);return i}function bQ(t=[],e){const n={};return t.forEach(r=>{const i=String(r[e]);n[i]||(n[i]=[]),n[i].push(r)}),n}function S$e(t){return t.replace(/{/g,"{{").replace(/}/g,"}}")}var ms=(t=>(t.Query="Query",t.Header="Header",t.Cookie="Cookie",t))(ms||{});const vE={documentedOAuth2Types:[],grantType:oe.ClientCredentials,authRequestExtraParams:[],tokenRequestExtraParams:[],[oe.ClientCredentials]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[],accessToken:""},[oe.ClientCredentialsWithJwtAssertion]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[],accessToken:""},[oe.AuthorizationCode]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],codeVerifier:"",codeChallenge:"",accessToken:""},[oe.AuthorizationCodeWithPkce]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],codeVerifier:"",codeChallenge:"",accessToken:""},[oe.Implicit]:{clientId:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],accessToken:""},[oe.Password]:{username:"",password:"",clientId:"",clientSecret:"",tokenUrl:"",accessToken:"",scopes:[]}},w$e={securityType:te.NoAuth,securitySchemeId:null,[te.BasicAuth]:{username:"",password:""},[te.JWT]:{token:""},[te.DigestAuth]:{username:"",password:"",nc:"00000001",realm:"",nonce:"",opaque:"",qop:"",algorithm:"",cnonce:""},[te.APIKey]:{location:ms.Header,name:"",key:""},[te.OAuth2]:vE,[te.OpenIDConnect]:{...vE,openIdConnectUrl:"",userInfoUrl:""}},T$e={clientCredentials:oe.ClientCredentials,clientCredentialsWithJwtAssertion:oe.ClientCredentialsWithJwtAssertion,authorizationCode:oe.AuthorizationCode,authorizationCodeWithPkce:oe.AuthorizationCodeWithPkce,implicit:oe.Implicit,password:oe.Password},j0="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 C$e={[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 mh(){return structuredClone({type:Hn.Text,content:"",activeExampleName:"",formData:{"multipart/form-data":[],"application/x-www-form-urlencoded":[]},binary:null})}const P$e={method:"GET",url:"",security:[ao()],body:mh(),queryParameters:[],headers:[],cookies:[],pathParameters:[]};function X6(){return structuredClone(P$e)}function ao(){return _a(w$e)}function U6(t){return _a({id:crypto.randomUUID(),...C$e[t]})}const k$e=new Hi({cdataPropName:"#cdata"}),E$e=/^[^\\/]+\.[a-z0-9]{1,5}$/i,F6=/^text\/|json|xml|x-www-form-urlencoded/i,I$e=new Set(["$ref","allOf"]);function $$e(t,e,n,r){const i=Qa(r)?r:void 0,s=R$e(i,t);return n&&z$e(n)?Q$e(t,e,n,s,i):A$e(t,e,n,s,i)}function A$e(t,e,n,r,i){const s=W6(r,e,i),o=(n?.contentType??"").split(",").map(h=>h.trim()).filter(Boolean),a=o.find(h=>!h.split(";")[0].includes("*")),l=a??o[0],c=Array.isArray(e)?e:[e],u=c.filter(h=>L$e(h,l)),d=B6(n);if(s.binary==="encoded"){const h=M$e(d,s.contentEncoding);return u.map(p=>({key:t,value:_f(p),file:!1,contentType:a??"application/octet-stream",headers:h}))}return Z6(s,c)||o.length>0&&!F6.test(o[0])?c.map(h=>{const p={key:t,value:_f(h),file:!0};return a&&(p.contentType=a),d&&(p.headers=d),p}):u.map(h=>{const p=o.length===0&&(Y6(h)||s.type==="object"||s.type==="array"||s.type===void 0&&typeof h=="string"&&G6(h)),m=a??(p?"application/json":void 0),g={key:t,value:X$e(h,l,s.xmlName??t),file:!1};return m&&(g.contentType=m),d&&(g.headers=d),g})}function Q$e(t,e,n,r,i){const s=n.style??"form",o=n.explode??s==="form",a=B6(n),l=(m,g)=>({key:m,value:_f(g),file:!1,...a&&{headers:a}}),c=V$e(e);if(c===void 0)return[];const u=Array.isArray(c)?c:[c],d=Z6(W6(r,c,i),u);if(Array.isArray(c)&&o&&s!=="deepObject")return c.map(m=>({...l(t,m),file:d}));if(!Y6(c))return[{...l(t,c),file:d}];const h=s==="spaceDelimited"?" ":s==="pipeDelimited"?"|":",";if(Array.isArray(c))return[l(t,c.map(_f).join(h))];const p=Object.entries(c);return s==="deepObject"?p.map(([m,g])=>l(`${t}[${m}]`,g)):o?p.map(([m,g])=>l(m,g)):[l(t,p.flatMap(([m,g])=>[m,_f(g)]).join(h))]}function R$e(t,e){return q6(xQ(t,t).members.map(n=>Qa(n.properties)?n.properties[e]:void 0))}function _$e(t,e){return q6(xQ(t,e).members.map(n=>n.items))}function q6(t){const e=t.filter(Qa);return e.length>1?{allOf:e}:e[0]}function W6(t,e,n){const r=fV(t,n);return Array.isArray(e)||r.type==="array"?fV(_$e(t,n),n):r}function Z6(t,e){return t.binary==="raw"||t.emptySchema===!0&&e.every(j$e)}function j$e(t){return t==null||t===""||typeof t=="string"&&E$e.test(t)}function fV(t,e){if(!t)return{};const{members:n,unresolved:r}=xQ(t,e),i=n.map(u=>D$e(u.type)).find(Boolean),s=n.map(u=>Qa(u.xml)?u.xml.name:void 0).find(u=>typeof u=="string"&&u!==""),o=n.map(u=>u.contentEncoding).find(u=>typeof u=="string")??(n.some(u=>u.format==="byte")?"base64":void 0);if(o&&o.toLowerCase()!=="binary")return{type:i,xmlName:s,binary:"encoded",contentEncoding:o};const a=n.map(u=>u.contentMediaType).find(u=>typeof u=="string"),l=o!==void 0||n.some(u=>u.format==="binary")||a!==void 0&&!F6.test(a),c=!r&&n.every(u=>Object.keys(u).every(d=>I$e.has(d)));return{type:i,xmlName:s,...l?{binary:"raw"}:c&&{emptySchema:!0}}}function xQ(t,e){const n=[];let r=!1;const i=s=>{if(!(!Qa(s)||n.includes(s))){if(n.push(s),typeof s.$ref=="string"){const o=N$e(e,s.$ref);o?i(o):r=!0}Array.isArray(s.allOf)&&s.allOf.forEach(i)}};return i(t),{members:n,unresolved:r}}function N$e(t,e){const n="#/components/schemas/";if(!e.startsWith(n))return;const r=Qa(t?.components)?t.components.schemas:void 0,i=Qa(r)?r[oh.unescape(e.slice(n.length))]:void 0;return Qa(i)?i:void 0}function D$e(t){return typeof t=="string"?t:Array.isArray(t)?t.find(e=>typeof e=="string"&&e!=="null"):void 0}function Qa(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function B6(t){const e=Object.entries(t?.headers??{});return e.length>0?Object.fromEntries(e):void 0}function M$e(t,e){const n=t??{};return Object.keys(n).some(r=>r.toLowerCase()==="content-transfer-encoding")?n:{...n,"Content-Transfer-Encoding":e}}function Y6(t){return typeof t=="object"&&t!==null}function V$e(t){const e=Array.isArray(t)?t.filter(Ry):Qa(t)?Object.fromEntries(Object.entries(t).filter(([,n])=>Ry(n))):t;return Ry(e)&&!(typeof e=="object"&&Object.keys(e).length===0)?e:void 0}function L$e(t,e){return Ry(t)||e!==void 0&&/json/i.test(e)}function Ry(t){return t!=null}function z$e(t){return t.style!==void 0||t.explode!==void 0||t.allowReserved!==void 0}function _f(t){return t==null?"":typeof t=="string"?t:JSON.stringify(t)}function X$e(t,e,n){return Qa(t)&&e&&/xml/i.test(e)?k$e.build({[n]:t}):e&&/json/i.test(e)?typeof t=="string"&&G6(t)?t:JSON.stringify(t)??"":_f(t)}function G6(t){try{const e=JSON.parse(t);return typeof e=="object"&&e!==null}catch{return!1}}function H6(t,e,n,r){if(!t||typeof t!="object")return[];const i=e===Ge.FormData;return Object.entries(t).flatMap(([s,o])=>$$e(s,o,n?.[s],r).map(a=>({id:crypto.randomUUID(),key:a.key,value:a.value,active:!0,type:i&&a.file?"file":"text",files:null,...i&&a.contentType&&{contentType:a.contentType},...i&&a.headers&&{headers:a.headers}})))}function yE(t){return typeof t!="string"?JSON.stringify(t,null,2):t}function J6(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 vl(t){const e=J6(t);return e?{query:e.query,variables:e.variables===void 0?"":yE(e.variables)}:{query:yE(t),variables:""}}function N0(t,e){return JSON.stringify({query:t,variables:e})}function K6(t){if(t.trim())try{const e=JSON.parse(t);return typeof e=="string"?t:e}catch{return t}}function U$e(t){const e=J6(t);return!e||typeof e.variables!="string"?t:JSON.stringify({...e,variables:K6(e.variables)},null,2)}function eY(t,e,n){for(const r of n){const i=hV(t,r),s=hV(e,r);if(typeof i=="object"&&typeof s=="object"){if(!eY(i,s,n))return!1}else if(i!==s)return!1}return!0}function hV(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 F$e(t,e){return t.length===e.length&&t.sort().join()===e.sort().join()}function q$e(t,e){return t.every(n=>e.includes(n))}function W$e(t){switch(t){case"query":return ms.Query;case"cookie":return ms.Cookie;case"header":return ms.Header;default:return}}function Z$e(t,e,n){const{security:r}=e,i=t?.inputs??[];if(!n)return!1;const s=yS(n),o=s.map(c=>c.securityType),a=r.map(c=>c.securityType);return F$e(o,a)?!r.every(c=>{const u=c.securityType,d=c[te.OAuth2]?.grantType,h=o.includes(u),p=s.find(v=>v.securityType===u),m=!p||eY(c,p,Y$e(u,d)),g=B$e(c,u,c[te.OAuth2]?.grantType,i),O=!!(h&&p&&m&&g);return!n.security?.length||O}):!0}function B$e(t,e,n,r){if(e===te.OAuth2&&(n===oe.AuthorizationCode||n===oe.AuthorizationCodeWithPkce||n===oe.Implicit)){const i=t[te.OAuth2][n]?.availableScopes,s=vS(t[te.OAuth2][n]?.scopes,r);return q$e(s,i)}return!0}function Y$e(t,e){return t===te.APIKey?[`${te.APIKey}/name`,`${te.APIKey}/location`]:t===te.OAuth2?[`${te.OAuth2}/grantType`,...G$e(e)]:t===te.OpenIDConnect?[`${te.OpenIDConnect}/openIdConnectUrl`]:[]}function G$e(t){return t===oe.ClientCredentials?[`${te.OAuth2}/${oe.ClientCredentials}/tokenUrl`]:t===oe.Password?[`${te.OAuth2}/${oe.Password}/tokenUrl`]:t===oe.Implicit?[`${te.OAuth2}/${oe.Implicit}/authorizationUrl`]:t===oe.AuthorizationCode?[`${te.OAuth2}/${oe.AuthorizationCode}/tokenUrl`,`${te.OAuth2}/${oe.AuthorizationCode}/authorizationUrl`]:t===oe.AuthorizationCodeWithPkce?[`${te.OAuth2}/${oe.AuthorizationCodeWithPkce}/tokenUrl`,`${te.OAuth2}/${oe.AuthorizationCodeWithPkce}/authorizationUrl`]:[]}function H$e(t){return t.map(e=>{const n=e.map(r=>r.id).join("_");return e.map(r=>({...r,schemeId:n}))})}function J$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(wQ(o))}),{id:i,security:s}});return e.length?n:[]}function K$e(t,e){const n=t.security||[];return n?.length?lY(n).map((r,i)=>wQ(r)):[]}function tY(t){if(!(t.securityType!==te.NoAuth||!t.securitySchemeId))return t.unsupportedScheme}function yS(t){const n=(t.security||[])[0];return n?n.map(r=>wQ(r)):[ao()]}const eAe={[te.OAuth2]:"oauth2",[te.OpenIDConnect]:"openIdConnect",[te.APIKey]:"apiKey",[te.JWT]:"http-bearer"};function tAe(t){return eAe[t]}function nAe(t){const e=SQ(t);return(e?[...cs(e)][0]:void 0)??rAe(t)}function rAe(t){const e=t.securitySchemeId;if(e){if(t.securityType===te.JWT)return e+rt.SecurityVariablesEnvSuffix.JWTToken;if(t.securityType===te.APIKey)return e+rt.SecurityVariablesEnvSuffix.APIKey;if(t.securityType===te.OAuth2||t.securityType===te.OpenIDConnect)return e+rt.SecurityVariablesEnvSuffix.Token}}function iAe(t,e){const n=SQ(t);if(!n)return"";const r=[...cs(n)][0];return r?e.find(i=>i.name===r)?.value??"":n}function pV(t,e){if(t.securityType===te.JWT)return{...t,[te.JWT]:{...t[te.JWT],token:e}};if(t.securityType===te.APIKey)return{...t,[te.APIKey]:{...t[te.APIKey],key:e}};if(t.securityType===te.OAuth2||t.securityType===te.OpenIDConnect){const n=t.securityType,r=t[n],i=r.grantType;return{...t,[n]:{...r,[i]:{...r[i],accessToken:e}}}}return t}function SQ(t){if(t.securityType===te.JWT)return t[te.JWT].token;if(t.securityType===te.APIKey)return t[te.APIKey].key;if(t.securityType===te.OAuth2){const e=t[te.OAuth2];return e[e.grantType]?.accessToken}if(t.securityType===te.OpenIDConnect){const e=t[te.OpenIDConnect];return e[e.grantType]?.accessToken}}function wQ(t,e){const n={...ao(),securitySchemeId:t.id},r=bS(t);n.securityType=r,n.unsupportedScheme=r===te.NoAuth?t.scheme||t.type:void 0;const i=t.id;if(t.id&&r!==te.NoAuth&&(n[r].schemeName=t.id),r===te.BasicAuth&&(n[te.BasicAuth].username||(n[te.BasicAuth].username=Nn(i+rt.SecurityVariablesEnvSuffix.Username)),n[te.BasicAuth].password||(n[te.BasicAuth].password=Nn(i+rt.SecurityVariablesEnvSuffix.Password))),r===te.DigestAuth&&(n[te.DigestAuth].username||(n[te.DigestAuth].username=Nn(i+rt.SecurityVariablesEnvSuffix.Username)),n[te.DigestAuth].password||(n[te.DigestAuth].password=Nn(i+rt.SecurityVariablesEnvSuffix.Password))),r===te.JWT&&!n[te.JWT].token&&(n[te.JWT].token=Nn(i+rt.SecurityVariablesEnvSuffix.JWTToken)),r===te.APIKey&&!n[te.APIKey].key){n[te.APIKey].name=t.name||"",n[te.APIKey].key=Nn(i+rt.SecurityVariablesEnvSuffix.APIKey);const s=W$e(t.in);s&&(n[te.APIKey].location=s)}if(r===te.OAuth2){const s=PQ(t),o=Nn(i+rt.SecurityVariablesEnvSuffix.Token),a=n[te.OAuth2];a.grantType=s[0],s.forEach(l=>{l===oe.AuthorizationCode&&!a[oe.AuthorizationCode].accessToken&&(a[oe.AuthorizationCode].accessToken=o,a[oe.AuthorizationCode].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.AuthorizationCode].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[oe.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[oe.AuthorizationCode].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[oe.AuthorizationCode].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[oe.AuthorizationCode].scopes=[...sc(t.flows?.authorizationCode?.scopes||{})||[]]),l===oe.AuthorizationCodeWithPkce&&!a[oe.AuthorizationCodeWithPkce].accessToken&&(a[oe.AuthorizationCodeWithPkce].accessToken=o,a[oe.AuthorizationCodeWithPkce].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.AuthorizationCodeWithPkce].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[oe.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[oe.AuthorizationCodeWithPkce].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[oe.AuthorizationCodeWithPkce].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[oe.AuthorizationCodeWithPkce].scopes=[...sc(t.flows?.authorizationCode?.scopes||{})]),l===oe.ClientCredentials&&!a[oe.ClientCredentials].accessToken&&(a[oe.ClientCredentials].accessToken=o,a[oe.ClientCredentials].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.ClientCredentials].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[oe.ClientCredentials].tokenUrl=t.flows?.clientCredentials?.tokenUrl||"",a[oe.ClientCredentials].scopes=[...sc(t.flows?.clientCredentials?.scopes||{})]),l===oe.ClientCredentialsWithJwtAssertion&&!a[oe.ClientCredentialsWithJwtAssertion].accessToken&&(a[oe.ClientCredentialsWithJwtAssertion].accessToken=o,a[oe.ClientCredentialsWithJwtAssertion].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.ClientCredentialsWithJwtAssertion].clientAssertion=Nn(i+rt.SecurityVariablesEnvSuffix.ClientAssertion),a[oe.ClientCredentialsWithJwtAssertion].scopes=[...sc(t.flows?.clientCredentials?.scopes||{})]),l===oe.Implicit&&!a[oe.Implicit].accessToken&&(a[oe.Implicit].accessToken=o,a[oe.Implicit].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.Implicit].authorizationUrl=t.flows?.implicit?.authorizationUrl||"",a[oe.Implicit].availableScopes=Object.keys(t.flows?.implicit?.scopes||{})||[],a[oe.Implicit].scopes=[...sc(t.flows?.implicit?.scopes||{})]),l===oe.Password&&!a[oe.Password].accessToken&&(a[oe.Password].accessToken=o,a[oe.Password].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.Password].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[oe.Password].tokenUrl=t.flows?.password?.tokenUrl||"",a[oe.Password].scopes=[...sc(t.flows?.password?.scopes||{})])})}if(r===te.OpenIDConnect){const s=Nn(i+rt.SecurityVariablesEnvSuffix.Token),o=n[te.OpenIDConnect];o[oe.AuthorizationCode].accessToken||(o[oe.AuthorizationCode].accessToken=s,o[oe.AuthorizationCode].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),o[oe.AuthorizationCode].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),o[oe.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),o[oe.AuthorizationCodeWithPkce].accessToken||(o[oe.AuthorizationCodeWithPkce].accessToken=s,o[oe.AuthorizationCodeWithPkce].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId),o[oe.AuthorizationCodeWithPkce].clientSecret=Nn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),o[oe.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),o[oe.Implicit].accessToken||(o[oe.Implicit].accessToken=s,o[oe.Implicit].clientId=Nn(i+rt.SecurityVariablesEnvSuffix.ClientId))}return n}function TQ(t){try{const e=JSON.parse(t);return JSON.stringify(e,null,2)}catch(e){return console.error({error:e}),t}}function nY(t,e){return t==="application/json"&&!!e}function rY(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function sAe(t){try{const e=JSON.stringify(t);return e===void 0?"undefined":e}catch{return String(t)}}function iY(t,e){return e&&e.length>0?V6(e):va(t||[],{})}function oAe(t,e,n){if(e&&e.length>0){const r=V6(e);return aAe(r,n)}return va(t||[],{boundNames:n})}function aAe(t,e){return t.map(n=>!n.key||!e.has(n.key)?n:{...n,value:`$inputs.${n.key}`,active:!0})}function lAe(t,e=!1,n="",r){const i=bQ(t.parameters,"in"),s=sY(t),o=yS(t),a=iY(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:SO(S$e(t.path),a),headers:va(i.header||[],{}),queryParameters:a,cookies:va(i.cookie||[],{}),body:s,security:o},response:null}}function CQ(t,e){const n=bQ(t.parameters,"in"),r=sY(t),i=yS(t),s=va(n.path||[],{boundNames:"all"});return e?{parameters:{pathParameters:s,queryParameters:oAe(n.query,n.querystring,z6(n.query,n.querystring,e)),headers:va(n.header||[],{boundNames:Rf(n.header,"header",e)}),cookies:va(n.cookie||[],{boundNames:Rf(n.cookie,"cookie",e)})},requestBody:r,security:i}:{parameters:{pathParameters:s,queryParameters:iY(n.query,n.querystring),headers:va(n.header||[],{}),cookies:va(n.cookie||[],{})},requestBody:r,security:i}}function cAe(t,e){const n=new Hi({format:!0});if(typeof t=="string")return e?.includes("json")?TQ(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 uAe(t){return xA.includes(t)}function sY(t){const e=t.body?.mediaTypes;if(!e||!Object.keys(e).length)return mh();const n=pAe(e,t),r=n?.name||"",i=uAe(r),s=!i&&!J7.includes(r),o=bE(n),l=o.find(({key:d})=>d===t.body?.activeExampleName)?.value??o[0]?.value,c=s&&l?cAe(l,r):"",u={"multipart/form-data":gV(e["multipart/form-data"]),"application/x-www-form-urlencoded":gV(e["application/x-www-form-urlencoded"])};if(i&&l){const d=H6(l,r,n?.encoding,n?.schema);d.length&&(u[r]=d)}return{...mh(),activeExampleName:t.body?.activeExampleName||o[0]?.key||"",...n&&{type:n.name},content:c,formData:u}}const dAe={[Ge.GraphqlJSON]:"graphql"};function Zh(t,e){const n=dAe[t];return!n||e?.[n]===!0}function oY(t,e){return Zh(t,e)?hc[t]:void 0}function aY(t,e){const n=Object.fromEntries(Object.entries(hc).filter(([r])=>Zh(r,e)));return t?{...fAe(t),...n}:n}function fAe(t){return Object.keys(t.body?.mediaTypes||{}).reduce((e,n)=>(e[n]={name:n,extensions:void 0},e),{})}function gV(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 hAe="Untitled example";function bE(t){const e=t?.examples;return Object.keys(e||{}).map(n=>{const r=e?.[n];return{name:(Ch.isString(r?.summary)?r?.summary:r?.summary?.raw)?.trim()||n||hAe,key:n,value:e?.[n].value}})}function pAe(t,e){const n=aY(e),r=Object.keys(t).find(i=>!!n[i]);return r?t[r]:null}function gAe(t){return!t?.security?.length||!t?[]:K$e(t)}function lY(t){const e=new Set;return t.flat().filter(n=>e.has(n.id)?!1:(e.add(n.id),!0))}function bS(t){if(t.type==="http"){const e=t.scheme?.toLowerCase();if(e==="bearer")return te.JWT;if(e==="basic")return te.BasicAuth;if(e==="digest")return te.DigestAuth}else{if(t.type==="apiKey")return te.APIKey;if(t.type==="oauth2")return te.OAuth2;if(t.type==="openIdConnect")return te.OpenIDConnect}return te.NoAuth}function mAe(t,e){if(t==="clientCredentials"&&e&&"x-assertionType"in e&&e["x-assertionType"]===j0)return oe.ClientCredentialsWithJwtAssertion;if(t==="authorizationCode"&&e&&"x-usePkce"in e&&e["x-usePkce"])return oe.AuthorizationCodeWithPkce;switch(t){case"implicit":return oe.Implicit;case"password":return oe.Password;case"clientCredentials":return oe.ClientCredentials;case"authorizationCode":return oe.AuthorizationCode;default:return oe.AuthorizationCode}}function OAe(t,e){const n=t?.security;if(!n?.length)return[];const s=H$e(n).flat().filter(o=>o.schemeId===e).find(o=>bS(o)===te.OAuth2);return PQ(s)}function PQ(t){return Object.entries(t?.flows||{}).map(([e,n])=>mAe(e,n)).filter(Boolean)}function xS(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function Xs(t){try{return new URL(t),!0}catch{return!1}}function vAe(t,e){let n;if(e.startsWith("//")){const{protocol:r}=new URL(t);n=`${r||"https:"}${e}`}else if(o6(e))n=e;else if(!e.startsWith("/"))n=uE(t)+"/"+e;else{const r=new URL(t);r.pathname=e,n=r.toString()}return uE(n)}function mV(t,e){let n=t;return e.forEach(({key:r,value:i,active:s})=>{i&&s&&(n=n.replaceAll(`{${r}}`,i))}),n}function cY(t,e){let n=t;return e.forEach(({name:r,value:i})=>{i&&(n=n.replaceAll(`{${r}}`,i))}),n}function yAe(t){return t.startsWith("http://")||t.startsWith("https://")}function Lv({url:t,serverUrl:e,corsProxyUrl:n}){let r;if(yAe(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 uY="New Step";function xE({name:t=uY,workflow:e}={}){let n=t.replaceAll(" ","-");if(!e)return n;const r=bAe(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function bAe(t){return t.steps.filter(e=>e.state!==Xt.Draft).map(e=>e.stepId)}function Na({name:t=uY,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:s,dynamicReplayValues:o,xOperation:a}={}){if(!n){const l=s?CQ(s,o):null,c=[ao()];return{stepId:xE({name:t,workflow:r}),description:t,outputs:[],successCriteria:[],state:e?Xt.Draft:Xt.Normal,parameters:{pathParameters:[],queryParameters:a?wO(a.url):[],headers:[],cookies:[]},requestBody:mh(),xOperation:a??(i?null:{method:"GET",url:""}),security:c,operation:i??null,...l}}return{stepId:xE({name:t,workflow:r}),description:n.description,outputs:n.outputs,successCriteria:n.successCriteria,state:e?Xt.Draft:Xt.Normal,parameters:n.parameters,requestBody:n.requestBody,xOperation:n.xOperation,security:n.security,operation:n.operation}}function Rc(t){return t.xOperation?.method??t.operation?.method??""}function Wu(t){return t.xOperation?.url??t.operation?.path??""}function SE({operation:t,requestBody:e}){return t?t.path==="/"&&e.type===Ge.GraphqlJSON?"":t.path:""}function SS(t,e,n,r,i){const{inputs:s,servers:o}=r,a=e$e(yc("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="",d="";if(l)d=l.method,u=mV(l.url,a);else if(c){const m=o.find(O=>O.apiId===c.apiId);d=c.method==="x-query"?"query":c.method,u=(m?.value?cY(m.value,m.variables):"")+mV(SE(t),a)}const h=u.split("?")[0];return{url:Qf(h,s,i??{}),method:d.toUpperCase()}}function xAe(){return structuredClone({id:crypto.randomUUID(),state:An.Normal,data:{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Ue.Step,draftStep:Na(),response:null,activeTabIdx:0,requestError:null,isProcessingRequest:!1}})}function SAe(t){return t?.data?.type===Ue.Step}function wAe(t,e){const{collectionId:n,workflowId:r,stepId:i}=e,s=e.draftStep??null;return n&&r&&i?xO(t,{collectionId:n,workflowId:r,stepId:i})??s:s}function TAe(t,e,n,r,i,s){const o=a=>a??"";return o(t)===r&&o(e)===i&&o(n)===s}const wE="New workflow";function dY({name:t=wE,collection:e}){let r=(t.trim().replace(/[^a-zA-Z0-9\-_\s]/g,"").replace(/\s+/g," ")||wE).replaceAll(" ","-").toLowerCase();if(!e)return r;const i=CAe(e);if(i.includes(r)){let s=1;for(;i.includes(`${r}-${s}`);)s++;r=`${r}-${s}`}return r}function CAe(t){return t.workflows.filter(e=>e.state!==Xt.Draft).map(e=>e.workflowId)}function kQ({name:t=wE,isDraft:e=!1,collection:n}={}){return{workflowId:dY({name:t,collection:n}),summary:t,steps:[],state:e?Xt.Draft:Xt.Normal,outputs:[],parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},security:[ao()]}}function PAe(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 d of cs(u))r.add(d);return t.steps.forEach(u=>{const d=u.security;for(const x of d)switch(x.securityType){case te.BasicAuth:case te.DigestAuth:for(const y of[x[x.securityType].username,x[x.securityType].password])for(const w of cs(y))r.add(w);break;case te.JWT:for(const y of cs(x[x.securityType].token))r.add(y);break;case te.APIKey:for(const y of cs(x[x.securityType].key))r.add(y);break;case te.OAuth2:case te.OpenIDConnect:{const y=x[x.securityType];for(const w of cs(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:x}of[...Vn([...h,...p,...m,...g],i),...O])for(const y of cs(x))r.add(y);const v=u.requestBody;switch(v.type){case Ge.FormData:case Ge.UrlEncoded:{for(const{value:x}of v.formData[v.type])for(const y of cs(x))r.add(y);break}case Ge.Binary:break;case Ge.GraphqlJSON:{const{query:x,variables:y}=Zh(Ge.GraphqlJSON,n)?vl(v.content):{query:v.content,variables:""};for(const w of[x,y])for(const S of cs(w))r.add(S);break}default:for(const x of cs(v.content))r.add(x)}}),r}function fY(t,e,n,r,i){const s=PAe(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(d=>d.name===c)?.isSecret;return[c,u?{type:"string",format:"password"}:l[c]||{type:"string"}]}))}}})}function Bh(t){return t.summary||t.workflowId||"Untitled Workflow"}function hY(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 wS=(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,e.operationId)??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 TS(t){const e=qo(),{convertOperationToReplayValue:n}=Fn();return b.useMemo(()=>wS(e,t,n),[e,t,n])}function EQ(){const t=AA(),{convertOperationToReplayValue:e}=Fn();return{getApiOperation:b.useCallback(r=>wS(t(),r,e),[t,e])}}function pY(t){const e=(t.match(new RegExp("\\{(?<!\\{[^}]*?\\{)([^}]+)\\}","g"))||[]).map(n=>n.slice(1,-1));return Array.from(new Set(e))}function kAe(t){const e=t.servers?.[0];if(!e)return{url:"",variables:[]};const n=e.url,i=pY(n).map(s=>({name:s,value:e.variables?.[s]?.default||""}));return{url:n,variables:i}}function gY(){const t=AA(),e=oo();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}=kAe(i);e(a=>{let l=!1;const c=a.map(u=>u.servers.some(d=>d.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=Qn()?await Promise.resolve().then(()=>require("./replay-tauri-path-Dch_ayrN.js")):{join:ic.join,resolve:ic.resolve,isAbsolute:ic.isAbsolute,relative:ic.relative,extname:ic.extname,dirname:ic.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 EAe({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 OV(t,e){return`${t}\0${e}`}function fd(){const t=pS(),e=qa(),n=AA(),{attachApiServerToEnvironments:r}=gY();async function i({collectionId:l,apiId:c}){const u=ph(t(),l);if(!u)return;if(!u.sourceDescriptions.some(h=>h.apiId===c)){const p=n().find(g=>g.id===c)?.info.title,m=Xs(c)?c:await sn.relative(`/${l}/..`,`/${c}`);e(g=>Ui(g,l,O=>O.sourceDescriptions.some(v=>v.apiId===c)?O:{...O,sourceDescriptions:[...O.sourceDescriptions,{name:EAe({apiName:p,sourceDescriptions:O.sourceDescriptions}),url:m,apiId:c}]}))}r(c)}function s(l){return ph(t(),l)}function o(l,c){e(u=>Ui(u,l,d=>({...d,sourceDescriptions:d.sourceDescriptions.filter(h=>c.name!==h.name)})))}function a(l,c){const u=new Set(c.map(d=>OV(d.workflowId??"",d.stepId)));e(d=>Ui(d,l,h=>{const p=h.workflows.map(m=>{const g=m.steps.map(O=>!u.has(OV(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 IAe{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 TE=(t,e)=>e.some(n=>t instanceof n);let vV,yV;function $Ae(){return vV||(vV=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function AAe(){return yV||(yV=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const CE=new WeakMap,H1=new WeakMap,CS=new WeakMap;function QAe(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(Iu(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return CS.set(e,t),e}function RAe(t){if(CE.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)});CE.set(t,e)}let PE={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return CE.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Iu(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 mY(t){PE=t(PE)}function _Ae(t){return AAe().includes(t)?function(...e){return t.apply(kE(this),e),Iu(this.request)}:function(...e){return Iu(t.apply(kE(this),e))}}function jAe(t){return typeof t=="function"?_Ae(t):(t instanceof IDBTransaction&&RAe(t),TE(t,$Ae())?new Proxy(t,PE):t)}function Iu(t){if(t instanceof IDBRequest)return QAe(t);if(H1.has(t))return H1.get(t);const e=jAe(t);return e!==t&&(H1.set(t,e),CS.set(e,t)),e}const kE=t=>CS.get(t);function NAe(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=Iu(o);return r&&o.addEventListener("upgradeneeded",l=>{r(Iu(o.result),l.oldVersion,l.newVersion,Iu(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 DAe=["get","getKey","getAll","getAllKeys","count"],MAe=["put","add","delete","clear"],J1=new Map;function bV(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(J1.get(e))return J1.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=MAe.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||DAe.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 J1.set(e,s),s}mY(t=>({...t,get:(e,n,r)=>bV(e,n)||t.get(e,n,r),has:(e,n)=>!!bV(e,n)||t.has(e,n)}));const VAe=["continue","continuePrimaryKey","advance"],xV={},EE=new WeakMap,OY=new WeakMap,LAe={get(t,e){if(!VAe.includes(e))return t[e];let n=xV[e];return n||(n=xV[e]=function(...r){EE.set(this,OY.get(this)[e](...r))}),n}};async function*zAe(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const n=new Proxy(e,LAe);for(OY.set(n,e),CS.set(n,kE(e));e;)yield n,e=await(EE.get(n)||e.continue()),EE.delete(n)}function SV(t,e){return e===Symbol.asyncIterator&&TE(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&TE(t,[IDBIndex,IDBObjectStore])}mY(t=>({...t,get(e,n,r){return SV(e,n)?zAe:t.get(e,n,r)},has(e,n){return SV(e,n)||t.has(e,n)}}));class IQ{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 IQ(e,n,r)}async initialize(){this.db||(this.db=await NAe(this.dbName,this.version,{upgrade:e=>{this.setupCallback(e)}}))}async close(){this.db&&(this.db.close(),this.db=null)}}const XAe=1;class $Q{constructor(e){this.indexedDB=e}indexedDB;static create(e){const n=`replay-history-${e}`,r=IQ.createInstance(n,XAe,this.setupDatabase);return new $Q(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 bc{static instance=null;static async initialize(e,n){this.close(),this.instance=await UAe(e,n)}static getInstance(){if(!this.instance)throw new Error("HistoryService not initialized");return this.instance}static close(){this.instance=null}}async function UAe(t,e){let n;if(e){const{HistorySqliteDBStorage:r}=await Promise.resolve().then(()=>require("./replay-HistorySqliteDBStorage-BrILW8Fu.js")),i=Em.getInstance();n=new r(i)}else n=$Q.create(t.id);return new IAe(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 FAe(t){return ki.useQuery({queryKey:ui.list(t),queryFn:async()=>bc.getInstance().getAll(t)})}function vY(){const t=ki.useQueryClient();return ki.useMutation({mutationFn:async e=>{await bc.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 qAe(){const t=ki.useQueryClient();return ki.useMutation({mutationFn:async e=>{await bc.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 WAe(){const t=ki.useQueryClient();return ki.useMutation({mutationFn:async()=>{await bc.getInstance().clear()},onSuccess:()=>{t.invalidateQueries({queryKey:ui.all})},onError:e=>{console.error("Failed to clear history:",e)}})}function ZAe(t){return t?{...t,bodyNotStored:!0,body:"",arrayBuffer:new ArrayBuffer(0)}:null}function BAe(){const t=vY();return b.useCallback(({step:e,response:n})=>{const r=ZAe(n),i={id:crypto.randomUUID(),date:Date.now(),type:"step",step:e,response:r,statusCode:n?.status??null};t.mutate(i)},[t])}function YAe(){const t=vY();return b.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 GAe(){const t=ki.useQueryClient();async function e(n){return t.ensureQueryData({queryKey:ui.detail(n),queryFn:()=>bc.getInstance().getById(n)})}return{getHistoryItem:e}}function yY(){const t=pS();return{getStep:n=>xO(t(),n)}}function HAe(t){const e=mi();return xO(e,{collectionId:t?.collectionId??null,workflowId:t?.workflowId??null,stepId:t?.stepId??null})??t?.draftStep??null}function bY(t,e){const n=t?.collectionId??null,r=t?.workflowId??null,i=t?.stepId??null,s=mi(),o=qa(),a=xO(s,{collectionId:n,workflowId:r,stepId:i});if(a)return{step:a,updateStep:c=>o(u=>gS(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 AQ(){const t=pS();return{getWorkflow:({collectionId:n,workflowId:r})=>bO(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 Jd(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 Kc,Is,Rd,zv,_y;const wV="__TAURI_TO_IPC_KEY__";function xY(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}class SY{constructor(e){Kc.set(this,void 0),Is.set(this,0),Rd.set(this,[]),zv.set(this,void 0),Jd(this,Kc,e||(()=>{})),this.id=xY(n=>{const r=n.index;if("end"in n){r==Vr(this,Is,"f")?this.cleanupCallback():Jd(this,zv,r);return}const i=n.message;if(r==Vr(this,Is,"f")){for(Vr(this,Kc,"f").call(this,i),Jd(this,Is,Vr(this,Is,"f")+1);Vr(this,Is,"f")in Vr(this,Rd,"f");){const s=Vr(this,Rd,"f")[Vr(this,Is,"f")];Vr(this,Kc,"f").call(this,s),delete Vr(this,Rd,"f")[Vr(this,Is,"f")],Jd(this,Is,Vr(this,Is,"f")+1)}Vr(this,Is,"f")===Vr(this,zv,"f")&&this.cleanupCallback()}else Vr(this,Rd,"f")[r]=i})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){Jd(this,Kc,e)}get onmessage(){return Vr(this,Kc,"f")}[(Kc=new WeakMap,Is=new WeakMap,Rd=new WeakMap,zv=new WeakMap,wV)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[wV]()}}async function Pn(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}class JAe{get rid(){return Vr(this,_y,"f")}constructor(e){_y.set(this,void 0),Jd(this,_y,e)}async close(){return Pn("plugin:resources|close",{rid:this.rid})}}_y=new WeakMap;var IE;(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"})(IE||(IE={}));var $E;(function(t){t[t.Start=0]="Start",t[t.Current=1]="Current",t[t.End=2]="End"})($E||($E={}));function QQ(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 RQ extends JAe{async read(e){if(e.byteLength===0)return 0;const[n,r]=await Pn("plugin:fs|read",{rid:this.rid,len:e.byteLength});return e.set(n),r===0?null:r}async seek(e,n){return await Pn("plugin:fs|seek",{rid:this.rid,offset:e,whence:n})}async stat(){const e=await Pn("plugin:fs|fstat",{rid:this.rid});return QQ(e)}async truncate(e){await Pn("plugin:fs|ftruncate",{rid:this.rid,len:e})}async write(e){return await Pn("plugin:fs|write",{rid:this.rid,data:e})}}async function KAe(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await Pn("plugin:fs|create",{path:t instanceof URL?t.toString():t,options:e});return new RQ(n)}async function eQe(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await Pn("plugin:fs|open",{path:t instanceof URL?t.toString():t,options:e});return new RQ(n)}async function tQe(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 Pn("plugin:fs|copy_file",{fromPath:t instanceof URL?t.toString():t,toPath:e instanceof URL?e.toString():e,options:n})}async function wY(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Pn("plugin:fs|mkdir",{path:t instanceof URL?t.toString():t,options:e})}async function TY(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await Pn("plugin:fs|read_dir",{path:t instanceof URL?t.toString():t,options:e})}async function CY(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await Pn("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 _Q(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await Pn("plugin:fs|read_text_file",{path:t instanceof URL?t.toString():t,options:e})}async function nQe(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 Pn("plugin:fs|read_text_file_lines",{path:n,options:e}));const[r,i]=await Pn("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 PY(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Pn("plugin:fs|remove",{path:t instanceof URL?t.toString():t,options:e})}async function kY(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 Pn("plugin:fs|rename",{oldPath:t instanceof URL?t.toString():t,newPath:e instanceof URL?e.toString():e,options:n})}async function rQe(t,e){const n=await Pn("plugin:fs|stat",{path:t instanceof URL?t.toString():t,options:e});return QQ(n)}async function iQe(t,e){const n=await Pn("plugin:fs|lstat",{path:t instanceof URL?t.toString():t,options:e});return QQ(n)}async function sQe(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Pn("plugin:fs|truncate",{path:t instanceof URL?t.toString():t,len:e,options:n})}async function oQe(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Pn("plugin:fs|write_file",e,{headers:{path:t instanceof URL?t.toString():t,options:JSON.stringify(n)}})}async function EY(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Pn("plugin:fs|write_text_file",{path:t instanceof URL?t.toString():t,data:e,options:n})}async function jQ(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await Pn("plugin:fs|exists",{path:t instanceof URL?t.toString():t,options:e})}async function IY(t){await Pn("plugin:fs|unwatch",{rid:t})}async function aQe(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 SY;s.onmessage=e;const o=await Pn("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:r,onEvent:s});return()=>{IY(o)}}async function lQe(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 SY;s.onmessage=e;const o=await Pn("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:r,onEvent:s});return()=>{IY(o)}}const TO=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return IE},FileHandle:RQ,get SeekMode(){return $E},copyFile:tQe,create:KAe,exists:jQ,lstat:iQe,mkdir:wY,open:eQe,readDir:TY,readFile:CY,readTextFile:_Q,readTextFileLines:nQe,remove:PY,rename:kY,stat:rQe,truncate:sQe,watch:aQe,watchImmediate:lQe,writeFile:oQe,writeTextFile:EY},Symbol.toStringTag,{value:"Module"}));function cQe(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function Yt(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}var En;(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"})(En||(En={}));async function uQe(){return Yt("plugin:path|resolve_directory",{directory:En.AppConfig})}async function AE(){return Yt("plugin:path|resolve_directory",{directory:En.AppData})}async function dQe(){return Yt("plugin:path|resolve_directory",{directory:En.AppLocalData})}async function fQe(){return Yt("plugin:path|resolve_directory",{directory:En.AppCache})}async function hQe(){return Yt("plugin:path|resolve_directory",{directory:En.Audio})}async function pQe(){return Yt("plugin:path|resolve_directory",{directory:En.Cache})}async function gQe(){return Yt("plugin:path|resolve_directory",{directory:En.Config})}async function mQe(){return Yt("plugin:path|resolve_directory",{directory:En.Data})}async function $Y(){return Yt("plugin:path|resolve_directory",{directory:En.Desktop})}async function OQe(){return Yt("plugin:path|resolve_directory",{directory:En.Document})}async function vQe(){return Yt("plugin:path|resolve_directory",{directory:En.Download})}async function yQe(){return Yt("plugin:path|resolve_directory",{directory:En.Executable})}async function bQe(){return Yt("plugin:path|resolve_directory",{directory:En.Font})}async function xQe(){return Yt("plugin:path|resolve_directory",{directory:En.Home})}async function SQe(){return Yt("plugin:path|resolve_directory",{directory:En.LocalData})}async function wQe(){return Yt("plugin:path|resolve_directory",{directory:En.Picture})}async function TQe(){return Yt("plugin:path|resolve_directory",{directory:En.Public})}async function CQe(){return Yt("plugin:path|resolve_directory",{directory:En.Resource})}async function PQe(t){return Yt("plugin:path|resolve_directory",{directory:En.Resource,path:t})}async function kQe(){return Yt("plugin:path|resolve_directory",{directory:En.Runtime})}async function EQe(){return Yt("plugin:path|resolve_directory",{directory:En.Template})}async function IQe(){return Yt("plugin:path|resolve_directory",{directory:En.Video})}async function $Qe(){return Yt("plugin:path|resolve_directory",{directory:En.AppLog})}async function AQe(){return Yt("plugin:path|resolve_directory",{directory:En.Temp})}function AY(){return window.__TAURI_INTERNALS__.plugins.path.sep}function QQe(){return window.__TAURI_INTERNALS__.plugins.path.delimiter}async function QY(...t){return Yt("plugin:path|resolve",{paths:t})}async function RQe(t){return Yt("plugin:path|normalize",{path:t})}async function NQ(...t){return Yt("plugin:path|join",{paths:t})}async function RY(t){return Yt("plugin:path|dirname",{path:t})}async function _Y(t){return Yt("plugin:path|extname",{path:t})}async function DQ(t,e){return Yt("plugin:path|basename",{path:t,ext:e})}async function jY(t){return Yt("plugin:path|is_absolute",{path:t})}const MQ=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return En},appCacheDir:fQe,appConfigDir:uQe,appDataDir:AE,appLocalDataDir:dQe,appLogDir:$Qe,audioDir:hQe,basename:DQ,cacheDir:pQe,configDir:gQe,dataDir:mQe,delimiter:QQe,desktopDir:$Y,dirname:RY,documentDir:OQe,downloadDir:vQe,executableDir:yQe,extname:_Y,fontDir:bQe,homeDir:xQe,isAbsolute:jY,join:NQ,localDataDir:SQe,normalize:RQe,pictureDir:wQe,publicDir:TQe,resolve:QY,resolveResource:PQe,resourceDir:CQe,runtimeDir:kQe,sep:AY,tempDir:AQe,templateDir:EQe,videoDir:IQe},Symbol.toStringTag,{value:"Module"})),Qo=window.__TAURI__?.http.fetch??globalThis.fetch;function TV(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 NY(t,e){const n=TV(t),r=e.find(({host:i,port:s})=>TV(`https://${i}:${s}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}const _Qe={id:"default",userFilesDir:"default",systemFilesDir:"default"},D0=Rl(Dr(_Qe));D0.debugLabel="project";function hd(){return Ir(D0)}function QE(){return{STATUS_CODE_CHECK:"error",SCHEMA_CHECK:"error",CONTENT_TYPE_CHECK:"error"}}const jQe=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function NQe(){const{userFilesDir:t}=hd(),{certificates:e}=pi(),n=Ft(),{getCollection:r}=fd();return{execute:async(s,o,a)=>{const l=r(s),{inputs:c,servers:u}=n,d=l?.sourceDescriptions??[],h=`${t}/${s}`,[{createConfig:p},{ExternalResolver:m}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-CbF5pwt2.js")),Promise.resolve().then(()=>require("./replay-external-resolver-DKDcfTBb.js"))]),g=new m,O=c.map(w=>JSON.stringify({[w.name]:w.value})),v=DQe(u,d),{run:x}=await Promise.resolve().then(()=>require("./replay-respect-run-ClSyJINq.js")),y=await x({files:[h],workflow:o?[o]:[],fetch:(w,S)=>{const P=jQe(w),{clientCert:k,clientKey:I}=NY(P,e);return Qo(P,{...S,clientCert:k,clientKey:I})},logger:mS,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async w=>{if(!await jQ(w))throw new Error(`File ${w} doesn't exist or isn't readable.`);try{const P=await _Q(w),k=new TextEncoder().encode(P);return new File([k],await DQ(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 DQe(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 MQe="com.redocly.tab.openFailed";function hf(t){return{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Ue.Step,draftStep:null,response:null,requestError:null,isProcessingRequest:!1,...t}}function RE(t,e){const n=t.draftStep?.xOperation;return n?.method===e.method&&n?.url===e.url}function VQe(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:SA(wO(s),l.parameters.queryParameters)}}}:a})}function hr(){const{getTabs:t,getActiveTabIdx:e,setTabs:n,setActiveTabIdx:r,updateTabAt:i,updateTabDataAt:s}=sd(),{dynamicReplayValues:o}=Fn(),{getStep:a}=yY(),{getHistoryItem:l}=GAe(),{getWorkflow:c}=AQ(),{getCollection:u}=fd(),{getApiOperation:d}=EQ(),{sendEvent:h}=Ke(),p=fIe(),m=b.useCallback((N,M,D,F)=>{console.warn(`[useTabHandlers] ${N}`,F),h(MQe,[{...ye("tab",M),reason:D,...F}])},[h]),g=b.useCallback((N,M)=>{const D=t()[N];D&&D.state!==M&&i(N,F=>({...F,state:M}))},[t,i]),O=b.useCallback(N=>{r(N)},[r]),v=b.useCallback(()=>{const N=t().length;n(M=>[...M,xAe()]),r(N)},[t,n,r]),x=b.useCallback(N=>{const M=[...t().filter(F=>F.state!==An.Preview)];M.push(N),n(()=>M);const D=M.length-1;return r(D),D},[t,n,r]),y=b.useCallback(N=>{const M=d(N),D=VQ(N,M,o);x(D)},[x,o,d]),w=b.useCallback(N=>{const M=t().findIndex(({data:D})=>T9(D,N));return M===-1?!1:(O(M),!0)},[t,O]),S=b.useCallback((N,M)=>{const D=t(),F=G=>D.findIndex(({data:ee})=>Rn(ee,Ue.Step)&&G(ee));if(M){const G=F(ne=>ne.sourceFile===M);if(G!==-1){VQe(D[G].data,ne=>s(G,ne),N),O(G);return}const ee=F(ne=>!ne.sourceFile&&RE(ne,N));if(ee!==-1){s(ee,ne=>({...ne,sourceFile:M})),O(ee);return}}else{const G=F(ee=>RE(ee,N));if(G!==-1){O(G);return}}const W=Na({xOperation:N,name:M??void 0});x({id:crypto.randomUUID(),state:An.Normal,data:hf({draftStep:W,activeTabName:vu(W),sourceFile:M??null})})},[t,s,O,x]),P=b.useCallback(N=>{const M=t(),D=e(),F=M[D]?.id,W=M.filter((ee,ne)=>ne!==N);n(()=>W);const G=N===D||!F?-1:W.findIndex(ee=>ee.id===F);r(G===-1?Math.max(0,N-1):G)},[t,e,r,n]),k=b.useCallback(()=>{n(()=>[]),r(0)},[r,n]);function I({collectionId:N,workflowId:M,stepId:D}){const F=t(),W=new Set;for(let G=0;G<F.length;G++){const ee=F[G].data;switch(ee.type){case Ue.Step:ee.collectionId===N&&ee.workflowId===M&&ee.stepId===D&&W.add(G);break;case Ue.Workflow:case Ue.WorkflowRun:ee.collectionId===N&&ee.workflowId===M&&!D&&W.add(G);break;case Ue.Collection:ee.collectionId===N&&!M&&!D&&W.add(G);break}}W.size&&(n(G=>G.filter((ee,ne)=>!W.has(ne))),r(0))}const E=b.useCallback(async N=>{const M=t().findIndex(({data:D})=>Rn(D,Ue.Step)&&D.historyId===N);if(M!==-1)r(M);else{const D=await l(N);if(!D||!jk(D)){m("Step history not found","stepHistoryTab","step_history_not_found",{historyId:N});return}const F=D.step;x({id:crypto.randomUUID(),state:An.Preview,data:hf({historyId:N,draftStep:structuredClone(F),response:structuredClone(D.response),activeTabName:vu(F)})})}},[r,t,x,l,m]),Q=b.useCallback(({collectionId:N,activeTabName:M})=>{const D=t().findIndex(F=>{const W=F.data;return Rn(W,Ue.Collection)&&W.collectionId===N});if(D!==-1)r(D);else{if(!u(N)){m("Collection not found","collectionTab","collection_not_found",{collectionId:N});return}x({id:crypto.randomUUID(),state:An.Preview,data:{collectionId:N,type:Ue.Collection,activeTabName:M??it.COLLECTION_SETTINGS}})}},[r,t,x,u,m]),j=b.useCallback(({collectionId:N,workflowId:M})=>{if(!c({collectionId:N,workflowId:M})){m("Workflow not found","workflowRunTab","workflow_not_found",{collectionId:N,workflowId:M});return}x({id:crypto.randomUUID(),state:An.Normal,data:{collectionId:N,workflowId:M,historyId:null,runDate:null,type:Ue.WorkflowRun,result:null,severitySettings:QE()}})},[x,c,m]),R=b.useCallback(async(N,{state:M=An.Preview}={})=>{const D=t().findIndex(({data:F})=>Rn(F,Ue.WorkflowRun)&&F.historyId===N);if(D!==-1)M===An.Normal&&t()[D].state===An.Preview&&g(D,An.Normal),r(D);else{const F=await l(N);if(!F||!Nk(F)){m("Workflow history not found","workflowHistoryTab","workflow_history_not_found",{historyId:N});return}x({id:crypto.randomUUID(),state:M,data:{collectionId:F.collectionId,workflowId:F.workflowId,historyId:N,runDate:F.date,type:Ue.WorkflowRun,result:structuredClone(F.workflowResult),severitySettings:QE(),label:Bh(F.workflow),secretValues:p().inputs.filter(W=>W.isSecret&&W.value).map(W=>String(W.value))}})}},[r,t,x,g,l,m,p]),V=b.useCallback(({collectionId:N,workflowId:M})=>{const D=t().findIndex(({data:F})=>Rn(F,Ue.WorkflowRun)&&F.collectionId===N&&F.workflowId===M);return D===-1?!1:(t()[D].state===An.Preview&&g(D,An.Normal),O(D),!0)},[t,g,O]),z=b.useCallback(({collectionId:N,workflowId:M,activeTabName:D})=>{const F=t().findIndex(W=>{const G=W.data;return Rn(G,Ue.Workflow)&&G.workflowId===M&&G.collectionId===N});if(F!==-1)D&&s(F,W=>({...W,activeTabName:D})),r(F);else{if(!c({collectionId:N,workflowId:M})){m("Workflow not found","workflowTab","workflow_not_found",{collectionId:N,workflowId:M});return}x({id:crypto.randomUUID(),state:An.Preview,data:{collectionId:N,workflowId:M,type:Ue.Workflow,activeTabName:D??it.WORKFLOW_SETTINGS}})}},[r,t,s,x,c,m]),X=b.useCallback(({collectionId:N,workflowId:M,stepId:D,state:F})=>{const W=t().findIndex(({data:G})=>Rn(G,Ue.Step)&&G.collectionId===N&&G.workflowId===M&&G.stepId===D&&G.historyId===null);if(W!==-1)r(W);else{const G=a({collectionId:N,workflowId:M,stepId:D});if(!G){m("Step not found","stepTab","step_not_found",{collectionId:N,workflowId:M,stepId:D});return}x({id:crypto.randomUUID(),state:F??An.Preview,data:hf({stepId:D,collectionId:N,workflowId:M,activeTabName:vu(G)})})}},[r,t,a,x,m]),A=b.useCallback(({step:N})=>{x({id:crypto.randomUUID(),state:An.Normal,data:hf({stepId:N.stepId??null,workflowId:N.workflowId??null,draftStep:structuredClone(N),activeTabName:vu(N)})})},[x]),U=b.useCallback((N,M)=>{if(N===M)return;const D=e(),F=[...t()],W=F[D]?.id,[G]=F.splice(N,1);if(F.splice(M,0,G),n(()=>F),W){const ee=F.findIndex(ne=>ne.id===W);r(ee)}},[e,t,n,r]);return{handleNewTabOpen:v,addNewTab:x,openStepTabFromOperation:y,focusOperationTab:w,openStepTabFromXOperation:S,handleTabChange:O,handleTabClose:P,handleCloseAllTabs:k,handleCloseByDataId:I,openCollectionTab:Q,openWorkflowTab:z,openWorkflowRunTab:j,openWorkflowRunTabFromHistory:R,focusWorkflowRunTab:V,openStepTabFromHistory:E,openStepTabFromCollection:X,openStepTab:A,handleTabReorder:U,changeTabState:g}}function VQ(t,e,n){const r=Na({operation:t,apiOperation:e,dynamicReplayValues:n});return{id:crypto.randomUUID(),state:An.Preview,data:hf({draftStep:r,activeTabName:vu(r)})}}function LQe(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.left>=r.left&&n.right<=r.right}const zQe=({transform:t})=>({...t,y:0}),XQe=({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))},pd=(t,e="currentColor")=>t?.startsWith("--")?`var(${t})`:t||e,UQe=t=>f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",...t,children:[f.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"}),f.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"})]}),PS=T.default(UQe)`
787
787
  path {
788
788
  fill: ${({color:t})=>pd(t)};
789
789
  }
@@ -1124,7 +1124,7 @@ ${D}`),U.pop(),`{${ee}}`}case"number":return isFinite(A)?String(A):y?y(A):"null"
1124
1124
  display: flex;
1125
1125
  flex-direction: column;
1126
1126
  gap: var(--spacing-xs);
1127
- `;function FRe({collection:t}){return f.jsx("div",{children:"TODO: ComponentsTab"})}function qY(t){const{attachApiServerToEnvironments:e}=gY(),n=qa(),{removeSourceDescription:r,disconnectStepsFromSource:i}=fd(),s=b.useCallback(l=>{const{name:c,apiId:u,sourceUrl:d,sourceDescriptionToEdit:h,sourceDescriptionToEditIndex:p}=l,m=c.trim(),g=h!==null&&p!==null;n(O=>Ui(O,t,v=>{if(g&&h!==null&&p!==null){const x=v.sourceDescriptions[p];if(x===void 0)return v;const y=[...v.sourceDescriptions];return y[p]={...x,name:m,url:d,apiId:u},{...v,sourceDescriptions:y}}return{...v,sourceDescriptions:[...v.sourceDescriptions,{name:m,url:d,apiId:u}]}})),e(u)},[t,n,e]),o=b.useCallback(l=>{r(t,l)},[t,r]),a=b.useCallback(l=>{i(t,l)},[t,i]);return{createOrUpdateSource:s,removeSourceDescription:o,disconnectStepsFromSource:a}}async function M0(t,e){const[{bundle:n,Config:r},{ExternalResolver:i}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-DajpN2Kv.js")),Promise.resolve().then(()=>require("./replay-external-resolver-BuY7tjwA.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"},IV=/^[A-Za-z0-9_-]+$/,qRe="apis";function WRe(t){if(!t)return{name:"",activeTab:qRe,selectedApiId:null,url:""};const e=Xs(t.url)||Xs(t.apiId);return{name:t.name,activeTab:e?"url":"apis",selectedApiId:e?null:t.apiId,url:e?t.url:""}}function ZRe(t,e,n){return t.length===0?null:e?n?"This name already exists":null:"Name must match [A-Za-z0-9_-]+"}function BRe({collection:t,sourceDescriptionToEdit:e,sourceDescriptionToEditIndex:n}){const r=qo(),i=QA(),{createOrUpdateSource:s}=qY(t.id),o=WRe(e),[a,l]=b.useState(o.name),[c,u]=b.useState(o.activeTab),[d,h]=b.useState(o.selectedApiId),[p,m]=b.useState(o.url),g=!!e,O=a.trim(),v=b.useMemo(()=>new Set(t.sourceDescriptions.filter((V,z)=>z!==n).map(V=>V.name)),[t.sourceDescriptions,n]),x=O.length>0&&v.has(O),y=IV.test(O),w=ZRe(O,y,x),S=O.length>0&&y&&!x,P=p.trim(),k=P.length>0&&Xs(P),I=P.length>0&&!k?"Please enter a valid URL":null,E=S&&(c==="apis"?!!d:!!k),Q=b.useMemo(()=>r.map(V=>({id:V.id,name:V.info.title,path:Xs(V.id)?V.id:`./${V.id.replace(/^\//,"")}`})),[r]),j=b.useCallback(async()=>{const V=t.id,z=p.trim();if(c==="apis"){if(!d)return null;const A=Xs(d)?d:await sn.relative(`/${V}/..`,`/${d}`);return{apiId:d,sourceUrl:A}}if(!z||!Xs(z))return null;if(!r.some(A=>A.id===z)){const{definition:A,fileDependencies:U}=await M0(z);i(N=>[...N,{id:z,srcType:qi.WEB,...A,...U&&{fileDependencies:U}}])}return{apiId:z,sourceUrl:z}},[c,r,i,t,d,p]),R=b.useCallback(async()=>{const V=a.trim();if(!V||!IV.test(V))return;const z=await j();if(!z)return;const{apiId:X,sourceUrl:A}=z;s({name:V,apiId:X,sourceUrl:A,sourceDescriptionToEdit:g?e:null,sourceDescriptionToEditIndex:g?n:null})},[a,s,g,j,e,n]);return{name:a,setName:l,activeTab:c,setActiveTab:u,selectedApiId:d,setSelectedApiId:h,url:p,setUrl:m,nameErrorText:w,urlErrorText:I,canSubmit:E,apiItems:Q,handleSubmit:R}}const YRe=t=>f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",...t,children:[f.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"}),f.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"})]}),UQ=T.default(YRe)`
1127
+ `;function FRe({collection:t}){return f.jsx("div",{children:"TODO: ComponentsTab"})}function qY(t){const{attachApiServerToEnvironments:e}=gY(),n=qa(),{removeSourceDescription:r,disconnectStepsFromSource:i}=fd(),s=b.useCallback(l=>{const{name:c,apiId:u,sourceUrl:d,sourceDescriptionToEdit:h,sourceDescriptionToEditIndex:p}=l,m=c.trim(),g=h!==null&&p!==null;n(O=>Ui(O,t,v=>{if(g&&h!==null&&p!==null){const x=v.sourceDescriptions[p];if(x===void 0)return v;const y=[...v.sourceDescriptions];return y[p]={...x,name:m,url:d,apiId:u},{...v,sourceDescriptions:y}}return{...v,sourceDescriptions:[...v.sourceDescriptions,{name:m,url:d,apiId:u}]}})),e(u)},[t,n,e]),o=b.useCallback(l=>{r(t,l)},[t,r]),a=b.useCallback(l=>{i(t,l)},[t,i]);return{createOrUpdateSource:s,removeSourceDescription:o,disconnectStepsFromSource:a}}async function M0(t,e){const[{bundle:n,Config:r},{ExternalResolver:i}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-CbF5pwt2.js")),Promise.resolve().then(()=>require("./replay-external-resolver-DKDcfTBb.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"},IV=/^[A-Za-z0-9_-]+$/,qRe="apis";function WRe(t){if(!t)return{name:"",activeTab:qRe,selectedApiId:null,url:""};const e=Xs(t.url)||Xs(t.apiId);return{name:t.name,activeTab:e?"url":"apis",selectedApiId:e?null:t.apiId,url:e?t.url:""}}function ZRe(t,e,n){return t.length===0?null:e?n?"This name already exists":null:"Name must match [A-Za-z0-9_-]+"}function BRe({collection:t,sourceDescriptionToEdit:e,sourceDescriptionToEditIndex:n}){const r=qo(),i=QA(),{createOrUpdateSource:s}=qY(t.id),o=WRe(e),[a,l]=b.useState(o.name),[c,u]=b.useState(o.activeTab),[d,h]=b.useState(o.selectedApiId),[p,m]=b.useState(o.url),g=!!e,O=a.trim(),v=b.useMemo(()=>new Set(t.sourceDescriptions.filter((V,z)=>z!==n).map(V=>V.name)),[t.sourceDescriptions,n]),x=O.length>0&&v.has(O),y=IV.test(O),w=ZRe(O,y,x),S=O.length>0&&y&&!x,P=p.trim(),k=P.length>0&&Xs(P),I=P.length>0&&!k?"Please enter a valid URL":null,E=S&&(c==="apis"?!!d:!!k),Q=b.useMemo(()=>r.map(V=>({id:V.id,name:V.info.title,path:Xs(V.id)?V.id:`./${V.id.replace(/^\//,"")}`})),[r]),j=b.useCallback(async()=>{const V=t.id,z=p.trim();if(c==="apis"){if(!d)return null;const A=Xs(d)?d:await sn.relative(`/${V}/..`,`/${d}`);return{apiId:d,sourceUrl:A}}if(!z||!Xs(z))return null;if(!r.some(A=>A.id===z)){const{definition:A,fileDependencies:U}=await M0(z);i(N=>[...N,{id:z,srcType:qi.WEB,...A,...U&&{fileDependencies:U}}])}return{apiId:z,sourceUrl:z}},[c,r,i,t,d,p]),R=b.useCallback(async()=>{const V=a.trim();if(!V||!IV.test(V))return;const z=await j();if(!z)return;const{apiId:X,sourceUrl:A}=z;s({name:V,apiId:X,sourceUrl:A,sourceDescriptionToEdit:g?e:null,sourceDescriptionToEditIndex:g?n:null})},[a,s,g,j,e,n]);return{name:a,setName:l,activeTab:c,setActiveTab:u,selectedApiId:d,setSelectedApiId:h,url:p,setUrl:m,nameErrorText:w,urlErrorText:I,canSubmit:E,apiItems:Q,handleSubmit:R}}const YRe=t=>f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",...t,children:[f.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"}),f.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"})]}),UQ=T.default(YRe)`
1128
1128
  path {
1129
1129
  fill: ${({color:t})=>pd(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)){X0(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(oc(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(c8(n.key)&&!oc(n.sep,"newline")){const o=Dd(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(oc(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const o=Dd(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]}):oc(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&&!oc(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)){X0(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||oc(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=Zv(r),s=Dd(i);RL(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=Zv(e),r=Dd(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=Zv(e),r=Dd(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 rNe(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new tNe||null,prettyErrors:e}}function iNe(t,e={}){const{lineCounter:n,prettyErrors:r}=rNe(e),i=new nNe(n?.addNewLine),s=new Gje(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 Gp(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(EL(t,n)),o.warnings.forEach(EL(t,n))),o}function oR(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function u8(t){return!hn(t)||t.value==null?null:typeof t.value=="string"?t.value:oR(t.value)?t.source??String(t.value):null}function $T(t,e){return u8(t)===e}function Eg(t){return hn(t)&&t.value==null}function tu(t){return t==null||Eg(t)||oi(t)||t instanceof Dt}function AT(t){return t==null||oi(t)||hn(t)&&(t.value==null||oR(t.value))}function sNe(t){return hn(t)&&typeof t.value=="string"}function So(t,e){return oi(t.getIn(e,!0))}function oNe(t){const{contents:e}=t;return e instanceof Dt&&e.items.length===0&&!e.commentBefore&&!e.comment&&!t.commentBefore&&!t.comment}const aNe="<<",_L="$ref";class lNe{constructor(e,n){this.providers=e,this.basePath=n}providers;basePath;sectionProblem(e){if(this.basePath.length===0){const s=e.contents;return tu(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(So(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 tu(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(Qc(o))continue;if(!tu(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(!tu(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(!AT(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(!tu(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 d=this.serverBodyProblem(String(u.key),u.value,n,i);if(d)return d}}return null}serverBodyProblem(e,n,r,i){if(!tu(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(!AT(o))return`The value of server ${e} of ${r} in ${i} must be a single value`;const a=n.get("variables",!0);if(!tu(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(!AT(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(!sNe(i.key))return`Replay reads only string keys, and ${n} holds ${String(i.key)}`;return null}reservedKeysProblem(e,n){return e.has(aNe)?`Replay cannot read a merge key, and ${n} uses one`:e.has(_L)?`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||Eg(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(_L))return!0}return!1}}const cNe=new Set(["inputs","servers"]),uNe=new Set(["value","variables"]);class dNe{constructor(e,n=[]){this.providers=e,this.basePath=n,this.validator=new lNe(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 u8(s)??(oR(r)?String(r):"")}extractEnvironments(e,n){const r=this.readSectionData(e);return r?Object.keys(r).filter(s=>!Qc(s)).map(s=>{const o=r[s]??{},a=Object.entries(o.inputs??{}).map(([c,u])=>{const d=this.providers.resolveProviderForMarker(u);return d?{name:c,value:d.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 d=this.sectionPath(s,"servers",c);return{apiId:c,value:this.leafText(e,[...d,"value"],u?.value),variables:Object.entries(u?.variables??{}).map(([h,p])=>({name:h,value:this.leafText(e,[...d,"variables",h],p)}))}});return{name:s,inputs:a,servers:l,state:Xt.Normal}}):[]}hydrateDocument(e,n,r){if(So(e,this.basePath))return e;for(let s=1;s<=this.basePath.length;s++){const o=this.basePath.slice(0,s);Eg(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);So(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&&So(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!cNe.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=>!uNe.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||Eg(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(!So(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(!So(e,l)){if(a.isSecret){const c=e.getIn(l,!0),u=c instanceof Dt?c.toJS(e):e.getIn(l),d=this.providers.resolveProviderForMarker(u);d||e.setIn(l,e.createNode(this.providers.getDefaultProvider().createMarker())),(d??this.providers.getDefaultProvider()).store(i,n,a.name,a.value);continue}$T(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(!So(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(So(e,a))continue;Eg(e.getIn(a,!0))&&e.setIn(a,this.createBlockMap(e));const l=[...a,"value"];!So(e,l)&&!$T(e.getIn(l,!0),o.value)&&e.setIn(l,o.value);const c=[...a,"variables"];if(So(e,c))continue;const u=new Set(o.variables.map(d=>d.name));this.deleteRemovedKeys(e,c,u),o.variables.length>0&&this.ensureBlockMap(e,c);for(const d of o.variables){const h=[...c,d.name];So(e,h)||$T(e.getIn(h,!0),d.value)||e.setIn(h,d.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()||Qc(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 fNe{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 hNe{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 pNe{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 gNe{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 jO={all:["notifications"],lists:()=>[...jO.all,"list"]};function mNe(){return ki.useQuery({queryKey:jO.lists(),queryFn:async()=>Am.getInstance().getAll()})}function ONe(){return ki.useQuery({queryKey:jO.lists(),queryFn:async()=>Am.getInstance().getAll(),select:t=>({total:t.reduce((e,n)=>e+n.issues.length,0),errorCount:t.reduce((e,n)=>e+n.errorCount,0)})})}class Am{static instance=null;static initialize(){this.close();const e=new gNe;this.instance=new pNe(e)}static getInstance(){if(!this.instance)throw new Error("NotificationsService not initialized");return this.instance}static close(){this.instance=null}}let QT=null;function VS(){return QT||(QT=new ki.QueryClient({defaultOptions:{queries:{staleTime:30*1e3,gcTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}})),QT}function vNe(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 yNe(t){const e=(t instanceof Error?t.message:String(t)).trim();return[{severity:"error",message:e,line:vNe(e)}]}function bNe(t){return t.map(e=>({severity:"error",message:e.message.trim(),line:e.linePos?.[0]?.line}))}async function aR(t){try{const e=Am.getInstance();await t(e),VS().invalidateQueries({queryKey:jO.all})}catch{}}async function U0(t,e){await aR(async n=>{await n.set(t,yNe(e))})}async function xNe(t,e){e.length!==0&&await aR(async n=>{await n.set(t,bNe(e))})}async function F0(t){await aR(async e=>{await e.clear(t)})}function jL(t){return RT(t,e=>e.name).map(e=>({...e,inputs:Rk(e.inputs),servers:RT(e.servers,n=>n.apiId).map(n=>({...n,variables:RT(n.variables,r=>r.name)}))}))}function RT(t,e){const n=new Set,r=[];for(const i of t){const s=e(i);!SNe(s)||n.has(s)||(n.add(s),r.push(i))}return r}function SNe(t){return!!t.trim()&&!Qc(t)}function wNe(t,e){return NL(t)===NL(e)}function NL(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 DL(t){if(t.length===0)return!0;if(t.length>1)return!1;const[e]=t;return e.name===Lh&&e.inputs.length===0&&e.servers.length===0}class TNe{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 dNe(new hNe([new fNe],"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,Md(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=jL(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(DL(i)){if(this.isSection){if(DL(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 wNe(jL(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 RO({}),i,r)}catch(l){return console.error(`Failed to update ${e}`,l),await this.blockOn(e,Md(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,Md(l),"secrets",s),"unavailable"}return this.store(e,a,s)}async serialize(e,n,{allowEmptyFile:r=!1}={}){try{return r&&oNe(n)?"":n.toString()}catch(i){return console.error(`Failed to serialize ${e}`,i),await this.blockOn(e,Md(i)),null}}async store(e,n,r){try{await this.storage.set(e,n)}catch(i){return await this.reportUnavailable(e,Md(i),"file",r),"unavailable"}return"written"}async blockOn(e,n){this.configError={filePath:e,issues:[{message:n.message}]},await U0(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 U0(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=iNe(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 xNe(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:Md(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=>F0(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 Md(t){return t instanceof Error?t:new Error(String(t))}const ML=[1e3,3e3,1e4];class CNe{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<ML.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=ML[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 PNe{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 XE=(t,e)=>({data:t,version:e});class d8 extends PNe{constructor(e,n,r,i){super(e,n,r),this.version=i}version;migrationMap={};migrate(e){if(!this.migrationMap[e.version])return XE(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(XE(e,this.version))}}const VL={activeTabIdx:0,tabs:[]};function kNe(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===Ue.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 ENe(t){const e=mh();return{...e,...t,formData:{...e.formData,...t?.formData}}}const _T=2,INe="tabs.json";class $Ne extends d8{migrationMap={1:kNe};constructor(e){super(e,INe,_a(VL),_T)}async parse(e){let n=null;try{n=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}n||(n=XE(_a(VL),_T)),n.version!==_T&&(n=this.migrate(n));const r=await Promise.all(n.data.tabs.map(async i=>{if(i.data.type===Ue.Step){if(i.data.draftStep){i.data.draftStep.requestBody=ENe(i.data.draftStep.requestBody);const s=i.data.draftStep.requestBody.formData;s["multipart/form-data"]=await LL(s["multipart/form-data"]),s["application/x-www-form-urlencoded"]=await LL(s["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await IO(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===Ue.Step){const{isProcessingRequest:i,...s}=r.data;return{...r,data:{...s,response:null}}}return r.data.type===Ue.WorkflowRun?{...r,data:{...r.data,result:null,runStatus:null,runError:null}}:r})};return super.stringify(n)}}async function LL(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 hG(r)}return n}))}const ANe=1;class f8{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 g2e(this.project.id);const l=new p2e;this.activeEnvironmentIdStorage=new d8(this.systemFilesStorage,"active_environment_id.json",Lh,ANe),this.tabsStateStorage=new $Ne(this.systemFilesStorage),this.environmentsStorage=new TNe(this.userFilesStorage,this.localStorageSecretsProvider,s),this.environmentsWriter=new CNe(this.environmentsStorage,s.rebuildWhenUnparseable),this.collectionsStorage=new B2e(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new m2e(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 QNe extends f8{constructor(e,n,r){const i=new jE(e.systemFilesDir),s=new jE(e.userFilesDir);super(i,s,e,!1,{filePaths:[f2e],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=_c.load(c);if(typeof u=="object"&&u!==null)if(typeof u.openapi=="string"){const d=await sn.resolve(await sn.join(this.userFilesStorage.baseDir,l)),{definition:h}=await M0(d,u);s.push({uri:l,type:qi.FS,content:h}),await F0(l)}else typeof u.arazzo=="string"&&(o.push({uri:l,type:qi.FS,content:u}),await F0(l),u.sourceDescriptions?.forEach(d=>{const h=d.type,p=d.url,m=!h||h==="openapi",g=typeof p=="string"&&Xs(p);m&&g&&a.add(p)}))}catch(u){console.info(`Error parsing YAML/JSON file ${l}:`,u),await U0(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 M0(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),d=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:d}}}function RNe(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 _Ne(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&&!fm(s,i)}),removed:t.filter(i=>!r.has(i.id)).map(i=>i.id)}}function h8(t=!1){let e,n,r=!1,i=Promise.resolve(),s=null,o=null,a=null,l=null,c=[],u=null,d=!1,h=null,p=null,m=[],g=[];function O(k){if(v(),!e)return;m=k.get(_s),g=k.get(Po);let I=!1;c.push(k.sub($o,()=>{r||!e||e.writeActiveEnvironmentId(k.get($o))}),k.sub(si,()=>{r||!e||d||e.writeEnvironments(k.get(si))}),k.sub(_s,()=>{const Q=k.get(_s),j=RNe(m,Q);m=Q,!(r||!e)&&e.writeApis(j)}),k.sub(Po,()=>{const Q=k.get(Po),j=_Ne(g,Q);g=Q,!(r||!e)&&e.writeCollections(j)}),k.sub(Zr,E),k.sub(Os,E));function E(){if(r||!e||I)return;I=!0;const Q=e;queueMicrotask(()=>{I=!1,!(r||e!==Q)&&Q.writeTabsState({activeTabIdx:k.get(Os),tabs:k.get(Zr)})})}}function v(){c.forEach(k=>k()),c=[]}function x(){l&&(l(),l=null)}async function y(k){if(!(!Qn()||!e||!a||!u||!h||!p)){await w();try{const{FileWatcher:I}=await Promise.resolve().then(()=>require("./replay-FileWatcher-DpvlfPhp.js")),E=a.get(D0).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(){Qn()&&(await w(),await Yt("cleanup_all_managed_watchers"))}const P=async(k,I,E,Q)=>{r=!0;try{const{convertOperationToReplayValue:j,aiEnabled:R}=I,V=Qn();if(a=E,x(),v(),t){E.set(si,[]);return}if(V){const{TauriRootStorage:D}=await Promise.resolve().then(()=>require("./replay-TauriRootStorage-PRPSPxCM.js"));n=new D(k,j,Q),e=n}else n=void 0,e=new QNe(k,j,Q);if(V){await w();const{getSemanticSearchService:D}=await Promise.resolve().then(()=>require("./replay-index-BEVJgOvG.js"));D().setProject(k.id)}u={get:()=>E.get(si),set:D=>{d=!0;try{E.set(si,D)}finally{d=!1}}},h={get:()=>E.get(_s),set:D=>E.set(_s,D)},p={get:()=>E.get(Po),set:D=>E.set(Po,D)},e.setConfigFileErrorAccessor({get:()=>E.get(V0),set:D=>E.set(V0,D)});const{project:z,activeEnvironmentId:X,environments:A,apis:U,collections:N,tabsState:M}=await e.read();if(E.set(D0,z),E.set($o,X),E.set(si,A),E.set(_s,U),E.set(Po,N),E.set(Zr,M.tabs),E.set(Os,M.activeTabIdx),O(E),V&&e.publishEnvironmentsConfigError(),!V)return;if(await y(R??!1),R){const[{getSemanticSearchService:D},{createIndexSnapshotGetter:F,startPeriodicIndexRevalidation:W}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-BEVJgOvG.js")),Promise.resolve().then(()=>require("./replay-periodic-revalidation-CQucebne.js"))]),G=D();G.preloadModel().catch(()=>{}),G.reindex(F(E)).catch(ee=>{console.error("Semantic reindex failed:",ee)}),l=W(G,E)}}finally{r=!1}};return{getTauriRootStorage:()=>n,cleanup:async()=>{s=null,x(),v(),await S()},init:async(k,I,E,Q)=>{if(s&&s.store===E&&s.projectId===k.id)return s.run;const j=i,R=(async()=>(await j,P(k,I,E,Q)))();i=R.then(()=>{},()=>{});const V={store:E,projectId:k.id,run:R};return s=V,R.catch(()=>{s===V&&(s=null)}),R}}}const jNe=h8(),p8=b.createContext(jNe),NNe=p8.Provider;function g8(){return b.useContext(p8)}const DNe="Fetching from URL...",MNe="Source updated",jT="Failed to re-fetch source";function VNe({sourceUrl:t,apiId:e}){const r=g8().getTauriRootStorage(),i=QA(),{loading:s,updateToast:o,dismissToast:a}=EI.useToast(),[l,c]=b.useState(!1),[u,d]=b.useState(!1),h=b.useRef(null);kh(b.useId(),l),b.useEffect(()=>()=>{h.current&&a(h.current)},[a]);const p=b.useCallback(O=>{c(O)},[]),m=b.useCallback(()=>{c(!1)},[]),g=b.useCallback(async()=>{if(u)return;d(!0),c(!1);const O=s(DNe);h.current=O;try{if(!r)throw new Error(jT);const[v]=await r.loadAndParseApis([{absolute_path:t,relative_path:e}],void 0,!0);if(!v)throw new Error(jT);i(x=>x.some(y=>y.id===e)?x.map(y=>y.id===e?v:y):[...x,v]),o(O,{type:"success",title:MNe})}catch(v){const x=v instanceof Error?v.message:jT;o(O,{type:"error",title:x})}finally{h.current===O&&(h.current=null),d(!1)}},[e,i,u,s,t,r,o]);return f.jsx(Xn,{trigger:"click",placement:"bottomRight",visible:l,onVisibleChange:p,content:f.jsx(LNe,{sourceUrl:t,onClose:m,onConfirm:g}),children:f.jsx(Ln.Tooltip,{tip:"Re-fetch source",children:f.jsx(ZNe,{children:f.jsx(be.Button,{variant:"text",size:"small",icon:f.jsx(o9.RenewIcon,{size:"14px"}),disabled:u})})})})}function LNe({sourceUrl:t,onClose:e,onConfirm:n}){return f.jsxs(zNe,{onClick:r=>r.stopPropagation(),children:[f.jsxs(XNe,{children:[f.jsxs(UNe,{children:[f.jsx(FNe,{children:f.jsx(bl.WarningFilledIcon,{size:"16px",color:"--color-warning-base"})}),f.jsx(Or.Typography,{children:"Re-fetch source"})]}),f.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."}),f.jsx(qNe,{title:t,children:t})]}),f.jsxs(WNe,{children:[f.jsx(be.Button,{variant:"text",size:"small",onClick:e,children:"Cancel"}),f.jsx(be.Button,{variant:"primary",size:"small",onClick:n,children:"Re-fetch"})]})]})}const zNe=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=Zv(e),r=Dd(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=Zv(e),r=Dd(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 rNe(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new tNe||null,prettyErrors:e}}function iNe(t,e={}){const{lineCounter:n,prettyErrors:r}=rNe(e),i=new nNe(n?.addNewLine),s=new Gje(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 Gp(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(EL(t,n)),o.warnings.forEach(EL(t,n))),o}function oR(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function u8(t){return!hn(t)||t.value==null?null:typeof t.value=="string"?t.value:oR(t.value)?t.source??String(t.value):null}function $T(t,e){return u8(t)===e}function Eg(t){return hn(t)&&t.value==null}function tu(t){return t==null||Eg(t)||oi(t)||t instanceof Dt}function AT(t){return t==null||oi(t)||hn(t)&&(t.value==null||oR(t.value))}function sNe(t){return hn(t)&&typeof t.value=="string"}function So(t,e){return oi(t.getIn(e,!0))}function oNe(t){const{contents:e}=t;return e instanceof Dt&&e.items.length===0&&!e.commentBefore&&!e.comment&&!t.commentBefore&&!t.comment}const aNe="<<",_L="$ref";class lNe{constructor(e,n){this.providers=e,this.basePath=n}providers;basePath;sectionProblem(e){if(this.basePath.length===0){const s=e.contents;return tu(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(So(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 tu(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(Qc(o))continue;if(!tu(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(!tu(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(!AT(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(!tu(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 d=this.serverBodyProblem(String(u.key),u.value,n,i);if(d)return d}}return null}serverBodyProblem(e,n,r,i){if(!tu(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(!AT(o))return`The value of server ${e} of ${r} in ${i} must be a single value`;const a=n.get("variables",!0);if(!tu(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(!AT(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(!sNe(i.key))return`Replay reads only string keys, and ${n} holds ${String(i.key)}`;return null}reservedKeysProblem(e,n){return e.has(aNe)?`Replay cannot read a merge key, and ${n} uses one`:e.has(_L)?`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||Eg(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(_L))return!0}return!1}}const cNe=new Set(["inputs","servers"]),uNe=new Set(["value","variables"]);class dNe{constructor(e,n=[]){this.providers=e,this.basePath=n,this.validator=new lNe(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 u8(s)??(oR(r)?String(r):"")}extractEnvironments(e,n){const r=this.readSectionData(e);return r?Object.keys(r).filter(s=>!Qc(s)).map(s=>{const o=r[s]??{},a=Object.entries(o.inputs??{}).map(([c,u])=>{const d=this.providers.resolveProviderForMarker(u);return d?{name:c,value:d.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 d=this.sectionPath(s,"servers",c);return{apiId:c,value:this.leafText(e,[...d,"value"],u?.value),variables:Object.entries(u?.variables??{}).map(([h,p])=>({name:h,value:this.leafText(e,[...d,"variables",h],p)}))}});return{name:s,inputs:a,servers:l,state:Xt.Normal}}):[]}hydrateDocument(e,n,r){if(So(e,this.basePath))return e;for(let s=1;s<=this.basePath.length;s++){const o=this.basePath.slice(0,s);Eg(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);So(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&&So(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!cNe.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=>!uNe.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||Eg(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(!So(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(!So(e,l)){if(a.isSecret){const c=e.getIn(l,!0),u=c instanceof Dt?c.toJS(e):e.getIn(l),d=this.providers.resolveProviderForMarker(u);d||e.setIn(l,e.createNode(this.providers.getDefaultProvider().createMarker())),(d??this.providers.getDefaultProvider()).store(i,n,a.name,a.value);continue}$T(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(!So(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(So(e,a))continue;Eg(e.getIn(a,!0))&&e.setIn(a,this.createBlockMap(e));const l=[...a,"value"];!So(e,l)&&!$T(e.getIn(l,!0),o.value)&&e.setIn(l,o.value);const c=[...a,"variables"];if(So(e,c))continue;const u=new Set(o.variables.map(d=>d.name));this.deleteRemovedKeys(e,c,u),o.variables.length>0&&this.ensureBlockMap(e,c);for(const d of o.variables){const h=[...c,d.name];So(e,h)||$T(e.getIn(h,!0),d.value)||e.setIn(h,d.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()||Qc(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 fNe{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 hNe{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 pNe{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 gNe{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 jO={all:["notifications"],lists:()=>[...jO.all,"list"]};function mNe(){return ki.useQuery({queryKey:jO.lists(),queryFn:async()=>Am.getInstance().getAll()})}function ONe(){return ki.useQuery({queryKey:jO.lists(),queryFn:async()=>Am.getInstance().getAll(),select:t=>({total:t.reduce((e,n)=>e+n.issues.length,0),errorCount:t.reduce((e,n)=>e+n.errorCount,0)})})}class Am{static instance=null;static initialize(){this.close();const e=new gNe;this.instance=new pNe(e)}static getInstance(){if(!this.instance)throw new Error("NotificationsService not initialized");return this.instance}static close(){this.instance=null}}let QT=null;function VS(){return QT||(QT=new ki.QueryClient({defaultOptions:{queries:{staleTime:30*1e3,gcTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}})),QT}function vNe(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 yNe(t){const e=(t instanceof Error?t.message:String(t)).trim();return[{severity:"error",message:e,line:vNe(e)}]}function bNe(t){return t.map(e=>({severity:"error",message:e.message.trim(),line:e.linePos?.[0]?.line}))}async function aR(t){try{const e=Am.getInstance();await t(e),VS().invalidateQueries({queryKey:jO.all})}catch{}}async function U0(t,e){await aR(async n=>{await n.set(t,yNe(e))})}async function xNe(t,e){e.length!==0&&await aR(async n=>{await n.set(t,bNe(e))})}async function F0(t){await aR(async e=>{await e.clear(t)})}function jL(t){return RT(t,e=>e.name).map(e=>({...e,inputs:Rk(e.inputs),servers:RT(e.servers,n=>n.apiId).map(n=>({...n,variables:RT(n.variables,r=>r.name)}))}))}function RT(t,e){const n=new Set,r=[];for(const i of t){const s=e(i);!SNe(s)||n.has(s)||(n.add(s),r.push(i))}return r}function SNe(t){return!!t.trim()&&!Qc(t)}function wNe(t,e){return NL(t)===NL(e)}function NL(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 DL(t){if(t.length===0)return!0;if(t.length>1)return!1;const[e]=t;return e.name===Lh&&e.inputs.length===0&&e.servers.length===0}class TNe{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 dNe(new hNe([new fNe],"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,Md(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=jL(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(DL(i)){if(this.isSection){if(DL(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 wNe(jL(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 RO({}),i,r)}catch(l){return console.error(`Failed to update ${e}`,l),await this.blockOn(e,Md(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,Md(l),"secrets",s),"unavailable"}return this.store(e,a,s)}async serialize(e,n,{allowEmptyFile:r=!1}={}){try{return r&&oNe(n)?"":n.toString()}catch(i){return console.error(`Failed to serialize ${e}`,i),await this.blockOn(e,Md(i)),null}}async store(e,n,r){try{await this.storage.set(e,n)}catch(i){return await this.reportUnavailable(e,Md(i),"file",r),"unavailable"}return"written"}async blockOn(e,n){this.configError={filePath:e,issues:[{message:n.message}]},await U0(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 U0(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=iNe(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 xNe(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:Md(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=>F0(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 Md(t){return t instanceof Error?t:new Error(String(t))}const ML=[1e3,3e3,1e4];class CNe{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<ML.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=ML[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 PNe{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 XE=(t,e)=>({data:t,version:e});class d8 extends PNe{constructor(e,n,r,i){super(e,n,r),this.version=i}version;migrationMap={};migrate(e){if(!this.migrationMap[e.version])return XE(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(XE(e,this.version))}}const VL={activeTabIdx:0,tabs:[]};function kNe(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===Ue.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 ENe(t){const e=mh();return{...e,...t,formData:{...e.formData,...t?.formData}}}const _T=2,INe="tabs.json";class $Ne extends d8{migrationMap={1:kNe};constructor(e){super(e,INe,_a(VL),_T)}async parse(e){let n=null;try{n=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}n||(n=XE(_a(VL),_T)),n.version!==_T&&(n=this.migrate(n));const r=await Promise.all(n.data.tabs.map(async i=>{if(i.data.type===Ue.Step){if(i.data.draftStep){i.data.draftStep.requestBody=ENe(i.data.draftStep.requestBody);const s=i.data.draftStep.requestBody.formData;s["multipart/form-data"]=await LL(s["multipart/form-data"]),s["application/x-www-form-urlencoded"]=await LL(s["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await IO(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===Ue.Step){const{isProcessingRequest:i,...s}=r.data;return{...r,data:{...s,response:null}}}return r.data.type===Ue.WorkflowRun?{...r,data:{...r.data,result:null,runStatus:null,runError:null}}:r})};return super.stringify(n)}}async function LL(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 hG(r)}return n}))}const ANe=1;class f8{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 g2e(this.project.id);const l=new p2e;this.activeEnvironmentIdStorage=new d8(this.systemFilesStorage,"active_environment_id.json",Lh,ANe),this.tabsStateStorage=new $Ne(this.systemFilesStorage),this.environmentsStorage=new TNe(this.userFilesStorage,this.localStorageSecretsProvider,s),this.environmentsWriter=new CNe(this.environmentsStorage,s.rebuildWhenUnparseable),this.collectionsStorage=new B2e(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new m2e(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 QNe extends f8{constructor(e,n,r){const i=new jE(e.systemFilesDir),s=new jE(e.userFilesDir);super(i,s,e,!1,{filePaths:[f2e],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=_c.load(c);if(typeof u=="object"&&u!==null)if(typeof u.openapi=="string"){const d=await sn.resolve(await sn.join(this.userFilesStorage.baseDir,l)),{definition:h}=await M0(d,u);s.push({uri:l,type:qi.FS,content:h}),await F0(l)}else typeof u.arazzo=="string"&&(o.push({uri:l,type:qi.FS,content:u}),await F0(l),u.sourceDescriptions?.forEach(d=>{const h=d.type,p=d.url,m=!h||h==="openapi",g=typeof p=="string"&&Xs(p);m&&g&&a.add(p)}))}catch(u){console.info(`Error parsing YAML/JSON file ${l}:`,u),await U0(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 M0(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),d=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:d}}}function RNe(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 _Ne(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&&!fm(s,i)}),removed:t.filter(i=>!r.has(i.id)).map(i=>i.id)}}function h8(t=!1){let e,n,r=!1,i=Promise.resolve(),s=null,o=null,a=null,l=null,c=[],u=null,d=!1,h=null,p=null,m=[],g=[];function O(k){if(v(),!e)return;m=k.get(_s),g=k.get(Po);let I=!1;c.push(k.sub($o,()=>{r||!e||e.writeActiveEnvironmentId(k.get($o))}),k.sub(si,()=>{r||!e||d||e.writeEnvironments(k.get(si))}),k.sub(_s,()=>{const Q=k.get(_s),j=RNe(m,Q);m=Q,!(r||!e)&&e.writeApis(j)}),k.sub(Po,()=>{const Q=k.get(Po),j=_Ne(g,Q);g=Q,!(r||!e)&&e.writeCollections(j)}),k.sub(Zr,E),k.sub(Os,E));function E(){if(r||!e||I)return;I=!0;const Q=e;queueMicrotask(()=>{I=!1,!(r||e!==Q)&&Q.writeTabsState({activeTabIdx:k.get(Os),tabs:k.get(Zr)})})}}function v(){c.forEach(k=>k()),c=[]}function x(){l&&(l(),l=null)}async function y(k){if(!(!Qn()||!e||!a||!u||!h||!p)){await w();try{const{FileWatcher:I}=await Promise.resolve().then(()=>require("./replay-FileWatcher-BezlpQyJ.js")),E=a.get(D0).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(){Qn()&&(await w(),await Yt("cleanup_all_managed_watchers"))}const P=async(k,I,E,Q)=>{r=!0;try{const{convertOperationToReplayValue:j,aiEnabled:R}=I,V=Qn();if(a=E,x(),v(),t){E.set(si,[]);return}if(V){const{TauriRootStorage:D}=await Promise.resolve().then(()=>require("./replay-TauriRootStorage-BkeH9lMX.js"));n=new D(k,j,Q),e=n}else n=void 0,e=new QNe(k,j,Q);if(V){await w();const{getSemanticSearchService:D}=await Promise.resolve().then(()=>require("./replay-index-DHAWtsCb.js"));D().setProject(k.id)}u={get:()=>E.get(si),set:D=>{d=!0;try{E.set(si,D)}finally{d=!1}}},h={get:()=>E.get(_s),set:D=>E.set(_s,D)},p={get:()=>E.get(Po),set:D=>E.set(Po,D)},e.setConfigFileErrorAccessor({get:()=>E.get(V0),set:D=>E.set(V0,D)});const{project:z,activeEnvironmentId:X,environments:A,apis:U,collections:N,tabsState:M}=await e.read();if(E.set(D0,z),E.set($o,X),E.set(si,A),E.set(_s,U),E.set(Po,N),E.set(Zr,M.tabs),E.set(Os,M.activeTabIdx),O(E),V&&e.publishEnvironmentsConfigError(),!V)return;if(await y(R??!1),R){const[{getSemanticSearchService:D},{createIndexSnapshotGetter:F,startPeriodicIndexRevalidation:W}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-DHAWtsCb.js")),Promise.resolve().then(()=>require("./replay-periodic-revalidation-DIONsjKq.js"))]),G=D();G.preloadModel().catch(()=>{}),G.reindex(F(E)).catch(ee=>{console.error("Semantic reindex failed:",ee)}),l=W(G,E)}}finally{r=!1}};return{getTauriRootStorage:()=>n,cleanup:async()=>{s=null,x(),v(),await S()},init:async(k,I,E,Q)=>{if(s&&s.store===E&&s.projectId===k.id)return s.run;const j=i,R=(async()=>(await j,P(k,I,E,Q)))();i=R.then(()=>{},()=>{});const V={store:E,projectId:k.id,run:R};return s=V,R.catch(()=>{s===V&&(s=null)}),R}}}const jNe=h8(),p8=b.createContext(jNe),NNe=p8.Provider;function g8(){return b.useContext(p8)}const DNe="Fetching from URL...",MNe="Source updated",jT="Failed to re-fetch source";function VNe({sourceUrl:t,apiId:e}){const r=g8().getTauriRootStorage(),i=QA(),{loading:s,updateToast:o,dismissToast:a}=EI.useToast(),[l,c]=b.useState(!1),[u,d]=b.useState(!1),h=b.useRef(null);kh(b.useId(),l),b.useEffect(()=>()=>{h.current&&a(h.current)},[a]);const p=b.useCallback(O=>{c(O)},[]),m=b.useCallback(()=>{c(!1)},[]),g=b.useCallback(async()=>{if(u)return;d(!0),c(!1);const O=s(DNe);h.current=O;try{if(!r)throw new Error(jT);const[v]=await r.loadAndParseApis([{absolute_path:t,relative_path:e}],void 0,!0);if(!v)throw new Error(jT);i(x=>x.some(y=>y.id===e)?x.map(y=>y.id===e?v:y):[...x,v]),o(O,{type:"success",title:MNe})}catch(v){const x=v instanceof Error?v.message:jT;o(O,{type:"error",title:x})}finally{h.current===O&&(h.current=null),d(!1)}},[e,i,u,s,t,r,o]);return f.jsx(Xn,{trigger:"click",placement:"bottomRight",visible:l,onVisibleChange:p,content:f.jsx(LNe,{sourceUrl:t,onClose:m,onConfirm:g}),children:f.jsx(Ln.Tooltip,{tip:"Re-fetch source",children:f.jsx(ZNe,{children:f.jsx(be.Button,{variant:"text",size:"small",icon:f.jsx(o9.RenewIcon,{size:"14px"}),disabled:u})})})})}function LNe({sourceUrl:t,onClose:e,onConfirm:n}){return f.jsxs(zNe,{onClick:r=>r.stopPropagation(),children:[f.jsxs(XNe,{children:[f.jsxs(UNe,{children:[f.jsx(FNe,{children:f.jsx(bl.WarningFilledIcon,{size:"16px",color:"--color-warning-base"})}),f.jsx(Or.Typography,{children:"Re-fetch source"})]}),f.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."}),f.jsx(qNe,{title:t,children:t})]}),f.jsxs(WNe,{children:[f.jsx(be.Button,{variant:"text",size:"small",onClick:e,children:"Cancel"}),f.jsx(be.Button,{variant:"primary",size:"small",onClick:n,children:"Re-fetch"})]})]})}const zNe=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 HXe(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function rw(t,...e){if(!HXe(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 m4(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 JXe(t,e){rw(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Mm(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function cC(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function sa(t,e){return t<<32-e|t>>>e}function KXe(t,e){return t<<e|t>>>32-e>>>0}const eUe=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",tUe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Vm(t){if(rw(t),eUe)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=tUe[t[n]];return e}function nUe(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function SJ(t){return typeof t=="string"&&(t=nUe(t)),rw(t),t}class rUe{}function wJ(t){const e=r=>t().update(SJ(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function iUe(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 eI(t,e,n){return t&e^~t&n}function sUe(t,e,n){return t&e^t&n^e&n}class TJ extends rUe{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=cC(this.buffer)}update(e){m4(this),e=SJ(e),rw(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=cC(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){m4(this),JXe(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,Mm(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let d=o;d<i;d++)n[d]=0;iUe(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=cC(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 d=0;d<c;d++)a.setUint32(4*d,u[d],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 Hl=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),oUe=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),aUe=Math.pow(2,32),lUe=Array.from({length:64},(t,e)=>Math.floor(aUe*Math.abs(Math.sin(e+1)))),ry=oUe.slice(0,4),uC=new Uint32Array(16);class cUe extends TJ{constructor(){super(64,16,8,!0),this.A=ry[0]|0,this.B=ry[1]|0,this.C=ry[2]|0,this.D=ry[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)uC[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=eI(i,s,o),c=a,u=[7,12,17,22]):a<32?(l=eI(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+lUe[a]+uC[c],r=o,o=s,s=i,i=i+KXe(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(){Mm(uC)}destroy(){this.set(0,0,0,0),Mm(this.buffer)}}const iw=wJ(()=>new cUe),uUe=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]),Jl=new Uint32Array(64);class dUe extends TJ{constructor(e=32){super(64,e,8,!1),this.A=Hl[0]|0,this.B=Hl[1]|0,this.C=Hl[2]|0,this.D=Hl[3]|0,this.E=Hl[4]|0,this.F=Hl[5]|0,this.G=Hl[6]|0,this.H=Hl[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 d=0;d<16;d++,n+=4)Jl[d]=e.getUint32(n,!1);for(let d=16;d<64;d++){const h=Jl[d-15],p=Jl[d-2],m=sa(h,7)^sa(h,18)^h>>>3,g=sa(p,17)^sa(p,19)^p>>>10;Jl[d]=g+Jl[d-7]+m+Jl[d-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:l,G:c,H:u}=this;for(let d=0;d<64;d++){const h=sa(a,6)^sa(a,11)^sa(a,25),p=u+h+eI(a,l,c)+uUe[d]+Jl[d]|0,g=(sa(r,2)^sa(r,13)^sa(r,22))+sUe(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(){Mm(Jl)}destroy(){this.set(0,0,0,0,0,0,0,0),Mm(this.buffer)}}const CJ=wJ(()=>new dUe);function fUe(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 hUe(t,e,n,r,i={}){const{inputs:s}=r,{requestBody:{content:o}}=t,{url:a,method:l}=SS(t,e,n,r,i),c=[...e?.security||[],...t.security].findLast(I=>I.securityType===te.DigestAuth);if(!c)return"";const{username:u,password:d,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,opaque:x}=c[te.DigestAuth],y=Qf(u,s,i),{pathname:w,search:S}=new URL(a),P=S?`${w}${S}`:w,k=pUe({username:y,password:Qf(d,s,i),uri:P,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,method:l,bodyContent:Qf(o,s,i)});return`Digest username="${y}", realm="${h}", nonce="${p}", uri="${P}", qop=${O}, nc=${v}, cnonce="${m}", response="${k}", algorithm=${g}${x?`, opaque="${x}"`:""}`}function pUe(t){const{username:e,password:n,realm:r,nonce:i,cnonce:s,algorithm:o,qop:a,nc:l,uri:c,method:u,bodyContent:d}=t,h=gUe(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(d)}`):h(`${u}:${c}`);return h(`${p}:${i}:${l}:${s}:${a}:${m}`).toString()}function gUe(t){return t?.replace("-sess","")==="SHA-256"?e=>Vm(CJ(e)):e=>Vm(iw(e))}function tI(t){return new TextEncoder().encode(t)}function mUe(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 OUe(t){return btoa(String.fromCharCode(...tI(t)))}function O4(t){return btoa(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function vUe(t){return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}async function yUe(t){const e=new TextEncoder().encode(t);return crypto?.subtle.digest("SHA-256",e)}function bUe(t){if(t)return btoa(String.fromCharCode.apply(null,new Uint8Array(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(new RegExp("(?<!=)=+$"),"")}function xUe(t){try{const n=new URL(t).hostname;return n==="localhost"||n==="127.0.0.1"}catch{return!1}}function J0(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function SUe(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 wUe=["json","xml","html","text"],TUe=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function dC(t,e){return t.get(e)??t.get(e.toLowerCase())}function CUe(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function PUe(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 kUe(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function EUe(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return TUe.some(r=>n.includes(r))?!0:n.startsWith("application/")?!wUe.some(r=>n.includes(r)):!1}async function IUe(t,e){const n=dC(t.headers,"content-type")?.split(";")[0].trim(),r=dC(t.headers,"content-disposition"),i=CUe(dC(t.headers,"content-length")),s=EUe(n,r),o=SUe(document.cookie);if(s){const h={fileName:PUe(r)||kUe(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 $Ue=":/?#[]@!$&'()*+,;=",AUe=new Set(["!","'","(",")","*"]);function QUe(t){return AUe.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function v4(t,e=!1){let n=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return n;const r=[...$Ue].map(i=>({char:i,encoded:QUe(i)}));for(const{char:i,encoded:s}of r)n=n.split(s).join(i);return n}function RUe(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function _Ue(t,e){const{exists:n}=await Promise.resolve().then(()=>TO),{join:r}=await Promise.resolve().then(()=>MQ),{baseName:i,extension:s}=RUe(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 jUe(t){return t.split(new RegExp("(\\{(?<!\\{[^}]*?\\{)[^}]+\\}|\\/)","g")).filter(e=>e!=="")}const jR=t=>t?.find(([e])=>e.toLowerCase()==="content-type")?.[1].split(";")[0],nI=t=>{switch(!0){case t.includes("jsonl"):return Gd.JSONL;case t.includes("x-ndjson"):return Gd.NDJSON;case t.includes("json-seq"):return Gd.JSONSeq;case t.includes("multipart/mixed"):return Gd.MultipartMixed;case t.includes("text/event-stream"):return Gd.TextStream;case t.includes("json"):return Hn.JSON;case t.includes("xml"):return Hn.XML;case t.includes("html"):return Hn.HTML;case t.includes("image"):return Hn.Image;default:return Hn.Text}},eg=new Map;function NUe(t){eg.get(t)?.abort()}function PJ(t){return t?t instanceof URLSearchParams?t.entries().next().done===!0:!1:!0}function DUe(t){if(!PJ(t))return t}function kJ(t,e){if(!e)return"same-origin";try{const n=new URL(e).origin;return new URL(xS(t)).origin===n?"include":"same-origin"}catch{return"same-origin"}}async function NR({collections:t,selectedEnvironment:e,step:n,onStepChange:r,settings:i,workflow:s,onWorkflowChange:o,collection:a,signal:l}){const{corsProxyUrl:c,credentialOrigin:u,certificates:d,features:h}=i,p=await OS(t,a?.id,s?.workflowId,OQ(n,s,a,e)),{url:m,method:g}=SS(n,s??void 0,a??void 0,e,p),O=c||"",v=AJ(n,s,a,e,p),x=GUe(m,u),y=HUe({proxyUrl:O,resolvedUrl:m,ignoreProxy:x,queryParameters:v}),w=await VUe(n,s??void 0,y,u,l);let S=n,P=s??void 0;const k=a??void 0;w?.target==="step"?(S=iy(S,w),r(U=>iy(U,w))):w?.target==="workflow"&&P&&(P=iy(P,w),o?.(U=>iy(U,w)));const I=ow(S,P,k,e,p,h),E=DUe(MR(S,e,p,h)),{clientCert:Q,clientKey:j}=NY(m,d),R=xS(y),V=g.toUpperCase(),z=!Ah.includes(V),X=z?"POST":V,A=z?{...I,"X-HTTP-Method-Override":V}:I;return{urlWithProxyAndProtocol:R,fetchMethod:X,fetchHeaders:A,body:E,credentials:kJ(R,u),mode:J0(R)?"same-origin":"cors",clientCert:Q,clientKey:j,resolvedUrl:m}}function DR(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 EJ(t,e,n,r,i,s){const{tabId:o,updateData:a}=t,l=_a(e.step);a(h=>({...h,isProcessingRequest:!0})),eg.get(o)?.abort();const c=new AbortController;eg.set(o,c);const{signal:u}=c,d=()=>eg.get(o)===c;try{const h=await NR({selectedEnvironment:r,settings:n,signal:u,...e}),p=Date.now(),m=await Qo(h.urlWithProxyAndProtocol,DR(h,u)),g=Date.now()-p,O=await IUe(m,g);if(!d())return;a(x=>({...x,requestError:null,response:O}));const v=_a(O);i?.(l,v),s?.({outcome:"success",status:O.status,duration:O.duration,size:O.size,content_type:jR(O.headers)})}catch(h){if(!d()||(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{d()&&(eg.delete(o),a(h=>({...h,isProcessingRequest:!1})))}}async function MUe({selectedEnvironment:t,settings:e,fileName:n,onProgress:r,...i}){const s=await NR({selectedEnvironment:t,settings:e,...i}),o=DR(s),a=Qn(),l=n||"response";let c=null;if(a){const{open:x}=await Promise.resolve().then(()=>require("./replay-index-CUoi3zH7.js")),y=await x({directory:!0,multiple:!1});if(!y)return;const w=Array.isArray(y)?y[0]:y;c=await _Ue(w,l)}const u=await Qo(s.urlWithProxyAndProtocol,o),d=u.headers.get("content-length"),h=d?Number.parseInt(d,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 x=u.body.getReader(),y=[];let w=0;for(;;){const{done:S,value:P}=await x.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:x}=await Promise.resolve().then(()=>TO),y=new Uint8Array(await g.arrayBuffer());if(!c)return;await x(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 iy(t,e){return{...t,security:t.security.map((n,r)=>r===e.index?{...n,[te.DigestAuth]:{...n[te.DigestAuth],...e.fields}}:n)}}async function VUe(t,e,n,r,i){const s=Rc(t),o=e?.security??[],l=[...o,...t.security].findLastIndex(p=>p.securityType===te.DigestAuth);if(l===-1)return null;const c=xS(n),u=await Qo(c,{signal:i,method:s.toUpperCase(),credentials:kJ(c,r),mode:J0(c)?"same-origin":"cors"}),d=fUe(u.headers.get("WWW-Authenticate")||""),h=l<o.length;return{target:h?"workflow":"step",index:h?l:l-o.length,fields:{nonce:d.nonce,realm:d.realm,qop:d.qop,algorithm:d.algorithm,opaque:d.opaque,cnonce:crypto.randomUUID(),nc:"00000001"}}}function LUe(t,e,n,r,i){return[...e?.security||[],...t.security].map(s=>{switch(s.securityType){case te.BasicAuth:{const o=s[te.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+OUe(`${_r(o.username,r,i)}:${_r(o.password,r,i)}`),active:!0,in:"header"}}case te.DigestAuth:return{id:"",key:"Authorization",value:hUe(t,e,n,r,i),active:!0,in:"header"};case te.JWT:return{id:"",key:"Authorization",value:"Bearer "+s[te.JWT].token,active:!0,in:"header"};case te.OAuth2:{const{grantType:o}=s[te.OAuth2],{accessToken:a}=s[te.OAuth2][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case te.OpenIDConnect:{const{grantType:o}=s[te.OpenIDConnect],{accessToken:a}=s[te.OpenIDConnect][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case te.APIKey:{const o=s[te.APIKey];return o.location===ms.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(s=>!!s)}function zUe(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"),d=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=!d.every(w=>o.some(S=>!ku(S)&&S.key===w.name)),v=!h.every(w=>a.some(S=>!ku(S)&&S.key===w.name)),x=!u.every(w=>l.some(S=>!ku(S)&&S.key===w.name)),y=Z$e(t,e,n);return!p&&!m&&!g&&!O&&!v&&!x&&!y}function sw(t,e,n={},r){const{requestBody:i}=t,o=Rc(t).toUpperCase();if(o==="GET"||o==="HEAD"||o==="OPTIONS")return null;try{if(i.type===Ge.FormData)return FUe(t,e,n);if(i.type===Ge.UrlEncoded)return UUe(t,e,n);if(i.type===Ge.Binary)return i.binary;if(i.type===Ge.GraphqlJSON&&Zh(Ge.GraphqlJSON,r)){const a=vl(i.content),l=_r(a.query,e,n),c=K6(_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 MR(t,e,n={},r){const{requestBody:i}=t,s=sw(t,e,n,r);if(s===null)return null;switch(i.type){default:return s;case Ge.FormData:return qUe(s);case Ge.UrlEncoded:return XUe(s);case Ge.Binary:return i.binary?.file??null}}function XUe(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function UUe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData[Ge.UrlEncoded];return jJ(s).forEach(o=>{const a=_r(o.value,e,n);i.push({key:_r(o.key,e,n),value:a,type:"text"})}),i}function FUe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData[Ge.FormData];return jJ(s).forEach(({type:o,files:a,value:l,key:c,contentType:u,headers:d})=>{const h=_r(c,e,n),p={...u&&{contentType:u},...d&&{headers:d}};if(o==="file")for(const m of a??[])i.push({key:h,value:m,type:o,...p});else if(l){const m=_r(l,e,n);i.push({key:h,value:m,type:o,...p})}}),i}function qUe(t){const e=`----replay${crypto.randomUUID().replace(/-/g,"")}`,n=[];for(const{key:r,value:i,type:s,contentType:o,headers:a}of t){const l=s==="file"?i.file:void 0;if(!i||s==="file"&&!(l instanceof Blob))continue;const c=l?l.type||o||"application/octet-stream":o,u=[`Content-Disposition: form-data; name="${y4(r)}"`+(l?`; filename="${y4(l.name)}"`:""),...c?[`Content-Type: ${c}`]:[],...Object.entries(a??{}).filter(([d,h])=>!/[\r\n]/.test(`${d}${h}`)).map(([d,h])=>`${d}: ${h}`)];n.push(`--${e}\r
2637
+ `;function HXe(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function rw(t,...e){if(!HXe(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 m4(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 JXe(t,e){rw(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Mm(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function cC(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function sa(t,e){return t<<32-e|t>>>e}function KXe(t,e){return t<<e|t>>>32-e>>>0}const eUe=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",tUe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Vm(t){if(rw(t),eUe)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=tUe[t[n]];return e}function nUe(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function SJ(t){return typeof t=="string"&&(t=nUe(t)),rw(t),t}class rUe{}function wJ(t){const e=r=>t().update(SJ(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function iUe(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 eI(t,e,n){return t&e^~t&n}function sUe(t,e,n){return t&e^t&n^e&n}class TJ extends rUe{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=cC(this.buffer)}update(e){m4(this),e=SJ(e),rw(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=cC(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){m4(this),JXe(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,Mm(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let d=o;d<i;d++)n[d]=0;iUe(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=cC(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 d=0;d<c;d++)a.setUint32(4*d,u[d],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 Hl=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),oUe=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),aUe=Math.pow(2,32),lUe=Array.from({length:64},(t,e)=>Math.floor(aUe*Math.abs(Math.sin(e+1)))),ry=oUe.slice(0,4),uC=new Uint32Array(16);class cUe extends TJ{constructor(){super(64,16,8,!0),this.A=ry[0]|0,this.B=ry[1]|0,this.C=ry[2]|0,this.D=ry[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)uC[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=eI(i,s,o),c=a,u=[7,12,17,22]):a<32?(l=eI(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+lUe[a]+uC[c],r=o,o=s,s=i,i=i+KXe(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(){Mm(uC)}destroy(){this.set(0,0,0,0),Mm(this.buffer)}}const iw=wJ(()=>new cUe),uUe=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]),Jl=new Uint32Array(64);class dUe extends TJ{constructor(e=32){super(64,e,8,!1),this.A=Hl[0]|0,this.B=Hl[1]|0,this.C=Hl[2]|0,this.D=Hl[3]|0,this.E=Hl[4]|0,this.F=Hl[5]|0,this.G=Hl[6]|0,this.H=Hl[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 d=0;d<16;d++,n+=4)Jl[d]=e.getUint32(n,!1);for(let d=16;d<64;d++){const h=Jl[d-15],p=Jl[d-2],m=sa(h,7)^sa(h,18)^h>>>3,g=sa(p,17)^sa(p,19)^p>>>10;Jl[d]=g+Jl[d-7]+m+Jl[d-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:l,G:c,H:u}=this;for(let d=0;d<64;d++){const h=sa(a,6)^sa(a,11)^sa(a,25),p=u+h+eI(a,l,c)+uUe[d]+Jl[d]|0,g=(sa(r,2)^sa(r,13)^sa(r,22))+sUe(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(){Mm(Jl)}destroy(){this.set(0,0,0,0,0,0,0,0),Mm(this.buffer)}}const CJ=wJ(()=>new dUe);function fUe(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 hUe(t,e,n,r,i={}){const{inputs:s}=r,{requestBody:{content:o}}=t,{url:a,method:l}=SS(t,e,n,r,i),c=[...e?.security||[],...t.security].findLast(I=>I.securityType===te.DigestAuth);if(!c)return"";const{username:u,password:d,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,opaque:x}=c[te.DigestAuth],y=Qf(u,s,i),{pathname:w,search:S}=new URL(a),P=S?`${w}${S}`:w,k=pUe({username:y,password:Qf(d,s,i),uri:P,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,method:l,bodyContent:Qf(o,s,i)});return`Digest username="${y}", realm="${h}", nonce="${p}", uri="${P}", qop=${O}, nc=${v}, cnonce="${m}", response="${k}", algorithm=${g}${x?`, opaque="${x}"`:""}`}function pUe(t){const{username:e,password:n,realm:r,nonce:i,cnonce:s,algorithm:o,qop:a,nc:l,uri:c,method:u,bodyContent:d}=t,h=gUe(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(d)}`):h(`${u}:${c}`);return h(`${p}:${i}:${l}:${s}:${a}:${m}`).toString()}function gUe(t){return t?.replace("-sess","")==="SHA-256"?e=>Vm(CJ(e)):e=>Vm(iw(e))}function tI(t){return new TextEncoder().encode(t)}function mUe(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 OUe(t){return btoa(String.fromCharCode(...tI(t)))}function O4(t){return btoa(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function vUe(t){return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}async function yUe(t){const e=new TextEncoder().encode(t);return crypto?.subtle.digest("SHA-256",e)}function bUe(t){if(t)return btoa(String.fromCharCode.apply(null,new Uint8Array(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(new RegExp("(?<!=)=+$"),"")}function xUe(t){try{const n=new URL(t).hostname;return n==="localhost"||n==="127.0.0.1"}catch{return!1}}function J0(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function SUe(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 wUe=["json","xml","html","text"],TUe=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function dC(t,e){return t.get(e)??t.get(e.toLowerCase())}function CUe(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function PUe(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 kUe(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function EUe(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return TUe.some(r=>n.includes(r))?!0:n.startsWith("application/")?!wUe.some(r=>n.includes(r)):!1}async function IUe(t,e){const n=dC(t.headers,"content-type")?.split(";")[0].trim(),r=dC(t.headers,"content-disposition"),i=CUe(dC(t.headers,"content-length")),s=EUe(n,r),o=SUe(document.cookie);if(s){const h={fileName:PUe(r)||kUe(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 $Ue=":/?#[]@!$&'()*+,;=",AUe=new Set(["!","'","(",")","*"]);function QUe(t){return AUe.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function v4(t,e=!1){let n=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return n;const r=[...$Ue].map(i=>({char:i,encoded:QUe(i)}));for(const{char:i,encoded:s}of r)n=n.split(s).join(i);return n}function RUe(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function _Ue(t,e){const{exists:n}=await Promise.resolve().then(()=>TO),{join:r}=await Promise.resolve().then(()=>MQ),{baseName:i,extension:s}=RUe(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 jUe(t){return t.split(new RegExp("(\\{(?<!\\{[^}]*?\\{)[^}]+\\}|\\/)","g")).filter(e=>e!=="")}const jR=t=>t?.find(([e])=>e.toLowerCase()==="content-type")?.[1].split(";")[0],nI=t=>{switch(!0){case t.includes("jsonl"):return Gd.JSONL;case t.includes("x-ndjson"):return Gd.NDJSON;case t.includes("json-seq"):return Gd.JSONSeq;case t.includes("multipart/mixed"):return Gd.MultipartMixed;case t.includes("text/event-stream"):return Gd.TextStream;case t.includes("json"):return Hn.JSON;case t.includes("xml"):return Hn.XML;case t.includes("html"):return Hn.HTML;case t.includes("image"):return Hn.Image;default:return Hn.Text}},eg=new Map;function NUe(t){eg.get(t)?.abort()}function PJ(t){return t?t instanceof URLSearchParams?t.entries().next().done===!0:!1:!0}function DUe(t){if(!PJ(t))return t}function kJ(t,e){if(!e)return"same-origin";try{const n=new URL(e).origin;return new URL(xS(t)).origin===n?"include":"same-origin"}catch{return"same-origin"}}async function NR({collections:t,selectedEnvironment:e,step:n,onStepChange:r,settings:i,workflow:s,onWorkflowChange:o,collection:a,signal:l}){const{corsProxyUrl:c,credentialOrigin:u,certificates:d,features:h}=i,p=await OS(t,a?.id,s?.workflowId,OQ(n,s,a,e)),{url:m,method:g}=SS(n,s??void 0,a??void 0,e,p),O=c||"",v=AJ(n,s,a,e,p),x=GUe(m,u),y=HUe({proxyUrl:O,resolvedUrl:m,ignoreProxy:x,queryParameters:v}),w=await VUe(n,s??void 0,y,u,l);let S=n,P=s??void 0;const k=a??void 0;w?.target==="step"?(S=iy(S,w),r(U=>iy(U,w))):w?.target==="workflow"&&P&&(P=iy(P,w),o?.(U=>iy(U,w)));const I=ow(S,P,k,e,p,h),E=DUe(MR(S,e,p,h)),{clientCert:Q,clientKey:j}=NY(m,d),R=xS(y),V=g.toUpperCase(),z=!Ah.includes(V),X=z?"POST":V,A=z?{...I,"X-HTTP-Method-Override":V}:I;return{urlWithProxyAndProtocol:R,fetchMethod:X,fetchHeaders:A,body:E,credentials:kJ(R,u),mode:J0(R)?"same-origin":"cors",clientCert:Q,clientKey:j,resolvedUrl:m}}function DR(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 EJ(t,e,n,r,i,s){const{tabId:o,updateData:a}=t,l=_a(e.step);a(h=>({...h,isProcessingRequest:!0})),eg.get(o)?.abort();const c=new AbortController;eg.set(o,c);const{signal:u}=c,d=()=>eg.get(o)===c;try{const h=await NR({selectedEnvironment:r,settings:n,signal:u,...e}),p=Date.now(),m=await Qo(h.urlWithProxyAndProtocol,DR(h,u)),g=Date.now()-p,O=await IUe(m,g);if(!d())return;a(x=>({...x,requestError:null,response:O}));const v=_a(O);i?.(l,v),s?.({outcome:"success",status:O.status,duration:O.duration,size:O.size,content_type:jR(O.headers)})}catch(h){if(!d()||(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{d()&&(eg.delete(o),a(h=>({...h,isProcessingRequest:!1})))}}async function MUe({selectedEnvironment:t,settings:e,fileName:n,onProgress:r,...i}){const s=await NR({selectedEnvironment:t,settings:e,...i}),o=DR(s),a=Qn(),l=n||"response";let c=null;if(a){const{open:x}=await Promise.resolve().then(()=>require("./replay-index-hKq2X34E.js")),y=await x({directory:!0,multiple:!1});if(!y)return;const w=Array.isArray(y)?y[0]:y;c=await _Ue(w,l)}const u=await Qo(s.urlWithProxyAndProtocol,o),d=u.headers.get("content-length"),h=d?Number.parseInt(d,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 x=u.body.getReader(),y=[];let w=0;for(;;){const{done:S,value:P}=await x.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:x}=await Promise.resolve().then(()=>TO),y=new Uint8Array(await g.arrayBuffer());if(!c)return;await x(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 iy(t,e){return{...t,security:t.security.map((n,r)=>r===e.index?{...n,[te.DigestAuth]:{...n[te.DigestAuth],...e.fields}}:n)}}async function VUe(t,e,n,r,i){const s=Rc(t),o=e?.security??[],l=[...o,...t.security].findLastIndex(p=>p.securityType===te.DigestAuth);if(l===-1)return null;const c=xS(n),u=await Qo(c,{signal:i,method:s.toUpperCase(),credentials:kJ(c,r),mode:J0(c)?"same-origin":"cors"}),d=fUe(u.headers.get("WWW-Authenticate")||""),h=l<o.length;return{target:h?"workflow":"step",index:h?l:l-o.length,fields:{nonce:d.nonce,realm:d.realm,qop:d.qop,algorithm:d.algorithm,opaque:d.opaque,cnonce:crypto.randomUUID(),nc:"00000001"}}}function LUe(t,e,n,r,i){return[...e?.security||[],...t.security].map(s=>{switch(s.securityType){case te.BasicAuth:{const o=s[te.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+OUe(`${_r(o.username,r,i)}:${_r(o.password,r,i)}`),active:!0,in:"header"}}case te.DigestAuth:return{id:"",key:"Authorization",value:hUe(t,e,n,r,i),active:!0,in:"header"};case te.JWT:return{id:"",key:"Authorization",value:"Bearer "+s[te.JWT].token,active:!0,in:"header"};case te.OAuth2:{const{grantType:o}=s[te.OAuth2],{accessToken:a}=s[te.OAuth2][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case te.OpenIDConnect:{const{grantType:o}=s[te.OpenIDConnect],{accessToken:a}=s[te.OpenIDConnect][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case te.APIKey:{const o=s[te.APIKey];return o.location===ms.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(s=>!!s)}function zUe(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"),d=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=!d.every(w=>o.some(S=>!ku(S)&&S.key===w.name)),v=!h.every(w=>a.some(S=>!ku(S)&&S.key===w.name)),x=!u.every(w=>l.some(S=>!ku(S)&&S.key===w.name)),y=Z$e(t,e,n);return!p&&!m&&!g&&!O&&!v&&!x&&!y}function sw(t,e,n={},r){const{requestBody:i}=t,o=Rc(t).toUpperCase();if(o==="GET"||o==="HEAD"||o==="OPTIONS")return null;try{if(i.type===Ge.FormData)return FUe(t,e,n);if(i.type===Ge.UrlEncoded)return UUe(t,e,n);if(i.type===Ge.Binary)return i.binary;if(i.type===Ge.GraphqlJSON&&Zh(Ge.GraphqlJSON,r)){const a=vl(i.content),l=_r(a.query,e,n),c=K6(_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 MR(t,e,n={},r){const{requestBody:i}=t,s=sw(t,e,n,r);if(s===null)return null;switch(i.type){default:return s;case Ge.FormData:return qUe(s);case Ge.UrlEncoded:return XUe(s);case Ge.Binary:return i.binary?.file??null}}function XUe(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function UUe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData[Ge.UrlEncoded];return jJ(s).forEach(o=>{const a=_r(o.value,e,n);i.push({key:_r(o.key,e,n),value:a,type:"text"})}),i}function FUe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData[Ge.FormData];return jJ(s).forEach(({type:o,files:a,value:l,key:c,contentType:u,headers:d})=>{const h=_r(c,e,n),p={...u&&{contentType:u},...d&&{headers:d}};if(o==="file")for(const m of a??[])i.push({key:h,value:m,type:o,...p});else if(l){const m=_r(l,e,n);i.push({key:h,value:m,type:o,...p})}}),i}function qUe(t){const e=`----replay${crypto.randomUUID().replace(/-/g,"")}`,n=[];for(const{key:r,value:i,type:s,contentType:o,headers:a}of t){const l=s==="file"?i.file:void 0;if(!i||s==="file"&&!(l instanceof Blob))continue;const c=l?l.type||o||"application/octet-stream":o,u=[`Content-Disposition: form-data; name="${y4(r)}"`+(l?`; filename="${y4(l.name)}"`:""),...c?[`Content-Type: ${c}`]:[],...Object.entries(a??{}).filter(([d,h])=>!/[\r\n]/.test(`${d}${h}`)).map(([d,h])=>`${d}: ${h}`)];n.push(`--${e}\r
2638
2638
  ${u.join(`\r
2639
2639
  `)}\r
2640
2640
  \r
@@ -3802,7 +3802,7 @@ ${u.join(`\r
3802
3802
  font-size: var(--font-size-base);
3803
3803
  font-weight: var(--font-weight-regular);
3804
3804
  line-height: var(--line-height-base);
3805
- `,p7e=["text","file"];function g7e({onParameterChange:t,files:e}){const n=b.useRef(null),r=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(Qn())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-CUoi3zH7.js")),l=await a({multiple:!0});if(!l)return;const u=(Array.isArray(l)?l:[l]).map(IO),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=b.useCallback(()=>{t(null)},[t]),o=b.useMemo(()=>{if(!e)return null;if(e.length===1)return f.jsx(I4,{icon:f.jsx(Wi.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:f.jsx($4,{children:e[0].file.name})});if(e.length>1)return f.jsx(I4,{icon:f.jsx(Wi.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:f.jsxs($4,{children:[e.length," files"]})})},[e,s]);return f.jsx(m7e,{children:f.jsxs(O7e,{children:[f.jsx(v7e,{children:o||f.jsx(x7e,{children:"Add files here"})}),f.jsxs(y7e,{children:[f.jsx(b7e,{onClick:i,variant:"secondary",size:"small","data-testid":"add-button",icon:f.jsx(Nr.AddIcon,{color:"--button-content-color"})}),f.jsx("input",{"data-testid":"file-input",hidden:!0,ref:n,type:"file",multiple:!0,accept:"files/*",onChange:r})]})]})})}const m7e=T.default.div`
3805
+ `,p7e=["text","file"];function g7e({onParameterChange:t,files:e}){const n=b.useRef(null),r=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(Qn())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-hKq2X34E.js")),l=await a({multiple:!0});if(!l)return;const u=(Array.isArray(l)?l:[l]).map(IO),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=b.useCallback(()=>{t(null)},[t]),o=b.useMemo(()=>{if(!e)return null;if(e.length===1)return f.jsx(I4,{icon:f.jsx(Wi.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:f.jsx($4,{children:e[0].file.name})});if(e.length>1)return f.jsx(I4,{icon:f.jsx(Wi.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:f.jsxs($4,{children:[e.length," files"]})})},[e,s]);return f.jsx(m7e,{children:f.jsxs(O7e,{children:[f.jsx(v7e,{children:o||f.jsx(x7e,{children:"Add files here"})}),f.jsxs(y7e,{children:[f.jsx(b7e,{onClick:i,variant:"secondary",size:"small","data-testid":"add-button",icon:f.jsx(Nr.AddIcon,{color:"--button-content-color"})}),f.jsx("input",{"data-testid":"file-input",hidden:!0,ref:n,type:"file",multiple:!0,accept:"files/*",onChange:r})]})]})})}const m7e=T.default.div`
3806
3806
  position: relative;
3807
3807
  display: flex;
3808
3808
  flex-grow: 1;
@@ -3941,7 +3941,7 @@ ${u.join(`\r
3941
3941
  `,R7e=T.default.div`
3942
3942
  display: flex;
3943
3943
  justify-content: center;
3944
- `,TK=t=>t==="file"?f.jsx(u9.FileIcon,{size:"14px"}):f.jsx(ate.CharacterIcon,{size:"14px"}),_7e=p7e.map(t=>({label:f.jsxs(S7e,{children:[TK(t),f.jsx(A7e,{children:t})]}),value:t}));function A4({isLast:t,index:e,parameter:n,onKeyChange:r,onValueChange:i,onActiveChange:s,onTypeChange:o,onFilesChange:a,environment:l,keyName:c,enableInputTypeSelection:u,autoCompleteOptions:d,actions:h}){const{value:p,key:m,active:g,type:O,files:v}=n,x=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 f.jsxs(P7e,{children:[f.jsx(k7e,{children:!t&&f.jsxs(f.Fragment,{children:[f.jsx(E7e,{"data-testid":w,type:"checkbox",checked:g,onChange:({target:S})=>s(S.checked)}),f.jsx(I7e,{checked:g})]})}),f.jsx(Ze,{}),f.jsxs(f.Fragment,{children:[f.jsx(jt,{dataTestId:x,placeholder:`${t?"New ":""}${c}`,value:m,environment:l,onChange:r}),u&&f.jsx(R7e,{children:f.jsx(Q7e,{options:_7e,value:{label:TK(O),value:O,active:!0},onChange:({value:S})=>o(S),withArrow:!1,size:"small"})})]}),f.jsx(Ze,{}),O==="file"?f.jsx(g7e,{files:v,onParameterChange:a}):f.jsx(jt,{dataTestId:y,placeholder:"Value",value:p,environment:l,options:d,onChange:i}),f.jsx(Ze,{}),f.jsx($7e,{children:!t&&h(e)})]})}function j7e({title:t,enableInputTypeSelection:e=!1,onParameterChange:n,actions:r,formElements:i,onFormElementsChange:s,keyName:o,environment:a,createEmptyParameter:l}){const c=Ji(),{ghost:u,updateGhost:d,promoteGhost:h}=uK({createEmptyParameter:l,onPromote:g=>{s?.(O=>[...O,g]),n?.()}});function p(g,O){s?.(v=>v.map((x,y)=>y===g?{...x,...O}:x)),n?.()}const m={environment:a,keyName:o,enableInputTypeSelection:e,autoCompleteOptions:c,actions:r};return f.jsxs(w7e,{children:[t&&f.jsx(T7e,{children:t}),f.jsx(C7e,{children:[...i.map((g,O)=>f.jsx(A4,{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?f.jsx(A4,{isLast:!0,index:i.length,parameter:u,onKeyChange:g=>h({key:g}),onValueChange:g=>h({value:g}),onActiveChange:g=>d({active:g}),onTypeChange:g=>d({type:g}),onFilesChange:g=>h({files:g}),...m},u.id):null]})]})}function N7e({formElements:t,onFormElementsChange:e,type:n}){const r=Ft();function i(s){e(o=>o.filter((a,l)=>l!==s))}return f.jsx(j7e,{keyName:"Param",formElements:t,onFormElementsChange:e,environment:r,enableInputTypeSelection:n!==Ge.UrlEncoded,createEmptyParameter:JIe,actions:s=>f.jsx(ws,{onClick:()=>i(s),variant:"text",icon:f.jsx(rr.TrashCanIcon,{})})})}const D7e=({binary:t,onBinaryChange:e})=>{const[n,r]=b.useState(!1),i=b.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(Qn())try{const{open:l}=await Promise.resolve().then(()=>require("./replay-index-CUoi3zH7.js")),c=await l();if(!c)return;const u=await IO(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?f.jsx(pC,{children:f.jsxs(M7e,{children:[f.jsx(ax.Spinner,{}),"Loading..."]})}):t&&t.file?.name?f.jsx(pC,{children:f.jsxs(V7e,{children:[f.jsxs(L7e,{children:[f.jsx(cte.DocumentBlankIcon,{size:"16px"}),f.jsx(z7e,{children:t.file?.name})]}),f.jsx(ws,{onClick:a,icon:f.jsx(rr.TrashCanIcon,{})})]})}):f.jsx(pC,{children:f.jsx(CK,{children:!t&&f.jsxs(f.Fragment,{children:[f.jsx("input",{type:"file",hidden:!0,ref:i,onChange:s}),f.jsx(be.Button,{type:"button",variant:"text",onClick:o,icon:f.jsx(lte.CloudUploadIcon,{}),children:"Upload file"})]})})})},pC=T.default(lQ)`
3944
+ `,TK=t=>t==="file"?f.jsx(u9.FileIcon,{size:"14px"}):f.jsx(ate.CharacterIcon,{size:"14px"}),_7e=p7e.map(t=>({label:f.jsxs(S7e,{children:[TK(t),f.jsx(A7e,{children:t})]}),value:t}));function A4({isLast:t,index:e,parameter:n,onKeyChange:r,onValueChange:i,onActiveChange:s,onTypeChange:o,onFilesChange:a,environment:l,keyName:c,enableInputTypeSelection:u,autoCompleteOptions:d,actions:h}){const{value:p,key:m,active:g,type:O,files:v}=n,x=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 f.jsxs(P7e,{children:[f.jsx(k7e,{children:!t&&f.jsxs(f.Fragment,{children:[f.jsx(E7e,{"data-testid":w,type:"checkbox",checked:g,onChange:({target:S})=>s(S.checked)}),f.jsx(I7e,{checked:g})]})}),f.jsx(Ze,{}),f.jsxs(f.Fragment,{children:[f.jsx(jt,{dataTestId:x,placeholder:`${t?"New ":""}${c}`,value:m,environment:l,onChange:r}),u&&f.jsx(R7e,{children:f.jsx(Q7e,{options:_7e,value:{label:TK(O),value:O,active:!0},onChange:({value:S})=>o(S),withArrow:!1,size:"small"})})]}),f.jsx(Ze,{}),O==="file"?f.jsx(g7e,{files:v,onParameterChange:a}):f.jsx(jt,{dataTestId:y,placeholder:"Value",value:p,environment:l,options:d,onChange:i}),f.jsx(Ze,{}),f.jsx($7e,{children:!t&&h(e)})]})}function j7e({title:t,enableInputTypeSelection:e=!1,onParameterChange:n,actions:r,formElements:i,onFormElementsChange:s,keyName:o,environment:a,createEmptyParameter:l}){const c=Ji(),{ghost:u,updateGhost:d,promoteGhost:h}=uK({createEmptyParameter:l,onPromote:g=>{s?.(O=>[...O,g]),n?.()}});function p(g,O){s?.(v=>v.map((x,y)=>y===g?{...x,...O}:x)),n?.()}const m={environment:a,keyName:o,enableInputTypeSelection:e,autoCompleteOptions:c,actions:r};return f.jsxs(w7e,{children:[t&&f.jsx(T7e,{children:t}),f.jsx(C7e,{children:[...i.map((g,O)=>f.jsx(A4,{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?f.jsx(A4,{isLast:!0,index:i.length,parameter:u,onKeyChange:g=>h({key:g}),onValueChange:g=>h({value:g}),onActiveChange:g=>d({active:g}),onTypeChange:g=>d({type:g}),onFilesChange:g=>h({files:g}),...m},u.id):null]})]})}function N7e({formElements:t,onFormElementsChange:e,type:n}){const r=Ft();function i(s){e(o=>o.filter((a,l)=>l!==s))}return f.jsx(j7e,{keyName:"Param",formElements:t,onFormElementsChange:e,environment:r,enableInputTypeSelection:n!==Ge.UrlEncoded,createEmptyParameter:JIe,actions:s=>f.jsx(ws,{onClick:()=>i(s),variant:"text",icon:f.jsx(rr.TrashCanIcon,{})})})}const D7e=({binary:t,onBinaryChange:e})=>{const[n,r]=b.useState(!1),i=b.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(Qn())try{const{open:l}=await Promise.resolve().then(()=>require("./replay-index-hKq2X34E.js")),c=await l();if(!c)return;const u=await IO(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?f.jsx(pC,{children:f.jsxs(M7e,{children:[f.jsx(ax.Spinner,{}),"Loading..."]})}):t&&t.file?.name?f.jsx(pC,{children:f.jsxs(V7e,{children:[f.jsxs(L7e,{children:[f.jsx(cte.DocumentBlankIcon,{size:"16px"}),f.jsx(z7e,{children:t.file?.name})]}),f.jsx(ws,{onClick:a,icon:f.jsx(rr.TrashCanIcon,{})})]})}):f.jsx(pC,{children:f.jsx(CK,{children:!t&&f.jsxs(f.Fragment,{children:[f.jsx("input",{type:"file",hidden:!0,ref:i,onChange:s}),f.jsx(be.Button,{type:"button",variant:"text",onClick:o,icon:f.jsx(lte.CloudUploadIcon,{}),children:"Upload file"})]})})})},pC=T.default(lQ)`
3945
3945
  align-items: flex-start;
3946
3946
  `,CK=T.default.div`
3947
3947
  display: flex;
@@ -4060,7 +4060,7 @@ ${u.join(`\r
4060
4060
  `,D4=T.default.div`
4061
4061
  flex: 1;
4062
4062
  min-height: 0;
4063
- `;function pZe(t){const{body:e,onBodyChange:n,apiOperation:r}=t,{content:i,type:s}=e,{features:o}=Fn(),a=oY(s,o);return f.jsx(lQ,{children:f.jsx(no,{dataTestId:"request-body-tab-codemirror",value:i,apiOperation:r,onChange:l=>n(c=>({...c,content:l})),extensions:a?.extensions,stateExtensions:a?.stateExtensions})})}function $K({onBodyChange:t,apply:e}){return f.jsx(be.Button,{variant:"text",size:"small",icon:f.jsx(ute.MagicWandIcon,{size:"14px",color:"--button-content-color"}),onClick:()=>t(e),children:"Prettify"})}function gZe(t){const{tabId:e}=t,{step:n}=ji(),r=F7e(e),i=IK(e),s=!!Wu(n),a=r?.status==="loading"?ax.Spinner:$I.DownloadIcon,l=s?"--button-content-color":"--dropdown-menu-item-color-disabled";return f.jsx(ed.DropdownMenuItem,{content:"Fetch schema",prefix:f.jsx(a,{size:"14px",color:l}),disabled:!s,onAction:s?i:void 0})}async function mZe(t){return Qn()?OZe(t):vZe(t)}async function OZe(t){const[{open:e},{readTextFile:n},{basename:r}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-CUoi3zH7.js")),Promise.resolve().then(()=>TO),Promise.resolve().then(()=>MQ)]),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 vZe(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 yZe=["graphql","graphqls","gql","json"];function bZe(t){const{tabId:e}=t,n=kK(),{showSchemaLoaded:r,showSchemaFailed:i}=EK(),s=(a,l)=>{const c=a instanceof Error?a.message:l;lI(e),n(e,()=>({status:"error",error:c})),i(c)},o=async()=>{let a;try{a=await mZe({extensions:yZe})}catch(l){s(l,"Failed to read the schema file.");return}if(a){lI(e),n(e,()=>({status:"loading"}));try{const l=sZe(a.text);n(e,()=>({status:"ready",introspection:l})),r(a.name)}catch(l){s(l,"Failed to load the schema file.")}}};return f.jsx(ed.DropdownMenuItem,{content:"Load schema file",prefix:f.jsx(u9.FileIcon,{size:"14px",color:"--button-content-color"}),onAction:o})}function xZe(t){return f.jsx(Yi.Dropdown,{alignment:"end",trigger:f.jsx(be.Button,{size:"small",variant:"text","aria-label":"Schema options",icon:f.jsx(PI.OverflowMenuHorizontalIcon,{size:"14px",color:"--button-content-color"})}),children:f.jsxs(Gi.DropdownMenu,{children:[f.jsx(gZe,{tabId:t.tabId}),f.jsx(bZe,{tabId:t.tabId})]})})}const SZe={matches:t=>xA.includes(t),applyExample:(t,e,n)=>{const r=t.type;return y5(t,r,()=>H6(e,r,n?.encoding,n?.schema))},Editor:({body:t,onBodyChange:e})=>f.jsx(N7e,{type:t.type,formElements:t.formData[t.type],onFormElementsChange:n=>e(r=>y5(r,t.type,n))})},wZe={matches:t=>J7.includes(t),Editor:({body:t,onBodyChange:e})=>f.jsx(D7e,{binary:t.binary,onBinaryChange:n=>e(r=>({...r,binary:n}))})},TZe={matches:t=>Ge.GraphqlJSON===t,applyExample:(t,e)=>{const{query:n,variables:r}=vl(e);return{...t,content:N0(n,r)}},prepareForTypeChange:t=>({...t,content:U$e(t.content)}),ToolbarActions:({body:t,onBodyChange:e,tabId:n})=>{const{query:r,variables:i}=vl(t.content),s=eZe(t.type,r),o=nY(Ge.JSON,i),a=l=>{const c=vl(l.content);return{...l,content:N0(s?nZe(c.query):c.query,o?TQ(c.variables):c.variables)}};return f.jsxs(f.Fragment,{children:[(s||o)&&f.jsx($K,{onBodyChange:e,apply:a}),f.jsx(SK,{}),f.jsx(xZe,{tabId:n})]})},Editor:fZe},CZe={applyExample:(t,e)=>({...t,content:yE(e)}),ToolbarActions:({body:t,onBodyChange:e})=>f.jsx(f.Fragment,{children:nY(t.type,t.content)&&f.jsx($K,{onBodyChange:e,apply:n=>({...n,content:TQ(n.content)})})}),Editor:pZe},PZe=[SZe,wZe,TZe],kZe=CZe;function tg(t,e){return PZe.find(r=>r.matches(t)&&Zh(t,e))??kZe}function EZe(t){const{apiOperation:e,type:n,activeExampleName:r,onBodyChange:i}=t,s=b.useMemo(()=>Object.keys(e?.body?.mediaTypes||{}),[e?.body?.mediaTypes]),{features:o}=Fn(),a=b.useMemo(()=>s7e(e,o),[e,o]),l=b.useMemo(()=>VR(s,a),[a,s]),c=b.useMemo(()=>a.find(({value:v})=>v===n)??wK(n,o),[a,n,o]),u=b.useMemo(()=>bE(e?.body?.mediaTypes?.[n]),[n,e]),d=!!tg(n,o).applyExample,h=b.useMemo(()=>d?u.map(({key:v,name:x})=>({label:x,value:v})):[],[u,d]),p=b.useMemo(()=>h.find(v=>v.value===r),[h,r]),{sendEvent:m}=Ke();return{contentTypes:l,activeContentType:c,onContentTypeChange:({value:v})=>{const x=String(v),y=e?.body?.mediaTypes?.[x],[w]=bE(y),S=tg(x,o),P=S.applyExample;i(k=>{const I=tg(k.type,o),Q={...I!==S&&I.prepareForTypeChange?I.prepareForTypeChange(k):k,type:x};return!w||!P?Q:P({...Q,activeExampleName:w.key},w.value,y)}),m("com.redocly.change.occurred",[{...ye("select","requestBodyType"),context:"type",source:"request_body",value:x}])},examples:h,activeExample:p,onExampleChange:v=>{const x=String(v.value),y=u.find(w=>w.key===x);y&&(i(w=>{const S=tg(w.type,o).applyExample;return S?S({...w,activeExampleName:y.key},y.value,e?.body?.mediaTypes?.[w.type]):w}),m("com.redocly.change.occurred",[{...ye("select","requestBodyExample"),context:"example",source:"request_body",value:y.name}]))}}}function IZe(t){const{body:e,onBodyChange:n,apiOperation:r,tabId:i}=t,s=EZe({apiOperation:r,onBodyChange:n,type:e.type,activeExampleName:e.activeExampleName}),{features:o}=Fn(),{Editor:a,ToolbarActions:l}=tg(e.type,o);return f.jsx(o7e,{contentTypes:s.contentTypes,activeContentType:s.activeContentType,onContentTypeChange:s.onContentTypeChange,examples:s.examples,activeExample:s.activeExample,onExampleChange:s.onExampleChange,actions:l&&f.jsx(l,{body:e,onBodyChange:n,apiOperation:r,tabId:i}),children:f.jsx(a,{body:e,onBodyChange:n,apiOperation:r,tabId:i})})}const $Ze=({activeTabName:t,onChange:e})=>{const{isMobile:n}=lo(),{isDraft:r}=ji(),i=K7(r);if(!n)return null;const s=i.find(({name:o})=>o===t);return f.jsx(QZe,{children:f.jsx(AZe,{dataTestId:"request-tab-change-select",options:i.map(({name:o})=>({element:o,label:o,value:o})),value:s?.name,onChange:o=>e(o)})})},AZe=T.default(id.Select)`
4063
+ `;function pZe(t){const{body:e,onBodyChange:n,apiOperation:r}=t,{content:i,type:s}=e,{features:o}=Fn(),a=oY(s,o);return f.jsx(lQ,{children:f.jsx(no,{dataTestId:"request-body-tab-codemirror",value:i,apiOperation:r,onChange:l=>n(c=>({...c,content:l})),extensions:a?.extensions,stateExtensions:a?.stateExtensions})})}function $K({onBodyChange:t,apply:e}){return f.jsx(be.Button,{variant:"text",size:"small",icon:f.jsx(ute.MagicWandIcon,{size:"14px",color:"--button-content-color"}),onClick:()=>t(e),children:"Prettify"})}function gZe(t){const{tabId:e}=t,{step:n}=ji(),r=F7e(e),i=IK(e),s=!!Wu(n),a=r?.status==="loading"?ax.Spinner:$I.DownloadIcon,l=s?"--button-content-color":"--dropdown-menu-item-color-disabled";return f.jsx(ed.DropdownMenuItem,{content:"Fetch schema",prefix:f.jsx(a,{size:"14px",color:l}),disabled:!s,onAction:s?i:void 0})}async function mZe(t){return Qn()?OZe(t):vZe(t)}async function OZe(t){const[{open:e},{readTextFile:n},{basename:r}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-hKq2X34E.js")),Promise.resolve().then(()=>TO),Promise.resolve().then(()=>MQ)]),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 vZe(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 yZe=["graphql","graphqls","gql","json"];function bZe(t){const{tabId:e}=t,n=kK(),{showSchemaLoaded:r,showSchemaFailed:i}=EK(),s=(a,l)=>{const c=a instanceof Error?a.message:l;lI(e),n(e,()=>({status:"error",error:c})),i(c)},o=async()=>{let a;try{a=await mZe({extensions:yZe})}catch(l){s(l,"Failed to read the schema file.");return}if(a){lI(e),n(e,()=>({status:"loading"}));try{const l=sZe(a.text);n(e,()=>({status:"ready",introspection:l})),r(a.name)}catch(l){s(l,"Failed to load the schema file.")}}};return f.jsx(ed.DropdownMenuItem,{content:"Load schema file",prefix:f.jsx(u9.FileIcon,{size:"14px",color:"--button-content-color"}),onAction:o})}function xZe(t){return f.jsx(Yi.Dropdown,{alignment:"end",trigger:f.jsx(be.Button,{size:"small",variant:"text","aria-label":"Schema options",icon:f.jsx(PI.OverflowMenuHorizontalIcon,{size:"14px",color:"--button-content-color"})}),children:f.jsxs(Gi.DropdownMenu,{children:[f.jsx(gZe,{tabId:t.tabId}),f.jsx(bZe,{tabId:t.tabId})]})})}const SZe={matches:t=>xA.includes(t),applyExample:(t,e,n)=>{const r=t.type;return y5(t,r,()=>H6(e,r,n?.encoding,n?.schema))},Editor:({body:t,onBodyChange:e})=>f.jsx(N7e,{type:t.type,formElements:t.formData[t.type],onFormElementsChange:n=>e(r=>y5(r,t.type,n))})},wZe={matches:t=>J7.includes(t),Editor:({body:t,onBodyChange:e})=>f.jsx(D7e,{binary:t.binary,onBinaryChange:n=>e(r=>({...r,binary:n}))})},TZe={matches:t=>Ge.GraphqlJSON===t,applyExample:(t,e)=>{const{query:n,variables:r}=vl(e);return{...t,content:N0(n,r)}},prepareForTypeChange:t=>({...t,content:U$e(t.content)}),ToolbarActions:({body:t,onBodyChange:e,tabId:n})=>{const{query:r,variables:i}=vl(t.content),s=eZe(t.type,r),o=nY(Ge.JSON,i),a=l=>{const c=vl(l.content);return{...l,content:N0(s?nZe(c.query):c.query,o?TQ(c.variables):c.variables)}};return f.jsxs(f.Fragment,{children:[(s||o)&&f.jsx($K,{onBodyChange:e,apply:a}),f.jsx(SK,{}),f.jsx(xZe,{tabId:n})]})},Editor:fZe},CZe={applyExample:(t,e)=>({...t,content:yE(e)}),ToolbarActions:({body:t,onBodyChange:e})=>f.jsx(f.Fragment,{children:nY(t.type,t.content)&&f.jsx($K,{onBodyChange:e,apply:n=>({...n,content:TQ(n.content)})})}),Editor:pZe},PZe=[SZe,wZe,TZe],kZe=CZe;function tg(t,e){return PZe.find(r=>r.matches(t)&&Zh(t,e))??kZe}function EZe(t){const{apiOperation:e,type:n,activeExampleName:r,onBodyChange:i}=t,s=b.useMemo(()=>Object.keys(e?.body?.mediaTypes||{}),[e?.body?.mediaTypes]),{features:o}=Fn(),a=b.useMemo(()=>s7e(e,o),[e,o]),l=b.useMemo(()=>VR(s,a),[a,s]),c=b.useMemo(()=>a.find(({value:v})=>v===n)??wK(n,o),[a,n,o]),u=b.useMemo(()=>bE(e?.body?.mediaTypes?.[n]),[n,e]),d=!!tg(n,o).applyExample,h=b.useMemo(()=>d?u.map(({key:v,name:x})=>({label:x,value:v})):[],[u,d]),p=b.useMemo(()=>h.find(v=>v.value===r),[h,r]),{sendEvent:m}=Ke();return{contentTypes:l,activeContentType:c,onContentTypeChange:({value:v})=>{const x=String(v),y=e?.body?.mediaTypes?.[x],[w]=bE(y),S=tg(x,o),P=S.applyExample;i(k=>{const I=tg(k.type,o),Q={...I!==S&&I.prepareForTypeChange?I.prepareForTypeChange(k):k,type:x};return!w||!P?Q:P({...Q,activeExampleName:w.key},w.value,y)}),m("com.redocly.change.occurred",[{...ye("select","requestBodyType"),context:"type",source:"request_body",value:x}])},examples:h,activeExample:p,onExampleChange:v=>{const x=String(v.value),y=u.find(w=>w.key===x);y&&(i(w=>{const S=tg(w.type,o).applyExample;return S?S({...w,activeExampleName:y.key},y.value,e?.body?.mediaTypes?.[w.type]):w}),m("com.redocly.change.occurred",[{...ye("select","requestBodyExample"),context:"example",source:"request_body",value:y.name}]))}}}function IZe(t){const{body:e,onBodyChange:n,apiOperation:r,tabId:i}=t,s=EZe({apiOperation:r,onBodyChange:n,type:e.type,activeExampleName:e.activeExampleName}),{features:o}=Fn(),{Editor:a,ToolbarActions:l}=tg(e.type,o);return f.jsx(o7e,{contentTypes:s.contentTypes,activeContentType:s.activeContentType,onContentTypeChange:s.onContentTypeChange,examples:s.examples,activeExample:s.activeExample,onExampleChange:s.onExampleChange,actions:l&&f.jsx(l,{body:e,onBodyChange:n,apiOperation:r,tabId:i}),children:f.jsx(a,{body:e,onBodyChange:n,apiOperation:r,tabId:i})})}const $Ze=({activeTabName:t,onChange:e})=>{const{isMobile:n}=lo(),{isDraft:r}=ji(),i=K7(r);if(!n)return null;const s=i.find(({name:o})=>o===t);return f.jsx(QZe,{children:f.jsx(AZe,{dataTestId:"request-tab-change-select",options:i.map(({name:o})=>({element:o,label:o,value:o})),value:s?.name,onChange:o=>e(o)})})},AZe=T.default(id.Select)`
4064
4064
  border-radius: var(--border-radius-md);
4065
4065
  background-color: var(--bg-color-active);
4066
4066
  `,QZe=T.default.div`
@@ -4116,7 +4116,7 @@ ${u.join(`\r
4116
4116
  font-size: var(--font-size-base);
4117
4117
  font-weight: var(--font-weight-medium);
4118
4118
  padding: var(--spacing-xs);
4119
- `;function WZe(t=32){let e="";for(;e.length<t;)e+=Math.random().toString(32).substring(2);return e.substring(0,t)}async function cI(t,e,n){const r=typeof t=="string"?t:t.toString();if(Qn()){const{openUrl:i}=await Promise.resolve().then(()=>require("./replay-index-DuaHxlY6.js"));await i(r);return}window.open(r,e,n)}const M4="/_auth/oauth2-redirect.html";let lw=class ng{static async authorizeImplicit({authorizationUrl:e,clientId:n,scopes:r,extraAuthParams:i={},routingBasePath:s="/",redirectUri:o,successCallback:a,errorCallback:l}){const c=V4({date:new Date().toString()});try{const u=new URL(e),d=s==="/"?"":s,h=`${window.location.origin}${d}${M4}`;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),ng.clearRedirectData("implicit")},errorCallback:p=>{l(p),ng.clearRedirectData("implicit")}},await cI(u.toString())}catch(u){l(sl.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:d={},extraTokenParams:h={},routingBasePath:p="/",redirectUri:m,withPkce:g,successCallback:O,errorCallback:v}){try{const x=Lv({url:e,serverUrl:r}),y=new URL(x),w=Lv({url:n,serverUrl:r}),S=new URL(w),P=p==="/"?"":p,k=`${window.location.origin}${P}${M4}`,I=V4({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=YZe(),a=await ZZe(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=_a({client_id:i,client_secret:s,...o&&{code_verifier:o},code:E,grant_type:"authorization_code",redirect_uri:m||k,...d});try{const j=await Qo(S,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...u},body:new URLSearchParams(Q).toString()});await mC(j,O,v)}catch(j){v(sl.OAuth2Error.fromError(j))}ng.clearRedirectData("authorizationCode")},errorCallback:E=>{v(sl.OAuth2Error.fromError(E)),ng.clearRedirectData("authorizationCode")}},await cI(y.toString())}catch(x){v(sl.OAuth2Error.fromError(x))}}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:d,successCallback:h,errorCallback:p}){try{const m=u===j0,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:d},...a},O=Lv({url:e,serverUrl:c,corsProxyUrl:l}),v=new URL(O);for(const y in s)v.searchParams.set(y,s[y]);const x=await Qo(O,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...o},body:new URLSearchParams(n5(g)).toString()});await mC(x,h,p)}catch(m){p(sl.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:d,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=Lv({url:r,serverUrl:d,corsProxyUrl:u}),O=new URL(g);for(const x in a)O.searchParams.set(x,a[x]);const v=await Qo(g,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...l},body:new URLSearchParams(n5(m)).toString()});await mC(v,h,p)}catch(m){p(sl.OAuth2Error.fromError(m))}}};function V4(t){const e={randomStr:WZe(),...t};return btoa(encodeURIComponent(JSON.stringify(e)))}async function mC(t,e,n){if(t.ok){const r=await t.json();if(r.error){n(sl.OAuth2Error.fromJsonData(r));return}e(r)}else{if((t.headers.get("Content-Type")||"").indexOf("json")>-1){const s=await t.json();n(sl.OAuth2Error.fromJsonData(s));return}n(sl.OAuth2Error.fromTextData(await t.text()))}}async function ZZe(t){return bUe(await yUe(t))}function BZe(t){return("0"+t.toString(16)).slice(-2)}function YZe(){const t=new Uint32Array(28);return crypto.getRandomValues(t),Array.from(t,BZe).join("")}function cw({scopes:t,onScopesChange:e,environment:n}){const r=i=>{e(s=>s.filter((o,a)=>a!==i))};return f.jsx(GZe,{children:f.jsx(HZe,{keyName:"Scopes",elements:t,onElementsChange:i=>e(s=>i(s)),createEmptyParameter:HIe,environment:n,actions:i=>f.jsx(ws,{onClick:()=>r(i),variant:"text",icon:f.jsx(rr.TrashCanIcon,{})}),singleValue:!0,hideOuterBorders:!0,valuePlaceholder:"New scope item"})})}const GZe=T.default.div`
4119
+ `;function WZe(t=32){let e="";for(;e.length<t;)e+=Math.random().toString(32).substring(2);return e.substring(0,t)}async function cI(t,e,n){const r=typeof t=="string"?t:t.toString();if(Qn()){const{openUrl:i}=await Promise.resolve().then(()=>require("./replay-index-CJwhVhXZ.js"));await i(r);return}window.open(r,e,n)}const M4="/_auth/oauth2-redirect.html";let lw=class ng{static async authorizeImplicit({authorizationUrl:e,clientId:n,scopes:r,extraAuthParams:i={},routingBasePath:s="/",redirectUri:o,successCallback:a,errorCallback:l}){const c=V4({date:new Date().toString()});try{const u=new URL(e),d=s==="/"?"":s,h=`${window.location.origin}${d}${M4}`;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),ng.clearRedirectData("implicit")},errorCallback:p=>{l(p),ng.clearRedirectData("implicit")}},await cI(u.toString())}catch(u){l(sl.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:d={},extraTokenParams:h={},routingBasePath:p="/",redirectUri:m,withPkce:g,successCallback:O,errorCallback:v}){try{const x=Lv({url:e,serverUrl:r}),y=new URL(x),w=Lv({url:n,serverUrl:r}),S=new URL(w),P=p==="/"?"":p,k=`${window.location.origin}${P}${M4}`,I=V4({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=YZe(),a=await ZZe(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=_a({client_id:i,client_secret:s,...o&&{code_verifier:o},code:E,grant_type:"authorization_code",redirect_uri:m||k,...d});try{const j=await Qo(S,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...u},body:new URLSearchParams(Q).toString()});await mC(j,O,v)}catch(j){v(sl.OAuth2Error.fromError(j))}ng.clearRedirectData("authorizationCode")},errorCallback:E=>{v(sl.OAuth2Error.fromError(E)),ng.clearRedirectData("authorizationCode")}},await cI(y.toString())}catch(x){v(sl.OAuth2Error.fromError(x))}}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:d,successCallback:h,errorCallback:p}){try{const m=u===j0,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:d},...a},O=Lv({url:e,serverUrl:c,corsProxyUrl:l}),v=new URL(O);for(const y in s)v.searchParams.set(y,s[y]);const x=await Qo(O,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...o},body:new URLSearchParams(n5(g)).toString()});await mC(x,h,p)}catch(m){p(sl.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:d,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=Lv({url:r,serverUrl:d,corsProxyUrl:u}),O=new URL(g);for(const x in a)O.searchParams.set(x,a[x]);const v=await Qo(g,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...l},body:new URLSearchParams(n5(m)).toString()});await mC(v,h,p)}catch(m){p(sl.OAuth2Error.fromError(m))}}};function V4(t){const e={randomStr:WZe(),...t};return btoa(encodeURIComponent(JSON.stringify(e)))}async function mC(t,e,n){if(t.ok){const r=await t.json();if(r.error){n(sl.OAuth2Error.fromJsonData(r));return}e(r)}else{if((t.headers.get("Content-Type")||"").indexOf("json")>-1){const s=await t.json();n(sl.OAuth2Error.fromJsonData(s));return}n(sl.OAuth2Error.fromTextData(await t.text()))}}async function ZZe(t){return bUe(await yUe(t))}function BZe(t){return("0"+t.toString(16)).slice(-2)}function YZe(){const t=new Uint32Array(28);return crypto.getRandomValues(t),Array.from(t,BZe).join("")}function cw({scopes:t,onScopesChange:e,environment:n}){const r=i=>{e(s=>s.filter((o,a)=>a!==i))};return f.jsx(GZe,{children:f.jsx(HZe,{keyName:"Scopes",elements:t,onElementsChange:i=>e(s=>i(s)),createEmptyParameter:HIe,environment:n,actions:i=>f.jsx(ws,{onClick:()=>r(i),variant:"text",icon:f.jsx(rr.TrashCanIcon,{})}),singleValue:!0,hideOuterBorders:!0,valuePlaceholder:"New scope item"})})}const GZe=T.default.div`
4120
4120
  width: 100%;
4121
4121
 
4122
4122
  > div {
@@ -6327,7 +6327,7 @@ ${u.join(`\r
6327
6327
  display: inline-block;
6328
6328
  color: var(--text-color-secondary);
6329
6329
  margin-left: var(--spacing-xs);
6330
- `,gKe="request",mKe=new Set(["replay:","redocly-replay:"]),OKe=8*1024,vKe=4*1024,OI=1024,yKe=new Set([Hn.JSON,Hn.XML,Hn.HTML,Hn.Text]);function vI(t){return hQ(t).length>0}function bKe(t,e,n){return{id:crypto.randomUUID(),key:e,value:n,in:t,active:!0}}function Pee(t,e){return!t||t.length>OI||e.length>OI||vI(e)}function SC(t,e,n){const r=[];for(const[i,s]of t){if(!i.startsWith(e))continue;const o=i.slice(e.length);if(Pee(o,s))return null;r.push(bKe(n,o,s))}return r}function xKe(t){if(t.length>OKe)return null;let e;try{e=new URL(t)}catch{return null}if(!mKe.has(e.protocol)||e.hostname.toLowerCase()!==gKe)return null;const n=e.searchParams,r=n.get("url");if(!r||vI(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(!Ah.includes(s))return null;const o=SC(n,"header.","header"),a=SC(n,"query.","query"),l=SC(n,"cookie.","cookie");if(!o||!a||!l)return null;const c=wO(r);if(c.some(p=>Pee(p.key,p.value)))return null;const u=n.get("body");if(u!==null&&(u.length>vKe||vI(u)))return null;const d=n.get("contentType")?.trim();if(d&&!yKe.has(d))return null;const h=n.get("env")?.trim();return h&&h.length>OI?null:{xOperation:{method:s,url:r},headers:o,queryParameters:[...c,...a],cookies:l,...u!==null&&{body:{content:u,...d&&{type:d}}},...h&&{environment:h}}}function SKe(t){return t.stepId===null&&t.collectionId===null&&t.workflowId===null&&t.historyId===null&&!t.sourceFile}function wKe({onEnvironmentNotFound:t}={}){const{getTabs:e,setActiveTabIdx:n,updateTabDataAt:r}=sd(),{addNewTab:i}=hr(),s=Fa(),o=Wh();return b.useCallback(a=>{const l=e().findIndex(({data:u})=>Rn(u,Ue.Step)&&SKe(u)&&RE(u,a.xOperation));let c;if(l!==-1)c=l,n(c);else{const u=Na({xOperation:a.xOperation});c=i({id:crypto.randomUUID(),state:An.Normal,data:hf({draftStep:u,activeTabName:vu(u)})})}e()[c]&&r(c,u=>{const d={...u,response:null,requestError:null,isProcessingRequest:!1};if(!d.draftStep)return d;const h=mh();return{...d,draftStep:{...d.draftStep,parameters:{...d.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(d=>d.name===a.environment)?o(a.environment):t?.(a.environment))},[e,n,r,i,s,o,t])}const TKe="com.redocly.deepLink.opened";let Ez=!1;function CKe(){const{warning:t}=EI.useToast(),e=Ke(),n=wKe({onEnvironmentNotFound:i=>t(`Environment "${i}" not found`)}),r=b.useRef(n);r.current=n,b.useEffect(()=>{let i,s=!1;const o=a=>{const l=a[0]&&xKe(a[0]);l&&(r.current(l),e.sendEvent(TKe,[{...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-B1ISf2Pd.js")),c=await a(o);if(s){c();return}if(i=c,!Ez){const u=await l();if(s)return;Ez=!0,u?.[0]&&o(u)}})(),()=>{s=!0,i?.()}},[])}function PKe(t){const e=t||"default";return{id:Vm(iw(e)),systemFilesDir:$k.join("/replay",e),userFilesDir:$k.join("/projects",e)}}async function kKe(t){if(!t)throw new Error("Tauri project: userFilesDir is required");const e=Vm(iw(t)),n=await EKe(),r=await NQ(n,"replay",e);return{id:e,systemFilesDir:r,userFilesDir:t}}async function EKe(){if(!cE)return AE();try{return await $Y()}catch{return AE()}}function ay(t,e){if(e.size===0)return t;let n=t;for(let r=0;r<t.length;r++){const i=t[r];!hO(i)||!i.key||!e.has(i.key)||(n===t&&(n=[...t]),n[r]={...i,value:`$inputs.${i.key}`,active:!0})}return n}function kee(t,e,n){if(typeof e=="string"){const s=eo(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=kee(r[s],o,n);a!==r[s]&&(i===r&&(i={...r}),i[s]=a)}return i}function IKe(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=kee(r[s],i,n);o!==r[s]&&(r===t&&(r=[...t]),r[s]=o)}return r}function $Ke(t,e,n){const r=bQ(e.parameters,"in"),{pathParameters:i,queryParameters:s,headers:o,cookies:a}=t.parameters;return{...t,parameters:{...t.parameters,pathParameters:ay(i,Rf(r.path,"path",n)),queryParameters:ay(s,z6(r.query,r.querystring,n)),headers:ay(o,Rf(r.header,"header",n)),cookies:ay(a,Rf(r.cookie,"cookie",n))},security:IKe(t.security,yS(e),h6e(e,n))}}function b_(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 AKe=(t,e,n)=>t.find(r=>{if(e&&r.operationId===e)return!0;if(n&&r.apiPath){const{path:i,method:s}=vG({operationPath:n,parsedSourceDescriptions:[]});return r.apiPath.path===i&&r.apiPath.method===s}return!1});function QKe(t,e,n){if(!t||!t.paths||Object.keys(t.paths).length===0)return{operations:null,error:0};const{operations:r}=RKe(t,e,n);return{operations:r}}function RKe(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}=Iz(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}=Iz(i,o,t,c,e,!0,n);u&&r.push(u)})}return{operations:r}}function Iz(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:lAe(a,s,i,l)}}function _Ke(t){return"kind"in t&&"definition"in t}function jKe(t,e,n){if(t)return _Ke(t)?t:{kind:"openapi",definition:{document:t},operation:NKe(e,n)}}function NKe(t,e){if(t&&e)return{operationId:t,pointer:e};if(t)return{operationId:t};if(e)return{pointer:e}}function $z(t,e,n){return t==="openapi"?DKe(e,n):(console.error(`Replay does not support the API kind "${String(t)}".`),null)}function DKe(t,e){try{const n=b_(t,[]),{operations:r}=QKe(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 Az(t,e){const n=AKe(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 MKe({store:t,selectedEnvironment:e,selectedEnvironmentSeq:n}){const r=b.useRef({seq:n,name:e});b.useEffect(()=>{!e||!(n===void 0?e!==r.current.name:n!==r.current.seq)||(r.current={seq:n,name:e},t.set($o,e))},[t,e,n])}let eb=performance.now();function VKe(){eb=performance.now()}const Wd=t=>Math.max(0,Math.round(t));function LKe({loadTiming:t,firstRenderTime:e,operationsCount:n}){const{sendEvent:r}=Ke();b.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:d=u}=t,h=Math.max(eb,d);r("com.redocly.app.loaded",[{...ye("app","replayApp"),duration_ms:Wd(c-u),definition_ms:Wd(d-u),chunk_ms:Wd(eb-d),mount_ms:Wd(e-h),init_ms:Wd(i-e),render_ms:Wd(c-i),cold:eb>u,operations_count:n}])},0)});return()=>{cancelAnimationFrame(l),clearTimeout(a),document.removeEventListener("visibilitychange",o)}},[])}class zKe{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 yI{static instance=null;static async initialize(e,n){this.close(),this.instance=await XKe(e,n)}static getInstance(){if(!this.instance)throw new Error("AiChatService not initialized");return this.instance}static close(){this.instance=null}}async function XKe(t,e){if(e){const{AiChatSqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-AiChatSqliteDBStorage-B978zufl.js")),r=Em.getInstance(),i=new n(r);return new zKe(i)}else throw new Error("Not implemented")}const Zd="ai-chat",wC="detail",UKe="title",Qz="infinite-history",Eee={all:()=>[Zd],details:()=>[Zd,wC],detail:t=>[Zd,wC,t],detailTitle:t=>[Zd,wC,t,UKe],infiniteHistories:()=>[Zd,Qz],infiniteHistory:t=>[Zd,Qz,t]};function FKe(t){return{data:t.data.map(e=>({...e,step:{...e.step,security:e.step.security.securities}})),version:2}}const qKe=2;function WKe(t){const e=JSON.parse(t);let n;return e.version===1?n=FKe(e):n=e,n.version!==qKe&&console.warn(`Unknown history version ${n.version}, attempting migration anyway`),n.data.map(r=>({...r,type:"step"}))}const TC="history.json",ZKe="history.json.backup";class BKe{static async migrateFromStorage(e,n,r){try{const i=await e.get(TC);if(!i||i.trim()==="")return{migrated:!1,itemCount:0};const s=WKe(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(TC,ZKe)}catch{await e.remove(TC)}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-DrnMzlvI.js")),s=new i(e.systemFilesDir);return this.migrateFromStorage(s,n,"JSON file")}else{const i=new jE(e.systemFilesDir);return this.migrateFromStorage(i,n,"localStorage")}}}const x_=t=>f.jsx(YKe,{...t},t.settings.storageKey),YKe=({children:t,settings:e,api:n,activeOperationId:r,activeOperationPointer:i,onLoad:s,loadTiming:o,selectedEnvironmentSeq:a})=>{const[l]=b.useState(()=>performance.now()),c=g8(),u=Ke(),d=ki.useQueryClient(),[h]=b.useState(jI),p=jKe(n,r,i),m=b.useRef(e);m.current=e;const g=b.useRef(!1);b.useEffect(()=>(g.current=!1,()=>{g.current=!0}),[]);async function O(){const U=Qn()?await kKe(m.current.storageKey):PKe(m.current.storageKey);if(m.current.layout!=="preview"&&Qn()&&Am.initialize(),await c.init(U,m.current,h,u),m.current.layout!=="preview"){if(g.current)return;if(Qn()){const M=`${U.systemFilesDir}/replay.db`;await Em.initialize(M),await yI.initialize(U,Qn())}if(g.current)return;await bc.initialize(U,Qn()),await Ao.initialize(Qn());try{await Ao.getInstance()?.pruneOlderThan(Date.now()-VIe)}catch(M){console.error("Failed to prune step context:",M)}if(g.current)return;try{const M=await BKe.migrate(U,bc.getInstance(),Qn());M.migrated&&u.sendEvent("com.redocly.history.migration",[{...ye("migration","historyMigration","storage"),status:"success",itemCount:M.itemCount}])}catch(M){console.error("History migration failed:",M),u.sendEvent("com.redocly.history.migration",[{...ye("migration","historyMigration","storage"),status:"error",error:M instanceof Error?M.message:"Unknown error"}])}}N(),h.get(si).length===0&&h.set(si,vA);function N(){if(!p)return;p.definition.graphql&&KKe(h,p.definition.document,p.definition.graphql.sdl);const{convertOperationToReplayValue:M,dynamicReplayValues:D}=m.current,F=$z(p.kind,p.definition.document,M);if(!F)return;const{apiId:W,operations:G}=F;if(!G[0].collectionPath?.split("/")?.[0])return;h.set(_s,[{id:W,srcType:qi.FS,...F.document}]),h.set(LR,W);const ne=Az(F,p.operation);if(!ne)return;const{requestOperation:q,path:H,method:J,openApiOperation:ie}=ne;ie&&Rz(h,W,ie,m.current),eet(h,{apiId:W,path:H,method:J,operationId:q.operationId,isAdditionalOperation:q.isAdditionalOperation},ie,D)}}const v=b.useRef(void 0),[x,y]=b.useState({status:"pending"}),w=b.useEffectEvent(O);b.useLayoutEffect(()=>{v.current??=w();let U=!0;return v.current.then(()=>U&&y({status:"fulfilled"}),N=>U&&y({status:"rejected",error:N})),()=>{U=!1}},[]),b.useEffect(()=>{if(e.layout!=="preview")return d.invalidateQueries({queryKey:ui.all}),d.invalidateQueries({queryKey:Eee.all()}),d.invalidateQueries({queryKey:jO.all}),()=>{bc.close(),yI.close(),Am.close(),Ao.close(),Qn()&&Em.close().catch(U=>{console.error("Failed to close SqliteDBConnection:",U)})}},[e.layout,d]),MKe({store:h,selectedEnvironment:e.selectedEnvironment,selectedEnvironmentSeq:a});const S=p?.kind,P=p?.definition.document,k=e.convertOperationToReplayValue,I=b.useMemo(()=>S&&P&&k?$z(S,P,k):null,[S,P,k]),E=p?.operation?.operationId,Q=p?.operation?.pointer,{predefinedEnvValues:j,dynamicReplayValues:R,gateEnvironments:V,allowedEnvironments:z,selectedEnvironment:X}=e;b.useEffect(()=>{if(!I)return;const U=Az(I,{operationId:E,pointer:Q});U?.openApiOperation&&Rz(h,I.apiId,U.openApiOperation,{predefinedEnvValues:j,dynamicReplayValues:R,gateEnvironments:V,allowedEnvironments:z,selectedEnvironment:X})},[h,I,E,Q,j,R,V,z,X]);const A=e.layout==="preview"?null:f.jsx(fKe,{projectPath:e.storageKey});if(x.status==="rejected")throw x.error;return f.jsx(b.Suspense,{fallback:A,children:x.status==="pending"?A:f.jsx(GKe,{store:h,settings:e,api:n,onLoad:s,loadTiming:o,firstRenderTime:l,operationsCount:I?.operations.length??0,children:t})})};function GKe({store:t,children:e,settings:n,api:r,onLoad:i,loadTiming:s,firstRenderTime:o,operationsCount:a}){LKe({loadTiming:s,firstRenderTime:o,operationsCount:a});const l=xie(n,r);return b.useEffect(()=>{i?.()},[]),f.jsx(cne,{store:t,children:f.jsxs(HKe,{settings:l,apiId:n.apiId,children:[Qn()&&f.jsx(JKe,{}),e]})})}function HKe({settings:t,apiId:e,children:n}){pne([[lg,t],[Tg,e]]);const r=Mo();return b.useEffect(()=>{fm(r.get(lg),t)||r.set(lg,t)},[r,t]),b.useEffect(()=>{r.get(Tg)!==e&&r.set(Tg,e)},[r,e]),f.jsx(f.Fragment,{children:n})}function JKe(){return CKe(),null}const Rz=(t,e,n,r)=>{const i=t.get(si),{environments:s,generatedInputs:o,synthesizedEnvironmentNames:a}=v6e(e,n,i,r.predefinedEnvValues,r.dynamicReplayValues,r.gateEnvironments);_z(t.get(ex),o)||t.set(ex,o);const{newEnvironments:l,predefinedEnvironmentNames:c,activeEnvName:u}=y6e({envs:s,synthesizedEnvironmentNames:a,existingEnvironments:i,allowedEnvironments:r.allowedEnvironments,selectedEnvironment:r.selectedEnvironment,activeEnvironmentId:t.get($o)});_z(t.get(K0),c)||t.set(K0,c),fm(l,t.get(si))||t.set(si,l),t.set($o,u)},_z=(t,e)=>t.size===e.size&&[...t].every(n=>e.has(n)),KKe=(t,e,n)=>{const r=e.info?.title;if(!r)return;let i;try{i=X7e(oZe(n))}catch(s){console.error(`Replay cannot read the GraphQL schema of "${r}".`,s),i={status:"error",error:s instanceof Error?s.message:String(s)}}U7e(t,b_(e,[]),i)},eet=(t,e,n,r)=>{const i=t.get(Zr).findIndex(({data:s})=>T9(s,e));if(i!==-1)n&&r&&t.set(Zr,s=>_g(s,i,o=>o.draftStep?{...o,draftStep:$Ke(o.draftStep,n,r)}:o)),t.set(Os,i);else{const s=VQ(e,n,r),o=[...t.get(Zr),{...s,state:An.Normal}];t.set(Zr,o),t.set(Os,o.length-1)}},Iee=.5,tet=.01,net=({intersectionRatio:t})=>t>=Iee-tet;function ret(t,e){const n=b.useRef(!1);b.useEffect(()=>{const r=t.current;if(!r||n.current)return;const i=new IntersectionObserver(s=>{n.current||s.some(net)&&(i.disconnect(),n.current=!0,e())},{threshold:Iee});return i.observe(r),()=>{i.disconnect()}},[t,e])}function iet(t){const e=b.useMemo(()=>h8(!0),[]);return f.jsx(ki.QueryClientProvider,{client:VS(),children:f.jsx(g_,{children:f.jsx(NNe,{value:e,children:f.jsx(Ox.Provider,{value:t.settings,children:f.jsx(x_,{...t,selectedEnvironmentSeq:void 0,children:f.jsx(mee,{onError:n=>console.error(n),children:f.jsx(set,{})})})})})})})}function set(){const{sendEvent:t}=Ke(),e=b.useRef(null),n=b.useCallback(()=>{t("com.redocly.app.lifecycle",[{...ye("app","replayApp"),action:"open"}])},[t]);return ret(e,n),f.jsx(b.StrictMode,{children:f.jsxs(oet,{ref:e,children:[f.jsx(aet,{children:f.jsx(y_,{})}),f.jsx(ox,{hideTabs:!0}),f.jsx(vee,{})]})})}const oet=T.default.div`
6330
+ `,gKe="request",mKe=new Set(["replay:","redocly-replay:"]),OKe=8*1024,vKe=4*1024,OI=1024,yKe=new Set([Hn.JSON,Hn.XML,Hn.HTML,Hn.Text]);function vI(t){return hQ(t).length>0}function bKe(t,e,n){return{id:crypto.randomUUID(),key:e,value:n,in:t,active:!0}}function Pee(t,e){return!t||t.length>OI||e.length>OI||vI(e)}function SC(t,e,n){const r=[];for(const[i,s]of t){if(!i.startsWith(e))continue;const o=i.slice(e.length);if(Pee(o,s))return null;r.push(bKe(n,o,s))}return r}function xKe(t){if(t.length>OKe)return null;let e;try{e=new URL(t)}catch{return null}if(!mKe.has(e.protocol)||e.hostname.toLowerCase()!==gKe)return null;const n=e.searchParams,r=n.get("url");if(!r||vI(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(!Ah.includes(s))return null;const o=SC(n,"header.","header"),a=SC(n,"query.","query"),l=SC(n,"cookie.","cookie");if(!o||!a||!l)return null;const c=wO(r);if(c.some(p=>Pee(p.key,p.value)))return null;const u=n.get("body");if(u!==null&&(u.length>vKe||vI(u)))return null;const d=n.get("contentType")?.trim();if(d&&!yKe.has(d))return null;const h=n.get("env")?.trim();return h&&h.length>OI?null:{xOperation:{method:s,url:r},headers:o,queryParameters:[...c,...a],cookies:l,...u!==null&&{body:{content:u,...d&&{type:d}}},...h&&{environment:h}}}function SKe(t){return t.stepId===null&&t.collectionId===null&&t.workflowId===null&&t.historyId===null&&!t.sourceFile}function wKe({onEnvironmentNotFound:t}={}){const{getTabs:e,setActiveTabIdx:n,updateTabDataAt:r}=sd(),{addNewTab:i}=hr(),s=Fa(),o=Wh();return b.useCallback(a=>{const l=e().findIndex(({data:u})=>Rn(u,Ue.Step)&&SKe(u)&&RE(u,a.xOperation));let c;if(l!==-1)c=l,n(c);else{const u=Na({xOperation:a.xOperation});c=i({id:crypto.randomUUID(),state:An.Normal,data:hf({draftStep:u,activeTabName:vu(u)})})}e()[c]&&r(c,u=>{const d={...u,response:null,requestError:null,isProcessingRequest:!1};if(!d.draftStep)return d;const h=mh();return{...d,draftStep:{...d.draftStep,parameters:{...d.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(d=>d.name===a.environment)?o(a.environment):t?.(a.environment))},[e,n,r,i,s,o,t])}const TKe="com.redocly.deepLink.opened";let Ez=!1;function CKe(){const{warning:t}=EI.useToast(),e=Ke(),n=wKe({onEnvironmentNotFound:i=>t(`Environment "${i}" not found`)}),r=b.useRef(n);r.current=n,b.useEffect(()=>{let i,s=!1;const o=a=>{const l=a[0]&&xKe(a[0]);l&&(r.current(l),e.sendEvent(TKe,[{...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-DXD-sXPY.js")),c=await a(o);if(s){c();return}if(i=c,!Ez){const u=await l();if(s)return;Ez=!0,u?.[0]&&o(u)}})(),()=>{s=!0,i?.()}},[])}function PKe(t){const e=t||"default";return{id:Vm(iw(e)),systemFilesDir:$k.join("/replay",e),userFilesDir:$k.join("/projects",e)}}async function kKe(t){if(!t)throw new Error("Tauri project: userFilesDir is required");const e=Vm(iw(t)),n=await EKe(),r=await NQ(n,"replay",e);return{id:e,systemFilesDir:r,userFilesDir:t}}async function EKe(){if(!cE)return AE();try{return await $Y()}catch{return AE()}}function ay(t,e){if(e.size===0)return t;let n=t;for(let r=0;r<t.length;r++){const i=t[r];!hO(i)||!i.key||!e.has(i.key)||(n===t&&(n=[...t]),n[r]={...i,value:`$inputs.${i.key}`,active:!0})}return n}function kee(t,e,n){if(typeof e=="string"){const s=eo(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=kee(r[s],o,n);a!==r[s]&&(i===r&&(i={...r}),i[s]=a)}return i}function IKe(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=kee(r[s],i,n);o!==r[s]&&(r===t&&(r=[...t]),r[s]=o)}return r}function $Ke(t,e,n){const r=bQ(e.parameters,"in"),{pathParameters:i,queryParameters:s,headers:o,cookies:a}=t.parameters;return{...t,parameters:{...t.parameters,pathParameters:ay(i,Rf(r.path,"path",n)),queryParameters:ay(s,z6(r.query,r.querystring,n)),headers:ay(o,Rf(r.header,"header",n)),cookies:ay(a,Rf(r.cookie,"cookie",n))},security:IKe(t.security,yS(e),h6e(e,n))}}function b_(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 AKe=(t,e,n)=>t.find(r=>{if(e&&r.operationId===e)return!0;if(n&&r.apiPath){const{path:i,method:s}=vG({operationPath:n,parsedSourceDescriptions:[]});return r.apiPath.path===i&&r.apiPath.method===s}return!1});function QKe(t,e,n){if(!t||!t.paths||Object.keys(t.paths).length===0)return{operations:null,error:0};const{operations:r}=RKe(t,e,n);return{operations:r}}function RKe(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}=Iz(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}=Iz(i,o,t,c,e,!0,n);u&&r.push(u)})}return{operations:r}}function Iz(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:lAe(a,s,i,l)}}function _Ke(t){return"kind"in t&&"definition"in t}function jKe(t,e,n){if(t)return _Ke(t)?t:{kind:"openapi",definition:{document:t},operation:NKe(e,n)}}function NKe(t,e){if(t&&e)return{operationId:t,pointer:e};if(t)return{operationId:t};if(e)return{pointer:e}}function $z(t,e,n){return t==="openapi"?DKe(e,n):(console.error(`Replay does not support the API kind "${String(t)}".`),null)}function DKe(t,e){try{const n=b_(t,[]),{operations:r}=QKe(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 Az(t,e){const n=AKe(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 MKe({store:t,selectedEnvironment:e,selectedEnvironmentSeq:n}){const r=b.useRef({seq:n,name:e});b.useEffect(()=>{!e||!(n===void 0?e!==r.current.name:n!==r.current.seq)||(r.current={seq:n,name:e},t.set($o,e))},[t,e,n])}let eb=performance.now();function VKe(){eb=performance.now()}const Wd=t=>Math.max(0,Math.round(t));function LKe({loadTiming:t,firstRenderTime:e,operationsCount:n}){const{sendEvent:r}=Ke();b.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:d=u}=t,h=Math.max(eb,d);r("com.redocly.app.loaded",[{...ye("app","replayApp"),duration_ms:Wd(c-u),definition_ms:Wd(d-u),chunk_ms:Wd(eb-d),mount_ms:Wd(e-h),init_ms:Wd(i-e),render_ms:Wd(c-i),cold:eb>u,operations_count:n}])},0)});return()=>{cancelAnimationFrame(l),clearTimeout(a),document.removeEventListener("visibilitychange",o)}},[])}class zKe{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 yI{static instance=null;static async initialize(e,n){this.close(),this.instance=await XKe(e,n)}static getInstance(){if(!this.instance)throw new Error("AiChatService not initialized");return this.instance}static close(){this.instance=null}}async function XKe(t,e){if(e){const{AiChatSqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-AiChatSqliteDBStorage-DN3HPpIj.js")),r=Em.getInstance(),i=new n(r);return new zKe(i)}else throw new Error("Not implemented")}const Zd="ai-chat",wC="detail",UKe="title",Qz="infinite-history",Eee={all:()=>[Zd],details:()=>[Zd,wC],detail:t=>[Zd,wC,t],detailTitle:t=>[Zd,wC,t,UKe],infiniteHistories:()=>[Zd,Qz],infiniteHistory:t=>[Zd,Qz,t]};function FKe(t){return{data:t.data.map(e=>({...e,step:{...e.step,security:e.step.security.securities}})),version:2}}const qKe=2;function WKe(t){const e=JSON.parse(t);let n;return e.version===1?n=FKe(e):n=e,n.version!==qKe&&console.warn(`Unknown history version ${n.version}, attempting migration anyway`),n.data.map(r=>({...r,type:"step"}))}const TC="history.json",ZKe="history.json.backup";class BKe{static async migrateFromStorage(e,n,r){try{const i=await e.get(TC);if(!i||i.trim()==="")return{migrated:!1,itemCount:0};const s=WKe(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(TC,ZKe)}catch{await e.remove(TC)}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-CkaGV5Gd.js")),s=new i(e.systemFilesDir);return this.migrateFromStorage(s,n,"JSON file")}else{const i=new jE(e.systemFilesDir);return this.migrateFromStorage(i,n,"localStorage")}}}const x_=t=>f.jsx(YKe,{...t},t.settings.storageKey),YKe=({children:t,settings:e,api:n,activeOperationId:r,activeOperationPointer:i,onLoad:s,loadTiming:o,selectedEnvironmentSeq:a})=>{const[l]=b.useState(()=>performance.now()),c=g8(),u=Ke(),d=ki.useQueryClient(),[h]=b.useState(jI),p=jKe(n,r,i),m=b.useRef(e);m.current=e;const g=b.useRef(!1);b.useEffect(()=>(g.current=!1,()=>{g.current=!0}),[]);async function O(){const U=Qn()?await kKe(m.current.storageKey):PKe(m.current.storageKey);if(m.current.layout!=="preview"&&Qn()&&Am.initialize(),await c.init(U,m.current,h,u),m.current.layout!=="preview"){if(g.current)return;if(Qn()){const M=`${U.systemFilesDir}/replay.db`;await Em.initialize(M),await yI.initialize(U,Qn())}if(g.current)return;await bc.initialize(U,Qn()),await Ao.initialize(Qn());try{await Ao.getInstance()?.pruneOlderThan(Date.now()-VIe)}catch(M){console.error("Failed to prune step context:",M)}if(g.current)return;try{const M=await BKe.migrate(U,bc.getInstance(),Qn());M.migrated&&u.sendEvent("com.redocly.history.migration",[{...ye("migration","historyMigration","storage"),status:"success",itemCount:M.itemCount}])}catch(M){console.error("History migration failed:",M),u.sendEvent("com.redocly.history.migration",[{...ye("migration","historyMigration","storage"),status:"error",error:M instanceof Error?M.message:"Unknown error"}])}}N(),h.get(si).length===0&&h.set(si,vA);function N(){if(!p)return;p.definition.graphql&&KKe(h,p.definition.document,p.definition.graphql.sdl);const{convertOperationToReplayValue:M,dynamicReplayValues:D}=m.current,F=$z(p.kind,p.definition.document,M);if(!F)return;const{apiId:W,operations:G}=F;if(!G[0].collectionPath?.split("/")?.[0])return;h.set(_s,[{id:W,srcType:qi.FS,...F.document}]),h.set(LR,W);const ne=Az(F,p.operation);if(!ne)return;const{requestOperation:q,path:H,method:J,openApiOperation:ie}=ne;ie&&Rz(h,W,ie,m.current),eet(h,{apiId:W,path:H,method:J,operationId:q.operationId,isAdditionalOperation:q.isAdditionalOperation},ie,D)}}const v=b.useRef(void 0),[x,y]=b.useState({status:"pending"}),w=b.useEffectEvent(O);b.useLayoutEffect(()=>{v.current??=w();let U=!0;return v.current.then(()=>U&&y({status:"fulfilled"}),N=>U&&y({status:"rejected",error:N})),()=>{U=!1}},[]),b.useEffect(()=>{if(e.layout!=="preview")return d.invalidateQueries({queryKey:ui.all}),d.invalidateQueries({queryKey:Eee.all()}),d.invalidateQueries({queryKey:jO.all}),()=>{bc.close(),yI.close(),Am.close(),Ao.close(),Qn()&&Em.close().catch(U=>{console.error("Failed to close SqliteDBConnection:",U)})}},[e.layout,d]),MKe({store:h,selectedEnvironment:e.selectedEnvironment,selectedEnvironmentSeq:a});const S=p?.kind,P=p?.definition.document,k=e.convertOperationToReplayValue,I=b.useMemo(()=>S&&P&&k?$z(S,P,k):null,[S,P,k]),E=p?.operation?.operationId,Q=p?.operation?.pointer,{predefinedEnvValues:j,dynamicReplayValues:R,gateEnvironments:V,allowedEnvironments:z,selectedEnvironment:X}=e;b.useEffect(()=>{if(!I)return;const U=Az(I,{operationId:E,pointer:Q});U?.openApiOperation&&Rz(h,I.apiId,U.openApiOperation,{predefinedEnvValues:j,dynamicReplayValues:R,gateEnvironments:V,allowedEnvironments:z,selectedEnvironment:X})},[h,I,E,Q,j,R,V,z,X]);const A=e.layout==="preview"?null:f.jsx(fKe,{projectPath:e.storageKey});if(x.status==="rejected")throw x.error;return f.jsx(b.Suspense,{fallback:A,children:x.status==="pending"?A:f.jsx(GKe,{store:h,settings:e,api:n,onLoad:s,loadTiming:o,firstRenderTime:l,operationsCount:I?.operations.length??0,children:t})})};function GKe({store:t,children:e,settings:n,api:r,onLoad:i,loadTiming:s,firstRenderTime:o,operationsCount:a}){LKe({loadTiming:s,firstRenderTime:o,operationsCount:a});const l=xie(n,r);return b.useEffect(()=>{i?.()},[]),f.jsx(cne,{store:t,children:f.jsxs(HKe,{settings:l,apiId:n.apiId,children:[Qn()&&f.jsx(JKe,{}),e]})})}function HKe({settings:t,apiId:e,children:n}){pne([[lg,t],[Tg,e]]);const r=Mo();return b.useEffect(()=>{fm(r.get(lg),t)||r.set(lg,t)},[r,t]),b.useEffect(()=>{r.get(Tg)!==e&&r.set(Tg,e)},[r,e]),f.jsx(f.Fragment,{children:n})}function JKe(){return CKe(),null}const Rz=(t,e,n,r)=>{const i=t.get(si),{environments:s,generatedInputs:o,synthesizedEnvironmentNames:a}=v6e(e,n,i,r.predefinedEnvValues,r.dynamicReplayValues,r.gateEnvironments);_z(t.get(ex),o)||t.set(ex,o);const{newEnvironments:l,predefinedEnvironmentNames:c,activeEnvName:u}=y6e({envs:s,synthesizedEnvironmentNames:a,existingEnvironments:i,allowedEnvironments:r.allowedEnvironments,selectedEnvironment:r.selectedEnvironment,activeEnvironmentId:t.get($o)});_z(t.get(K0),c)||t.set(K0,c),fm(l,t.get(si))||t.set(si,l),t.set($o,u)},_z=(t,e)=>t.size===e.size&&[...t].every(n=>e.has(n)),KKe=(t,e,n)=>{const r=e.info?.title;if(!r)return;let i;try{i=X7e(oZe(n))}catch(s){console.error(`Replay cannot read the GraphQL schema of "${r}".`,s),i={status:"error",error:s instanceof Error?s.message:String(s)}}U7e(t,b_(e,[]),i)},eet=(t,e,n,r)=>{const i=t.get(Zr).findIndex(({data:s})=>T9(s,e));if(i!==-1)n&&r&&t.set(Zr,s=>_g(s,i,o=>o.draftStep?{...o,draftStep:$Ke(o.draftStep,n,r)}:o)),t.set(Os,i);else{const s=VQ(e,n,r),o=[...t.get(Zr),{...s,state:An.Normal}];t.set(Zr,o),t.set(Os,o.length-1)}},Iee=.5,tet=.01,net=({intersectionRatio:t})=>t>=Iee-tet;function ret(t,e){const n=b.useRef(!1);b.useEffect(()=>{const r=t.current;if(!r||n.current)return;const i=new IntersectionObserver(s=>{n.current||s.some(net)&&(i.disconnect(),n.current=!0,e())},{threshold:Iee});return i.observe(r),()=>{i.disconnect()}},[t,e])}function iet(t){const e=b.useMemo(()=>h8(!0),[]);return f.jsx(ki.QueryClientProvider,{client:VS(),children:f.jsx(g_,{children:f.jsx(NNe,{value:e,children:f.jsx(Ox.Provider,{value:t.settings,children:f.jsx(x_,{...t,selectedEnvironmentSeq:void 0,children:f.jsx(mee,{onError:n=>console.error(n),children:f.jsx(set,{})})})})})})})}function set(){const{sendEvent:t}=Ke(),e=b.useRef(null),n=b.useCallback(()=>{t("com.redocly.app.lifecycle",[{...ye("app","replayApp"),action:"open"}])},[t]);return ret(e,n),f.jsx(b.StrictMode,{children:f.jsxs(oet,{ref:e,children:[f.jsx(aet,{children:f.jsx(y_,{})}),f.jsx(ox,{hideTabs:!0}),f.jsx(vee,{})]})})}const oet=T.default.div`
6331
6331
  display: flex;
6332
6332
  flex-direction: column;
6333
6333
  max-height: 80vh;
@@ -6718,7 +6718,7 @@ ${u.join(`\r
6718
6718
  `,vtt=T.default.div`
6719
6719
  display: flex;
6720
6720
  gap: var(--spacing-xs);
6721
- `;async function T_(t,e,n){try{const{join:r,dirname:i}=await Promise.resolve().then(()=>MQ),{exists:s}=await Promise.resolve().then(()=>TO),{revealItemInDir:o,openPath:a}=await Promise.resolve().then(()=>require("./replay-index-DuaHxlY6.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 ytt({node:t}){const e=t.data.type==="api"&&t.data.api.srcType===qi.WEB,n=hd(),r=b.useMemo(()=>Qn(),[]),{sendEvent:i}=Ke();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 T_(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 f.jsx(btt,{onClick:a=>a.stopPropagation(),children:f.jsx(Xn,{content:"More actions",placement:"topRight",children:f.jsx(Yi.Dropdown,{trigger:f.jsx(be.Button,{variant:"text",size:"small",icon:f.jsx(Ph.OverflowMenuVerticalIcon,{})}),alignment:"end",children:f.jsxs(Gi.DropdownMenu,{children:[r&&f.jsxs(br,{onClick:o,children:[f.jsx(QI.FolderIcon,{size:"14px"}),"Reveal in folder"]}),f.jsxs(br,{onClick:s,children:[f.jsx(rr.TrashCanIcon,{size:"14px"}),"Delete"]})]})})})})}const btt=T.default.div`
6721
+ `;async function T_(t,e,n){try{const{join:r,dirname:i}=await Promise.resolve().then(()=>MQ),{exists:s}=await Promise.resolve().then(()=>TO),{revealItemInDir:o,openPath:a}=await Promise.resolve().then(()=>require("./replay-index-CJwhVhXZ.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 ytt({node:t}){const e=t.data.type==="api"&&t.data.api.srcType===qi.WEB,n=hd(),r=b.useMemo(()=>Qn(),[]),{sendEvent:i}=Ke();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 T_(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 f.jsx(btt,{onClick:a=>a.stopPropagation(),children:f.jsx(Xn,{content:"More actions",placement:"topRight",children:f.jsx(Yi.Dropdown,{trigger:f.jsx(be.Button,{variant:"text",size:"small",icon:f.jsx(Ph.OverflowMenuVerticalIcon,{})}),alignment:"end",children:f.jsxs(Gi.DropdownMenu,{children:[r&&f.jsxs(br,{onClick:o,children:[f.jsx(QI.FolderIcon,{size:"14px"}),"Reveal in folder"]}),f.jsxs(br,{onClick:s,children:[f.jsx(rr.TrashCanIcon,{size:"14px"}),"Delete"]})]})})})})}const btt=T.default.div`
6722
6722
  display: flex;
6723
6723
  gap: var(--spacing-xxs);
6724
6724
  `;function xtt({onImport:t}){return f.jsxs(Stt,{children:[f.jsx(wtt,{children:"No OpenAPI files were imported yet"}),f.jsx(Ttt,{children:f.jsx(be.Button,{icon:f.jsx($I.DownloadIcon,{}),onClick:t,children:"Import OpenAPI file"})})]})}const Stt=T.default.div`
@@ -7092,7 +7092,7 @@ ${u.join(`\r
7092
7092
  gap: var(--spacing-sm);
7093
7093
  flex: 1;
7094
7094
  justify-content: flex-end;
7095
- `;function prt({children:t}){const[e,n]=b.useState(new Set),r=b.useCallback(o=>{n(a=>{const l=new Set(a);return l.add(o),l})},[]),i=b.useCallback(o=>{n(a=>{const l=new Set(a);return l.delete(o),l})},[]),s=b.useMemo(()=>({hasActiveOverlay:e.size>0,registerOverlay:r,unregisterOverlay:i}),[e.size,r,i]);return f.jsx(RI.Provider,{value:s,children:t})}function grt({children:t,renderProjectSelect:e}){return f.jsx($ee.Provider,{value:{renderProjectSelect:e},children:t})}function mrt({error:t}){const{userFilesDir:e}=hd(),n=b.useCallback(async()=>{try{const{openPath:r}=await Promise.resolve().then(()=>require("./replay-index-DuaHxlY6.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 f.jsx(Ort,{"data-testid":"replay-config-error",children:f.jsxs(vrt,{children:[f.jsx(bl.WarningFilledIcon,{size:"24px",color:"--color-warning-base"}),f.jsxs(yrt,{children:[f.jsxs(brt,{children:["Replay cannot use ",t.filePath]}),f.jsx(xrt,{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&&f.jsx(Srt,{"data-testid":"replay-config-error-issues",children:t.issues.map((r,i)=>f.jsxs(wrt,{children:[r.line!==void 0&&f.jsxs(Trt,{children:["Line ",r.line]}),f.jsx(Crt,{children:r.message})]},`${r.line??"unknown"}-${i}`))}),f.jsx(be.Button,{"data-testid":"replay-config-error-open",variant:"secondary",size:"small",icon:f.jsx(jr.EditIcon,{}),iconPosition:"left",onClick:n,children:"Open in editor"}),f.jsx(Prt,{children:"Replay picks up the fix as soon as you save."})]})]})})}const Ort=T.default.div`
7095
+ `;function prt({children:t}){const[e,n]=b.useState(new Set),r=b.useCallback(o=>{n(a=>{const l=new Set(a);return l.add(o),l})},[]),i=b.useCallback(o=>{n(a=>{const l=new Set(a);return l.delete(o),l})},[]),s=b.useMemo(()=>({hasActiveOverlay:e.size>0,registerOverlay:r,unregisterOverlay:i}),[e.size,r,i]);return f.jsx(RI.Provider,{value:s,children:t})}function grt({children:t,renderProjectSelect:e}){return f.jsx($ee.Provider,{value:{renderProjectSelect:e},children:t})}function mrt({error:t}){const{userFilesDir:e}=hd(),n=b.useCallback(async()=>{try{const{openPath:r}=await Promise.resolve().then(()=>require("./replay-index-CJwhVhXZ.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 f.jsx(Ort,{"data-testid":"replay-config-error",children:f.jsxs(vrt,{children:[f.jsx(bl.WarningFilledIcon,{size:"24px",color:"--color-warning-base"}),f.jsxs(yrt,{children:[f.jsxs(brt,{children:["Replay cannot use ",t.filePath]}),f.jsx(xrt,{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&&f.jsx(Srt,{"data-testid":"replay-config-error-issues",children:t.issues.map((r,i)=>f.jsxs(wrt,{children:[r.line!==void 0&&f.jsxs(Trt,{children:["Line ",r.line]}),f.jsx(Crt,{children:r.message})]},`${r.line??"unknown"}-${i}`))}),f.jsx(be.Button,{"data-testid":"replay-config-error-open",variant:"secondary",size:"small",icon:f.jsx(jr.EditIcon,{}),iconPosition:"left",onClick:n,children:"Open in editor"}),f.jsx(Prt,{children:"Replay picks up the fix as soon as you save."})]})]})})}const Ort=T.default.div`
7096
7096
  display: flex;
7097
7097
  flex: 1;
7098
7098
  justify-content: center;
@@ -7212,7 +7212,7 @@ ${u.join(`\r
7212
7212
  border-right: ${({$isOverlayLayout:t})=>t?"1px solid var(--border-color-secondary)":"none"};
7213
7213
  width: 100%;
7214
7214
  user-select: none;
7215
- `;function qz({children:t}){const e=qh(),{sendEvent:n}=Ke(),{tabsParams:r}=pw(e,!1),[i,s]=b.useState(r[0]?.key||null),o=b.useCallback(l=>{s(l),n("com.redocly.tab.change",[{...ye("tab","sidePanelTab"),source:"side_panel",name:l}])},[n]),a=b.useMemo(()=>({tabsParams:r,activeTab:i,onTabChange:o}),[r,i,o]);return f.jsx(zee.Provider,{value:a,children:t})}const Qrt={content:24,main:44,ai:27},Rrt=[{fromWidth:1920,minSizes:{content:19,main:40,ai:16}},{fromWidth:1512,minSizes:{content:24,main:40,ai:20}},{fromWidth:1280,minSizes:{content:28,main:40,ai:24}}];function Wz(t){return Rrt.find(({fromWidth:e})=>t>=e)?.minSizes??Qrt}function _rt(t,e){const n=e.mainMinSize??t.main,r=e.hasAiPanel?t.ai:0;return{content:{minSize:t.content,maxSize:100-n-r},main:{minSize:n},ai:{minSize:t.ai,maxSize:100-n-t.content}}}function jrt({hasAiPanel:t,mainMinSize:e}){const[n,r]=b.useState(()=>Wz(document.documentElement.clientWidth));return b.useEffect(()=>{const i=()=>{r(Wz(document.documentElement.clientWidth))};return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),b.useMemo(()=>_rt(n,{hasAiPanel:t,mainMinSize:e}),[n,t,e])}function xI(t){const e=t.parentElement;return e?[...e.children].filter(n=>n instanceof HTMLElement&&n.hasAttribute("data-panel-id")):[]}function Uee(t){return xI(t).reduce((e,n)=>e+n.getBoundingClientRect().width,0)/100}const Qg={LEFT:"left",RIGHT:"right"};function Nrt(t,e,n,r,i){const s=Math.max(0,r-i),o=t+s,a=Math.min(n,o);return Math.max(e,a)}function Drt(t,e,n){const r=n/2,i=t.left+r,s=t.right-r;return e===Qg.LEFT?i:s}function Mrt(t,e,n){const r=n<t,i=n>t;return e===Qg.LEFT?r:i}const Vrt="cubic-bezier(0, 0, 0.2, 1)",Zz=80;function C_(t){return parseFloat(getComputedStyle(t).transitionDuration)*1e3}function Lrt(t){return t.flatMap(e=>typeof e.getAnimations=="function"?e.getAnimations():[])}function zrt(t,e){const n=t.map(s=>parseFloat(getComputedStyle(s).flexGrow)),r=t[0]?C_(t[0]):0,i=r>0&&typeof t[0].animate=="function";return e&&qee(e),i?{startSizes:n,animations:t.map((s,o)=>s.animate([{flexGrow:`${n[o]}`},{flexGrow:`${n[o]}`}],{duration:r,easing:Vrt}))}:null}function Xrt({animations:t,startSizes:e},n){t.forEach((r,i)=>{const s=r.effect,o=n[i];!(r.playState==="running")||!s||o===void 0||s.setKeyframes([{flexGrow:`${e[i]}`},{flexGrow:`${o}`}])})}function Fee(t){t.forEach(e=>{const{endTime:n,localTime:r}=e.effect?.getComputedTiming()??{},i=(Number(n??0)-Number(r??0))/e.playbackRate,s=e.playState==="running",o=i>Zz;s&&o&&e.updatePlaybackRate(e.playbackRate*(i/Zz))})}function Urt({animations:t}){Fee(t)}function qee({animations:t}){t.forEach(e=>e.cancel())}const Frt=4;function qrt(){const t=b.useRef(null),e=b.useRef(null),n=()=>{window.clearTimeout(e.current?.timer),e.current?.moveListener.abort(),e.current=null};b.useEffect(()=>()=>{t.current?.moveListener.abort(),window.clearTimeout(e.current?.timer),e.current?.moveListener.abort()},[]);const r=l=>{const c=t.current;if(!c?.at)return;Math.hypot(l.clientX-c.at.x,l.clientY-c.at.y)>Frt&&(c.hasMoved=!0)};return{start:()=>{t.current?.moveListener.abort(),n();const l={at:null,hasMoved:!1,moveListener:new AbortController};t.current=l,window.addEventListener("pointermove",r,{signal:l.moveListener.signal})},finish:()=>{const l=t.current;return t.current=null,l?.moveListener.abort(),!l||l.hasMoved?null:l.at},resetCursorAfter:(l,c)=>{n();let u=l;const d=new AbortController;window.addEventListener("pointermove",p=>{u={x:p.clientX,y:p.clientY}},{capture:!0,passive:!0,signal:d.signal});const h=window.setTimeout(()=>{d.abort(),document.body.dispatchEvent(new PointerEvent("pointermove",{clientX:u.x,clientY:u.y,isPrimary:!0}))},c);e.current={timer:h,moveListener:d}},onPointerDownCapture:l=>{const c=t.current;c&&(c.at={x:l.clientX,y:l.clientY})}}}function Wrt(){const t=b.useRef(null);return b.useEffect(()=>()=>{t.current&&qee(t.current)},[]),b.useMemo(()=>({freeze:e=>{t.current=zrt(e,t.current)},slideTo:e=>{t.current&&Xrt(t.current,e)},finishFast:()=>{t.current&&Urt(t.current)},finishAllFast:e=>{Fee(Lrt(e))}}),[])}const Zrt=50,Lf={OPEN:"open",CLOSED:"closed"},Brt={collapsible:!0,minSize:0,maxSize:0,defaultSize:void 0};function Yrt(t){const{panel:e,element:n,foldsTo:r,minSize:i,maxSize:s,neighbourSize:o,neighbourMinSize:a}=t,l=e.getSize(),c=l===0,u=i*Uee(n);return{phase:c?Lf.CLOSED:Lf.OPEN,openBounds:{collapsible:!1,minSize:i,maxSize:Nrt(l,i,s,o,a),defaultSize:void 0},foldLineX:Drt(n.getBoundingClientRect(),r,u),sizeAfterSnap:null,moveListener:new AbortController}}function Bz(t){return t.phase===Lf.CLOSED?Brt:t.openBounds}function Yz({groupRef:t,foldsTo:e,minSize:n,maxSize:r,neighbour:i,initiallyCollapsed:s=!1,onCollapse:o,onExpand:a}){const l=hR(s,{onCollapse:o,onExpand:a}),c=Wrt(),u=qrt(),[d,h]=b.useState(null),[p,m]=b.useState(!1),g=b.useRef(null),O=l.panelProps.ref;b.useEffect(()=>()=>g.current?.moveListener.abort(),[]);const v=()=>{const E=O.current;return E?document.getElementById(E.getId()):null},x=(E,Q)=>{h(E),m(Q)},y=(E,Q)=>{l.panelProps.onResize(E,Q);const j=g.current;if(!j)return;c.slideTo(t.current?.getLayout()??[]),j.sizeAfterSnap!==null&&E!==j.sizeAfterSnap&&(j.sizeAfterSnap=null,c.finishFast(),m(!0))},w=(E,Q)=>{const j=v(),R=O.current;!j||!R||(c.freeze(xI(j)),E.phase=Q,E.sizeAfterSnap=null,Ns.flushSync(()=>x(Bz(E),!1)),E.sizeAfterSnap=R.getSize())},S=E=>{const Q=g.current;if(!Q)return;const R=Mrt(Q.foldLineX,e,E.clientX)?Lf.CLOSED:Lf.OPEN;R!==Q.phase&&w(Q,R)},P=()=>{const E=O.current,Q=v(),j=i.ref.current?.getSize();if(!E||!Q||j===void 0)return;c.finishAllFast(xI(Q)),u.start();const R=Yrt({panel:E,element:Q,foldsTo:e,minSize:n,maxSize:r,neighbourSize:j,neighbourMinSize:i.minSize});g.current=R,window.addEventListener("pointermove",S,{signal:R.moveListener.signal}),x(Bz(R),!0)},k=(E,Q)=>{const j=O.current,R=v();!j||!R||(E.phase===Lf.CLOSED?j.expand():j.collapse(),u.resetCursorAfter(Q,C_(R)+Zrt))},I=()=>{const E=g.current;if(!E)return;g.current=null,E.moveListener.abort();const Q=u.finish();Ns.flushSync(()=>x(null,!1)),Q&&k(E,Q)};return{panel:l.panel,isDragging:d!==null,isFollowingCursor:p,panelProps:{...l.panelProps,onResize:y,...d??{minSize:n,maxSize:r}},handleProps:{onDragging:E=>E?P():I(),onPointerDownCapture:u.onPointerDownCapture}}}const Grt=50;function Gz({panelRef:t,isCollapsed:e,isFollowingCursor:n}){const[r,i]=b.useState(void 0),s=b.useRef(e);return b.useLayoutEffect(()=>{if(e===s.current)return;s.current=e;const o=t.current,a=o&&document.getElementById(o.getId());if(!o||!a)return;const l=a.getBoundingClientRect().width,c=o.getSize()*Uee(a);i(Math.round(e?l:Math.max(l,c)));const u=C_(a)+Grt,d=setTimeout(()=>i(void 0),u);return()=>clearTimeout(d)},[e,t]),b.useLayoutEffect(()=>{n&&i(void 0)},[n]),r}const Hrt={isOpen:!1,openPanel:()=>{},closePanel:()=>{}},Wee=b.createContext(Hrt);function Zee(){return b.useContext(Wee)}const Jrt=b.lazy(()=>Promise.resolve().then(()=>require("./replay-AiPanel-8K1Nn8fs.js")).then(t=>({default:t.AiPanel}))),Krt=55,eit=30,tit=25;function nit(){const{layout:t,aiEnabled:e}=Fn(),n=e===!0,r=t==="overlay",i=jrt({hasAiPanel:n&&!r,mainMinSize:r?Krt:void 0}),{isOpen:s,openPanel:o,closePanel:a}=Zee(),l=b.useRef(null),c=b.useRef(null),u={ref:c,minSize:i.main.minSize},d=Yz({groupRef:l,foldsTo:r?Qg.RIGHT:Qg.LEFT,minSize:i.content.minSize,maxSize:i.content.maxSize,neighbour:u}),h=Yz({groupRef:l,foldsTo:Qg.RIGHT,minSize:i.ai.minSize,maxSize:i.ai.maxSize,neighbour:u,initiallyCollapsed:!s,onCollapse:a,onExpand:o}),p=Math.min(eit,i.content.maxSize),m=n&&!r&&s?Math.max(i.ai.minSize,Math.min(tit,i.ai.maxSize)):0,g=100-p-m,O=Gz({panelRef:d.panelProps.ref,isCollapsed:d.panel.isCollapsed,isFollowingCursor:d.isFollowingCursor}),v=Gz({panelRef:h.panelProps.ref,isCollapsed:h.panel.isCollapsed,isFollowingCursor:h.isFollowingCursor}),x=b.useMemo(()=>f.jsx(ox,{}),[]),y=b.useMemo(()=>f.jsx($rt,{isOverlayLayout:r}),[r]),w=b.useMemo(()=>f.jsx(b.Suspense,{fallback:null,children:f.jsx(Jrt,{})}),[]);if(b.useEffect(()=>{s&&h.panel.isCollapsed&&h.panel.expand(),!s&&!h.panel.isCollapsed&&h.panel.collapse()},[h.panel,s]),t==="preview")return f.jsx(ox,{hideTabs:!0});const S=d.isDragging||h.isDragging;return r?f.jsx(qz,{children:f.jsxs(Hz,{children:[f.jsxs(Jz,{direction:"horizontal",autoSaveId:"replay-layout-overlay",ref:l,"data-dragging":S||void 0,children:[f.jsx(tf,{id:"main-panel",ref:c,defaultSize:g,minSize:i.main.minSize,children:x}),f.jsx(Vf,{direction:"vertical",tip:f.jsx(gC,{isCollapsed:d.panel.isCollapsed}),tipPlacement:"left",...d.handleProps}),f.jsx(tf,{id:"content-panel",defaultSize:p,$pinnedWidth:O,$pinTo:"left",...d.panelProps,children:y})]}),f.jsx(Uz,{panel:d.panel,isOverlayLayout:r})]})}):f.jsx(qz,{children:f.jsxs(Hz,{children:[f.jsx(Uz,{panel:d.panel,isOverlayLayout:r}),f.jsxs(Jz,{direction:"horizontal",autoSaveId:"replay-layout",ref:l,"data-dragging":S||void 0,children:[f.jsx(tf,{id:"content-panel",defaultSize:p,$pinnedWidth:O,$pinTo:"right",...d.panelProps,children:y}),f.jsx(Vf,{direction:"vertical",tip:f.jsx(gC,{isCollapsed:d.panel.isCollapsed}),...d.handleProps}),f.jsx(tf,{id:"main-panel",ref:c,defaultSize:g,minSize:i.main.minSize,children:x}),n&&f.jsxs(f.Fragment,{children:[(!h.panel.isCollapsed||h.isDragging)&&f.jsx(Vf,{direction:"vertical",tip:f.jsx(gC,{isCollapsed:!1}),tipPlacement:"left",...h.handleProps}),f.jsx(tf,{id:"ai-panel",defaultSize:m,$pinnedWidth:v,$pinTo:"left",collapsedSize:0,...h.panelProps,children:w})]})]})]})})}const tf=T.default(Bu)`
7215
+ `;function qz({children:t}){const e=qh(),{sendEvent:n}=Ke(),{tabsParams:r}=pw(e,!1),[i,s]=b.useState(r[0]?.key||null),o=b.useCallback(l=>{s(l),n("com.redocly.tab.change",[{...ye("tab","sidePanelTab"),source:"side_panel",name:l}])},[n]),a=b.useMemo(()=>({tabsParams:r,activeTab:i,onTabChange:o}),[r,i,o]);return f.jsx(zee.Provider,{value:a,children:t})}const Qrt={content:24,main:44,ai:27},Rrt=[{fromWidth:1920,minSizes:{content:19,main:40,ai:16}},{fromWidth:1512,minSizes:{content:24,main:40,ai:20}},{fromWidth:1280,minSizes:{content:28,main:40,ai:24}}];function Wz(t){return Rrt.find(({fromWidth:e})=>t>=e)?.minSizes??Qrt}function _rt(t,e){const n=e.mainMinSize??t.main,r=e.hasAiPanel?t.ai:0;return{content:{minSize:t.content,maxSize:100-n-r},main:{minSize:n},ai:{minSize:t.ai,maxSize:100-n-t.content}}}function jrt({hasAiPanel:t,mainMinSize:e}){const[n,r]=b.useState(()=>Wz(document.documentElement.clientWidth));return b.useEffect(()=>{const i=()=>{r(Wz(document.documentElement.clientWidth))};return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),b.useMemo(()=>_rt(n,{hasAiPanel:t,mainMinSize:e}),[n,t,e])}function xI(t){const e=t.parentElement;return e?[...e.children].filter(n=>n instanceof HTMLElement&&n.hasAttribute("data-panel-id")):[]}function Uee(t){return xI(t).reduce((e,n)=>e+n.getBoundingClientRect().width,0)/100}const Qg={LEFT:"left",RIGHT:"right"};function Nrt(t,e,n,r,i){const s=Math.max(0,r-i),o=t+s,a=Math.min(n,o);return Math.max(e,a)}function Drt(t,e,n){const r=n/2,i=t.left+r,s=t.right-r;return e===Qg.LEFT?i:s}function Mrt(t,e,n){const r=n<t,i=n>t;return e===Qg.LEFT?r:i}const Vrt="cubic-bezier(0, 0, 0.2, 1)",Zz=80;function C_(t){return parseFloat(getComputedStyle(t).transitionDuration)*1e3}function Lrt(t){return t.flatMap(e=>typeof e.getAnimations=="function"?e.getAnimations():[])}function zrt(t,e){const n=t.map(s=>parseFloat(getComputedStyle(s).flexGrow)),r=t[0]?C_(t[0]):0,i=r>0&&typeof t[0].animate=="function";return e&&qee(e),i?{startSizes:n,animations:t.map((s,o)=>s.animate([{flexGrow:`${n[o]}`},{flexGrow:`${n[o]}`}],{duration:r,easing:Vrt}))}:null}function Xrt({animations:t,startSizes:e},n){t.forEach((r,i)=>{const s=r.effect,o=n[i];!(r.playState==="running")||!s||o===void 0||s.setKeyframes([{flexGrow:`${e[i]}`},{flexGrow:`${o}`}])})}function Fee(t){t.forEach(e=>{const{endTime:n,localTime:r}=e.effect?.getComputedTiming()??{},i=(Number(n??0)-Number(r??0))/e.playbackRate,s=e.playState==="running",o=i>Zz;s&&o&&e.updatePlaybackRate(e.playbackRate*(i/Zz))})}function Urt({animations:t}){Fee(t)}function qee({animations:t}){t.forEach(e=>e.cancel())}const Frt=4;function qrt(){const t=b.useRef(null),e=b.useRef(null),n=()=>{window.clearTimeout(e.current?.timer),e.current?.moveListener.abort(),e.current=null};b.useEffect(()=>()=>{t.current?.moveListener.abort(),window.clearTimeout(e.current?.timer),e.current?.moveListener.abort()},[]);const r=l=>{const c=t.current;if(!c?.at)return;Math.hypot(l.clientX-c.at.x,l.clientY-c.at.y)>Frt&&(c.hasMoved=!0)};return{start:()=>{t.current?.moveListener.abort(),n();const l={at:null,hasMoved:!1,moveListener:new AbortController};t.current=l,window.addEventListener("pointermove",r,{signal:l.moveListener.signal})},finish:()=>{const l=t.current;return t.current=null,l?.moveListener.abort(),!l||l.hasMoved?null:l.at},resetCursorAfter:(l,c)=>{n();let u=l;const d=new AbortController;window.addEventListener("pointermove",p=>{u={x:p.clientX,y:p.clientY}},{capture:!0,passive:!0,signal:d.signal});const h=window.setTimeout(()=>{d.abort(),document.body.dispatchEvent(new PointerEvent("pointermove",{clientX:u.x,clientY:u.y,isPrimary:!0}))},c);e.current={timer:h,moveListener:d}},onPointerDownCapture:l=>{const c=t.current;c&&(c.at={x:l.clientX,y:l.clientY})}}}function Wrt(){const t=b.useRef(null);return b.useEffect(()=>()=>{t.current&&qee(t.current)},[]),b.useMemo(()=>({freeze:e=>{t.current=zrt(e,t.current)},slideTo:e=>{t.current&&Xrt(t.current,e)},finishFast:()=>{t.current&&Urt(t.current)},finishAllFast:e=>{Fee(Lrt(e))}}),[])}const Zrt=50,Lf={OPEN:"open",CLOSED:"closed"},Brt={collapsible:!0,minSize:0,maxSize:0,defaultSize:void 0};function Yrt(t){const{panel:e,element:n,foldsTo:r,minSize:i,maxSize:s,neighbourSize:o,neighbourMinSize:a}=t,l=e.getSize(),c=l===0,u=i*Uee(n);return{phase:c?Lf.CLOSED:Lf.OPEN,openBounds:{collapsible:!1,minSize:i,maxSize:Nrt(l,i,s,o,a),defaultSize:void 0},foldLineX:Drt(n.getBoundingClientRect(),r,u),sizeAfterSnap:null,moveListener:new AbortController}}function Bz(t){return t.phase===Lf.CLOSED?Brt:t.openBounds}function Yz({groupRef:t,foldsTo:e,minSize:n,maxSize:r,neighbour:i,initiallyCollapsed:s=!1,onCollapse:o,onExpand:a}){const l=hR(s,{onCollapse:o,onExpand:a}),c=Wrt(),u=qrt(),[d,h]=b.useState(null),[p,m]=b.useState(!1),g=b.useRef(null),O=l.panelProps.ref;b.useEffect(()=>()=>g.current?.moveListener.abort(),[]);const v=()=>{const E=O.current;return E?document.getElementById(E.getId()):null},x=(E,Q)=>{h(E),m(Q)},y=(E,Q)=>{l.panelProps.onResize(E,Q);const j=g.current;if(!j)return;c.slideTo(t.current?.getLayout()??[]),j.sizeAfterSnap!==null&&E!==j.sizeAfterSnap&&(j.sizeAfterSnap=null,c.finishFast(),m(!0))},w=(E,Q)=>{const j=v(),R=O.current;!j||!R||(c.freeze(xI(j)),E.phase=Q,E.sizeAfterSnap=null,Ns.flushSync(()=>x(Bz(E),!1)),E.sizeAfterSnap=R.getSize())},S=E=>{const Q=g.current;if(!Q)return;const R=Mrt(Q.foldLineX,e,E.clientX)?Lf.CLOSED:Lf.OPEN;R!==Q.phase&&w(Q,R)},P=()=>{const E=O.current,Q=v(),j=i.ref.current?.getSize();if(!E||!Q||j===void 0)return;c.finishAllFast(xI(Q)),u.start();const R=Yrt({panel:E,element:Q,foldsTo:e,minSize:n,maxSize:r,neighbourSize:j,neighbourMinSize:i.minSize});g.current=R,window.addEventListener("pointermove",S,{signal:R.moveListener.signal}),x(Bz(R),!0)},k=(E,Q)=>{const j=O.current,R=v();!j||!R||(E.phase===Lf.CLOSED?j.expand():j.collapse(),u.resetCursorAfter(Q,C_(R)+Zrt))},I=()=>{const E=g.current;if(!E)return;g.current=null,E.moveListener.abort();const Q=u.finish();Ns.flushSync(()=>x(null,!1)),Q&&k(E,Q)};return{panel:l.panel,isDragging:d!==null,isFollowingCursor:p,panelProps:{...l.panelProps,onResize:y,...d??{minSize:n,maxSize:r}},handleProps:{onDragging:E=>E?P():I(),onPointerDownCapture:u.onPointerDownCapture}}}const Grt=50;function Gz({panelRef:t,isCollapsed:e,isFollowingCursor:n}){const[r,i]=b.useState(void 0),s=b.useRef(e);return b.useLayoutEffect(()=>{if(e===s.current)return;s.current=e;const o=t.current,a=o&&document.getElementById(o.getId());if(!o||!a)return;const l=a.getBoundingClientRect().width,c=o.getSize()*Uee(a);i(Math.round(e?l:Math.max(l,c)));const u=C_(a)+Grt,d=setTimeout(()=>i(void 0),u);return()=>clearTimeout(d)},[e,t]),b.useLayoutEffect(()=>{n&&i(void 0)},[n]),r}const Hrt={isOpen:!1,openPanel:()=>{},closePanel:()=>{}},Wee=b.createContext(Hrt);function Zee(){return b.useContext(Wee)}const Jrt=b.lazy(()=>Promise.resolve().then(()=>require("./replay-AiPanel-DLwB7Rrw.js")).then(t=>({default:t.AiPanel}))),Krt=55,eit=30,tit=25;function nit(){const{layout:t,aiEnabled:e}=Fn(),n=e===!0,r=t==="overlay",i=jrt({hasAiPanel:n&&!r,mainMinSize:r?Krt:void 0}),{isOpen:s,openPanel:o,closePanel:a}=Zee(),l=b.useRef(null),c=b.useRef(null),u={ref:c,minSize:i.main.minSize},d=Yz({groupRef:l,foldsTo:r?Qg.RIGHT:Qg.LEFT,minSize:i.content.minSize,maxSize:i.content.maxSize,neighbour:u}),h=Yz({groupRef:l,foldsTo:Qg.RIGHT,minSize:i.ai.minSize,maxSize:i.ai.maxSize,neighbour:u,initiallyCollapsed:!s,onCollapse:a,onExpand:o}),p=Math.min(eit,i.content.maxSize),m=n&&!r&&s?Math.max(i.ai.minSize,Math.min(tit,i.ai.maxSize)):0,g=100-p-m,O=Gz({panelRef:d.panelProps.ref,isCollapsed:d.panel.isCollapsed,isFollowingCursor:d.isFollowingCursor}),v=Gz({panelRef:h.panelProps.ref,isCollapsed:h.panel.isCollapsed,isFollowingCursor:h.isFollowingCursor}),x=b.useMemo(()=>f.jsx(ox,{}),[]),y=b.useMemo(()=>f.jsx($rt,{isOverlayLayout:r}),[r]),w=b.useMemo(()=>f.jsx(b.Suspense,{fallback:null,children:f.jsx(Jrt,{})}),[]);if(b.useEffect(()=>{s&&h.panel.isCollapsed&&h.panel.expand(),!s&&!h.panel.isCollapsed&&h.panel.collapse()},[h.panel,s]),t==="preview")return f.jsx(ox,{hideTabs:!0});const S=d.isDragging||h.isDragging;return r?f.jsx(qz,{children:f.jsxs(Hz,{children:[f.jsxs(Jz,{direction:"horizontal",autoSaveId:"replay-layout-overlay",ref:l,"data-dragging":S||void 0,children:[f.jsx(tf,{id:"main-panel",ref:c,defaultSize:g,minSize:i.main.minSize,children:x}),f.jsx(Vf,{direction:"vertical",tip:f.jsx(gC,{isCollapsed:d.panel.isCollapsed}),tipPlacement:"left",...d.handleProps}),f.jsx(tf,{id:"content-panel",defaultSize:p,$pinnedWidth:O,$pinTo:"left",...d.panelProps,children:y})]}),f.jsx(Uz,{panel:d.panel,isOverlayLayout:r})]})}):f.jsx(qz,{children:f.jsxs(Hz,{children:[f.jsx(Uz,{panel:d.panel,isOverlayLayout:r}),f.jsxs(Jz,{direction:"horizontal",autoSaveId:"replay-layout",ref:l,"data-dragging":S||void 0,children:[f.jsx(tf,{id:"content-panel",defaultSize:p,$pinnedWidth:O,$pinTo:"right",...d.panelProps,children:y}),f.jsx(Vf,{direction:"vertical",tip:f.jsx(gC,{isCollapsed:d.panel.isCollapsed}),...d.handleProps}),f.jsx(tf,{id:"main-panel",ref:c,defaultSize:g,minSize:i.main.minSize,children:x}),n&&f.jsxs(f.Fragment,{children:[(!h.panel.isCollapsed||h.isDragging)&&f.jsx(Vf,{direction:"vertical",tip:f.jsx(gC,{isCollapsed:!1}),tipPlacement:"left",...h.handleProps}),f.jsx(tf,{id:"ai-panel",defaultSize:m,$pinnedWidth:v,$pinTo:"left",collapsedSize:0,...h.panelProps,children:w})]})]})]})})}const tf=T.default(Bu)`
7216
7216
  transition-property: flex-grow;
7217
7217
  transition-duration: var(--replay-transition-duration);
7218
7218
  transition-timing-function: var(--replay-transition-timing-function);
@@ -7241,7 +7241,7 @@ ${u.join(`\r
7241
7241
  &[data-dragging] ${tf} {
7242
7242
  transition-property: none;
7243
7243
  }
7244
- `,rit=b.lazy(()=>Promise.resolve().then(()=>require("./replay-AiChatProvider-DBLnNCF8.js")).then(t=>({default:t.AiChatProvider}))),iit=({className:t,renderProjectSelect:e})=>{const{isMobile:n,closeButton:r}=lo(),{layout:i,aiEnabled:s}=Fn(),o=BY(),a=i==="preview",l=s===!0,c=o?f.jsx(mrt,{error:o}):null,u=n?c||f.jsx(srt,{}):f.jsxs(f.Fragment,{children:[!a&&f.jsx(fet,{}),c||f.jsx(nit,{})]});return f.jsxs(f.Fragment,{children:[!n&&!a&&r,f.jsxs(oit,{className:t,isPreviewLayout:a,children:[f.jsx(mee,{onError:d=>console.error(d),children:f.jsx(prt,{children:f.jsx(grt,{renderProjectSelect:e,children:l?f.jsx(b.Suspense,{fallback:null,children:f.jsx(rit,{children:u})}):u})})}),f.jsx(vee,{})]})]})};function Bee({className:t,renderProjectSelect:e}){return f.jsx(iit,{className:t,renderProjectSelect:e})}function sit({className:t,renderProjectSelect:e}){return f.jsx(Lee,{children:f.jsx(Bee,{className:t,renderProjectSelect:e})})}const oit=T.default.div`
7244
+ `,rit=b.lazy(()=>Promise.resolve().then(()=>require("./replay-AiChatProvider-B2P9I5ug.js")).then(t=>({default:t.AiChatProvider}))),iit=({className:t,renderProjectSelect:e})=>{const{isMobile:n,closeButton:r}=lo(),{layout:i,aiEnabled:s}=Fn(),o=BY(),a=i==="preview",l=s===!0,c=o?f.jsx(mrt,{error:o}):null,u=n?c||f.jsx(srt,{}):f.jsxs(f.Fragment,{children:[!a&&f.jsx(fet,{}),c||f.jsx(nit,{})]});return f.jsxs(f.Fragment,{children:[!n&&!a&&r,f.jsxs(oit,{className:t,isPreviewLayout:a,children:[f.jsx(mee,{onError:d=>console.error(d),children:f.jsx(prt,{children:f.jsx(grt,{renderProjectSelect:e,children:l?f.jsx(b.Suspense,{fallback:null,children:f.jsx(rit,{children:u})}):u})})}),f.jsx(vee,{})]})]})};function Bee({className:t,renderProjectSelect:e}){return f.jsx(iit,{className:t,renderProjectSelect:e})}function sit({className:t,renderProjectSelect:e}){return f.jsx(Lee,{children:f.jsx(Bee,{className:t,renderProjectSelect:e})})}const oit=T.default.div`
7245
7245
  display: flex;
7246
7246
  flex-direction: column;
7247
7247
  height: 100vh;
@@ -7277,4 +7277,4 @@ ${u.join(`\r
7277
7277
  @media (max-width: ${fi}px) {
7278
7278
  width: 100vw;
7279
7279
  }
7280
- `;async function xit(t,e,n,r){const{validateApiKey:i}=await Promise.resolve().then(()=>require("./replay-validate-key-BewHEjjp.js"));return i(t,e,n,r)}async function Sit(){return(await Promise.resolve().then(()=>require("./replay-agent-loop-DOsYsIM_.js"))).AgentLoop}VKe();exports.AI_PROVIDERS=zY;exports.AiChatContext=UY;exports.AiChatServiceFactory=yI;exports.AiPanelContext=Wee;exports.Builder=Hi;exports.CriterionType=Xr;exports.DEFAULT_ENVIRONMENTS=vA;exports.DEFAULT_MAX_RETRIES=fRe;exports.DEFAULT_MAX_STEPS=dRe;exports.Divider=at;exports.EmbeddedReplay=iet;exports.GRANT_TYPE_MAP=T$e;exports.GraphQLError=Se;exports.ItemState=Xt;exports.JsonPointerLib=oh;exports.MAX_OUTPUT_TOKENS_FOR_VALIDATION=pRe;exports.Markdown=mJ;exports.Modal=ro;exports.OAUTH2_SECURITY=vE;exports.PathUtils=sn;exports.REDOCLY_CONFIG_FILE_NAMES=c2e;exports.REPLAY_CHANGE_PREVIEW_SNAPSHOT_KEY=mRe;exports.REPLAY_ENVIRONMENTS_SECTION_PATH=h2e;exports.REPLAY_MESSAGE_METADATA_NS=gRe;exports.REQUEST_METHODS=Ah;exports.REUNITE_AI_PROVIDER=LQ;exports.REUNITE_MODEL_OPTION=_E;exports.Replay=Oit;exports.ReplayOverlay=yit;exports.RootStorage=f8;exports.SECRET_MASK=_R;exports.SecurityFlows=oe;exports.SecurityTypes=te;exports.Source=ZI;exports.SourceType=qi;exports.StyledSpinner=aQ;exports.TAB_NAMES=it;exports.TOOL_CALL_MESSAGES_TO_KEEP=hRe;exports.TabDataType=Ue;exports.TabState=An;exports.TelemetryClient=s6;exports.TextContentType=Hn;exports.VerticalDivider=Ze;exports.activeEnvironmentIdAtom=$o;exports.activeTabAtom=NI;exports.activeTabIdxAtom=Os;exports.aiChatKeys=Eee;exports.apiUrlToApiId=OG;exports.apisAtom=_s;exports.applyThemeToDOM=iXe;exports.bgRed=gbe;exports.blue=fbe;exports.bold=obe;exports.buildASTSchema=u$;exports.bytesToHex=Vm;exports.clearNotificationsForSource=F0;exports.cloneObject=_a;exports.collectionsAtom=Po;exports.context=$a;exports.createResource=ye;exports.createTabFromOperation=VQ;exports.dayjs=UO;exports.defaultAiChatContextValue=XY;exports.dim=abe;exports.dirname=RY;exports.environmentsAtom=si;exports.evaluateRuntimeExpression=Ac;exports.evaluateRuntimeExpressionPayload=yg;exports.exists=jQ;exports.extname=_Y;exports.fetch=Qo;exports.findCollection=ph;exports.findStep=xO;exports.findWorkflow=bO;exports.getAPIKeyLocation=bG;exports.getActiveTab=w9;exports.getActiveTabIndex=yne;exports.getApiOperationFromStore=wS;exports.getCurrentTheme=KS;exports.getDefaultExportFromCjs=jl;exports.getEmptyCriterionObject=U6;exports.getEmptyRequestParameter=R0;exports.getEmptySingleSecurity=ao;exports.getLocation=pb;exports.getNewCollection=gR;exports.getNewStep=Na;exports.getNewWorkflow=kQ;exports.getOperationsList=hY;exports.getSelectedEnvironment=dd;exports.getStepFailures=RYe;exports.getStepForActiveStepTab=wAe;exports.getStepMethod=Rc;exports.getStepUrl=Wu;exports.getValueFromContext=gm;exports.getWorkflowRunVerdict=s_;exports.gray=pbe;exports.green=ube;exports.hasAllStepPassed=i_;exports.inverse=cbe;exports.invoke=Pn;exports.invoke$1=Yt;exports.isAbsolute=jY;exports.isAbsoluteUrl=o6;exports.isInlineRequestParameter=hO;exports.isPlainObject=Vh;exports.isRedoclyConfigFile=d2e;exports.isReservedEnvironmentFileKey=Qc;exports.isStepTab=SAe;exports.isTabType=Rn;exports.isTauriApp=Qn;exports.isWebUrl=Xs;exports.join=NQ;exports.loadAgentLoop=Sit;exports.loadAndBundleDefinition=M0;exports.makeProviderRecord=ORe;exports.makeRequest=EJ;exports.markdownParserMarked=gJ;exports.maskSecretsInText=ep;exports.md5=iw;exports.mergeUrlParametersWithPreviousParameters=SA;exports.mkdir=wY;exports.module=I7;exports.parse=od;exports.path=$k;exports.pathBrowserifyExports=ic;exports.readDir=TY;exports.readTextFile=_Q;exports.red=yi;exports.remove=PY;exports.removeCollection=m6;exports.removeStep=pE;exports.removeWorkflow=hE;exports.rename=kY;exports.reportParseError=U0;exports.requireFastDeepEqual=A7;exports.resolve=QY;exports.resolvePath=Pbe;exports.resolveTheme=rXe;exports.resolveWorkflowReference=j7;exports.sep=AY;exports.sha256=CJ;exports.stringToQueryParameters=wO;exports.tabStepUidsMatch=TAe;exports.tabsAtom=Zr;exports.toCompactJson=sAe;exports.trace=ps;exports.transformCallback=cQe;exports.transformCallback$1=xY;exports.tty=$7;exports.ulid=uh;exports.underline=lbe;exports.updateCollection=Ui;exports.updateStep=gS;exports.updateTabDataAt=bne;exports.updateTabDataById=xne;exports.updateWorkflow=Ds;exports.useActiveTab=_l;exports.useAiChatContext=PO;exports.useAiPanel=Zee;exports.useApiOperationGetter=EQ;exports.useApis=qo;exports.useAtomValue=Ir;exports.useCollectionActions=fd;exports.useCollections=mi;exports.useRunWorkflow=KK;exports.useSettings=pi;exports.useSettingsContext=Fn;exports.useStore=Mo;exports.useTabHandlers=hr;exports.useTelemetry=Ke;exports.useTelemetryClient=nIe;exports.validateApiKey=xit;exports.validateEnvironmentName=v_;exports.validateSchema=r$;exports.visit=Rh;exports.visitInParallel=YI;exports.white=hbe;exports.writeTextFile=EY;exports.yaml=_c;exports.yellow=dbe;
7280
+ `;async function xit(t,e,n,r){const{validateApiKey:i}=await Promise.resolve().then(()=>require("./replay-validate-key-DbIGv2l3.js"));return i(t,e,n,r)}async function Sit(){return(await Promise.resolve().then(()=>require("./replay-agent-loop-Z0kCw9Qe.js"))).AgentLoop}VKe();exports.AI_PROVIDERS=zY;exports.AiChatContext=UY;exports.AiChatServiceFactory=yI;exports.AiPanelContext=Wee;exports.Builder=Hi;exports.CriterionType=Xr;exports.DEFAULT_ENVIRONMENTS=vA;exports.DEFAULT_MAX_RETRIES=fRe;exports.DEFAULT_MAX_STEPS=dRe;exports.Divider=at;exports.EmbeddedReplay=iet;exports.GRANT_TYPE_MAP=T$e;exports.GraphQLError=Se;exports.ItemState=Xt;exports.JsonPointerLib=oh;exports.MAX_OUTPUT_TOKENS_FOR_VALIDATION=pRe;exports.Markdown=mJ;exports.Modal=ro;exports.OAUTH2_SECURITY=vE;exports.PathUtils=sn;exports.REDOCLY_CONFIG_FILE_NAMES=c2e;exports.REPLAY_CHANGE_PREVIEW_SNAPSHOT_KEY=mRe;exports.REPLAY_ENVIRONMENTS_SECTION_PATH=h2e;exports.REPLAY_MESSAGE_METADATA_NS=gRe;exports.REQUEST_METHODS=Ah;exports.REUNITE_AI_PROVIDER=LQ;exports.REUNITE_MODEL_OPTION=_E;exports.Replay=Oit;exports.ReplayOverlay=yit;exports.RootStorage=f8;exports.SECRET_MASK=_R;exports.SecurityFlows=oe;exports.SecurityTypes=te;exports.Source=ZI;exports.SourceType=qi;exports.StyledSpinner=aQ;exports.TAB_NAMES=it;exports.TOOL_CALL_MESSAGES_TO_KEEP=hRe;exports.TabDataType=Ue;exports.TabState=An;exports.TelemetryClient=s6;exports.TextContentType=Hn;exports.VerticalDivider=Ze;exports.activeEnvironmentIdAtom=$o;exports.activeTabAtom=NI;exports.activeTabIdxAtom=Os;exports.aiChatKeys=Eee;exports.apiUrlToApiId=OG;exports.apisAtom=_s;exports.applyThemeToDOM=iXe;exports.bgRed=gbe;exports.blue=fbe;exports.bold=obe;exports.buildASTSchema=u$;exports.bytesToHex=Vm;exports.clearNotificationsForSource=F0;exports.cloneObject=_a;exports.collectionsAtom=Po;exports.context=$a;exports.createResource=ye;exports.createTabFromOperation=VQ;exports.dayjs=UO;exports.defaultAiChatContextValue=XY;exports.dim=abe;exports.dirname=RY;exports.environmentsAtom=si;exports.evaluateRuntimeExpression=Ac;exports.evaluateRuntimeExpressionPayload=yg;exports.exists=jQ;exports.extname=_Y;exports.fetch=Qo;exports.findCollection=ph;exports.findStep=xO;exports.findWorkflow=bO;exports.getAPIKeyLocation=bG;exports.getActiveTab=w9;exports.getActiveTabIndex=yne;exports.getApiOperationFromStore=wS;exports.getCurrentTheme=KS;exports.getDefaultExportFromCjs=jl;exports.getEmptyCriterionObject=U6;exports.getEmptyRequestParameter=R0;exports.getEmptySingleSecurity=ao;exports.getLocation=pb;exports.getNewCollection=gR;exports.getNewStep=Na;exports.getNewWorkflow=kQ;exports.getOperationsList=hY;exports.getSelectedEnvironment=dd;exports.getStepFailures=RYe;exports.getStepForActiveStepTab=wAe;exports.getStepMethod=Rc;exports.getStepUrl=Wu;exports.getValueFromContext=gm;exports.getWorkflowRunVerdict=s_;exports.gray=pbe;exports.green=ube;exports.hasAllStepPassed=i_;exports.inverse=cbe;exports.invoke=Pn;exports.invoke$1=Yt;exports.isAbsolute=jY;exports.isAbsoluteUrl=o6;exports.isInlineRequestParameter=hO;exports.isPlainObject=Vh;exports.isRedoclyConfigFile=d2e;exports.isReservedEnvironmentFileKey=Qc;exports.isStepTab=SAe;exports.isTabType=Rn;exports.isTauriApp=Qn;exports.isWebUrl=Xs;exports.join=NQ;exports.loadAgentLoop=Sit;exports.loadAndBundleDefinition=M0;exports.makeProviderRecord=ORe;exports.makeRequest=EJ;exports.markdownParserMarked=gJ;exports.maskSecretsInText=ep;exports.md5=iw;exports.mergeUrlParametersWithPreviousParameters=SA;exports.mkdir=wY;exports.module=I7;exports.parse=od;exports.path=$k;exports.pathBrowserifyExports=ic;exports.readDir=TY;exports.readTextFile=_Q;exports.red=yi;exports.remove=PY;exports.removeCollection=m6;exports.removeStep=pE;exports.removeWorkflow=hE;exports.rename=kY;exports.reportParseError=U0;exports.requireFastDeepEqual=A7;exports.resolve=QY;exports.resolvePath=Pbe;exports.resolveTheme=rXe;exports.resolveWorkflowReference=j7;exports.sep=AY;exports.sha256=CJ;exports.stringToQueryParameters=wO;exports.tabStepUidsMatch=TAe;exports.tabsAtom=Zr;exports.toCompactJson=sAe;exports.trace=ps;exports.transformCallback=cQe;exports.transformCallback$1=xY;exports.tty=$7;exports.ulid=uh;exports.underline=lbe;exports.updateCollection=Ui;exports.updateStep=gS;exports.updateTabDataAt=bne;exports.updateTabDataById=xne;exports.updateWorkflow=Ds;exports.useActiveTab=_l;exports.useAiChatContext=PO;exports.useAiPanel=Zee;exports.useApiOperationGetter=EQ;exports.useApis=qo;exports.useAtomValue=Ir;exports.useCollectionActions=fd;exports.useCollections=mi;exports.useRunWorkflow=KK;exports.useSettings=pi;exports.useSettingsContext=Fn;exports.useStore=Mo;exports.useTabHandlers=hr;exports.useTelemetry=Ke;exports.useTelemetryClient=nIe;exports.validateApiKey=xit;exports.validateEnvironmentName=v_;exports.validateSchema=r$;exports.visit=Rh;exports.visitInParallel=YI;exports.white=hbe;exports.writeTextFile=EY;exports.yaml=_c;exports.yellow=dbe;