@redocly/replay 0.28.0-next.2 → 0.28.0-next.4
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.
- package/dist/{replay-AiChatProvider-D3tGLym7.js → replay-AiChatProvider-BIplPHOS.js} +6 -6
- package/dist/{replay-AiChatProvider-DLZX3ihL.js → replay-AiChatProvider-TF1u9E5L.js} +1 -1
- package/dist/{replay-AiChatSqliteDBStorage-ckjqpV-2.js → replay-AiChatSqliteDBStorage-Bay95FHW.js} +1 -1
- package/dist/{replay-AiChatSqliteDBStorage-yawoZunX.js → replay-AiChatSqliteDBStorage-C-rkQ3jG.js} +1 -1
- package/dist/{replay-AiPanel-CtMW4jHp.js → replay-AiPanel-DU5aVA3q.js} +4 -4
- package/dist/{replay-AiPanel-C2dOENPe.js → replay-AiPanel-DzGN1t86.js} +1 -1
- package/dist/{replay-FileWatcher-sxKCrDRy.js → replay-FileWatcher-XMkIoDEA.js} +1 -1
- package/dist/{replay-FileWatcher-Da7VcNHD.js → replay-FileWatcher-iYbHpwCv.js} +2 -2
- package/dist/{replay-SemanticSearchService-d98JHVBr.js → replay-SemanticSearchService-BWwCFW3F.js} +1 -1
- package/dist/{replay-SemanticSearchService-Z4oXtg1-.js → replay-SemanticSearchService-Dk4UTm2r.js} +1 -1
- package/dist/{replay-SqliteDBStorage-u6WbcK1f.js → replay-SqliteDBStorage-BFdjYsG7.js} +1 -1
- package/dist/{replay-SqliteDBStorage-3VBWw1et.js → replay-SqliteDBStorage-DGQjzDy4.js} +1 -1
- package/dist/{replay-TauriFileSystemAdapter-CjAHiJt1.js → replay-TauriFileSystemAdapter-C8k9RvT1.js} +1 -1
- package/dist/{replay-TauriFileSystemAdapter-ICQ2nRWO.js → replay-TauriFileSystemAdapter-CLzYSck7.js} +1 -1
- package/dist/{replay-TauriRootStorage-hW8Tndk0.js → replay-TauriRootStorage-C1MIH5ji.js} +2 -2
- package/dist/{replay-TauriRootStorage-CQj8br8Q.js → replay-TauriRootStorage-CiGY8MO6.js} +1 -1
- package/dist/{replay-agent-loop-B-IEIGri.js → replay-agent-loop-BoEw65rR.js} +3 -3
- package/dist/{replay-agent-loop-B06Jshb3.js → replay-agent-loop-Cm1iS9G2.js} +1 -1
- package/dist/{replay-ai-chat-mappers-B5sjJdrE.js → replay-ai-chat-mappers-Csm9vJrG.js} +1 -1
- package/dist/{replay-ai-chat-mappers-UGovEa4H.js → replay-ai-chat-mappers-IZNFNXug.js} +1 -1
- package/dist/{replay-create-model-lRYWX-0l.js → replay-create-model-BqvD-0wF.js} +3 -3
- package/dist/{replay-create-model-B-KPLEJi.js → replay-create-model-Y9UJSztb.js} +3 -3
- package/dist/{replay-db-00pWKHyY.js → replay-db-BImXgUGU.js} +1 -1
- package/dist/{replay-db-B_wOpXdd.js → replay-db-C7FD3opa.js} +1 -1
- package/dist/{replay-external-resolver-D-h0nPH_.js → replay-external-resolver-Bj3sLTnz.js} +2 -2
- package/dist/{replay-external-resolver-Ds5-nzcf.js → replay-external-resolver-CjM7Da6t.js} +1 -1
- package/dist/{replay-index-C-A7VOiR.js → replay-index-BH8cTSEK.js} +21 -21
- package/dist/{replay-index-C8p-US63.js → replay-index-BuYoH96w.js} +11 -11
- package/dist/{replay-index-9rbZ-mEz.js → replay-index-CKRKzXMt.js} +1 -1
- package/dist/replay-index-Cp06WK82.js +574 -0
- package/dist/{replay-index-DenMrfEa.js → replay-index-DJwfdo0s.js} +1 -1
- package/dist/{replay-index-lxN84rl9.js → replay-index-DlTloE6S.js} +1 -1
- package/dist/replay-index-Dxk-kqkZ.js +1 -0
- package/dist/{replay-index-CtSJHuow.js → replay-index-xheWgsnj.js} +2 -2
- package/dist/{replay-lint-To3OwiOO.js → replay-lint--iBW-6Vj.js} +9461 -13309
- package/dist/replay-lint-BIbkYU09.js +177 -0
- package/dist/{replay-lint-graphql-Bm1aR8BO.js → replay-lint-graphql-2b4GIER6.js} +1 -1
- package/dist/{replay-lint-graphql-k2xF1Dxd.js → replay-lint-graphql-EXBI8I89.js} +1 -1
- package/dist/{replay-resolve-Id-g4Fn5.js → replay-resolve-B5yIfyuT.js} +16 -16
- package/dist/{replay-resolve-uDAWE6Oj.js → replay-resolve-D9BUvjqv.js} +357 -355
- package/dist/{replay-respect-run-BkDXTsm6.js → replay-respect-run-Bx46aUHi.js} +3 -3
- package/dist/{replay-respect-run-B0ZG-ZH7.js → replay-respect-run-DNFoFnJU.js} +1 -1
- package/dist/{replay-tauri-path-BfRUQXOx.js → replay-tauri-path-BVoW6En0.js} +2 -2
- package/dist/{replay-tauri-path-GCN1liZ4.js → replay-tauri-path-C8GiFO5s.js} +1 -1
- package/dist/{replay-useAiChatQueries-CeHqt0jZ.js → replay-useAiChatQueries-BDgjmzz-.js} +1 -1
- package/dist/{replay-useAiChatQueries-cuGEM1L6.js → replay-useAiChatQueries-BTuu2xLG.js} +4 -4
- package/dist/{replay-validate-key-BismpJXJ.js → replay-validate-key-CjcIElmE.js} +2 -2
- package/dist/{replay-validate-key-DYqoWPkp.js → replay-validate-key-D4M7QvCw.js} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/package.json +4 -4
- package/dist/replay-index-BCtyyb1v.js +0 -504
- package/dist/replay-index-DCvqReXK.js +0 -1
- package/dist/replay-lint-BJ5AeIt-.js +0 -184
|
@@ -107,7 +107,7 @@ html body {
|
|
|
107
107
|
`+R.slice(ue,Se),ue=Se+1),xe=Te;return $e+=`
|
|
108
108
|
`,R.length-ue>G&&xe>ue?$e+=R.slice(ue,xe)+`
|
|
109
109
|
`+R.slice(xe+1):$e+=R.slice(ue),$e.slice(1)}function dt(R){let G="",de=0;for(let le=0;le<R.length;de>=65536?le+=2:le++){de=je(R,le);const ue=j[de];!ue&&se(de)?(G+=R[le],de>=65536&&(G+=R[le+1])):G+=ue||L(de)}return G}function un(R,G,de){let le="";const ue=R.tag;for(let Se=0,xe=de.length;Se<xe;Se+=1){let Te=de[Se];R.replacer&&(Te=R.replacer.call(de,String(Se),Te)),(ce(R,G,Te,!1,!1)||typeof Te>"u"&&ce(R,G,null,!1,!1))&&(le!==""&&(le+=","+(R.condenseFlow?"":" ")),le+=R.dump)}R.tag=ue,R.dump="["+le+"]"}function Dt(R,G,de,le){let ue="";const Se=R.tag;for(let xe=0,Te=de.length;xe<Te;xe+=1){let $e=de[xe];R.replacer&&($e=R.replacer.call(de,String(xe),$e)),(ce(R,G+1,$e,!0,!0,!1,!0)||typeof $e>"u"&&ce(R,G+1,null,!0,!0,!1,!0))&&((!le||ue!=="")&&(ue+=Y(R,G)),R.dump&&a===R.dump.charCodeAt(0)?ue+="-":ue+="- ",ue+=R.dump)}R.tag=Se,R.dump=ue||"[]"}function dn(R,G,de){let le="";const ue=R.tag,Se=Object.keys(de);for(let xe=0,Te=Se.length;xe<Te;xe+=1){let $e="";le!==""&&($e+=", "),R.condenseFlow&&($e+='"');const Ee=Se[xe];let Re=de[Ee];R.replacer&&(Re=R.replacer.call(de,Ee,Re)),ce(R,G,Ee,!1,!1)&&(R.dump.length>1024&&($e+="? "),$e+=R.dump+(R.condenseFlow?'"':"")+":"+(R.condenseFlow?"":" "),ce(R,G,Re,!1,!1)&&($e+=R.dump,le+=$e))}R.tag=ue,R.dump="{"+le+"}"}function P(R,G,de,le){let ue="";const Se=R.tag,xe=Object.keys(de);if(R.sortKeys===!0)xe.sort();else if(typeof R.sortKeys=="function")xe.sort(R.sortKeys);else if(R.sortKeys)throw new e("sortKeys must be a boolean or a function");for(let Te=0,$e=xe.length;Te<$e;Te+=1){let Ee="";(!le||ue!=="")&&(Ee+=Y(R,G));const Re=xe[Te];let ze=de[Re];if(R.replacer&&(ze=R.replacer.call(de,Re,ze)),!ce(R,G+1,Re,!0,!0,!0))continue;const Ue=R.tag!==null&&R.tag!=="?"||R.dump&&R.dump.length>1024;Ue&&(R.dump&&a===R.dump.charCodeAt(0)?Ee+="?":Ee+="? "),Ee+=R.dump,Ue&&(Ee+=Y(R,G)),ce(R,G+1,ze,!0,Ue)&&(R.dump&&a===R.dump.charCodeAt(0)?Ee+=":":Ee+=": ",Ee+=R.dump,ue+=Ee)}R.tag=Se,R.dump=ue||"{}"}function H(R,G,de){const le=de?R.explicitTypes:R.implicitTypes;for(let ue=0,Se=le.length;ue<Se;ue+=1){const xe=le[ue];if((xe.instanceOf||xe.predicate)&&(!xe.instanceOf||typeof G=="object"&&G instanceof xe.instanceOf)&&(!xe.predicate||xe.predicate(G))){if(de?xe.multi&&xe.representName?R.tag=xe.representName(G):R.tag=xe.tag:R.tag="?",xe.represent){const Te=R.styleMap[xe.tag]||xe.defaultStyle;let $e;if(r.call(xe.represent)==="[object Function]")$e=xe.represent(G,Te);else if(i.call(xe.represent,Te))$e=xe.represent[Te](G,Te);else throw new e("!<"+xe.tag+'> tag resolver accepts not "'+Te+'" style');R.dump=$e}return!0}}return!1}function ce(R,G,de,le,ue,Se,xe){R.tag=null,R.dump=de,H(R,de,!1)||H(R,de,!0);const Te=r.call(R.dump),$e=le;le&&(le=R.flowLevel<0||R.flowLevel>G);const Ee=Te==="[object Object]"||Te==="[object Array]";let Re,ze;if(Ee&&(Re=R.duplicates.indexOf(de),ze=Re!==-1),(R.tag!==null&&R.tag!=="?"||ze||R.indent!==2&&G>0)&&(ue=!1),ze&&R.usedDuplicates[Re])R.dump="*ref_"+Re;else{if(Ee&&ze&&!R.usedDuplicates[Re]&&(R.usedDuplicates[Re]=!0),Te==="[object Object]")le&&Object.keys(R.dump).length!==0?(P(R,G,R.dump,ue),ze&&(R.dump="&ref_"+Re+R.dump)):(dn(R,G,R.dump),ze&&(R.dump="&ref_"+Re+" "+R.dump));else if(Te==="[object Array]")le&&R.dump.length!==0?(R.noArrayIndent&&!xe&&G>0?Dt(R,G-1,R.dump,ue):Dt(R,G,R.dump,ue),ze&&(R.dump="&ref_"+Re+R.dump)):(un(R,G,R.dump),ze&&(R.dump="&ref_"+Re+" "+R.dump));else if(Te==="[object String]")R.tag!=="?"&&It(R,R.dump,G,Se,$e);else{if(Te==="[object Undefined]")return!1;if(R.skipInvalid)return!1;throw new e("unacceptable kind of an object to dump "+Te)}if(R.tag!==null&&R.tag!=="?"){let Ue=encodeURI(R.tag[0]==="!"?R.tag.slice(1):R.tag).replace(/!/g,"%21");R.tag[0]==="!"?Ue="!"+Ue:Ue.slice(0,18)==="tag:yaml.org,2002:"?Ue="!!"+Ue.slice(18):Ue="!<"+Ue+">",R.dump=Ue+" "+R.dump}}return!0}function he(R,G){const de=[],le=[];ae(R,de,le);const ue=le.length;for(let Se=0;Se<ue;Se+=1)G.duplicates.push(de[le[Se]]);G.usedDuplicates=new Array(ue)}function ae(R,G,de){if(R!==null&&typeof R=="object"){const le=G.indexOf(R);if(le!==-1)de.indexOf(le)===-1&&de.push(le);else if(G.push(R),Array.isArray(R))for(let ue=0,Se=R.length;ue<Se;ue+=1)ae(R[ue],G,de);else{const ue=Object.keys(R);for(let Se=0,xe=ue.length;Se<xe;Se+=1)ae(R[ue[Se]],G,de)}}}function we(R,G){G=G||{};const de=new q(G);de.noRefs||he(R,de);let le=R;return de.replacer&&(le=de.replacer.call({"":le},"",le)),ce(de,0,le,!0,!0)?de.dump+`
|
|
110
|
-
`:""}return X0.dump=we,X0}var sA;function DH(){if(sA)return br;sA=1;const t=jH(),e=_H();function n(r,i){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+i+" instead, which is now safe by default.")}}return br.Type=Br(),br.Schema=q3(),br.FAILSAFE_SCHEMA=Y3(),br.JSON_SCHEMA=e4(),br.CORE_SCHEMA=t4(),br.DEFAULT_SCHEMA=nk(),br.load=t.load,br.loadAll=t.loadAll,br.dump=e.dump,br.YAMLException=jp(),br.types={binary:i4(),float:K3(),map:F3(),null:G3(),pairs:o4(),set:a4(),timestamp:n4(),bool:H3(),int:J3(),merge:r4(),omap:s4(),seq:B3(),str:U3()},br.safeLoad=n("safeLoad","load"),br.safeLoadAll=n("safeLoadAll","loadAll"),br.safeDump=n("safeDump","dump"),br}var NH=DH();const el=QH(NH),{Type:S6e,Schema:w6e,FAILSAFE_SCHEMA:C6e,JSON_SCHEMA:P6e,CORE_SCHEMA:k6e,DEFAULT_SCHEMA:T6e,load:$6e,loadAll:I6e,dump:E6e,YAMLException:A6e,types:Q6e,safeLoad:R6e,safeLoadAll:j6e,safeDump:_6e}=el,Ll="1.9.1",oA=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function MH(t){const e=new Set([t]),n=new Set,r=t.match(oA);if(!r)return()=>!1;const i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(l){return l===t};function s(a){return n.add(a),!1}function o(a){return e.add(a),!0}return function(l){if(e.has(l))return!0;if(n.has(l))return!1;const c=l.match(oA);if(!c)return s(l);const u={major:+c[1],minor:+c[2],patch:+c[3],prerelease:c[4]};return u.prerelease!=null||i.major!==u.major?s(l):i.major===0?i.minor===u.minor&&i.patch<=u.patch?o(l):s(l):i.minor<=u.minor?o(l):s(l)}}const zH=MH(Ll),VH=Ll.split(".")[0],Qh=Symbol.for(`opentelemetry.js.api.${VH}`),Rh=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{};function _p(t,e,n,r=!1){var i;const s=Rh[Qh]=(i=Rh[Qh])!==null&&i!==void 0?i:{version:Ll};if(!r&&s[t]){const o=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${t}`);return n.error(o.stack||o.message),!1}if(s.version!==Ll){const o=new Error(`@opentelemetry/api: Registration of version v${s.version} for ${t} does not match previously registered API v${Ll}`);return n.error(o.stack||o.message),!1}return s[t]=e,n.debug(`@opentelemetry/api: Registered a global for ${t} v${Ll}.`),!0}function rc(t){var e,n;const r=(e=Rh[Qh])===null||e===void 0?void 0:e.version;if(!(!r||!zH(r)))return(n=Rh[Qh])===null||n===void 0?void 0:n[t]}function Dp(t,e){e.debug(`@opentelemetry/api: Unregistering a global for ${t} v${Ll}.`);const n=Rh[Qh];n&&delete n[t]}class LH{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return lf("debug",this._namespace,e)}error(...e){return lf("error",this._namespace,e)}info(...e){return lf("info",this._namespace,e)}warn(...e){return lf("warn",this._namespace,e)}verbose(...e){return lf("verbose",this._namespace,e)}}function lf(t,e,n){const r=rc("diag");if(r)return r[t](e,...n)}var yi;(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(yi||(yi={}));function XH(t,e){t<yi.NONE?t=yi.NONE:t>yi.ALL&&(t=yi.ALL),e=e||{};function n(r,i){const s=e[r];return typeof s=="function"&&t>=i?s.bind(e):function(){}}return{error:n("error",yi.ERROR),warn:n("warn",yi.WARN),info:n("info",yi.INFO),debug:n("debug",yi.DEBUG),verbose:n("verbose",yi.VERBOSE)}}const WH="diag";class Ji{static instance(){return this._instance||(this._instance=new Ji),this._instance}constructor(){function e(i){return function(...s){const o=rc("diag");if(o)return o[i](...s)}}const n=this,r=(i,s={logLevel:yi.INFO})=>{var o,a,l;if(i===n){const f=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return n.error((o=f.stack)!==null&&o!==void 0?o:f.message),!1}typeof s=="number"&&(s={logLevel:s});const c=rc("diag"),u=XH((a=s.logLevel)!==null&&a!==void 0?a:yi.INFO,i);if(c&&!s.suppressOverrideMessage){const f=(l=new Error().stack)!==null&&l!==void 0?l:"<failed to generate stacktrace>";c.warn(`Current logger will be overwritten from ${f}`),u.warn(`Current logger will overwrite one already registered from ${f}`)}return _p("diag",u,n,!0)};n.setLogger=r,n.disable=()=>{Dp(WH,n)},n.createComponentLogger=i=>new LH(i),n.verbose=e("verbose"),n.debug=e("debug"),n.info=e("info"),n.warn=e("warn"),n.error=e("error")}}class gu{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){const n=this._entries.get(e);if(n)return Object.assign({},n)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(e,n){const r=new gu(this._entries);return r._entries.set(e,n),r}removeEntry(e){const n=new gu(this._entries);return n._entries.delete(e),n}removeEntries(...e){const n=new gu(this._entries);for(const r of e)n._entries.delete(r);return n}clear(){return new gu}}const ZH=Symbol("BaggageEntryMetadata"),qH=Ji.instance();function UH(t={}){return new gu(new Map(Object.entries(t)))}function BH(t){return typeof t!="string"&&(qH.error(`Cannot create baggage metadata from unknown type: ${typeof t}`),t=""),{__TYPE__:ZH,toString(){return t}}}function rk(t){return Symbol.for(t)}class WO{constructor(e){const n=this;n._currentContext=e?new Map(e):new Map,n.getValue=r=>n._currentContext.get(r),n.setValue=(r,i)=>{const s=new WO(n._currentContext);return s._currentContext.set(r,i),s},n.deleteValue=r=>{const i=new WO(n._currentContext);return i._currentContext.delete(r),i}}}const au=new WO;class FH{constructor(){}createGauge(e,n){return rJ}createHistogram(e,n){return iJ}createCounter(e,n){return nJ}createUpDownCounter(e,n){return sJ}createObservableGauge(e,n){return aJ}createObservableCounter(e,n){return oJ}createObservableUpDownCounter(e,n){return lJ}addBatchObservableCallback(e,n){}removeBatchObservableCallback(e){}}class jy{}class YH extends jy{add(e,n){}}class GH extends jy{add(e,n){}}class HH extends jy{record(e,n){}}class JH extends jy{record(e,n){}}class ik{addCallback(e){}removeCallback(e){}}class KH extends ik{}class eJ extends ik{}class tJ extends ik{}const l4=new FH,nJ=new YH,rJ=new HH,iJ=new JH,sJ=new GH,oJ=new KH,aJ=new eJ,lJ=new tJ;function cJ(){return l4}const uJ={get(t,e){if(t!=null)return t[e]},keys(t){return t==null?[]:Object.keys(t)}},dJ={set(t,e,n){t!=null&&(t[e]=n)}};class fJ{active(){return au}with(e,n,r,...i){return n.call(r,...i)}bind(e,n){return n}enable(){return this}disable(){return this}}const W0="context",hJ=new fJ;class Td{constructor(){}static getInstance(){return this._instance||(this._instance=new Td),this._instance}setGlobalContextManager(e){return _p(W0,e,Ji.instance())}active(){return this._getContextManager().active()}with(e,n,r,...i){return this._getContextManager().with(e,n,r,...i)}bind(e,n){return this._getContextManager().bind(e,n)}_getContextManager(){return rc(W0)||hJ}disable(){this._getContextManager().disable(),Dp(W0,Ji.instance())}}var sa;(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(sa||(sa={}));const c4="0000000000000000",u4="00000000000000000000000000000000",d4={traceId:u4,spanId:c4,traceFlags:sa.NONE};class Jf{constructor(e=d4){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,n){return this}setAttributes(e){return this}addEvent(e,n){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,n){}}const sk=rk("OpenTelemetry Context Key SPAN");function ok(t){return t.getValue(sk)||void 0}function pJ(){return ok(Td.getInstance().active())}function ak(t,e){return t.setValue(sk,e)}function gJ(t){return t.deleteValue(sk)}function mJ(t,e){return ak(t,new Jf(e))}function f4(t){var e;return(e=ok(t))===null||e===void 0?void 0:e.spanContext()}const Ig=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function h4(t,e){if(typeof t!="string"||t.length!==e)return!1;let n=0;for(let r=0;r<t.length;r+=4)n+=(Ig[t.charCodeAt(r)]|0)+(Ig[t.charCodeAt(r+1)]|0)+(Ig[t.charCodeAt(r+2)]|0)+(Ig[t.charCodeAt(r+3)]|0);return n===e}function p4(t){return h4(t,32)&&t!==u4}function OJ(t){return h4(t,16)&&t!==c4}function _y(t){return p4(t.traceId)&&OJ(t.spanId)}function vJ(t){return new Jf(t)}const Z0=Td.getInstance();class g4{startSpan(e,n,r=Z0.active()){if(!!n?.root)return new Jf;const s=r&&f4(r);return yJ(s)&&_y(s)?new Jf(s):new Jf}startActiveSpan(e,n,r,i){let s,o,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(s=n,a=r):(s=n,o=r,a=i);const l=o??Z0.active(),c=this.startSpan(e,s,l),u=ak(l,c);return Z0.with(u,a,void 0,c)}}function yJ(t){return t!==null&&typeof t=="object"&&"spanId"in t&&typeof t.spanId=="string"&&"traceId"in t&&typeof t.traceId=="string"&&"traceFlags"in t&&typeof t.traceFlags=="number"}const bJ=new g4;class xJ{constructor(e,n,r,i){this._provider=e,this.name=n,this.version=r,this.options=i}startSpan(e,n,r){return this._getTracer().startSpan(e,n,r)}startActiveSpan(e,n,r,i){const s=this._getTracer();return Reflect.apply(s.startActiveSpan,s,arguments)}_getTracer(){if(this._delegate)return this._delegate;const e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):bJ}}class SJ{getTracer(e,n,r){return new g4}}const wJ=new SJ;class aA{getTracer(e,n,r){var i;return(i=this.getDelegateTracer(e,n,r))!==null&&i!==void 0?i:new xJ(this,e,n,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:wJ}setDelegate(e){this._delegate=e}getDelegateTracer(e,n,r){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(e,n,r)}}var ZO;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(ZO||(ZO={}));exports.SpanKind=void 0;(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(exports.SpanKind||(exports.SpanKind={}));exports.SpanStatusCode=void 0;(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(exports.SpanStatusCode||(exports.SpanStatusCode={}));const mo=Td.getInstance(),ct=Ji.instance();class CJ{getMeter(e,n,r){return l4}}const PJ=new CJ,q0="metrics";class lk{constructor(){}static getInstance(){return this._instance||(this._instance=new lk),this._instance}setGlobalMeterProvider(e){return _p(q0,e,Ji.instance())}getMeterProvider(){return rc(q0)||PJ}getMeter(e,n,r){return this.getMeterProvider().getMeter(e,n,r)}disable(){Dp(q0,Ji.instance())}}const m4=lk.getInstance();class kJ{inject(e,n){}extract(e,n){return e}fields(){return[]}}const ck=rk("OpenTelemetry Baggage Key");function O4(t){return t.getValue(ck)||void 0}function TJ(){return O4(Td.getInstance().active())}function $J(t,e){return t.setValue(ck,e)}function IJ(t){return t.deleteValue(ck)}const U0="propagation",EJ=new kJ;class uk{constructor(){this.createBaggage=UH,this.getBaggage=O4,this.getActiveBaggage=TJ,this.setBaggage=$J,this.deleteBaggage=IJ}static getInstance(){return this._instance||(this._instance=new uk),this._instance}setGlobalPropagator(e){return _p(U0,e,Ji.instance())}inject(e,n,r=dJ){return this._getGlobalPropagator().inject(e,n,r)}extract(e,n,r=uJ){return this._getGlobalPropagator().extract(e,n,r)}fields(){return this._getGlobalPropagator().fields()}disable(){Dp(U0,Ji.instance())}_getGlobalPropagator(){return rc(U0)||EJ}}const Kf=uk.getInstance(),B0="trace";class dk{constructor(){this._proxyTracerProvider=new aA,this.wrapSpanContext=vJ,this.isSpanContextValid=_y,this.deleteSpan=gJ,this.getSpan=ok,this.getActiveSpan=pJ,this.getSpanContext=f4,this.setSpan=ak,this.setSpanContext=mJ}static getInstance(){return this._instance||(this._instance=new dk),this._instance}setGlobalTracerProvider(e){const n=_p(B0,this._proxyTracerProvider,Ji.instance());return n&&this._proxyTracerProvider.setDelegate(e),n}getTracerProvider(){return rc(B0)||this._proxyTracerProvider}getTracer(e,n){return this.getTracerProvider().getTracer(e,n)}disable(){Dp(B0,Ji.instance()),this._proxyTracerProvider=new aA}}const Nr=dk.getInstance(),oi={FS:"fs",WEB:"web"};class Wt{static utils=null;static async getUtils(){return Wt.utils||(Wt.utils=pn()?await Promise.resolve().then(()=>require("./replay-tauri-path-GCN1liZ4.js")):{join:_a.join,resolve:_a.resolve,isAbsolute:_a.isAbsolute,relative:_a.relative,extname:_a.extname,dirname:_a.dirname}),Wt.utils}static async dirname(e){return(await Wt.getUtils()).dirname(e)}static async join(...e){return(await Wt.getUtils()).join(...e)}static async resolve(e){return(await Wt.getUtils()).resolve(e)}static async isAbsolute(e){return(await Wt.getUtils()).isAbsolute(e)}static async relative(e,n){return(await Wt.getUtils()).relative(e,n)}static async extname(e){return(await Wt.getUtils()).extname(e)}}async function qO(t,e){const[{bundle:n,Config:r},{ExternalResolver:i}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-DCvqReXK.js")),Promise.resolve().then(()=>require("./replay-external-resolver-Ds5-nzcf.js"))]),s=new r({});s.getRulesForSpecVersion=()=>[];const o=await Wt.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}}function v4(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function D1(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function y4(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function Xi(t){try{return new URL(t),!0}catch{return!1}}function AJ(t,e){let n;if(e.startsWith("//")){const{protocol:r}=new URL(t);n=`${r||"https:"}${e}`}else if(v4(e))n=e;else if(!e.startsWith("/"))n=D1(t)+"/"+e;else{const r=new URL(t);r.pathname=e,n=r.toString()}return D1(n)}function lA(t,e){let n=t;return e.forEach(({key:r,value:i,active:s})=>{i&&s&&(n=n.replaceAll(`{${r}}`,i))}),n}function b4(t,e){let n=t;return e.forEach(({name:r,value:i})=>{i&&(n=n.replaceAll(`{${r}}`,i))}),n}function QJ(t){return t.startsWith("http://")||t.startsWith("https://")}function Eg({url:t,serverUrl:e,corsProxyUrl:n}){let r;if(QJ(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}class N1{constructor(e){this.baseDir=e}baseDir;writeExcludedKeys=new Set;setWriteExcludedKeys(e){this.writeExcludedKeys=e}async ls(e=""){const n=this.makeKey(e);return Object.keys(localStorage).filter(r=>r.startsWith(n)).map(r=>r.replace(n,""))}async get(e){const n=this.makeKey(e);return localStorage.getItem(n)??null}async has(e){const n=this.makeKey(e);return localStorage.getItem(n)!==null}async set(e,n){if(this.writeExcludedKeys.has(e))return;const r=this.makeKey(e);localStorage.setItem(r,n)}async remove(e){if(this.writeExcludedKeys.has(e))return;const n=this.makeKey(e);localStorage.removeItem(n)}async rename(e,n){const r=this.makeKey(e),i=this.makeKey(n),s=localStorage.getItem(r);s!==null&&(localStorage.setItem(i,s),localStorage.removeItem(r))}makeKey(e){return`replay:fs:${this.baseDir}/${e}`}on(e,n){}off(e,n){}}class RJ{baseDir="";async ls(e=""){return[]}async get(e){return null}async has(e){return!1}async set(e,n){}async remove(e){}async rename(e,n){}setWriteExcludedKeys(e){}on(e,n){}off(e,n){}}class jJ{constructor(e){this.projectId=e}projectId;async get(){const e=this.getKey();return localStorage.getItem(e)??null}async set(e){const n=this.getKey();localStorage.setItem(n,e)}async remove(){const e=this.getKey();localStorage.removeItem(e)}getKey(){return`replay:secrets:${this.projectId}`}}class x4{constructor(e){this.storage=e}storage;itemIds=[];async getAbsolutePath(e){return await Wt.resolve(await Wt.join(this.storage.baseDir,"/",e))}async parseMany(e,n){return(await Promise.all(e.map(async i=>{try{return await this.parse(i,n)}catch(s){return console.error(`Error parsing from ${i.type} ${i.uri}:`,s),null}}))).filter(i=>i!==null)}setItemIds(e){this.itemIds=e}async write(e){e.state===At.Draft||e.srcType!==oi.FS||await this.storage.set(e.id,await this.stringify(e))}async remove(e){await this.storage.remove(e)}async updateRoot(e,n){const r=e.actions;if(r){for(const s in r){const o=parseInt(s);switch(r[s]){case"D":await this.remove(this.itemIds[o]);break;case"I":case"U":await this.write(n[o]);break}}return}const i=this.itemIds.filter(s=>!n.some(o=>o.id===s));await Promise.all([...n.map(s=>this.write(s)),...i.map(s=>this.remove(s))])}async update(e,n){const i={path:e.path.slice(1),actions:e.actions};if(i.path.length===0&&await this.updateRoot(i,n),i.path.length>0){const s=i.path[0];i.path.length===1&&i.actions&&i.actions.id==="U"&&await this.remove(this.itemIds[s]),i.path[1]&&i.path[1]==="id"&&await this.remove(this.itemIds[s]),await this.write(n[s])}this.itemIds=n.map(s=>s.id)}}class _J extends x4{parse(e){return{...e.content,id:e.uri,srcType:e.type,fileDependencies:e.fileDependencies}}async stringify(e){const{id:n,srcType:r,fileDependencies:i,...s}=e;return await Wt.extname(n)===".json"?JSON.stringify(s,null,2):el.dump(s)}async write(e){await this.storage.has(e.id)||await super.write(e)}}var cr=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(cr||{});class UO{constructor(e,n={},r){this.pattern=e,this.separator=n.separator||".",this.segments=this._parse(e),this.data=r,this._hasDeepWildcard=this.segments.some(i=>i.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(i=>i.attrName!==void 0),this._hasPositionSelector=this.segments.some(i=>i.position!==void 0)}_parse(e){const n=[];let r=0,i="";for(;r<e.length;)e[r]===this.separator?r+1<e.length&&e[r+1]===this.separator?(i.trim()&&(n.push(this._parseSegment(i.trim())),i=""),n.push({type:"deep-wildcard"}),r+=2):(i.trim()&&n.push(this._parseSegment(i.trim())),i="",r++):(i+=e[r],r++);return i.trim()&&n.push(this._parseSegment(i.trim())),n}_parseSegment(e){const n={type:"tag"};let r=null,i=e;const s=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(s&&(i=s[1]+s[3],s[2])){const u=s[2].slice(1,-1);u&&(r=u)}let o,a=i;if(i.includes("::")){const u=i.indexOf("::");if(o=i.substring(0,u).trim(),a=i.substring(u+2).trim(),!o)throw new Error(`Invalid namespace in pattern: ${e}`)}let l,c=null;if(a.includes(":")){const u=a.lastIndexOf(":"),f=a.substring(0,u).trim(),h=a.substring(u+1).trim();["first","last","odd","even"].includes(h)||/^nth\(\d+\)$/.test(h)?(l=f,c=h):l=a}else l=a;if(!l)throw new Error(`Invalid segment pattern: ${e}`);if(n.tag=l,o&&(n.namespace=o),r)if(r.includes("=")){const u=r.indexOf("=");n.attrName=r.substring(0,u).trim(),n.attrValue=r.substring(u+1).trim()}else n.attrName=r.trim();if(c){const u=c.match(/^nth\((\d+)\)$/);u?(n.position="nth",n.positionValue=parseInt(u[1],10)):n.position=c}return n}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class DJ{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}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 S4{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new DJ(this)}push(e,n=null,r=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const i=this.path.length;this.siblingStacks[i]||(this.siblingStacks[i]=new Map);const s=this.siblingStacks[i],o=r?`${r}:${e}`:e,a=s.get(o)||0;let l=0;for(const u of s.values())l+=u;s.set(o,a+1);const c={tag:e,position:l,counter:a};r!=null&&(c.namespace=r),n!=null&&(c.values=n),this.path.push(c)}pop(){if(this.path.length===0)return;this._pathStringCache=null;const e=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),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}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=[]}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=>new Map(e))}}restore(e){this._pathStringCache=null,this.path=e.path.map(n=>({...n})),this.siblingStacks=e.siblingStacks.map(n=>new Map(n))}readOnly(){return this._view}}function w4(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function C4(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function Fu(t){return String(t).replace(/"/g,""").replace(/'/g,"'")}const P4=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�",NJ=P4+"\\-\\.\\d·̀-ͯ‿-⁀",k4=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",MJ=k4+"\\-\\.\\d·̀-ͯ҇‿-⁀",T4=(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)}},zJ=T4(P4,NJ),VJ=T4(k4,MJ,"u"),LJ=(t="1.0")=>t==="1.1"?VJ:zJ,$4=(t,{xmlVersion:e="1.0"}={})=>LJ(e).qName.test(t),XJ=`
|
|
110
|
+
`:""}return X0.dump=we,X0}var sA;function DH(){if(sA)return br;sA=1;const t=jH(),e=_H();function n(r,i){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+i+" instead, which is now safe by default.")}}return br.Type=Br(),br.Schema=q3(),br.FAILSAFE_SCHEMA=Y3(),br.JSON_SCHEMA=e4(),br.CORE_SCHEMA=t4(),br.DEFAULT_SCHEMA=nk(),br.load=t.load,br.loadAll=t.loadAll,br.dump=e.dump,br.YAMLException=jp(),br.types={binary:i4(),float:K3(),map:F3(),null:G3(),pairs:o4(),set:a4(),timestamp:n4(),bool:H3(),int:J3(),merge:r4(),omap:s4(),seq:B3(),str:U3()},br.safeLoad=n("safeLoad","load"),br.safeLoadAll=n("safeLoadAll","loadAll"),br.safeDump=n("safeDump","dump"),br}var NH=DH();const el=QH(NH),{Type:S6e,Schema:w6e,FAILSAFE_SCHEMA:C6e,JSON_SCHEMA:P6e,CORE_SCHEMA:k6e,DEFAULT_SCHEMA:T6e,load:$6e,loadAll:I6e,dump:E6e,YAMLException:A6e,types:Q6e,safeLoad:R6e,safeLoadAll:j6e,safeDump:_6e}=el,Ll="1.9.1",oA=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function MH(t){const e=new Set([t]),n=new Set,r=t.match(oA);if(!r)return()=>!1;const i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(l){return l===t};function s(a){return n.add(a),!1}function o(a){return e.add(a),!0}return function(l){if(e.has(l))return!0;if(n.has(l))return!1;const c=l.match(oA);if(!c)return s(l);const u={major:+c[1],minor:+c[2],patch:+c[3],prerelease:c[4]};return u.prerelease!=null||i.major!==u.major?s(l):i.major===0?i.minor===u.minor&&i.patch<=u.patch?o(l):s(l):i.minor<=u.minor?o(l):s(l)}}const zH=MH(Ll),VH=Ll.split(".")[0],Qh=Symbol.for(`opentelemetry.js.api.${VH}`),Rh=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{};function _p(t,e,n,r=!1){var i;const s=Rh[Qh]=(i=Rh[Qh])!==null&&i!==void 0?i:{version:Ll};if(!r&&s[t]){const o=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${t}`);return n.error(o.stack||o.message),!1}if(s.version!==Ll){const o=new Error(`@opentelemetry/api: Registration of version v${s.version} for ${t} does not match previously registered API v${Ll}`);return n.error(o.stack||o.message),!1}return s[t]=e,n.debug(`@opentelemetry/api: Registered a global for ${t} v${Ll}.`),!0}function rc(t){var e,n;const r=(e=Rh[Qh])===null||e===void 0?void 0:e.version;if(!(!r||!zH(r)))return(n=Rh[Qh])===null||n===void 0?void 0:n[t]}function Dp(t,e){e.debug(`@opentelemetry/api: Unregistering a global for ${t} v${Ll}.`);const n=Rh[Qh];n&&delete n[t]}class LH{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return lf("debug",this._namespace,e)}error(...e){return lf("error",this._namespace,e)}info(...e){return lf("info",this._namespace,e)}warn(...e){return lf("warn",this._namespace,e)}verbose(...e){return lf("verbose",this._namespace,e)}}function lf(t,e,n){const r=rc("diag");if(r)return r[t](e,...n)}var yi;(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(yi||(yi={}));function XH(t,e){t<yi.NONE?t=yi.NONE:t>yi.ALL&&(t=yi.ALL),e=e||{};function n(r,i){const s=e[r];return typeof s=="function"&&t>=i?s.bind(e):function(){}}return{error:n("error",yi.ERROR),warn:n("warn",yi.WARN),info:n("info",yi.INFO),debug:n("debug",yi.DEBUG),verbose:n("verbose",yi.VERBOSE)}}const WH="diag";class Ji{static instance(){return this._instance||(this._instance=new Ji),this._instance}constructor(){function e(i){return function(...s){const o=rc("diag");if(o)return o[i](...s)}}const n=this,r=(i,s={logLevel:yi.INFO})=>{var o,a,l;if(i===n){const f=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return n.error((o=f.stack)!==null&&o!==void 0?o:f.message),!1}typeof s=="number"&&(s={logLevel:s});const c=rc("diag"),u=XH((a=s.logLevel)!==null&&a!==void 0?a:yi.INFO,i);if(c&&!s.suppressOverrideMessage){const f=(l=new Error().stack)!==null&&l!==void 0?l:"<failed to generate stacktrace>";c.warn(`Current logger will be overwritten from ${f}`),u.warn(`Current logger will overwrite one already registered from ${f}`)}return _p("diag",u,n,!0)};n.setLogger=r,n.disable=()=>{Dp(WH,n)},n.createComponentLogger=i=>new LH(i),n.verbose=e("verbose"),n.debug=e("debug"),n.info=e("info"),n.warn=e("warn"),n.error=e("error")}}class gu{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){const n=this._entries.get(e);if(n)return Object.assign({},n)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(e,n){const r=new gu(this._entries);return r._entries.set(e,n),r}removeEntry(e){const n=new gu(this._entries);return n._entries.delete(e),n}removeEntries(...e){const n=new gu(this._entries);for(const r of e)n._entries.delete(r);return n}clear(){return new gu}}const ZH=Symbol("BaggageEntryMetadata"),qH=Ji.instance();function UH(t={}){return new gu(new Map(Object.entries(t)))}function BH(t){return typeof t!="string"&&(qH.error(`Cannot create baggage metadata from unknown type: ${typeof t}`),t=""),{__TYPE__:ZH,toString(){return t}}}function rk(t){return Symbol.for(t)}class WO{constructor(e){const n=this;n._currentContext=e?new Map(e):new Map,n.getValue=r=>n._currentContext.get(r),n.setValue=(r,i)=>{const s=new WO(n._currentContext);return s._currentContext.set(r,i),s},n.deleteValue=r=>{const i=new WO(n._currentContext);return i._currentContext.delete(r),i}}}const au=new WO;class FH{constructor(){}createGauge(e,n){return rJ}createHistogram(e,n){return iJ}createCounter(e,n){return nJ}createUpDownCounter(e,n){return sJ}createObservableGauge(e,n){return aJ}createObservableCounter(e,n){return oJ}createObservableUpDownCounter(e,n){return lJ}addBatchObservableCallback(e,n){}removeBatchObservableCallback(e){}}class jy{}class YH extends jy{add(e,n){}}class GH extends jy{add(e,n){}}class HH extends jy{record(e,n){}}class JH extends jy{record(e,n){}}class ik{addCallback(e){}removeCallback(e){}}class KH extends ik{}class eJ extends ik{}class tJ extends ik{}const l4=new FH,nJ=new YH,rJ=new HH,iJ=new JH,sJ=new GH,oJ=new KH,aJ=new eJ,lJ=new tJ;function cJ(){return l4}const uJ={get(t,e){if(t!=null)return t[e]},keys(t){return t==null?[]:Object.keys(t)}},dJ={set(t,e,n){t!=null&&(t[e]=n)}};class fJ{active(){return au}with(e,n,r,...i){return n.call(r,...i)}bind(e,n){return n}enable(){return this}disable(){return this}}const W0="context",hJ=new fJ;class Td{constructor(){}static getInstance(){return this._instance||(this._instance=new Td),this._instance}setGlobalContextManager(e){return _p(W0,e,Ji.instance())}active(){return this._getContextManager().active()}with(e,n,r,...i){return this._getContextManager().with(e,n,r,...i)}bind(e,n){return this._getContextManager().bind(e,n)}_getContextManager(){return rc(W0)||hJ}disable(){this._getContextManager().disable(),Dp(W0,Ji.instance())}}var sa;(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(sa||(sa={}));const c4="0000000000000000",u4="00000000000000000000000000000000",d4={traceId:u4,spanId:c4,traceFlags:sa.NONE};class Jf{constructor(e=d4){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,n){return this}setAttributes(e){return this}addEvent(e,n){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,n){}}const sk=rk("OpenTelemetry Context Key SPAN");function ok(t){return t.getValue(sk)||void 0}function pJ(){return ok(Td.getInstance().active())}function ak(t,e){return t.setValue(sk,e)}function gJ(t){return t.deleteValue(sk)}function mJ(t,e){return ak(t,new Jf(e))}function f4(t){var e;return(e=ok(t))===null||e===void 0?void 0:e.spanContext()}const Ig=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function h4(t,e){if(typeof t!="string"||t.length!==e)return!1;let n=0;for(let r=0;r<t.length;r+=4)n+=(Ig[t.charCodeAt(r)]|0)+(Ig[t.charCodeAt(r+1)]|0)+(Ig[t.charCodeAt(r+2)]|0)+(Ig[t.charCodeAt(r+3)]|0);return n===e}function p4(t){return h4(t,32)&&t!==u4}function OJ(t){return h4(t,16)&&t!==c4}function _y(t){return p4(t.traceId)&&OJ(t.spanId)}function vJ(t){return new Jf(t)}const Z0=Td.getInstance();class g4{startSpan(e,n,r=Z0.active()){if(!!n?.root)return new Jf;const s=r&&f4(r);return yJ(s)&&_y(s)?new Jf(s):new Jf}startActiveSpan(e,n,r,i){let s,o,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(s=n,a=r):(s=n,o=r,a=i);const l=o??Z0.active(),c=this.startSpan(e,s,l),u=ak(l,c);return Z0.with(u,a,void 0,c)}}function yJ(t){return t!==null&&typeof t=="object"&&"spanId"in t&&typeof t.spanId=="string"&&"traceId"in t&&typeof t.traceId=="string"&&"traceFlags"in t&&typeof t.traceFlags=="number"}const bJ=new g4;class xJ{constructor(e,n,r,i){this._provider=e,this.name=n,this.version=r,this.options=i}startSpan(e,n,r){return this._getTracer().startSpan(e,n,r)}startActiveSpan(e,n,r,i){const s=this._getTracer();return Reflect.apply(s.startActiveSpan,s,arguments)}_getTracer(){if(this._delegate)return this._delegate;const e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):bJ}}class SJ{getTracer(e,n,r){return new g4}}const wJ=new SJ;class aA{getTracer(e,n,r){var i;return(i=this.getDelegateTracer(e,n,r))!==null&&i!==void 0?i:new xJ(this,e,n,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:wJ}setDelegate(e){this._delegate=e}getDelegateTracer(e,n,r){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(e,n,r)}}var ZO;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(ZO||(ZO={}));exports.SpanKind=void 0;(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(exports.SpanKind||(exports.SpanKind={}));exports.SpanStatusCode=void 0;(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(exports.SpanStatusCode||(exports.SpanStatusCode={}));const mo=Td.getInstance(),ct=Ji.instance();class CJ{getMeter(e,n,r){return l4}}const PJ=new CJ,q0="metrics";class lk{constructor(){}static getInstance(){return this._instance||(this._instance=new lk),this._instance}setGlobalMeterProvider(e){return _p(q0,e,Ji.instance())}getMeterProvider(){return rc(q0)||PJ}getMeter(e,n,r){return this.getMeterProvider().getMeter(e,n,r)}disable(){Dp(q0,Ji.instance())}}const m4=lk.getInstance();class kJ{inject(e,n){}extract(e,n){return e}fields(){return[]}}const ck=rk("OpenTelemetry Baggage Key");function O4(t){return t.getValue(ck)||void 0}function TJ(){return O4(Td.getInstance().active())}function $J(t,e){return t.setValue(ck,e)}function IJ(t){return t.deleteValue(ck)}const U0="propagation",EJ=new kJ;class uk{constructor(){this.createBaggage=UH,this.getBaggage=O4,this.getActiveBaggage=TJ,this.setBaggage=$J,this.deleteBaggage=IJ}static getInstance(){return this._instance||(this._instance=new uk),this._instance}setGlobalPropagator(e){return _p(U0,e,Ji.instance())}inject(e,n,r=dJ){return this._getGlobalPropagator().inject(e,n,r)}extract(e,n,r=uJ){return this._getGlobalPropagator().extract(e,n,r)}fields(){return this._getGlobalPropagator().fields()}disable(){Dp(U0,Ji.instance())}_getGlobalPropagator(){return rc(U0)||EJ}}const Kf=uk.getInstance(),B0="trace";class dk{constructor(){this._proxyTracerProvider=new aA,this.wrapSpanContext=vJ,this.isSpanContextValid=_y,this.deleteSpan=gJ,this.getSpan=ok,this.getActiveSpan=pJ,this.getSpanContext=f4,this.setSpan=ak,this.setSpanContext=mJ}static getInstance(){return this._instance||(this._instance=new dk),this._instance}setGlobalTracerProvider(e){const n=_p(B0,this._proxyTracerProvider,Ji.instance());return n&&this._proxyTracerProvider.setDelegate(e),n}getTracerProvider(){return rc(B0)||this._proxyTracerProvider}getTracer(e,n){return this.getTracerProvider().getTracer(e,n)}disable(){Dp(B0,Ji.instance()),this._proxyTracerProvider=new aA}}const Nr=dk.getInstance(),oi={FS:"fs",WEB:"web"};class Wt{static utils=null;static async getUtils(){return Wt.utils||(Wt.utils=pn()?await Promise.resolve().then(()=>require("./replay-tauri-path-C8GiFO5s.js")):{join:_a.join,resolve:_a.resolve,isAbsolute:_a.isAbsolute,relative:_a.relative,extname:_a.extname,dirname:_a.dirname}),Wt.utils}static async dirname(e){return(await Wt.getUtils()).dirname(e)}static async join(...e){return(await Wt.getUtils()).join(...e)}static async resolve(e){return(await Wt.getUtils()).resolve(e)}static async isAbsolute(e){return(await Wt.getUtils()).isAbsolute(e)}static async relative(e,n){return(await Wt.getUtils()).relative(e,n)}static async extname(e){return(await Wt.getUtils()).extname(e)}}async function qO(t,e){const[{bundle:n,Config:r},{ExternalResolver:i}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-Dxk-kqkZ.js")),Promise.resolve().then(()=>require("./replay-external-resolver-CjM7Da6t.js"))]),s=new r({});s.getRulesForSpecVersion=()=>[];const o=await Wt.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}}function v4(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function D1(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function y4(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function Xi(t){try{return new URL(t),!0}catch{return!1}}function AJ(t,e){let n;if(e.startsWith("//")){const{protocol:r}=new URL(t);n=`${r||"https:"}${e}`}else if(v4(e))n=e;else if(!e.startsWith("/"))n=D1(t)+"/"+e;else{const r=new URL(t);r.pathname=e,n=r.toString()}return D1(n)}function lA(t,e){let n=t;return e.forEach(({key:r,value:i,active:s})=>{i&&s&&(n=n.replaceAll(`{${r}}`,i))}),n}function b4(t,e){let n=t;return e.forEach(({name:r,value:i})=>{i&&(n=n.replaceAll(`{${r}}`,i))}),n}function QJ(t){return t.startsWith("http://")||t.startsWith("https://")}function Eg({url:t,serverUrl:e,corsProxyUrl:n}){let r;if(QJ(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}class N1{constructor(e){this.baseDir=e}baseDir;writeExcludedKeys=new Set;setWriteExcludedKeys(e){this.writeExcludedKeys=e}async ls(e=""){const n=this.makeKey(e);return Object.keys(localStorage).filter(r=>r.startsWith(n)).map(r=>r.replace(n,""))}async get(e){const n=this.makeKey(e);return localStorage.getItem(n)??null}async has(e){const n=this.makeKey(e);return localStorage.getItem(n)!==null}async set(e,n){if(this.writeExcludedKeys.has(e))return;const r=this.makeKey(e);localStorage.setItem(r,n)}async remove(e){if(this.writeExcludedKeys.has(e))return;const n=this.makeKey(e);localStorage.removeItem(n)}async rename(e,n){const r=this.makeKey(e),i=this.makeKey(n),s=localStorage.getItem(r);s!==null&&(localStorage.setItem(i,s),localStorage.removeItem(r))}makeKey(e){return`replay:fs:${this.baseDir}/${e}`}on(e,n){}off(e,n){}}class RJ{baseDir="";async ls(e=""){return[]}async get(e){return null}async has(e){return!1}async set(e,n){}async remove(e){}async rename(e,n){}setWriteExcludedKeys(e){}on(e,n){}off(e,n){}}class jJ{constructor(e){this.projectId=e}projectId;async get(){const e=this.getKey();return localStorage.getItem(e)??null}async set(e){const n=this.getKey();localStorage.setItem(n,e)}async remove(){const e=this.getKey();localStorage.removeItem(e)}getKey(){return`replay:secrets:${this.projectId}`}}class x4{constructor(e){this.storage=e}storage;itemIds=[];async getAbsolutePath(e){return await Wt.resolve(await Wt.join(this.storage.baseDir,"/",e))}async parseMany(e,n){return(await Promise.all(e.map(async i=>{try{return await this.parse(i,n)}catch(s){return console.error(`Error parsing from ${i.type} ${i.uri}:`,s),null}}))).filter(i=>i!==null)}setItemIds(e){this.itemIds=e}async write(e){e.state===At.Draft||e.srcType!==oi.FS||await this.storage.set(e.id,await this.stringify(e))}async remove(e){await this.storage.remove(e)}async updateRoot(e,n){const r=e.actions;if(r){for(const s in r){const o=parseInt(s);switch(r[s]){case"D":await this.remove(this.itemIds[o]);break;case"I":case"U":await this.write(n[o]);break}}return}const i=this.itemIds.filter(s=>!n.some(o=>o.id===s));await Promise.all([...n.map(s=>this.write(s)),...i.map(s=>this.remove(s))])}async update(e,n){const i={path:e.path.slice(1),actions:e.actions};if(i.path.length===0&&await this.updateRoot(i,n),i.path.length>0){const s=i.path[0];i.path.length===1&&i.actions&&i.actions.id==="U"&&await this.remove(this.itemIds[s]),i.path[1]&&i.path[1]==="id"&&await this.remove(this.itemIds[s]),await this.write(n[s])}this.itemIds=n.map(s=>s.id)}}class _J extends x4{parse(e){return{...e.content,id:e.uri,srcType:e.type,fileDependencies:e.fileDependencies}}async stringify(e){const{id:n,srcType:r,fileDependencies:i,...s}=e;return await Wt.extname(n)===".json"?JSON.stringify(s,null,2):el.dump(s)}async write(e){await this.storage.has(e.id)||await super.write(e)}}var cr=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(cr||{});class UO{constructor(e,n={},r){this.pattern=e,this.separator=n.separator||".",this.segments=this._parse(e),this.data=r,this._hasDeepWildcard=this.segments.some(i=>i.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(i=>i.attrName!==void 0),this._hasPositionSelector=this.segments.some(i=>i.position!==void 0)}_parse(e){const n=[];let r=0,i="";for(;r<e.length;)e[r]===this.separator?r+1<e.length&&e[r+1]===this.separator?(i.trim()&&(n.push(this._parseSegment(i.trim())),i=""),n.push({type:"deep-wildcard"}),r+=2):(i.trim()&&n.push(this._parseSegment(i.trim())),i="",r++):(i+=e[r],r++);return i.trim()&&n.push(this._parseSegment(i.trim())),n}_parseSegment(e){const n={type:"tag"};let r=null,i=e;const s=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(s&&(i=s[1]+s[3],s[2])){const u=s[2].slice(1,-1);u&&(r=u)}let o,a=i;if(i.includes("::")){const u=i.indexOf("::");if(o=i.substring(0,u).trim(),a=i.substring(u+2).trim(),!o)throw new Error(`Invalid namespace in pattern: ${e}`)}let l,c=null;if(a.includes(":")){const u=a.lastIndexOf(":"),f=a.substring(0,u).trim(),h=a.substring(u+1).trim();["first","last","odd","even"].includes(h)||/^nth\(\d+\)$/.test(h)?(l=f,c=h):l=a}else l=a;if(!l)throw new Error(`Invalid segment pattern: ${e}`);if(n.tag=l,o&&(n.namespace=o),r)if(r.includes("=")){const u=r.indexOf("=");n.attrName=r.substring(0,u).trim(),n.attrValue=r.substring(u+1).trim()}else n.attrName=r.trim();if(c){const u=c.match(/^nth\((\d+)\)$/);u?(n.position="nth",n.positionValue=parseInt(u[1],10)):n.position=c}return n}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class DJ{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}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 S4{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new DJ(this)}push(e,n=null,r=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const i=this.path.length;this.siblingStacks[i]||(this.siblingStacks[i]=new Map);const s=this.siblingStacks[i],o=r?`${r}:${e}`:e,a=s.get(o)||0;let l=0;for(const u of s.values())l+=u;s.set(o,a+1);const c={tag:e,position:l,counter:a};r!=null&&(c.namespace=r),n!=null&&(c.values=n),this.path.push(c)}pop(){if(this.path.length===0)return;this._pathStringCache=null;const e=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),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}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=[]}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=>new Map(e))}}restore(e){this._pathStringCache=null,this.path=e.path.map(n=>({...n})),this.siblingStacks=e.siblingStacks.map(n=>new Map(n))}readOnly(){return this._view}}function w4(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function C4(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function Fu(t){return String(t).replace(/"/g,""").replace(/'/g,"'")}const P4=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�",NJ=P4+"\\-\\.\\d·̀-ͯ‿-⁀",k4=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",MJ=k4+"\\-\\.\\d·̀-ͯ҇‿-⁀",T4=(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)}},zJ=T4(P4,NJ),VJ=T4(k4,MJ,"u"),LJ=(t="1.0")=>t==="1.1"?VJ:zJ,$4=(t,{xmlVersion:e="1.0"}={})=>LJ(e).qName.test(t),XJ=`
|
|
111
111
|
`;function WJ(t,e){if(!Array.isArray(t)||t.length===0)return"1.0";const n=t[0];if(fk(n)==="?xml"){const i=n[":@"];if(i){const s=e.attributeNamePrefix+"version";if(i[s])return i[s]}}return"1.0"}function I4(t,e,n,r,i){return!n.sanitizeName||$4(t,{xmlVersion:i})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}function ZJ(t,e){let n="";e.format&&(n=XJ);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 UO(a)):a instanceof UO&&r.push(a)}const i=WJ(t,e),s=new S4;return E4(t,e,n,s,r,i)}function E4(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=M1(l,e),l}return""}for(let l=0;l<t.length;l++){const c=t[l],u=fk(c);if(u===void 0)continue;const h=u===e.textNodeName||u===e.cdataPropName||u===e.commentPropName||u[0]==="?"?u:I4(u,!1,e,r,s),p=qJ(c[":@"],e);r.push(h,p);const m=BJ(r,i);if(h===e.textNodeName){let x=c[u];m||(x=e.tagValueProcessor(h,x),x=M1(x,e)),a&&(o+=n),o+=x,a=!1,r.pop();continue}else if(h===e.cdataPropName){a&&(o+=n);const x=c[u][0][e.textNodeName],C=C4(x);o+=`<![CDATA[${C}]]>`,a=!1,r.pop();continue}else if(h===e.commentPropName){const x=c[u][0][e.textNodeName],C=w4(x);o+=n+`<!--${C}-->`,a=!0,r.pop();continue}else if(h[0]==="?"){const x=cA(c[":@"],e,m,r,s);o+=(h==="?xml"?"":n)+`<${h}${x}?>`,a=!0,r.pop();continue}let g=n;g!==""&&(g+=e.indentBy);const O=cA(c[":@"],e,m,r,s),v=n+`<${h}${O}`;let b;m?b=A4(c[u],e):b=E4(c[u],e,g,r,i,s),e.unpairedTags.indexOf(h)!==-1?e.suppressUnpairedNode?o+=v+">":o+=v+"/>":(!b||b.length===0)&&e.suppressEmptyNode?o+=v+"/>":b&&b.endsWith(">")?o+=v+`>${b}${n}</${h}>`:(o+=v+">",b&&n!==""&&(b.includes("/>")||b.includes("</"))?o+=n+e.indentBy+b+n:o+=b,o+=`</${h}>`),a=!0,r.pop()}return o}function qJ(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]=Fu(t[i]),r=!0}return r?n:null}function A4(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=fk(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=UJ(i[":@"],e),a=A4(i[s],e);!a||a.length===0?n+=`<${s}${o}/>`:n+=`<${s}${o}>${a}</${s}>`}}}return n}function UJ(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)}="${Fu(i)}"`}return n}function fk(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 cA(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:I4(a,!0,e,r,i);let c;n?c=t[o]:(c=e.attributeValueProcessor(o,t[o]),c=M1(c,e)),c===!0&&e.suppressBooleanAttributes?s+=` ${l}`:s+=` ${l}="${Fu(c)}"`}return s}function BJ(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 M1(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 FJ(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 YJ={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:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0,sanitizeName:!1};function Ai(t){if(this.options=Object.assign({},YJ,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 UO(n)):n instanceof UO&&this.stopNodeExpressions.push(n)}this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=FJ(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=KJ),this.processTextOrObjNode=HJ,this.options.format?(this.indentate=JJ,this.tagEndChar=`>
|
|
112
112
|
`,this.newLine=`
|
|
113
113
|
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function GJ(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 F0(t,e,n,r,i){return!n.sanitizeName||$4(t,{xmlVersion:i})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}Ai.prototype.build=function(t){if(this.options.preserveOrder)return ZJ(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new S4,n=GJ(t,this.options);return this.j2x(t,0,e,n).val}};Ai.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:F0(l,!1,this.options,n,r);if(typeof t[l]>"u")this.isAttribute(l)&&(s+="");else if(t[l]===null)this.isAttribute(l)||u===this.options.cdataPropName||u===this.options.commentPropName?s+="":u[0]==="?"?s+=this.indentate(e)+"<"+u+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+u+"/"+this.tagEndChar;else if(t[l]instanceof Date)s+=this.buildTextValNode(t[l],u,"",e,n);else if(typeof t[l]!="object"){const f=this.isAttribute(l);if(f&&!this.ignoreAttributesFn(f,o)){const h=F0(f,!0,this.options,n,r);i+=this.buildAttrPairStr(h,""+t[l],a)}else if(!f)if(l===this.options.textNodeName){let h=this.options.tagValueProcessor(l,""+t[l]);s+=this.replaceEntitiesValue(h)}else{n.push(u);const h=this.checkStopNode(n);if(n.pop(),h){const p=""+t[l];p===""?s+=this.indentate(e)+"<"+u+this.closeTag(u)+this.tagEndChar:s+=this.indentate(e)+"<"+u+">"+p+"</"+u+this.tagEndChar}else s+=this.buildTextValNode(t[l],u,"",e,n)}}else if(Array.isArray(t[l])){const f=t[l].length;let h="",p="";for(let m=0;m<f;m++){const g=t[l][m];if(!(typeof g>"u"))if(g===null)u[0]==="?"?s+=this.indentate(e)+"<"+u+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+u+"/"+this.tagEndChar;else if(typeof g=="object")if(this.options.oneListGroup){n.push(u);const O=this.j2x(g,e+1,n,r);n.pop(),h+=O.val,this.options.attributesGroupName&&g.hasOwnProperty(this.options.attributesGroupName)&&(p+=O.attrStr)}else h+=this.processTextOrObjNode(g,u,e,n,r);else if(this.options.oneListGroup){let O=this.options.tagValueProcessor(u,g);O=this.replaceEntitiesValue(O),h+=O}else{n.push(u);const O=this.checkStopNode(n);if(n.pop(),O){const v=""+g;v===""?h+=this.indentate(e)+"<"+u+this.closeTag(u)+this.tagEndChar:h+=this.indentate(e)+"<"+u+">"+v+"</"+u+this.tagEndChar}else h+=this.buildTextValNode(g,u,"",e,n)}}this.options.oneListGroup&&(h=this.buildObjectNode(h,u,p,e)),s+=h}else if(this.options.attributesGroupName&&l===this.options.attributesGroupName){const f=Object.keys(t[l]),h=f.length;for(let p=0;p<h;p++){const m=F0(f[p],!0,this.options,n,r);i+=this.buildAttrPairStr(m,""+t[l][f[p]],a)}}else s+=this.processTextOrObjNode(t[l],u,e,n,r)}return{attrStr:i,val:s}};Ai.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+'="'+Fu(e)+'"'};function HJ(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)}Ai.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]=Fu(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]=Fu(t[r]),n=!0)}return n?e:null};Ai.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};Ai.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};Ai.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}};Ai.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};Ai.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};Ai.prototype.buildTextValNode=function(t,e,n,r,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName){const s=C4(t);return this.indentate(r)+`<![CDATA[${s}]]>`+this.newLine}else if(this.options.commentPropName!==!1&&e===this.options.commentPropName){const s=w4(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}}};Ai.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 JJ(t){return this.options.indentBy.repeat(t)}function KJ(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}const Np={active:!0,key:"",value:""},eK=/[\n\r\t]/g;function Q4(t){return t.replace(eK,"").trim()}function io(t,e){return t.map(n=>{const r=e.boundNames==="all"||!!e.boundNames?.has(n.name);return{id:crypto.randomUUID(),key:n.name,value:r?`$inputs.${n.name}`:n.example?Q4(String(n.example)):"",active:r?!0:!!n.example,in:n.in,...n.allowReserved&&{allowReserved:n.allowReserved}}})}function Mp(t,e){const[n]=t.split("?"),r=e.filter(i=>i.active).map(i=>`${i.key}=${i.value}`).join("&");return`${n}${r?`?${r}`:""}`}function zp(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 R4(){return{id:crypto.randomUUID(),...Np}}function tK(){return{id:crypto.randomUUID(),...Np,description:""}}function BO(t){return{...Np,id:crypto.randomUUID(),in:t}}function nK(){return{id:crypto.randomUUID(),...Np,type:"text",files:null}}function rK(){return{id:crypto.randomUUID(),...Np,sendIn:Er.URL}}function Y0(t){return t.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function Dy(t,e){return t.filter(n=>n.active&&n.value).map(({value:n})=>(e?ln(n,e):n).trim())}function Ba(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 iK(t,e,n){return t.map(({value:r,...i})=>({...i,value:Xu(r,e,n??{})}))}function sK(t,e){if(!t.startsWith("$components.parameters."))return null;const n=t.replace("$components.parameters.","");return n&&e[n]||null}function gn(t=[],e={}){const n=[];for(const r of t)if(Gl(r)){const i=sK(r.reference,e);i&&n.push({...i,active:r.active,value:r.value||i.value})}else n.push(r);return n}function Da(t){return Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:n}))}function j4(t){return t.schema}function _4(t){return j4(t)?.fields??[]}function D4(t,e){return t.flatMap(n=>{const r=j4(n),i=r?.fields||[];return i.length>0?i.flatMap(s=>uA(s.name,s.example,n.allowReserved)):uA(n.name,r?.example??n.example,n.allowReserved)})}function uA(t,e,n){if(e===void 0)return[G0(t,"",!1,n)];const r=z1(e,t);return r.length===0?[G0(t,"",!1,n)]:r.map(i=>G0(i.key,i.value,!0,n))}function z1(t,e){return t===void 0?[]:t===null?[{key:e,value:""}]:Array.isArray(t)?t.flatMap((n,r)=>n!==null&&typeof n=="object"?z1(n,`${e}[${r}]`):[{key:e,value:String(n)}]):oK(t)?Object.entries(t).flatMap(([n,r])=>z1(r,`${e}[${n}]`)):[{key:e,value:String(t)}]}function oK(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function G0(t,e,n,r){return{id:crypto.randomUUID(),key:t,value:Q4(e),active:n,in:"query",...r&&{allowReserved:r}}}const N4={path:"path",query:"query",header:"headers",cookie:"cookie"};function hk(t){return t!==void 0}function aK(t,e){if(t)return dy.isDirectConfigureRequestValues(t)?t:t[e]}function dA(t,e,n){const r=n[N4[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 Tu(t,e,n){if(dy.isDirectConfigureRequestValues(n))return dA(t,e,n);const r=new Set;for(const i of Object.values(n))if(i)for(const s of dA(t,e,i))r.add(s);return r}function fA(t,e,n){const r=n.query,i=n.envVariables;for(const s of e??[]){const o=_4(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 M4(t,e,n){const r=[...t??[],...e??[]],i=new Set(Tu(r,"query",n));if(dy.isDirectConfigureRequestValues(n))return fA(i,e,n),i;for(const s of Object.values(n))s&&fA(i,e,s);return i}const z4=1024;let lK=0,qi=class{constructor(e,n){this.from=e,this.to=n}};class vt{constructor(e={}){this.id=lK++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Qr.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}vt.closedBy=new vt({deserialize:t=>t.split(" ")});vt.openedBy=new vt({deserialize:t=>t.split(" ")});vt.group=new vt({deserialize:t=>t.split(" ")});vt.isolate=new vt({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});vt.contextHash=new vt({perNode:!0});vt.lookAhead=new vt({perNode:!0});vt.mounted=new vt({perNode:!0});class jh{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[vt.mounted.id]}}const cK=Object.create(null);class Qr{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):cK,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Qr(e.name||"",n,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(vt.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(vt.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}}Qr.none=new Qr("",Object.create(null),0,8);class Ny{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let i=null;for(let s of e){let o=s(r);o&&(i||(i=Object.assign({},r.props)),i[o[0].id]=o[1])}n.push(i?new Qr(r.name,i,r.id,r.flags):r)}return new Ny(n)}}const Ag=new WeakMap,hA=new WeakMap;var nn;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(nn||(nn={}));let sn=class V1{constructor(e,n,r,i,s){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=jh.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new FO(this.topNode,e)}cursorAt(e,n=0,r=0){let i=Ag.get(this)||this.topNode,s=new FO(i);return s.moveTo(e,n),Ag.set(this,s._tree),s}get topNode(){return new Ki(this,0,0,null)}resolve(e,n=0){let r=_h(Ag.get(this)||this.topNode,e,n,!1);return Ag.set(this,r),r}resolveInner(e,n=0){let r=_h(hA.get(this)||this.topNode,e,n,!0);return hA.set(this,r),r}resolveStack(e,n=0){return fK(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&nn.IncludeAnonymous)>0;for(let l=this.cursor(o|nn.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:mk(Qr.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new V1(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new V1(Qr.none,n,r,i)))}static build(e){return hK(e)}};sn.empty=new sn(Qr.none,[],[],0);class pk{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new pk(this.buffer,this.index)}}class tl{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return Qr.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],i=this.set.types[n],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,n,r,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=n&&!(V4(s,i,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let a=e,l=0;a<n;){s[l++]=i[a++],s[l++]=i[a++]-r;let c=s[l++]=i[a++]-r;s[l++]=i[a++]-e,o=Math.max(o,c)}return new tl(s,o,this.set)}}function V4(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function _h(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let o=!r&&t instanceof Ki&&t.index<0?null:t.parent;if(!o)return t;t=o}let s=r?0:nn.IgnoreOverlays;if(r)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof Ki&&o.index<0&&((i=a.enter(e,n,s))===null||i===void 0?void 0:i.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,n,s);if(!o)return t;t=o}}class L4{cursor(e=0){return new FO(this,e)}getChild(e,n=null,r=null){let i=pA(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return pA(this,e,n,r)}resolve(e,n=0){return _h(this,e,n,!1)}resolveInner(e,n=0){return _h(this,e,n,!0)}matchContext(e){return L1(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(r=n,n=i.prevSibling):n=i}return r}get node(){return this}get next(){return this.parent}}let Ki=class Vm extends L4{constructor(e,n,r,i){super(),this._tree=e,this.from=n,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,i,s=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=n>0?a.length:-1;e!=c;e+=n){let u=a[e],f=l[e]+o.from;if(V4(i,r,f,f+u.length)){if(u instanceof tl){if(s&nn.ExcludeBuffers)continue;let h=u.findChild(0,u.buffer.length,n,r-f,i);if(h>-1)return new lo(new uK(o,u,e,f),null,h)}else if(s&nn.IncludeAnonymous||!u.type.isAnonymous||gk(u)){let h;if(!(s&nn.IgnoreMounts)&&(h=jh.get(u))&&!h.overlay)return new Vm(h.tree,f,e,o);let p=new Vm(u,f,e,o);return s&nn.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?u.children.length-1:0,n,r,i)}}}if(s&nn.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+n:e=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let i;if(!(r&nn.IgnoreOverlays)&&(i=jh.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:a}of i.overlay)if((n>0?o<=s:o<s)&&(n<0?a>=s:a>s))return new Vm(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function pA(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function L1(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class uK{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class lo extends L4{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return s<0?null:new lo(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&nn.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return s<0?null:new lo(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new lo(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new lo(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),n.push(0)}return new sn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function X4(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;s<t.length;s++){let o=t[s];(o.from>n.from||o.to<n.to)&&(n=o,e=s)}let r=n instanceof Ki&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new dK(i,n)}class dK{constructor(e,n){this.heads=e,this.node=n}get next(){return X4(this.heads)}}function fK(t,e,n){let r=t.resolveInner(e,n),i=null;for(let s=r instanceof Ki?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[r])).push(o.resolve(e,n)),s=o}else{let o=jh.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Ki(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(_h(a,e,n,!1))}}return i?X4(i):r}class FO{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ki)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof Ki?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&nn.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&nn.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&nn.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let s=n+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let a=r._tree.children[s];if(this.mode&nn.IncludeAnonymous||a instanceof tl||!a.type.isAnonymous||gk(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;n=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)n=new lo(this.buffer,n,this.stack[i]);return this.bufferNode=new lo(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&n&&n(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return L1(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return L1(this._tree,e,i);let o=r[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function gk(t){return t.children.some(e=>e instanceof tl||!e.type.isAnonymous||gk(e))}function hK(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=z4,reused:s=[],minRepeatType:o=r.types.length}=t,a=Array.isArray(n)?new pk(n,n.length):n,l=r.types,c=0,u=0;function f(S,T,k,$,A,z){let{id:M,start:Q,end:_,size:j}=a,D=u,I=c;for(;j<0;)if(a.next(),j==-1){let q=s[M];k.push(q),$.push(Q-S);return}else if(j==-3){c=M;return}else if(j==-4){u=M;return}else throw new RangeError(`Unrecognized record size: ${j}`);let V=l[M],L,B,Z=Q-S;if(_-Q<=i&&(B=O(a.pos-T,A))){let q=new Uint16Array(B.size-B.skip),F=a.pos-B.size,Y=q.length;for(;a.pos>F;)Y=v(B.start,q,Y);L=new tl(q,_-B.start,r),Z=B.start-S}else{let q=a.pos-j;a.next();let F=[],Y=[],re=M>=o?M:-1,ee=0,se=_;for(;a.pos>q;)re>=0&&a.id==re&&a.size>=0?(a.end<=se-i&&(m(F,Y,Q,ee,a.end,se,re,D,I),ee=F.length,se=a.end),a.next()):z>2500?h(Q,q,F,Y):f(Q,q,F,Y,re,z+1);if(re>=0&&ee>0&&ee<F.length&&m(F,Y,Q,ee,Q,se,re,D,I),F.reverse(),Y.reverse(),re>-1&&ee>0){let J=p(V,I);L=mk(V,F,Y,0,F.length,0,_-Q,J,J)}else L=g(V,F,Y,_-Q,D-_,I)}k.push(L),$.push(Z)}function h(S,T,k,$){let A=[],z=0,M=-1;for(;a.pos>T;){let{id:Q,start:_,end:j,size:D}=a;if(D>4)a.next();else{if(M>-1&&_<M)break;M<0&&(M=j-i),A.push(Q,_,j),z++,a.next()}}if(z){let Q=new Uint16Array(z*4),_=A[A.length-2];for(let j=A.length-3,D=0;j>=0;j-=3)Q[D++]=A[j],Q[D++]=A[j+1]-_,Q[D++]=A[j+2]-_,Q[D++]=D;k.push(new tl(Q,A[2]-_,r)),$.push(_-S)}}function p(S,T){return(k,$,A)=>{let z=0,M=k.length-1,Q,_;if(M>=0&&(Q=k[M])instanceof sn){if(!M&&Q.type==S&&Q.length==A)return Q;(_=Q.prop(vt.lookAhead))&&(z=$[M]+Q.length+_)}return g(S,k,$,A,z,T)}}function m(S,T,k,$,A,z,M,Q,_){let j=[],D=[];for(;S.length>$;)j.push(S.pop()),D.push(T.pop()+k-A);S.push(g(r.types[M],j,D,z-A,Q-z,_)),T.push(A-k)}function g(S,T,k,$,A,z,M){if(z){let Q=[vt.contextHash,z];M=M?[Q].concat(M):[Q]}if(A>25){let Q=[vt.lookAhead,A];M=M?[Q].concat(M):[Q]}return new sn(S,T,k,$,M)}function O(S,T){let k=a.fork(),$=0,A=0,z=0,M=k.end-i,Q={size:0,start:0,skip:0};e:for(let _=k.pos-S;k.pos>_;){let j=k.size;if(k.id==T&&j>=0){Q.size=$,Q.start=A,Q.skip=z,z+=4,$+=4,k.next();continue}let D=k.pos-j;if(j<0||D<_||k.start<M)break;let I=k.id>=o?4:0,V=k.start;for(k.next();k.pos>D;){if(k.size<0)if(k.size==-3)I+=4;else break e;else k.id>=o&&(I+=4);k.next()}A=V,$+=j,z+=I}return(T<0||$==S)&&(Q.size=$,Q.start=A,Q.skip=z),Q.size>4?Q:void 0}function v(S,T,k){let{id:$,start:A,end:z,size:M}=a;if(a.next(),M>=0&&$<o){let Q=k;if(M>4){let _=a.pos-(M-4);for(;a.pos>_;)k=v(S,T,k)}T[--k]=Q,T[--k]=z-S,T[--k]=A-S,T[--k]=$}else M==-3?c=$:M==-4&&(u=$);return k}let b=[],x=[];for(;a.pos>0;)f(t.start||0,t.bufferStart||0,b,x,-1,0);let C=(e=t.length)!==null&&e!==void 0?e:b.length?x[0]+b[0].length:0;return new sn(l[t.topID],b.reverse(),x.reverse(),C)}const gA=new WeakMap;function Lm(t,e){if(!t.isAnonymous||e instanceof tl||e.type!=t)return 1;let n=gA.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof sn)){n=1;break}n+=Lm(t,r)}gA.set(e,n)}return n}function mk(t,e,n,r,i,s,o,a,l){let c=0;for(let m=r;m<i;m++)c+=Lm(t,e[m]);let u=Math.ceil(c*1.5/8),f=[],h=[];function p(m,g,O,v,b){for(let x=O;x<v;){let C=x,S=g[x],T=Lm(t,m[x]);for(x++;x<v;x++){let k=Lm(t,m[x]);if(T+k>=u)break;T+=k}if(x==C+1){if(T>u){let k=m[C];p(k.children,k.positions,0,k.children.length,g[C]+b);continue}f.push(m[C])}else{let k=g[x-1]+m[x-1].length-S;f.push(mk(t,m,g,C,x,S,k,null,l))}h.push(S+b-s)}}return p(e,n,r,i,0),(a||l)(f,h,o)}class Ok{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof lo?this.setBuffer(e.context.buffer,e.index,n):e instanceof Ki&&this.map.set(e.tree,n)}get(e){return e instanceof lo?this.getBuffer(e.context.buffer,e.index):e instanceof Ki?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Ko{constructor(e,n,r,i,s=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new Ko(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<n.length?n[a]:null,f=u?u.fromA:1e9;if(f-l>=r)for(;o&&o.from<f;){let h=o;if(l>=h.from||f<=h.to||c){let p=Math.max(h.from,l)-c,m=Math.min(h.to,f)-c;h=p>=m?null:new Ko(p,m,h.tree,h.offset+c,a>0,!!u)}if(h&&i.push(h),o.to>f)break;o=s<e.length?e[s++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return i}}let vk=class{startParse(e,n,r){return typeof e=="string"&&(e=new pK(e)),r=r?r.length?r.map(i=>new qi(i.from,i.to)):[new qi(0,0)]:[new qi(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}};class pK{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}function gK(t){return(e,n,r,i)=>new OK(e,t,n,r,i)}class mA{constructor(e,n,r,i,s){this.parser=e,this.parse=n,this.overlay=r,this.target=i,this.from=s}}function OA(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class mK{constructor(e,n,r,i,s,o,a){this.parser=e,this.predicate=n,this.mounts=r,this.index=i,this.start=s,this.target=o,this.prev=a,this.depth=0,this.ranges=[]}}const X1=new vt({perNode:!0});class OK{constructor(e,n,r,i,s){this.nest=n,this.input=r,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new sn(r.type,r.children,r.positions,r.length,r.propValues.concat([[X1,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],n=e.parse.advance();if(n){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[vt.mounted.id]=new jh(n,e.overlay,e.parser),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].from<e&&(e=Math.min(e,this.inner[n].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].parse.stopAt(e)}startInner(){let e=new bK(this.fragments),n=null,r=null,i=new FO(new Ki(this.baseTree,this.ranges[0].from,0,null),nn.IncludeAnonymous|nn.IgnoreMounts);e:for(let s,o;;){let a=!0,l;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)a=!1;else if(e.hasNode(i)){if(n){let c=n.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let f=u.from+c.pos,h=u.to+c.pos;f>=i.from&&h<=i.to&&!n.ranges.some(p=>p.from<h&&p.to>f)&&n.ranges.push({from:f,to:h})}}a=!1}else if(r&&(o=vK(r.ranges,i.from,i.to)))a=o!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.from<i.to||!s.overlay)){i.tree||yK(i);let c=e.findMounts(i.from,s.parser);if(typeof s.overlay=="function")n=new mK(s.parser,s.overlay,c,this.inner.length,i.from,i.tree,n);else{let u=bA(this.ranges,s.overlay||(i.from<i.to?[new qi(i.from,i.to)]:[]));u.length&&OA(u),(u.length||!s.overlay)&&this.inner.push(new mA(s.parser,u.length?s.parser.startParse(this.input,xA(c,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(f=>new qi(f.from-i.from,f.to-i.from)):null,i.tree,u.length?u[0].from:i.from)),s.overlay?u.length&&(r={ranges:u,depth:0,prev:r}):a=!1}}else if(n&&(l=n.predicate(i))&&(l===!0&&(l=new qi(i.from,i.to)),l.from<l.to)){let c=n.ranges.length-1;c>=0&&n.ranges[c].to==l.from?n.ranges[c]={from:n.ranges[c].from,to:l.to}:n.ranges.push(l)}if(a&&i.firstChild())n&&n.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(n&&!--n.depth){let c=bA(this.ranges,n.ranges);c.length&&(OA(c),this.inner.splice(n.index,0,new mA(n.parser,n.parser.startParse(this.input,xA(n.mounts,c),c),n.ranges.map(u=>new qi(u.from-n.start,u.to-n.start)),n.target,c[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function vK(t,e,n){for(let r of t){if(r.from>=n)break;if(r.to>e)return r.from<=e&&r.to>=n?2:1}return 0}function vA(t,e,n,r,i,s){if(e<n){let o=t.buffer[e+1];r.push(t.slice(e,n,o)),i.push(o-s)}}function yK(t){let{node:e}=t,n=[],r=e.context.buffer;do n.push(t.index),t.parent();while(!t.tree);let i=t.tree,s=i.children.indexOf(r),o=i.children[s],a=o.buffer,l=[s];function c(u,f,h,p,m,g){let O=n[g],v=[],b=[];vA(o,u,O,v,b,p);let x=a[O+1],C=a[O+2];l.push(v.length);let S=g?c(O+4,a[O+3],o.set.types[a[O]],x,C-x,g-1):e.toTree();return v.push(S),b.push(x-p),vA(o,a[O+3],f,v,b,p),new sn(h,v,b,m)}i.children[s]=c(0,a.length,Qr.none,0,o.length,n.length-1);for(let u of l){let f=t.tree.children[u],h=t.tree.positions[u];t.yield(new Ki(f,h+t.from,u,t._tree))}}class yA{constructor(e,n){this.offset=n,this.done=!1,this.cursor=e.cursor(nn.IncludeAnonymous|nn.IgnoreMounts)}moveTo(e){let{cursor:n}=this,r=e-this.offset;for(;!this.done&&n.from<r;)n.to>=e&&n.enter(r,1,nn.IgnoreOverlays|nn.ExcludeBuffers)||n.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==e.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof sn)n=n.children[0];else break}return!1}}let bK=class{constructor(e){var n;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(n=r.tree.prop(X1))!==null&&n!==void 0?n:r.to,this.inner=new yA(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let n=this.curFrag=this.fragments[this.fragI];this.curTo=(e=n.tree.prop(X1))!==null&&e!==void 0?e:n.to,this.inner=new yA(n.tree,-n.offset)}}findMounts(e,n){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(r=s.tree)===null||r===void 0?void 0:r.prop(vt.mounted);if(o&&o.parser==n)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=s.to)break;l.tree==this.curFrag.tree&&i.push({frag:l,pos:s.from-l.offset,mount:o})}}}return i}};function bA(t,e){let n=null,r=e;for(let i=1,s=0;i<t.length;i++){let o=t[i-1].to,a=t[i].from;for(;s<r.length;s++){let l=r[s];if(l.from>=a)break;l.to<=o||(n||(r=n=e.slice()),l.from<o?(n[s]=new qi(l.from,o),l.to>a&&n.splice(s+1,0,new qi(a,l.to))):l.to>a?n[s--]=new qi(a,l.to):n.splice(s--,1))}}return r}function xK(t,e,n,r){let i=0,s=0,o=!1,a=!1,l=-1e9,c=[];for(;;){let u=i==t.length?1e9:o?t[i].to:t[i].from,f=s==e.length?1e9:a?e[s].to:e[s].from;if(o!=a){let h=Math.max(l,n),p=Math.min(u,f,r);h<p&&c.push(new qi(h,p))}if(l=Math.min(u,f),l==1e9)break;u==l&&(o?(o=!1,i++):o=!0),f==l&&(a?(a=!1,s++):a=!0)}return c}function xA(t,e){let n=[];for(let{pos:r,mount:i,frag:s}of t){let o=r+(i.overlay?i.overlay[0].from:0),a=o+i.tree.length,l=Math.max(s.from,o),c=Math.min(s.to,a);if(i.overlay){let u=i.overlay.map(h=>new qi(h.from+r,h.to+r)),f=xK(e,u,l,c);for(let h=0,p=l;;h++){let m=h==f.length,g=m?c:f[h].from;if(g>p&&n.push(new Ko(p,g,i.tree,-o,s.from>=p||s.openStart,s.to<=g||s.openEnd)),m)break;p=f[h].to}}else n.push(new Ko(l,c,i.tree,-o,s.from>=o||s.openStart,s.to<=a||s.openEnd))}return n}class YO{constructor(e,n,r,i,s,o,a,l,c,u=0,f){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=f}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new YO(e,[],n,r,r,0,[],0,i?new SA(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,i=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25;o&&this.setLookAhead(this.pos);let a=s.dynamicPrecedence(i);if(a&&(this.score+=a),r==0){this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i<s.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(i,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,u=this.reducePos-c;u>=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=u));let f=l?this.stack[l-1]:0,h=this.bufferBase+this.buffer.length-f;if(i<s.minRepeatTerm||e&131072){let p=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,c,p,h+4,!0)}if(e&262144)this.state=this.stack[l];else{let p=this.stack[l-3];this.state=s.getGoto(p,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,c)}storeNode(e,n,r,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,a=this.buffer.length;if(a==0&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(n==r)return;if(o.buffer[a-2]>=n){o.buffer[a-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,n,r,i);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4)}this.buffer[o]=e,this.buffer[o+1]=n,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:o}=this.p;(i>this.pos||n<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,r),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,i,4)}else this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4)}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new YO(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new SK(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let s=0,o;s<n.length;s+=2)(o=n[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(n[s],o);if(this.stack.length<120)for(let s=0;i.length<8&&s<n.length;s+=2){let o=n[s+1];i.some((a,l)=>l&1&&a==o)||i.push(n[s],o)}n=i}let r=[];for(let i=0;i<n.length&&r.length<4;i+=2){let s=n[i+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(n[i],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if((n&65536)==0)return!1;if(!e.validAction(this.state,n)){let r=n>>19,i=n&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,s)=>{if(!n.includes(i))return n.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,s+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new SA(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class SA{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class SK{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class GO{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new GO(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new GO(this.stack,this.pos,this.index)}}function Qf(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r<t.length;){let s=0;for(;;){let o=t.charCodeAt(r++),a=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),s+=l,a)break;s*=46}n?n[i++]=s:n=new e(s)}return n}class Xm{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const wA=new Xm;class wK{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=wA,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,i=this.rangeIndex,s=this.pos+e;for(;s<r.from;){if(!i)return null;let o=this.ranges[--i];s-=r.from-o.to,r=o}for(;n<0?s>r.to:s>=r.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-r.to,r=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n<this.chunk.length)r=this.pos+e,i=this.chunk.charCodeAt(n);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(r=s,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=wA,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class $u{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;W4(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}$u.prototype.contextual=$u.prototype.fallback=$u.prototype.extend=!1;class HO{constructor(e,n,r){this.precTable=n,this.elseToken=r,this.data=typeof e=="string"?Qf(e):e}token(e,n){let r=e.pos,i=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(W4(this.data,e,n,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||i++,o==null)break;e.reset(o,e.token)}i&&(e.reset(r,e.token),e.acceptToken(this.elseToken,i))}}HO.prototype.contextual=$u.prototype.fallback=$u.prototype.extend=!1;class Mn{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function W4(t,e,n,r,i,s){let o=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;(a&t[o])!=0;){let c=t[o+1];for(let p=o+3;p<c;p+=2)if((t[p+1]&a)>0){let m=t[p];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||CK(m,e.token.value,i,s))){e.acceptToken(m);break}}let u=e.next,f=0,h=t[o+2];if(e.next<0&&h>f&&t[c+h*3-3]==65535){o=t[c+h*3-1];continue e}for(;f<h;){let p=f+h>>1,m=c+p+(p<<1),g=t[m],O=t[m+1]||65536;if(u<g)h=p;else if(u>=O)f=p+1;else{o=t[m+2],e.advance();continue e}}break}}function CA(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function CK(t,e,n,r){let i=CA(n,r,e);return i<0||CA(n,r,t)<i}const pi=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let H0=null;function PA(t,e,n){let r=t.cursor(nn.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class PK{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?PA(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?PA(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],i=this.index[n];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=r.children[i],o=this.start[n]+r.positions[i];if(o>e)return this.nextStart=o,null;if(s instanceof sn){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let l=s.prop(vt.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[n]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+s.length}}}class kK{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Xm)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<s.length;c++){if((1<<c&o)==0)continue;let u=s[c],f=this.tokens[c];if(!(r&&!u.fallback)&&((u.contextual||f.start!=e.pos||f.mask!=o||f.context!=a)&&(this.updateCachedToken(f,u,e),f.mask=o,f.context=a),f.lookAhead>f.end+25&&(l=Math.max(f.lookAhead,l)),f.value!=0)){let h=n;if(f.extended>-1&&(n=this.addActions(e,f.extended,f.end,n)),n=this.addActions(e,f.value,f.end,n),!u.extend&&(r=f,n>h))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new Xm,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new Xm,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let a=s.specializers[o](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,n,r,i){for(let s=0;s<i;s+=3)if(this.actions[s]==e)return i;return this.actions[i++]=e,this.actions[i++]=n,this.actions[i++]=r,i}addActions(e,n,r,i){let{state:s}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let c=o.stateSlot(s,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=Bo(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(Bo(a,c+2),n,r,i));break}a[c]==n&&(i=this.putAction(Bo(a,c+1),n,r,i))}return i}}let TK=class{constructor(e,n,r,i){this.parser=e,this.input=n,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new wK(n,i),this.tokens=new kK(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[YO.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new PK(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>n)r.push(a);else{if(this.advanceStack(a,r,e))continue;{i||(i=[],s=[]),i.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!r.length){let o=i&&IK(i);if(o)return pi&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw pi&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(o)return pi&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((a,l)=>l.score-a.score);r.length>o;)r.pop();r.some(a=>a.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let a=r[o];for(let l=o+1;l<r.length;l++){let c=r[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(o--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let o=1;o<r.length;o++)r[o].pos<this.minStackPos&&(this.minStackPos=r[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,r){let i=e.pos,{parser:s}=this,o=pi?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let h=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(e.state,f.type.id):-1;if(h>-1&&f.length&&(!c||(f.prop(vt.contextHash)||0)==u))return e.useNode(f,h),pi&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof sn)||f.children.length==0||f.positions[0]>0)break;let p=f.children[0];if(p instanceof sn&&f.positions[0]==0)f=p;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),pi&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let u=l[c++],f=l[c++],h=l[c++],p=c==l.length||!r,m=p?e:e.split(),g=this.tokens.mainToken;if(m.apply(u,f,g?g.start:m.pos,h),pi&&console.log(o+this.stackID(m)+` (via ${(u&65536)==0?"shift":`reduce of ${s.getName(u&65535)}`} for ${s.getName(f)} @ ${i}${m==e?"":", split"})`),p)return!0;m.pos>i?n.push(m):r.push(m)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return kA(e,n),!0}}runRecovery(e,n,r){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=n[o<<1],c=n[(o<<1)+1],u=pi?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),pi&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let f=a.split(),h=u;for(let p=0;f.forceReduce()&&p<10&&(pi&&console.log(h+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,r));p++)pi&&(h=this.stackID(f)+" -> ");for(let p of a.recoverByInsert(l))pi&&console.log(u+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),pi&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),kA(a,r)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),sn.build({buffer:GO.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(H0||(H0=new WeakMap)).get(e);return n||H0.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}};function kA(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class $K{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}const J0=t=>t;class Vp{constructor(e){this.start=e.start,this.shift=e.shift||J0,this.reduce=e.reduce||J0,this.reuse=e.reuse||J0,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Ps extends vk{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;a<e.repeatNodeCount;a++)n.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<n.length;a++)i.push([]);function s(a,l,c){i[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=vt[l]);for(let c=1;c<a.length;){let u=a[c++];if(u>=0)s(u,l,a[c++]);else{let f=a[c+-u];for(let h=-u;h>0;h--)s(a[c++],l,f);c++}}}this.nodeSet=new Ny(n.map((a,l)=>Qr.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:i[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=z4;let o=Qf(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(TA),this.states=Qf(e.states,Uint32Array),this.data=Qf(e.stateData),this.goto=Qf(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new $u(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let i=new TK(this,e,n,r);for(let s of this.wrappers)i=s(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let s=i[n+1];;){let o=i[s++],a=o&1,l=i[s++];if(a&&r)return l;for(let c=s+(o>>1);s<c;s++)if(i[s]==e)return l;if(a)return-1}}hasAction(e,n){let r=this.data;for(let i=0;i<2;i++)for(let s=this.stateSlot(e,i?2:1),o;;s+=3){if((o=r[s])==65535)if(r[s+1]==1)o=r[s=Bo(r,s+2)];else{if(r[s+1]==2)return Bo(r,s+2);break}if(o==n||o==0)return Bo(r,s+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(r):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Bo(this.data,s+2);else break;i=n(Bo(this.data,s+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Bo(this.data,r+2);else break;if((this.data[r+2]&1)==0){let i=this.data[r+1];n.some((s,o)=>o&1&&s==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(Ps.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=e.specializers.find(a=>a.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return n.specializers[i]=TA(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let s of e.split(" ")){let o=n.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;s<n.length;s++)if(!r[s])for(let o=this.dialects[n[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new $K(e,r,i)}static deserialize(e){return new Ps(e)}}function Bo(t,e){return t[e]|t[e+1]<<16}function IK(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function TA(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}let EK=0,Fo=class W1{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=EK++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof W1&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let i=new W1(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(e){let n=new JO(e);return r=>r.modified.indexOf(n)>-1?r:JO.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}},AK=0;class JO{constructor(e){this.name=e,this.instances=[],this.id=AK++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&QK(n,a.modified));if(r)return r;let i=[],s=new Fo(e.name,i,e,n);for(let a of n)a.instances.push(s);let o=RK(n);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(JO.get(a,l));return s}}function QK(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function RK(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function pa(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let s=[],o=2,a=i;for(let f=0;;){if(a=="..."&&f>0&&f+3==i.length){o=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!h)throw new RangeError("Invalid path: "+i);if(s.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),f+=h[0].length,f==i.length)break;let p=i[f++];if(f==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);a=i.slice(f)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let u=new KO(r,o,l>0?s.slice(0,l):null);e[c]=u.sort(e[c])}}return Z4.add(e)}const Z4=new vt;class KO{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}KO.empty=new KO([],2,null);function q4(t,e){let n=Object.create(null);for(let s of t)if(!Array.isArray(s.tag))n[s.tag.id]=s.class;else for(let o of s.tag)n[o.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let o=i;for(let a of s)for(let l of a.set){let c=n[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function jK(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function _K(t,e,n,r=0,i=t.length){let s=new DK(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class DK{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,s){let{type:o,from:a,to:l}=e;if(a>=r||l<=n)return;o.isTop&&(s=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=i,u=NK(e)||KO.empty,f=jK(s,u.tags);if(f&&(c&&(c+=" "),c+=f,u.mode==1&&(i+=(i?" ":"")+f)),this.startSpan(Math.max(n,a),c),u.opaque)return;let h=e.tree&&e.tree.prop(vt.mounted);if(h&&h.overlay){let p=e.node.enter(h.overlay[0].from+a,1),m=this.highlighters.filter(O=>!O.scope||O.scope(h.tree.type)),g=e.firstChild();for(let O=0,v=a;;O++){let b=O<h.overlay.length?h.overlay[O]:null,x=b?b.from+a:l,C=Math.max(n,v),S=Math.min(r,x);if(C<S&&g)for(;e.from<S&&(this.highlightRange(e,C,S,i,s),this.startSpan(Math.min(S,e.to),c),!(e.to>=x||!e.nextSibling())););if(!b||x>r)break;v=b.to+a,v>n&&(this.highlightRange(p.cursor(),Math.max(n,b.from+a),Math.min(r,v),"",m),this.startSpan(Math.min(r,v),c))}g&&e.parent()}else if(e.firstChild()){h&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function NK(t){let e=t.type.prop(Z4);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Qe=Fo.define,Qg=Qe(),Na=Qe(),$A=Qe(Na),IA=Qe(Na),Ma=Qe(),Rg=Qe(Ma),K0=Qe(Ma),Ys=Qe(),$l=Qe(Ys),qs=Qe(),Us=Qe(),Z1=Qe(),cf=Qe(Z1),jg=Qe(),E={comment:Qg,lineComment:Qe(Qg),blockComment:Qe(Qg),docComment:Qe(Qg),name:Na,variableName:Qe(Na),typeName:$A,tagName:Qe($A),propertyName:IA,attributeName:Qe(IA),className:Qe(Na),labelName:Qe(Na),namespace:Qe(Na),macroName:Qe(Na),literal:Ma,string:Rg,docString:Qe(Rg),character:Qe(Rg),attributeValue:Qe(Rg),number:K0,integer:Qe(K0),float:Qe(K0),bool:Qe(Ma),regexp:Qe(Ma),escape:Qe(Ma),color:Qe(Ma),url:Qe(Ma),keyword:qs,self:Qe(qs),null:Qe(qs),atom:Qe(qs),unit:Qe(qs),modifier:Qe(qs),operatorKeyword:Qe(qs),controlKeyword:Qe(qs),definitionKeyword:Qe(qs),moduleKeyword:Qe(qs),operator:Us,derefOperator:Qe(Us),arithmeticOperator:Qe(Us),logicOperator:Qe(Us),bitwiseOperator:Qe(Us),compareOperator:Qe(Us),updateOperator:Qe(Us),definitionOperator:Qe(Us),typeOperator:Qe(Us),controlOperator:Qe(Us),punctuation:Z1,separator:Qe(Z1),bracket:cf,angleBracket:Qe(cf),squareBracket:Qe(cf),paren:Qe(cf),brace:Qe(cf),content:Ys,heading:$l,heading1:Qe($l),heading2:Qe($l),heading3:Qe($l),heading4:Qe($l),heading5:Qe($l),heading6:Qe($l),contentSeparator:Qe(Ys),list:Qe(Ys),quote:Qe(Ys),emphasis:Qe(Ys),strong:Qe(Ys),link:Qe(Ys),monospace:Qe(Ys),strikethrough:Qe(Ys),inserted:Qe(),deleted:Qe(),changed:Qe(),invalid:Qe(),meta:jg,documentMeta:Qe(jg),annotation:Qe(jg),processingInstruction:Qe(jg),definition:Fo.defineModifier("definition"),constant:Fo.defineModifier("constant"),function:Fo.defineModifier("function"),standard:Fo.defineModifier("standard"),local:Fo.defineModifier("local"),special:Fo.defineModifier("special")};for(let t in E){let e=E[t];e instanceof Fo&&(e.name=t)}q4([{tag:E.link,class:"tok-link"},{tag:E.heading,class:"tok-heading"},{tag:E.emphasis,class:"tok-emphasis"},{tag:E.strong,class:"tok-strong"},{tag:E.keyword,class:"tok-keyword"},{tag:E.atom,class:"tok-atom"},{tag:E.bool,class:"tok-bool"},{tag:E.url,class:"tok-url"},{tag:E.labelName,class:"tok-labelName"},{tag:E.inserted,class:"tok-inserted"},{tag:E.deleted,class:"tok-deleted"},{tag:E.literal,class:"tok-literal"},{tag:E.string,class:"tok-string"},{tag:E.number,class:"tok-number"},{tag:[E.regexp,E.escape,E.special(E.string)],class:"tok-string2"},{tag:E.variableName,class:"tok-variableName"},{tag:E.local(E.variableName),class:"tok-variableName tok-local"},{tag:E.definition(E.variableName),class:"tok-variableName tok-definition"},{tag:E.special(E.variableName),class:"tok-variableName2"},{tag:E.definition(E.propertyName),class:"tok-propertyName tok-definition"},{tag:E.typeName,class:"tok-typeName"},{tag:E.namespace,class:"tok-namespace"},{tag:E.className,class:"tok-className"},{tag:E.macroName,class:"tok-macroName"},{tag:E.propertyName,class:"tok-propertyName"},{tag:E.operator,class:"tok-operator"},{tag:E.comment,class:"tok-comment"},{tag:E.meta,class:"tok-meta"},{tag:E.invalid,class:"tok-invalid"},{tag:E.punctuation,class:"tok-punctuation"}]);const MK=pa({String:E.string,Number:E.number,"True False":E.bool,PropertyName:E.propertyName,Null:E.null,",":E.separator,"[ ]":E.squareBracket,"{ }":E.brace}),zK=Ps.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[MK],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});let q1=[],U4=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?U4:q1).push(n=n+t[e])})();function VK(t){if(t<768)return!1;for(let e=0,n=q1.length;;){let r=e+n>>1;if(t<q1[r])n=r;else if(t>=U4[r])e=r+1;else return!0;if(e==n)return!1}}function EA(t){return t>=127462&&t<=127487}const AA=8205;function LK(t,e,n=!0,r=!0){return(n?B4:XK)(t,e,r)}function B4(t,e,n){if(e==t.length)return e;e&&F4(t.charCodeAt(e))&&Y4(t.charCodeAt(e-1))&&e--;let r=ex(t,e);for(e+=QA(r);e<t.length;){let i=ex(t,e);if(r==AA||i==AA||n&&VK(i))e+=QA(i),r=i;else if(EA(i)){let s=0,o=e-2;for(;o>=0&&EA(ex(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function XK(t,e,n){for(;e>0;){let r=B4(t,e-2,n);if(r<e)return r;e--}return 0}function ex(t,e){let n=t.charCodeAt(e);if(!Y4(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return F4(r)?(n-55296<<10)+(r-56320)+65536:n}function F4(t){return t>=56320&&t<57344}function Y4(t){return t>=55296&&t<56320}function QA(t){return t<65536?1:2}let Mt=class G4{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=Yu(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),so.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Yu(this,e,n);let r=[];return this.decompose(e,n,r,0),so.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new eh(this),s=new eh(e);for(let o=n,a=n;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new eh(this,e)}iterRange(e,n=this.length){return new H4(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new J4(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?G4.empty:e.length<=32?new jn(e):so.from(jn.split(e,[]))}};class jn extends Mt{constructor(e,n=WK(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((n?r:a)>=e)return new ZK(i,a,r,o);i=a+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new jn(RA(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),a=Wm(s.text,o.text.slice(),0,s.length);if(a.length<=32)r.push(new jn(a,o.length+s.length));else{let l=a.length>>1;r.push(new jn(a.slice(0,l)),new jn(a.slice(l)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof jn))return super.replace(e,n,r);[e,n]=Yu(this,e,n);let i=Wm(this.text,Wm(r.text,RA(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new jn(i,s):so.from(jn.split(i,[]),s)}sliceString(e,n=this.length,r=`
|
|
@@ -301,7 +301,7 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
|
|
|
301
301
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
302
302
|
`,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)){Qv(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(za(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(y7(n.key)&&!za(n.sep,"newline")){const o=Hc(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(za(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const o=Hc(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]}):za(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&&!za(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)){Qv(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||za(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=am(r),s=Hc(i);Tj(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(`
|
|
303
303
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
304
|
-
`,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=am(e),r=Hc(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=am(e),r=Hc(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 The(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Phe||null,prettyErrors:e}}function $he(t,e={}){const{lineCounter:n,prettyErrors:r}=The(e),i=new khe(n?.addNewLine),s=new bhe(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 zf(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(Sj(t,n)),o.warnings.forEach(Sj(t,n))),o}class Ihe{constructor(e){this.providers=e}providers;extractEnvironments(e,n){const r=e.toJS();return Object.keys(r).filter(s=>s!=="version").map(s=>{const o=r[s],a=Object.entries(o.inputs??{}).map(([c,u])=>{const f=this.providers.resolveProviderForMarker(u);return f?{name:c,value:f.resolve(n,s,c),isSecret:!0}:{name:c,value:typeof u=="string"?u:"",isSecret:!1}}),l=Object.entries(o.servers??{}).map(([c,u])=>({apiId:c,value:u.value,variables:Object.entries(u.variables??{}).map(([f,h])=>({name:f,value:h}))}));return{name:s,inputs:a,servers:l,state:At.Normal}})}hydrateDocument(e,n,r){const i=new Set(n.map(s=>s.name).filter(Boolean));this.deleteRemovedKeys(e,[],i,"version");for(const s of n)if(s.name){if(!e.hasIn([s.name])){const o=e.createNode({});o instanceof zr&&(o.flow=!1),e.setIn([s.name],o)}this.syncInputs(e,s.name,s.inputs,r),this.syncServers(e,s.name,s.servers)}return e}syncInputs(e,n,r,i){const s=new Set(r.map(o=>o.name));this.deleteRemovedKeys(e,[n,"inputs"],s),r.length>0&&this.unflowMap(e,[n,"inputs"]);for(const o of r){const a=[n,"inputs",o.name];if(o.isSecret){const l=this.providers.getDefaultProvider();l.isMarker(e.getIn(a))||e.setIn(a,e.createNode(l.createMarker())),l.store(i,n,o.name,o.value);continue}e.getIn(a)!==o.value&&e.setIn(a,o.value)}}syncServers(e,n,r){const i=new Set(r.map(s=>s.apiId));this.deleteRemovedKeys(e,[n,"servers"],i),r.length>0&&this.unflowMap(e,[n,"servers"]);for(const s of r){const o=[n,"servers",s.apiId];e.getIn([...o,"value"])!==s.value&&e.setIn([...o,"value"],s.value);const a=new Set(s.variables.map(l=>l.name));this.deleteRemovedKeys(e,[...o,"variables"],a),s.variables.length>0&&this.unflowMap(e,[...o,"variables"]);for(const l of s.variables){const c=[...o,"variables",l.name];e.getIn(c)!==l.value&&e.setIn(c,l.value)}}}unflowMap(e,n){const r=e.getIn(n,!0);r instanceof zr&&r.flow&&(r.flow=!1)}deleteRemovedKeys(e,n,r,i){for(const s of this.getMapKeys(e,...n))s!==i&&!r.has(s)&&e.deleteIn([...n,s])}getMapKeys(e,...n){const r=n.length===0?e.contents:e.getIn(n,!0);return r instanceof zr?r.items.map(i=>String(i.key)):[]}}class Ehe{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 Ahe{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 Qhe{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 Rhe{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 sg={all:["notifications"],lists:()=>[...sg.all,"list"]};function jhe(){return Zr.useQuery({queryKey:sg.lists(),queryFn:async()=>sp.getInstance().getAll()})}function _he(){return Zr.useQuery({queryKey:sg.lists(),queryFn:async()=>sp.getInstance().getAll(),select:t=>({total:t.reduce((e,n)=>e+n.issues.length,0),errorCount:t.reduce((e,n)=>e+n.errorCount,0)})})}class sp{static instance=null;static initialize(){this.close();const e=new Rhe;this.instance=new Qhe(e)}static getInstance(){if(!this.instance)throw new Error("NotificationsService not initialized");return this.instance}static close(){this.instance=null}}let Ux=null;function fb(){return Ux||(Ux=new Zr.QueryClient({defaultOptions:{queries:{staleTime:30*1e3,gcTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}})),Ux}function Dhe(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 Nhe(t){const e=(t instanceof Error?t.message:String(t)).trim();return[{severity:"error",message:e,line:Dhe(e)}]}function Mhe(t){return t.map(e=>({severity:"error",message:e.message.trim(),line:e.linePos?.[0]?.line}))}async function zT(t){try{const e=sp.getInstance();await t(e),fb().invalidateQueries({queryKey:sg.all})}catch{}}async function VT(t,e){await zT(async n=>{await n.set(t,Nhe(e))})}async function zhe(t,e){e.length!==0&&await zT(async n=>{await n.set(t,Mhe(e))})}async function Mu(t){await zT(async e=>{await e.clear(t)})}class Vhe{constructor(e,n,r){this.storage=e,this.localStorageSecretsProvider=n,this.options=r}storage;localStorageSecretsProvider;options;default=[];configError=null;handler=new Ihe(new Ahe([new Ehe],"local"));filePath="replay-environments.yaml";getConfigError(){return this.configError}async read(){const e=await this.loadDocumentFromStorage();if(e.status!=="ok")return this.default;try{const n=await this.readSecrets(),r=this.handler.extractEnvironments(e.document,n);return await Mu(this.filePath),r}catch(n){return console.info("Error reading replay environments",n),await VT(this.filePath,n),this.default}}async write(e){const n=await this.loadDocumentFromStorage();if(n.status==="invalid"&&!this.options.rebuildWhenUnparseable)return;const r=n.status==="ok"?n.document:null;if(!r&&Lhe(e))return;const i=await this.readSecrets(),s=this.handler.hydrateDocument(r??new rg({}),e,i);await this.localStorageSecretsProvider.set(JSON.stringify(i)),await this.storage.set(this.filePath,s.toString())}async loadDocumentFromStorage(){const e=await this.storage.get(this.filePath);if(!e)return this.configError=null,await Mu(this.filePath),{status:"absent"};const n=$he(e);return n.errors.length>0?(console.error("Environments file has YAML errors",n.errors),this.configError={filePath:this.filePath,issues:n.errors.map(r=>({message:r.message.trim(),line:r.linePos?.[0]?.line}))},await zhe(this.filePath,n.errors),{status:"invalid"}):(this.configError=null,n.contents?{status:"ok",document:n}:(await Mu(this.filePath),{status:"absent"}))}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 Lhe(t){if(t.length===0)return!0;if(t.length>1)return!1;const[e]=t;return e.name===kd&&e.inputs.length===0&&e.servers.length===0}class Xhe{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(){const e=await this.storage.get(this.filePath);return e?await this.parse(e):this.defaultValue}async write(e){return this.storage.set(this.filePath,this.stringify(e))}}const kC=(t,e)=>({data:t,version:e});class b7 extends Xhe{constructor(e,n,r,i){super(e,n,r),this.version=i}version;migrationMap={};migrate(e){if(!this.migrationMap[e.version])return kC(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(kC(e,this.version))}}function Whe(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===De.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}}const Bx=2,Zhe="tabs.json";class qhe extends b7{migrationMap={1:Whe};constructor(e){super(e,Zhe,Ss(j1),Bx)}async parse(e){let n=null;try{n=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}n||(n=kC(Ss(j1),Bx)),n.version!==Bx&&(n=this.migrate(n));const r=await Promise.all(n.data.tabs.map(async i=>{if(i.data.type===De.Step){if(i.data.draftStep){const s=i.data.draftStep.requestBody.formData;s["multipart/form-data"]=await $j(s["multipart/form-data"]),s["application/x-www-form-urlencoded"]=await $j(s["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await Kp(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===De.Step){const{isProcessingRequest:i,...s}=r.data;return{...r,data:{...s,response:null}}}return r.data.type===De.WorkflowRun?{...r,data:{...r.data,result:null,runStatus:null,runError:null}}:r})};return super.stringify(n)}}async function $j(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 TX(r)}return n}))}const Uhe=1;class x7{constructor(e,n,r,i,s,o,a){this.systemFilesStorage=e,this.userFilesStorage=n,this.project=r,this.isApiPersisted=i,this.rebuildUnparseableEnvironments=s,this.convertOperationToReplayValue=o,this.telemetry=a,this.localStorageSecretsProvider=new jJ(this.project.id);const l=new RJ;this.activeEnvironmentIdStorage=new b7(this.systemFilesStorage,"active_environment_id.json",kd,Uhe),this.tabsStateStorage=new qhe(this.systemFilesStorage),this.environmentsStorage=new Vhe(this.userFilesStorage,this.localStorageSecretsProvider,{rebuildWhenUnparseable:s}),this.collectionsStorage=new vfe(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new _J(this.isApiPersisted?this.userFilesStorage:l)}systemFilesStorage;userFilesStorage;project;isApiPersisted;rebuildUnparseableEnvironments;convertOperationToReplayValue;telemetry;activeEnvironmentIdStorage;tabsStateStorage;environmentsStorage;collectionsStorage;apisStorage;localStorageSecretsProvider;persistExcludedIds=new Set;watchExcludedIds=new Set;getEnvironmentsConfigError(){return this.environmentsStorage.getConfigError()}reportEnvironmentsConfigError(e){if(this.rebuildUnparseableEnvironments)return;const n=this.getEnvironmentsConfigError();!n&&!e.configFileError.get({noproxy:!0})||e.configFileError.set(n)}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)}async update(e,n){switch(e.path[0]){case"activeEnvironmentId":this.activeEnvironmentIdStorage.write(n.activeEnvironmentId.get());break;case"tabsState":this.tabsStateStorage.write(n.tabsState.get());break;case"environments":await this.environmentsStorage.write(n.environments.get()),this.reportEnvironmentsConfigError(n);break;case"apis":this.isApiPersisted&&await this.apisStorage.update(e,n.apis.get());break;case"collections":await this.collectionsStorage.update(e,n.collections.get());break}}}function me(t,e,n="ui"){let r=`urn:redocly:replay:${n}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!pn()&&(r=y4(window.location.href)),{object:t,id:e,uri:r}}class Bhe extends x7{constructor(e,n,r){const i=new N1(e.systemFilesDir),s=new N1(e.userFilesDir);super(i,s,e,!1,!0,n,r)}async detectProjectFiles(e){const n=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[me("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=el.load(c);if(typeof u=="object"&&u!==null)if(typeof u.openapi=="string"){const f=await Wt.resolve(await Wt.join(this.userFilesStorage.baseDir,l)),{definition:h}=await qO(f,u);s.push({uri:l,type:oi.FS,content:h}),await Mu(l)}else typeof u.arazzo=="string"&&(o.push({uri:l,type:oi.FS,content:u}),await Mu(l),u.sourceDescriptions?.forEach(f=>{const h=f.type,p=f.url,m=!h||h==="openapi",g=typeof p=="string"&&Xi(p);m&&g&&a.add(p)}))}catch(u){console.info(`Error parsing YAML/JSON file ${l}:`,u),await VT(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",[{...me("storageOperation","loadApis","storage"),apiUrlsCount:e.size}],n?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async s=>{try{const{definition:o}=await qO(s);i.push({uri:s,type:oi.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",[{...me("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",[{...me("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",[me("storageOperation","read","storage")],void 0),n=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[me("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);this.apisStorage.setItemIds(u.map(h=>h.id));const f=await this.parseCollections(a,u,e);return this.collectionsStorage.setItemIds(f.map(h=>h.id)),e?.setAttribute("status","completed"),e?.setStatus(exports.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:i,environments:s,apis:u,collections:f,configFileError:null}}}function S7(t=!1){let e,n,r=!1,i=null,s=null,o=null;function a(){o&&(o(),o=null)}async function l(f){if(!(!pn()||!e||!s)){await c();try{const{FileWatcher:h}=await Promise.resolve().then(()=>require("./replay-FileWatcher-sxKCrDRy.js")),p=s.project.userFilesDir.get();i=new h(e,s,p,f),await i.start()}catch(h){console.error("Failed to start file watcher:",h),i=null}}}async function c(){i&&(await i.stop(),i=null)}async function u(){pn()&&(await c(),await qe("cleanup_all_managed_watchers"))}return()=>({id:"RootStoragePlugin",onCreate:(f,h)=>({getTauriRootStorage:p=>()=>n,cleanup:()=>async()=>{a(),await u()},init:p=>async(m,g,O)=>{if(r||p.path.length>0)return{isInitialized:!1};const{convertOperationToReplayValue:v,aiEnabled:b}=g,x=pn();if(r=!0,s=p,a(),t)return r=!1,{isInitialized:!0};if(x){const{TauriRootStorage:S}=await Promise.resolve().then(()=>require("./replay-TauriRootStorage-CQj8br8Q.js"));n=new S(m,v,O),e=n}else n=void 0,e=new Bhe(m,v,O);if(x){await c();const{getSemanticSearchService:S}=await Promise.resolve().then(()=>require("./replay-index-9rbZ-mEz.js"));S().setProject(m.id)}const C=await e.read();if(p.merge(C),!x)return r=!1,{isInitialized:!0};try{if(await l(b??!1),b){const[{getSemanticSearchService:S},{createIndexSnapshotGetter:T,startPeriodicIndexRevalidation:k}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-9rbZ-mEz.js")),Promise.resolve().then(()=>require("./replay-periodic-revalidation-BoyLQHtg.js"))]),$=S();$.preloadModel().catch(()=>{}),$.reindex(T(s)).catch(A=>{console.error("Semantic reindex failed:",A)}),o=k($,s)}}finally{r=!1}return{isInitialized:!0}}}),onSet(f,h,p){r||!t&&e&&e.update(h,p)},onDestroy:async()=>{a(),await u()}})}function w7({defaultEnvironments:t}={}){return structuredClone({project:{id:"default",userFilesDir:"default",systemFilesDir:"default"},tabsState:Ss(j1),activeEnvironmentId:kd,environments:t||tk,collections:[],apis:[],apps:{apps:[],appsLoadingState:Gs.Idle},predefinedApiId:null,predefinedEnvironmentNames:new Set,predefinedInputNames:new Set,configFileError:null})}const Fhe=DM(w7(),NM(EH({key:"replay-root-store"}),S7())),LT=y.createContext(Fhe),Yhe=LT.Provider;function He(){const t=y.useContext(LT);return XP(t)}function Pc(){const t=He(),{apis:e}=t;return{apis:e}}function og(t){const{apis:e}=Pc();return{api:e.find(r=>r.id.get()===t)??null}}function hb(t,e,n){const{api:r}=og(t);return{specDefault:r?.servers?.ornull?.find(s=>s.url.get()===e)?.variables?.ornull?.[n]?.ornull?.default?.get()}}function Ghe({variable:t,apiId:e,serverUrl:n}){const{specDefault:r}=hb(e,n,t.get().name);return r===void 0?null:d.jsx(Hhe,{fullWidth:!0,variant:"ghost",size:"small",icon:d.jsx(EO.ResetIcon,{size:"14px"}),onClick:()=>t.merge({value:r}),children:"Reset to default"})}const Hhe=w.default(pe.Button)`
|
|
304
|
+
`,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=am(e),r=Hc(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=am(e),r=Hc(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 The(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Phe||null,prettyErrors:e}}function $he(t,e={}){const{lineCounter:n,prettyErrors:r}=The(e),i=new khe(n?.addNewLine),s=new bhe(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 zf(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(Sj(t,n)),o.warnings.forEach(Sj(t,n))),o}class Ihe{constructor(e){this.providers=e}providers;extractEnvironments(e,n){const r=e.toJS();return Object.keys(r).filter(s=>s!=="version").map(s=>{const o=r[s],a=Object.entries(o.inputs??{}).map(([c,u])=>{const f=this.providers.resolveProviderForMarker(u);return f?{name:c,value:f.resolve(n,s,c),isSecret:!0}:{name:c,value:typeof u=="string"?u:"",isSecret:!1}}),l=Object.entries(o.servers??{}).map(([c,u])=>({apiId:c,value:u.value,variables:Object.entries(u.variables??{}).map(([f,h])=>({name:f,value:h}))}));return{name:s,inputs:a,servers:l,state:At.Normal}})}hydrateDocument(e,n,r){const i=new Set(n.map(s=>s.name).filter(Boolean));this.deleteRemovedKeys(e,[],i,"version");for(const s of n)if(s.name){if(!e.hasIn([s.name])){const o=e.createNode({});o instanceof zr&&(o.flow=!1),e.setIn([s.name],o)}this.syncInputs(e,s.name,s.inputs,r),this.syncServers(e,s.name,s.servers)}return e}syncInputs(e,n,r,i){const s=new Set(r.map(o=>o.name));this.deleteRemovedKeys(e,[n,"inputs"],s),r.length>0&&this.unflowMap(e,[n,"inputs"]);for(const o of r){const a=[n,"inputs",o.name];if(o.isSecret){const l=this.providers.getDefaultProvider();l.isMarker(e.getIn(a))||e.setIn(a,e.createNode(l.createMarker())),l.store(i,n,o.name,o.value);continue}e.getIn(a)!==o.value&&e.setIn(a,o.value)}}syncServers(e,n,r){const i=new Set(r.map(s=>s.apiId));this.deleteRemovedKeys(e,[n,"servers"],i),r.length>0&&this.unflowMap(e,[n,"servers"]);for(const s of r){const o=[n,"servers",s.apiId];e.getIn([...o,"value"])!==s.value&&e.setIn([...o,"value"],s.value);const a=new Set(s.variables.map(l=>l.name));this.deleteRemovedKeys(e,[...o,"variables"],a),s.variables.length>0&&this.unflowMap(e,[...o,"variables"]);for(const l of s.variables){const c=[...o,"variables",l.name];e.getIn(c)!==l.value&&e.setIn(c,l.value)}}}unflowMap(e,n){const r=e.getIn(n,!0);r instanceof zr&&r.flow&&(r.flow=!1)}deleteRemovedKeys(e,n,r,i){for(const s of this.getMapKeys(e,...n))s!==i&&!r.has(s)&&e.deleteIn([...n,s])}getMapKeys(e,...n){const r=n.length===0?e.contents:e.getIn(n,!0);return r instanceof zr?r.items.map(i=>String(i.key)):[]}}class Ehe{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 Ahe{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 Qhe{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 Rhe{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 sg={all:["notifications"],lists:()=>[...sg.all,"list"]};function jhe(){return Zr.useQuery({queryKey:sg.lists(),queryFn:async()=>sp.getInstance().getAll()})}function _he(){return Zr.useQuery({queryKey:sg.lists(),queryFn:async()=>sp.getInstance().getAll(),select:t=>({total:t.reduce((e,n)=>e+n.issues.length,0),errorCount:t.reduce((e,n)=>e+n.errorCount,0)})})}class sp{static instance=null;static initialize(){this.close();const e=new Rhe;this.instance=new Qhe(e)}static getInstance(){if(!this.instance)throw new Error("NotificationsService not initialized");return this.instance}static close(){this.instance=null}}let Ux=null;function fb(){return Ux||(Ux=new Zr.QueryClient({defaultOptions:{queries:{staleTime:30*1e3,gcTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}})),Ux}function Dhe(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 Nhe(t){const e=(t instanceof Error?t.message:String(t)).trim();return[{severity:"error",message:e,line:Dhe(e)}]}function Mhe(t){return t.map(e=>({severity:"error",message:e.message.trim(),line:e.linePos?.[0]?.line}))}async function zT(t){try{const e=sp.getInstance();await t(e),fb().invalidateQueries({queryKey:sg.all})}catch{}}async function VT(t,e){await zT(async n=>{await n.set(t,Nhe(e))})}async function zhe(t,e){e.length!==0&&await zT(async n=>{await n.set(t,Mhe(e))})}async function Mu(t){await zT(async e=>{await e.clear(t)})}class Vhe{constructor(e,n,r){this.storage=e,this.localStorageSecretsProvider=n,this.options=r}storage;localStorageSecretsProvider;options;default=[];configError=null;handler=new Ihe(new Ahe([new Ehe],"local"));filePath="replay-environments.yaml";getConfigError(){return this.configError}async read(){const e=await this.loadDocumentFromStorage();if(e.status!=="ok")return this.default;try{const n=await this.readSecrets(),r=this.handler.extractEnvironments(e.document,n);return await Mu(this.filePath),r}catch(n){return console.info("Error reading replay environments",n),await VT(this.filePath,n),this.default}}async write(e){const n=await this.loadDocumentFromStorage();if(n.status==="invalid"&&!this.options.rebuildWhenUnparseable)return;const r=n.status==="ok"?n.document:null;if(!r&&Lhe(e))return;const i=await this.readSecrets(),s=this.handler.hydrateDocument(r??new rg({}),e,i);await this.localStorageSecretsProvider.set(JSON.stringify(i)),await this.storage.set(this.filePath,s.toString())}async loadDocumentFromStorage(){const e=await this.storage.get(this.filePath);if(!e)return this.configError=null,await Mu(this.filePath),{status:"absent"};const n=$he(e);return n.errors.length>0?(console.error("Environments file has YAML errors",n.errors),this.configError={filePath:this.filePath,issues:n.errors.map(r=>({message:r.message.trim(),line:r.linePos?.[0]?.line}))},await zhe(this.filePath,n.errors),{status:"invalid"}):(this.configError=null,n.contents?{status:"ok",document:n}:(await Mu(this.filePath),{status:"absent"}))}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 Lhe(t){if(t.length===0)return!0;if(t.length>1)return!1;const[e]=t;return e.name===kd&&e.inputs.length===0&&e.servers.length===0}class Xhe{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(){const e=await this.storage.get(this.filePath);return e?await this.parse(e):this.defaultValue}async write(e){return this.storage.set(this.filePath,this.stringify(e))}}const kC=(t,e)=>({data:t,version:e});class b7 extends Xhe{constructor(e,n,r,i){super(e,n,r),this.version=i}version;migrationMap={};migrate(e){if(!this.migrationMap[e.version])return kC(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(kC(e,this.version))}}function Whe(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===De.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}}const Bx=2,Zhe="tabs.json";class qhe extends b7{migrationMap={1:Whe};constructor(e){super(e,Zhe,Ss(j1),Bx)}async parse(e){let n=null;try{n=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}n||(n=kC(Ss(j1),Bx)),n.version!==Bx&&(n=this.migrate(n));const r=await Promise.all(n.data.tabs.map(async i=>{if(i.data.type===De.Step){if(i.data.draftStep){const s=i.data.draftStep.requestBody.formData;s["multipart/form-data"]=await $j(s["multipart/form-data"]),s["application/x-www-form-urlencoded"]=await $j(s["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await Kp(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===De.Step){const{isProcessingRequest:i,...s}=r.data;return{...r,data:{...s,response:null}}}return r.data.type===De.WorkflowRun?{...r,data:{...r.data,result:null,runStatus:null,runError:null}}:r})};return super.stringify(n)}}async function $j(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 TX(r)}return n}))}const Uhe=1;class x7{constructor(e,n,r,i,s,o,a){this.systemFilesStorage=e,this.userFilesStorage=n,this.project=r,this.isApiPersisted=i,this.rebuildUnparseableEnvironments=s,this.convertOperationToReplayValue=o,this.telemetry=a,this.localStorageSecretsProvider=new jJ(this.project.id);const l=new RJ;this.activeEnvironmentIdStorage=new b7(this.systemFilesStorage,"active_environment_id.json",kd,Uhe),this.tabsStateStorage=new qhe(this.systemFilesStorage),this.environmentsStorage=new Vhe(this.userFilesStorage,this.localStorageSecretsProvider,{rebuildWhenUnparseable:s}),this.collectionsStorage=new vfe(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new _J(this.isApiPersisted?this.userFilesStorage:l)}systemFilesStorage;userFilesStorage;project;isApiPersisted;rebuildUnparseableEnvironments;convertOperationToReplayValue;telemetry;activeEnvironmentIdStorage;tabsStateStorage;environmentsStorage;collectionsStorage;apisStorage;localStorageSecretsProvider;persistExcludedIds=new Set;watchExcludedIds=new Set;getEnvironmentsConfigError(){return this.environmentsStorage.getConfigError()}reportEnvironmentsConfigError(e){if(this.rebuildUnparseableEnvironments)return;const n=this.getEnvironmentsConfigError();!n&&!e.configFileError.get({noproxy:!0})||e.configFileError.set(n)}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)}async update(e,n){switch(e.path[0]){case"activeEnvironmentId":this.activeEnvironmentIdStorage.write(n.activeEnvironmentId.get());break;case"tabsState":this.tabsStateStorage.write(n.tabsState.get());break;case"environments":await this.environmentsStorage.write(n.environments.get()),this.reportEnvironmentsConfigError(n);break;case"apis":this.isApiPersisted&&await this.apisStorage.update(e,n.apis.get());break;case"collections":await this.collectionsStorage.update(e,n.collections.get());break}}}function me(t,e,n="ui"){let r=`urn:redocly:replay:${n}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!pn()&&(r=y4(window.location.href)),{object:t,id:e,uri:r}}class Bhe extends x7{constructor(e,n,r){const i=new N1(e.systemFilesDir),s=new N1(e.userFilesDir);super(i,s,e,!1,!0,n,r)}async detectProjectFiles(e){const n=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[me("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=el.load(c);if(typeof u=="object"&&u!==null)if(typeof u.openapi=="string"){const f=await Wt.resolve(await Wt.join(this.userFilesStorage.baseDir,l)),{definition:h}=await qO(f,u);s.push({uri:l,type:oi.FS,content:h}),await Mu(l)}else typeof u.arazzo=="string"&&(o.push({uri:l,type:oi.FS,content:u}),await Mu(l),u.sourceDescriptions?.forEach(f=>{const h=f.type,p=f.url,m=!h||h==="openapi",g=typeof p=="string"&&Xi(p);m&&g&&a.add(p)}))}catch(u){console.info(`Error parsing YAML/JSON file ${l}:`,u),await VT(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",[{...me("storageOperation","loadApis","storage"),apiUrlsCount:e.size}],n?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async s=>{try{const{definition:o}=await qO(s);i.push({uri:s,type:oi.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",[{...me("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",[{...me("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",[me("storageOperation","read","storage")],void 0),n=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[me("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);this.apisStorage.setItemIds(u.map(h=>h.id));const f=await this.parseCollections(a,u,e);return this.collectionsStorage.setItemIds(f.map(h=>h.id)),e?.setAttribute("status","completed"),e?.setStatus(exports.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:i,environments:s,apis:u,collections:f,configFileError:null}}}function S7(t=!1){let e,n,r=!1,i=null,s=null,o=null;function a(){o&&(o(),o=null)}async function l(f){if(!(!pn()||!e||!s)){await c();try{const{FileWatcher:h}=await Promise.resolve().then(()=>require("./replay-FileWatcher-XMkIoDEA.js")),p=s.project.userFilesDir.get();i=new h(e,s,p,f),await i.start()}catch(h){console.error("Failed to start file watcher:",h),i=null}}}async function c(){i&&(await i.stop(),i=null)}async function u(){pn()&&(await c(),await qe("cleanup_all_managed_watchers"))}return()=>({id:"RootStoragePlugin",onCreate:(f,h)=>({getTauriRootStorage:p=>()=>n,cleanup:()=>async()=>{a(),await u()},init:p=>async(m,g,O)=>{if(r||p.path.length>0)return{isInitialized:!1};const{convertOperationToReplayValue:v,aiEnabled:b}=g,x=pn();if(r=!0,s=p,a(),t)return r=!1,{isInitialized:!0};if(x){const{TauriRootStorage:S}=await Promise.resolve().then(()=>require("./replay-TauriRootStorage-CiGY8MO6.js"));n=new S(m,v,O),e=n}else n=void 0,e=new Bhe(m,v,O);if(x){await c();const{getSemanticSearchService:S}=await Promise.resolve().then(()=>require("./replay-index-CKRKzXMt.js"));S().setProject(m.id)}const C=await e.read();if(p.merge(C),!x)return r=!1,{isInitialized:!0};try{if(await l(b??!1),b){const[{getSemanticSearchService:S},{createIndexSnapshotGetter:T,startPeriodicIndexRevalidation:k}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-CKRKzXMt.js")),Promise.resolve().then(()=>require("./replay-periodic-revalidation-BoyLQHtg.js"))]),$=S();$.preloadModel().catch(()=>{}),$.reindex(T(s)).catch(A=>{console.error("Semantic reindex failed:",A)}),o=k($,s)}}finally{r=!1}return{isInitialized:!0}}}),onSet(f,h,p){r||!t&&e&&e.update(h,p)},onDestroy:async()=>{a(),await u()}})}function w7({defaultEnvironments:t}={}){return structuredClone({project:{id:"default",userFilesDir:"default",systemFilesDir:"default"},tabsState:Ss(j1),activeEnvironmentId:kd,environments:t||tk,collections:[],apis:[],apps:{apps:[],appsLoadingState:Gs.Idle},predefinedApiId:null,predefinedEnvironmentNames:new Set,predefinedInputNames:new Set,configFileError:null})}const Fhe=DM(w7(),NM(EH({key:"replay-root-store"}),S7())),LT=y.createContext(Fhe),Yhe=LT.Provider;function He(){const t=y.useContext(LT);return XP(t)}function Pc(){const t=He(),{apis:e}=t;return{apis:e}}function og(t){const{apis:e}=Pc();return{api:e.find(r=>r.id.get()===t)??null}}function hb(t,e,n){const{api:r}=og(t);return{specDefault:r?.servers?.ornull?.find(s=>s.url.get()===e)?.variables?.ornull?.[n]?.ornull?.default?.get()}}function Ghe({variable:t,apiId:e,serverUrl:n}){const{specDefault:r}=hb(e,n,t.get().name);return r===void 0?null:d.jsx(Hhe,{fullWidth:!0,variant:"ghost",size:"small",icon:d.jsx(EO.ResetIcon,{size:"14px"}),onClick:()=>t.merge({value:r}),children:"Reset to default"})}const Hhe=w.default(pe.Button)`
|
|
305
305
|
justify-content: flex-start;
|
|
306
306
|
`;function Jhe({defaultValue:t,onReset:e,name:n}){const r=()=>{e(t)};return d.jsxs(Khe,{children:[d.jsxs(epe,{children:["Default: ",t]}),d.jsx(pe.Button,{variant:"ghost",size:"small",icon:d.jsx(EO.ResetIcon,{size:"14px"}),onClick:r,"data-testid":n?`reset-server-variable-editor-${n}`:"reset-server-variable-editor",children:"Reset"})]})}const Khe=w.default.div`
|
|
307
307
|
display: flex;
|
|
@@ -506,7 +506,7 @@ ${B}`,ge=Math.min(I.length,A);let ye=0;for(;ye<ge-1;ye++){const fe=Q(String(ye),
|
|
|
506
506
|
${Z}`,V.pop(),`[${J}]`}let q=Object.keys(I);const F=q.length;if(F===0)return"{}";if($<V.length+1)return'"[Object]"';B+=L;const Y=`,
|
|
507
507
|
${B}`;let re="",ee="",se=Math.min(F,A);l(I)&&(re+=c(I,Y,A),q=q.slice(I.length),se-=I.length,ee=Y),T&&(q=o(q,k)),V.push(I);for(let J=0;J<se;J++){const Oe=q[J],ge=Q(Oe,I[Oe],V,L,B);ge!==void 0&&(re+=`${ee}${s(Oe)}: ${ge}`,ee=Y)}if(F>A){const J=F-A;re+=`${ee}"...": "${m(J)} not stringified"`,ee=Y}return ee!==""&&(re=`
|
|
508
508
|
${B}${re}
|
|
509
|
-
${Z}`),V.pop(),`{${re}}`}case"number":return isFinite(I)?String(I):x?x(I):"null";case"boolean":return I===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(I);default:return x?x(I):void 0}}function _(D,I,V){switch(typeof I){case"string":return s(I);case"object":{if(I===null)return"null";if(typeof I.toJSON=="function"){if(I=I.toJSON(D),typeof I!="object")return _(D,I,V);if(I===null)return"null"}if(V.indexOf(I)!==-1)return C;let L="";const B=I.length!==void 0;if(B&&Array.isArray(I)){if(I.length===0)return"[]";if($<V.length+1)return'"[Array]"';V.push(I);const re=Math.min(I.length,A);let ee=0;for(;ee<re-1;ee++){const J=_(String(ee),I[ee],V);L+=J!==void 0?J:"null",L+=","}const se=_(String(ee),I[ee],V);if(L+=se!==void 0?se:"null",I.length-1>A){const J=I.length-A-1;L+=`,"... ${m(J)} not stringified"`}return V.pop(),`[${L}]`}let Z=Object.keys(I);const q=Z.length;if(q===0)return"{}";if($<V.length+1)return'"[Object]"';let F="",Y=Math.min(q,A);B&&l(I)&&(L+=c(I,",",A),Z=Z.slice(I.length),Y-=I.length,F=","),T&&(Z=o(Z,k)),V.push(I);for(let re=0;re<Y;re++){const ee=Z[re],se=_(ee,I[ee],V);se!==void 0&&(L+=`${F}${s(ee)}:${se}`,F=",")}if(q>A){const re=q-A;L+=`${F}"...":"${m(re)} not stringified"`}return V.pop(),`{${L}}`}case"number":return isFinite(I)?String(I):x?x(I):"null";case"boolean":return I===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(I);default:return x?x(I):void 0}}function j(D,I,V){if(arguments.length>1){let L="";if(typeof V=="number"?L=" ".repeat(Math.min(V,10)):typeof V=="string"&&(L=V.slice(0,10)),I!=null){if(typeof I=="function")return z("",{"":D},[],I,L,"");if(Array.isArray(I))return M("",D,[],g(I),L,"")}if(L.length!==0)return Q("",D,[],L,"")}return _("",D,[])}return j}})(vm,vm.exports)),vm.exports}var f0e=d0e();const h0e=ha(f0e),p0e=h0e.configure;class fp extends Gbe{static maxErrorTextChars=4096;static stringify=p0e({maximumDepth:2,maximumBreadth:10});sendErrorEvent;constructor(e,n){super("errors","1.0",e||{}),this.sendErrorEvent=n}static toErrorEvent(e,n){return{type:"error",payload:[{handler:n,errorType:this.getErrorType(e),message:this.getErrorMessage(e),stack:this.getErrorStack(e)}]}}enable(){window.addEventListener("error",this.onError),window.addEventListener("unhandledrejection",this.onUnhandledRejection),this._wrap(console,"error",this.patchConsoleError())}disable(){window.removeEventListener("error",this.onError),window.removeEventListener("unhandledrejection",this.onUnhandledRejection),this._unwrap(console,"error")}init(){}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(){return e=>{const n=this;return function(...i){try{const s=fp.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(fp.toErrorEvent(e,n))}}class g0e{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new u0e,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,instrumentations:[...e.otel.enableErrorInstrumentation===!0?[new fp(void 0,n=>{this.sendToOtelService({type:n.type,data:n.payload})})]:[],...e.otel.instrumentations||[]]}))}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 hve({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=fp.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)}sendEnvironmentManagementMessage(e,n){this.send("com.redocly.environment.management",e,n)}sendServerManagementMessage(e,n){this.send("com.redocly.server.management",e,n)}sendSourceManagementMessage(e,n){this.send("com.redocly.source.management",e,n)}sendInputManagementMessage(e,n){this.send("com.redocly.input.management",e,n)}sendNodeManagementMessage(e,n){this.send("com.redocly.node.management",e,n)}sendHistoryManagementMessage(e,n){this.send("com.redocly.history.management",e,n)}sendHistoryMigrationMessage(e,n){this.send("com.redocly.history.migration",e,n)}sendCredentialManagementMessage(e,n){this.send("com.redocly.credential.management",e,n)}sendPanelToggleMessage(e,n){this.send("com.redocly.panel.toggle",e,n)}sendWorkflowRunClickMessage(e,n){this.send("com.redocly.workflowRun.click",e,n)}sendWorkflowRunResultMessage(e,n){this.send("com.redocly.workflowRun.result",e,n)}sendStorageReadMessage(e,n){this.send("com.redocly.storage.read",e,n)}sendStorageLoadUserStateMessage(e,n){this.send("com.redocly.storage.loadUserState",e,n)}sendStorageDetectFilesMessage(e,n){this.send("com.redocly.storage.detectFiles",e,n)}sendStorageLoadApisMessage(e,n){this.send("com.redocly.storage.loadApis",e,n)}sendStorageParseApisMessage(e,n){this.send("com.redocly.storage.parseApis",e,n)}sendStorageParseCollectionsMessage(e,n){this.send("com.redocly.storage.parseCollections",e,n)}sendUpdaterCheckMessage(e,n){this.send("com.redocly.updater.check",e,n)}sendUpdaterDownloadMessage(e,n){this.send("com.redocly.updater.download",e,n)}sendUpdaterInstallMessage(e,n){this.send("com.redocly.updater.install",e,n)}sendUpdaterProcessMessage(e,n){this.send("com.redocly.updater.process",e,n)}sendErrorMessage(e,n){this.send("com.redocly.error.occurred",e,n)}sendBackendEventMessage(e,n){this.send("com.redocly.backend.event",e,n)}sendCodeEditorSearchMessage(e,n){this.send("com.redocly.codeEditor.search",e,n)}sendAiChatToolCallStartedMessage(e,n){this.send("com.redocly.aiChat.toolCallStarted",e,n)}sendAiChatToolCallFinishedMessage(e,n){this.send("com.redocly.aiChat.toolCallFinished",e,n)}sendAiChatConversationStartedMessage(e,n){this.send("com.redocly.aiChat.conversationStarted",e,n)}sendAiChatConversationFinishedMessage(e,n){this.send("com.redocly.aiChat.conversationFinished",e,n)}sendDeepLinkOpenedMessage(e,n){this.send("com.redocly.deepLink.opened",e,n)}}const Ld=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],m0e="https://cors.redocly.com/";function O0e(){return{theme:"light",disableCollectionsTab:!1,oAuth2RedirectURI:void 0,corsProxyUrl:void 0,credentialOrigin:void 0,certificates:[],isApiBased:!1,generatedEnvironments:[],generatedInputs:[],hideOtherSecuritySchemes:!1,aiEnabled:!1,isPreviewLayout:!1}}const v0e=O0e(),y0e=y.createContext(v0e);function Yr(){const t=y.useContext(y0e);return XP(t)}function b0e(t,e){const{apps:{apiId:n}}=He(),{corsProxyUrl:r,credentialOrigin:i,disableCollectionsTab:s,oAuth2RedirectURI:o,certificates:a,storageKey:l,isApiBased:c,aiEnabled:u,isPreviewLayout:f}=Yr();r.set(t?.corsProxyUrl??m0e),i.set(t?.credentialOrigin),n.set(t?.apiId),o.set(t?.oAuth2RedirectURI),s.set(!!t?.disableCollectionsTab),l.set(t?.storageKey),c.set(!!e),u.set(!!t?.aiEnabled),f.set(t?.layout==="preview"),y.useEffect(()=>{a.set(t?.certificates||[])},[t?.certificates])}const bb=y.createContext({});function Or(){return y.useContext(bb)||{}}const zC=process.env.NODE_ENV==="development",M_=process.env.NODE_ENV==="production",x0e="0.28.0-next.2",S0e={version:x0e},w0e={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"urn:redocly:replay:app",origin:"replayUi"};class VW{_client;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new g0e}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(()=>({...w0e,...e,env:M_?"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||"desktop",s=r.enableErrorInstrumentation??i==="desktop",o={serviceName:"replay",serviceVersion:S0e.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:M_,enableErrorInstrumentation:s};this._client.init({otel:{...o,...r}}),this.setCloudEventData(n),this._initResolve?.(this),this._isInitialized=!0}sendEvent(e,n){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}const r=n.map(i=>({...this._globalAttributes,...i}));zC&&console.log(`[Telemetry] ${e}:`,JSON.stringify(r,null,2));try{this.client.send(e,r)}catch(i){console.error("Failed to send telemetry event:",i)}}startSpan(e,n,r){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}try{const i=(n??[{}]).map(s=>({...this._globalAttributes,...s}));return zC&&console.log(`[Telemetry] span ${e}:`,JSON.stringify(i,null,2)),this._client.startSpan(e,i,r)}catch(i){console.error("Failed to start telemetry span:",i);return}}}const Nl=new VW;function Fe(){const{telemetry:t}=Or();Nl.isInitialized||Nl.init(t);const e=t?.cloudEventData;y.useEffect(()=>{e&&Nl.setCloudEventData(e)},[e]);const n=y.useCallback((i,s)=>{Nl.sendEvent(i,s)},[]),r=y.useCallback((i,s,o)=>Nl.startSpan(i,s,o),[]);return{sendEvent:n,startSpan:r}}const C0e=({awaitInit:t=!0}={})=>{const[e,n]=y.useState(void 0);return y.useEffect(()=>{(async()=>{const i=t?await Nl.awaitInit():Nl;n(i)})()},[t]),e},Ar=800,$i=w.default(pe.Button).attrs({variant:"text",size:"small",tone:"danger"})`
|
|
509
|
+
${Z}`),V.pop(),`{${re}}`}case"number":return isFinite(I)?String(I):x?x(I):"null";case"boolean":return I===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(I);default:return x?x(I):void 0}}function _(D,I,V){switch(typeof I){case"string":return s(I);case"object":{if(I===null)return"null";if(typeof I.toJSON=="function"){if(I=I.toJSON(D),typeof I!="object")return _(D,I,V);if(I===null)return"null"}if(V.indexOf(I)!==-1)return C;let L="";const B=I.length!==void 0;if(B&&Array.isArray(I)){if(I.length===0)return"[]";if($<V.length+1)return'"[Array]"';V.push(I);const re=Math.min(I.length,A);let ee=0;for(;ee<re-1;ee++){const J=_(String(ee),I[ee],V);L+=J!==void 0?J:"null",L+=","}const se=_(String(ee),I[ee],V);if(L+=se!==void 0?se:"null",I.length-1>A){const J=I.length-A-1;L+=`,"... ${m(J)} not stringified"`}return V.pop(),`[${L}]`}let Z=Object.keys(I);const q=Z.length;if(q===0)return"{}";if($<V.length+1)return'"[Object]"';let F="",Y=Math.min(q,A);B&&l(I)&&(L+=c(I,",",A),Z=Z.slice(I.length),Y-=I.length,F=","),T&&(Z=o(Z,k)),V.push(I);for(let re=0;re<Y;re++){const ee=Z[re],se=_(ee,I[ee],V);se!==void 0&&(L+=`${F}${s(ee)}:${se}`,F=",")}if(q>A){const re=q-A;L+=`${F}"...":"${m(re)} not stringified"`}return V.pop(),`{${L}}`}case"number":return isFinite(I)?String(I):x?x(I):"null";case"boolean":return I===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(I);default:return x?x(I):void 0}}function j(D,I,V){if(arguments.length>1){let L="";if(typeof V=="number"?L=" ".repeat(Math.min(V,10)):typeof V=="string"&&(L=V.slice(0,10)),I!=null){if(typeof I=="function")return z("",{"":D},[],I,L,"");if(Array.isArray(I))return M("",D,[],g(I),L,"")}if(L.length!==0)return Q("",D,[],L,"")}return _("",D,[])}return j}})(vm,vm.exports)),vm.exports}var f0e=d0e();const h0e=ha(f0e),p0e=h0e.configure;class fp extends Gbe{static maxErrorTextChars=4096;static stringify=p0e({maximumDepth:2,maximumBreadth:10});sendErrorEvent;constructor(e,n){super("errors","1.0",e||{}),this.sendErrorEvent=n}static toErrorEvent(e,n){return{type:"error",payload:[{handler:n,errorType:this.getErrorType(e),message:this.getErrorMessage(e),stack:this.getErrorStack(e)}]}}enable(){window.addEventListener("error",this.onError),window.addEventListener("unhandledrejection",this.onUnhandledRejection),this._wrap(console,"error",this.patchConsoleError())}disable(){window.removeEventListener("error",this.onError),window.removeEventListener("unhandledrejection",this.onUnhandledRejection),this._unwrap(console,"error")}init(){}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(){return e=>{const n=this;return function(...i){try{const s=fp.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(fp.toErrorEvent(e,n))}}class g0e{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new u0e,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,instrumentations:[...e.otel.enableErrorInstrumentation===!0?[new fp(void 0,n=>{this.sendToOtelService({type:n.type,data:n.payload})})]:[],...e.otel.instrumentations||[]]}))}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 hve({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=fp.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)}sendEnvironmentManagementMessage(e,n){this.send("com.redocly.environment.management",e,n)}sendServerManagementMessage(e,n){this.send("com.redocly.server.management",e,n)}sendSourceManagementMessage(e,n){this.send("com.redocly.source.management",e,n)}sendInputManagementMessage(e,n){this.send("com.redocly.input.management",e,n)}sendNodeManagementMessage(e,n){this.send("com.redocly.node.management",e,n)}sendHistoryManagementMessage(e,n){this.send("com.redocly.history.management",e,n)}sendHistoryMigrationMessage(e,n){this.send("com.redocly.history.migration",e,n)}sendCredentialManagementMessage(e,n){this.send("com.redocly.credential.management",e,n)}sendPanelToggleMessage(e,n){this.send("com.redocly.panel.toggle",e,n)}sendWorkflowRunClickMessage(e,n){this.send("com.redocly.workflowRun.click",e,n)}sendWorkflowRunResultMessage(e,n){this.send("com.redocly.workflowRun.result",e,n)}sendStorageReadMessage(e,n){this.send("com.redocly.storage.read",e,n)}sendStorageLoadUserStateMessage(e,n){this.send("com.redocly.storage.loadUserState",e,n)}sendStorageDetectFilesMessage(e,n){this.send("com.redocly.storage.detectFiles",e,n)}sendStorageLoadApisMessage(e,n){this.send("com.redocly.storage.loadApis",e,n)}sendStorageParseApisMessage(e,n){this.send("com.redocly.storage.parseApis",e,n)}sendStorageParseCollectionsMessage(e,n){this.send("com.redocly.storage.parseCollections",e,n)}sendUpdaterCheckMessage(e,n){this.send("com.redocly.updater.check",e,n)}sendUpdaterDownloadMessage(e,n){this.send("com.redocly.updater.download",e,n)}sendUpdaterInstallMessage(e,n){this.send("com.redocly.updater.install",e,n)}sendUpdaterProcessMessage(e,n){this.send("com.redocly.updater.process",e,n)}sendErrorMessage(e,n){this.send("com.redocly.error.occurred",e,n)}sendBackendEventMessage(e,n){this.send("com.redocly.backend.event",e,n)}sendCodeEditorSearchMessage(e,n){this.send("com.redocly.codeEditor.search",e,n)}sendAiChatToolCallStartedMessage(e,n){this.send("com.redocly.aiChat.toolCallStarted",e,n)}sendAiChatToolCallFinishedMessage(e,n){this.send("com.redocly.aiChat.toolCallFinished",e,n)}sendAiChatConversationStartedMessage(e,n){this.send("com.redocly.aiChat.conversationStarted",e,n)}sendAiChatConversationFinishedMessage(e,n){this.send("com.redocly.aiChat.conversationFinished",e,n)}sendDeepLinkOpenedMessage(e,n){this.send("com.redocly.deepLink.opened",e,n)}}const Ld=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],m0e="https://cors.redocly.com/";function O0e(){return{theme:"light",disableCollectionsTab:!1,oAuth2RedirectURI:void 0,corsProxyUrl:void 0,credentialOrigin:void 0,certificates:[],isApiBased:!1,generatedEnvironments:[],generatedInputs:[],hideOtherSecuritySchemes:!1,aiEnabled:!1,isPreviewLayout:!1}}const v0e=O0e(),y0e=y.createContext(v0e);function Yr(){const t=y.useContext(y0e);return XP(t)}function b0e(t,e){const{apps:{apiId:n}}=He(),{corsProxyUrl:r,credentialOrigin:i,disableCollectionsTab:s,oAuth2RedirectURI:o,certificates:a,storageKey:l,isApiBased:c,aiEnabled:u,isPreviewLayout:f}=Yr();r.set(t?.corsProxyUrl??m0e),i.set(t?.credentialOrigin),n.set(t?.apiId),o.set(t?.oAuth2RedirectURI),s.set(!!t?.disableCollectionsTab),l.set(t?.storageKey),c.set(!!e),u.set(!!t?.aiEnabled),f.set(t?.layout==="preview"),y.useEffect(()=>{a.set(t?.certificates||[])},[t?.certificates])}const bb=y.createContext({});function Or(){return y.useContext(bb)||{}}const zC=process.env.NODE_ENV==="development",M_=process.env.NODE_ENV==="production",x0e="0.28.0-next.4",S0e={version:x0e},w0e={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"urn:redocly:replay:app",origin:"replayUi"};class VW{_client;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new g0e}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(()=>({...w0e,...e,env:M_?"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||"desktop",s=r.enableErrorInstrumentation??i==="desktop",o={serviceName:"replay",serviceVersion:S0e.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:M_,enableErrorInstrumentation:s};this._client.init({otel:{...o,...r}}),this.setCloudEventData(n),this._initResolve?.(this),this._isInitialized=!0}sendEvent(e,n){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}const r=n.map(i=>({...this._globalAttributes,...i}));zC&&console.log(`[Telemetry] ${e}:`,JSON.stringify(r,null,2));try{this.client.send(e,r)}catch(i){console.error("Failed to send telemetry event:",i)}}startSpan(e,n,r){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}try{const i=(n??[{}]).map(s=>({...this._globalAttributes,...s}));return zC&&console.log(`[Telemetry] span ${e}:`,JSON.stringify(i,null,2)),this._client.startSpan(e,i,r)}catch(i){console.error("Failed to start telemetry span:",i);return}}}const Nl=new VW;function Fe(){const{telemetry:t}=Or();Nl.isInitialized||Nl.init(t);const e=t?.cloudEventData;y.useEffect(()=>{e&&Nl.setCloudEventData(e)},[e]);const n=y.useCallback((i,s)=>{Nl.sendEvent(i,s)},[]),r=y.useCallback((i,s,o)=>Nl.startSpan(i,s,o),[]);return{sendEvent:n,startSpan:r}}const C0e=({awaitInit:t=!0}={})=>{const[e,n]=y.useState(void 0);return y.useEffect(()=>{(async()=>{const i=t?await Nl.awaitInit():Nl;n(i)})()},[t]),e},Ar=800,$i=w.default(pe.Button).attrs({variant:"text",size:"small",tone:"danger"})`
|
|
510
510
|
border: none;
|
|
511
511
|
margin: 0;
|
|
512
512
|
|
|
@@ -762,14 +762,14 @@ ${Z}`),V.pop(),`{${re}}`}case"number":return isFinite(I)?String(I):x?x(I):"null"
|
|
|
762
762
|
border-radius: var(--border-radius);
|
|
763
763
|
border: 1px solid var(--border-color-primary);
|
|
764
764
|
padding: 0 calc(var(--spacing-xxs) / 2);
|
|
765
|
-
`,ln=(t,e,n=new Set)=>{const r=d$(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.findLast(f=>f.name===l),u=t.slice(i,c?o:a);if(i=a,c){n.add(l);const f=ln(c.value,e,n);return n.delete(l),[u.length?u:null,f||t.slice(o,a)]}return[u.length?u:null]});return t.slice(i).length&&s.push(t.slice(i)),s.join("")};function q0e(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function U0e(t,e){const n=qW(t);if(!n.length)return d.jsx(L_,{children:t});let r=0;const i=n.flatMap(({start:s,end:o})=>{const a=t.slice(r,s),l=q0e(t.slice(s,o),e);return r=o,[a.length?a:null,l]});return t.slice(r).length&&i.push(t.slice(r)),d.jsx(L_,{children:i.join("")})}class B0e{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 hp{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-3VBWw1et.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 xb={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t};function Bl(t){if(t!==void 0)try{return JSON.parse(JSON.stringify(t))}catch{return}}function F0e(t,e){if(typeof t!="string"||t===""||!(!e||/json/i.test(e)))return t;try{return JSON.parse(t)}catch{return t}}function Y0e(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:F0e(t.body,n),header:e,contentType:n,time:t.duration}}async function f$(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(()=>yY);for(const{key:i,value:s,active:o}of t)if(!(!i||!s||!o))try{n[i]=r(s,e,xb)}catch{}return n}function G0e(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:Bl(i?.request)??null,response:Bl(i?.response)??null,outputs:Bl(i?.outputs)??{}}))}let UW=0;const XC=new Set;function H0e(){UW+=1;for(const t of XC)t()}function J0e(){return UW}function K0e(t){return XC.add(t),()=>{XC.delete(t)}}const exe=10080*60*1e3;async function h$(t){const e=ws.getInstance();if(e&&!(!t.collectionId||!t.workflowId||!t.stepId))try{await e.upsert({id:dp(),date:Date.now(),...t}),H0e()}catch(n){console.error("Failed to persist step context:",n)}}async function txe(t,e,n){if(ws.getInstance())for(const i of G0e(n,e))await h$({collectionId:t,workflowId:e,...i})}class ws{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=hp.getInstance(),i=new n(r);this.instance=new B0e(i)}static getInstance(){return this.instance}static close(){this.instance=null}}const nxe={__replayClearedOutput:!0};function BW(t){return typeof t=="object"&&t!==null&&t.__replayClearedOutput===!0}async function FW(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 f$(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))BW(i[o])&&delete i[o];n[r.stepId]={request:r.request??void 0,response:r.response??void 0,outputs:i}}return n}function YW(t){if(t!==void 0)return typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t)}const rxe=/\{\$steps\.[^}\s]+\}|^\$steps\.[^}\s]+$/g;function p$(t){const e=new RegExp(rxe),n=[];let r;for(;(r=e.exec(t))!==null;)n.push({start:r.index,end:r.index+r[0].length});return n}const ixe=/^\{?\$steps\.([^.{}\s]+)\.(outputs|request|response)\.([^{}\s#]+)(?:#\/([^{}\s]*))?\}?$/;function GW(t){const e=ixe.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 sxe=/^(\{?)(\$steps\.[^.{}\s]+\.(?:request|response)\.[^{}\s#]+)#\/([^{}\s]*)(\}?)$/;function oxe(t,e){const n=sxe.exec(t);if(!n)return;const[,r,i,s,o]=n;if(!!r!=!!o)return;let a;try{a=Ja(`${r}${i}${o}`,{$steps:e},xb)}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 YW(l)}function HW(t,e){if(!t||!t.includes("$steps"))return t;const n=p$(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=oxe(s,e);if(c!==void 0)l=c;else try{const u=YW(Ja(s,{$steps:e},xb));u!==void 0&&(l=u)}catch{}i.push(l),r=a}return i.push(t.slice(r)),i.join("")}function JW(t,e,n){const s=t.collections.find(a=>a.id.get()===e)?.workflows.find(a=>a.workflowId.get()===n)?.steps.get({noproxy:!0});if(!s)return{};const o={};for(const a of s)o[a.stepId]=a.outputs??[];return o}async function KW(t,e){if(!t.response)return{hasValue:!1};const n=await f$([e],{$response:t.response,$request:t.request??void 0});return e.key in n?{hasValue:!0,value:n[e.key]}:{hasValue:!1}}async function axe(t,e){if(!e)return!1;const n=t.outputs?.[e.key];if(n===void 0||BW(n))return!1;const r=await KW(t,e);return r.hasValue?JSON.stringify(r.value)!==JSON.stringify(n):!1}async function lxe(t,e){return e?(await KW(t,e)).hasValue:!1}const cxe=/\$steps\.([^.\s"'}]+)\./g;function uxe(t){if(!t||!t.includes("$steps."))return[];const e=new Set;for(const n of t.matchAll(cxe))e.add(n[1]);return[...e]}function g$(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.get({noproxy:!0})),s(e?.get({noproxy:!0})),s(n?.components.parameters.get({noproxy:!0}));for(const o of r?.inputs??[])o.value&&i.push(o.value);return uxe(i.join("\0"))}async function Sb(t,e,n,r){const i=ws.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 FW(o,JW(t,e,n)):{}}function Xu(t,e,n){return HW(ln(t,e),n)}function eZ(t){return K8(t)}const tZ="New Step";function WC({name:t=tZ,workflow:e}={}){let n=t.replaceAll(" ","-");if(!e)return n;const r=dxe(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function dxe(t){return t.steps.filter(e=>e.state.get()!==At.Draft).map(e=>e.stepId.get())}function Co({name:t=tZ,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:s,dynamicReplayValues:o,xOperation:a}={}){if(!n){const c=s?mT(s,o):null,u=[os()];return{stepId:WC({name:t,workflow:r}),description:t,outputs:[],successCriteria:[],state:e?At.Draft:At.Normal,parameters:{pathParameters:[],queryParameters:a?zp(a.url):[],headers:[],cookies:[]},requestBody:np(),xOperation:a??(i?null:{method:"GET",url:""}),security:u,operation:i??null,...c}}const l=n.get({noproxy:!0});return{stepId:WC({name:t,workflow:r}),description:l.description,outputs:l.outputs,successCriteria:l.successCriteria,state:e?At.Draft:At.Normal,parameters:l.parameters,requestBody:l.requestBody,xOperation:l.xOperation,security:l.security,operation:l.operation}}function al(t){return eZ(t)?t.xOperation?.ornull?.method.get()??t.operation.ornull?.method.get()??"":t.xOperation?.method??t.operation?.method??""}function pp(t){return eZ(t)?t.xOperation?.ornull?.url.get()??t.operation.ornull?.nested("path").get()??"":t.xOperation?.url??t.operation?.path??""}function wb(t,e,n,r,i){const{inputs:s,servers:o}=r,a=iK(Ba("path",[gn(e?.parameters.pathParameters,n?.components.parameters),gn(t.parameters.pathParameters,n?.components.parameters)]),r.inputs,i),l=t.xOperation??null,c=t.operation??null;let u="",f="";if(l)f=l.method,u=lA(l.url,a);else if(c){const m=o.find(O=>O.apiId===c.apiId);f=c.method==="x-query"?"query":c.method,u=(m?.value?b4(m.value,m.variables):"")+lA(c.path,a)}const h=u.split("?")[0];return{url:Xu(h,s,i??{}),method:f.toUpperCase()}}function m$(t,{collectionId:e,workflowId:n,stepId:r}){return t.collections.find(a=>a.id.get()===e)?.workflows.find(a=>a.workflowId.get()===n)?.steps.find(a=>a.stepId.get()===r)??null}function fxe(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 hxe(t,e,n,r,i={}){const{inputs:s}=r,{requestBody:{content:o}}=t,{url:a,method:l}=wb(t,e,n,r,i),c=[...e?.security||[],...t.security].findLast($=>$.securityType===te.DigestAuth);if(!c)return"";const{username:u,password:f,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,opaque:b}=c[te.DigestAuth],x=Xu(u,s,i),{pathname:C,search:S}=new URL(a),T=S?`${C}${S}`:C,k=pxe({username:x,password:Xu(f,s,i),uri:T,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,method:l,bodyContent:Xu(o,s,i)});return`Digest username="${x}", realm="${h}", nonce="${p}", uri="${T}", qop=${O}, nc=${v}, cnonce="${m}", response="${k}", algorithm=${g}${b?`, opaque="${b}"`:""}`}function pxe(t){const{username:e,password:n,realm:r,nonce:i,cnonce:s,algorithm:o,qop:a,nc:l,uri:c,method:u,bodyContent:f}=t,h=gxe(o),p=o?.endsWith("-sess")?h(`${h(`${e}:${r}:${n}`)}:${i}:${s}`):h(`${e}:${r}:${n}`),m=a?.includes("auth-int")?h(`${u}:${c}:${h(f)}`):h(`${u}:${c}`);return h(`${p}:${i}:${l}:${s}:${a}:${m}`).toString()}function gxe(t){return t?.replace("-sess","")==="SHA-256"?e=>Ch(XM(e)):e=>Ch(wy(e))}const xo=window.__TAURI__?.http.fetch??globalThis.fetch;function mxe(t){try{const n=new URL(t).hostname;return n==="localhost"||n==="127.0.0.1"}catch{return!1}}function Bv(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function Oxe(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 vxe=["json","xml","html","text"],yxe=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function dS(t,e){return t.get(e)??t.get(e.toLowerCase())}function bxe(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function xxe(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 Sxe(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function wxe(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return yxe.some(r=>n.includes(r))?!0:n.startsWith("application/")?!vxe.some(r=>n.includes(r)):!1}async function Cxe(t,e){const n=dS(t.headers,"content-type")?.split(";")[0].trim(),r=dS(t.headers,"content-disposition"),i=bxe(dS(t.headers,"content-length")),s=wxe(n,r),o=Oxe(document.cookie);if(s){const h={fileName:xxe(r)||Sxe(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 Pxe=":/?#[]@!$&'()*+,;=",kxe=new Set(["!","'","(",")","*"]);function Txe(t){return kxe.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function X_(t,e=!1){let n=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return n;const r=[...Pxe].map(i=>({char:i,encoded:Txe(i)}));for(const{char:i,encoded:s}of r)n=n.split(s).join(i);return n}function W_(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 nZ(t,e){let n=W_(t);const r=e.find(({host:i,port:s})=>W_(`https://${i}:${s}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}function $xe(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function Ixe(t,e){const{exists:n}=await Promise.resolve().then(()=>nb),{join:r}=await Promise.resolve().then(()=>yX),{baseName:i,extension:s}=$xe(e);let o=0;for(;;){const a=o===0?"":` (${o})`,l=`${i}${a}${s}`,c=await r(t,l);if(!await n(c))return c;o+=1}}function Exe(t){return t.split(/(\{[^}]+\}|\/)/g).filter(e=>e!=="")}const Xf=new Map;function Axe(t){Xf.get(t)?.abort()}function rZ(t){return t?t instanceof FormData||t instanceof URLSearchParams?t.entries().next().done===!0:!1:!0}function Qxe(t){if(!rZ(t))return t}function Cb(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function iZ(t,e){if(!e)return"same-origin";try{const n=new URL(e).origin;return new URL(Cb(t)).origin===n?"include":"same-origin"}catch{return"same-origin"}}async function sZ({store:t,step:e,settings:n,workflow:r,collection:i,signal:s}){const{corsProxyUrl:o,credentialOrigin:a,certificates:l}=n.get(),c=Rd(t),u=await Sb(t,i?.id.get(),r?.workflowId.get(),g$(e,r,i,c)),{url:f,method:h}=wb(e.get(),r?.get(),i?.get(),c,u),p=o||"",m=cZ(e,r,i,t,u),g=qxe(f,a),O=Uxe({proxyUrl:p,resolvedUrl:f,ignoreProxy:g,queryParameters:m});await jxe(e,r??void 0,O,a,s);const v=Pb(e,r??void 0,i??void 0,t,u),b=Qxe(v$(e,t,u)),{clientCert:x,clientKey:C}=nZ(f,l||[]),S=Cb(O),T=h.toUpperCase(),k=!Ld.includes(T),$=k?"POST":T,A=k?{...v,"X-HTTP-Method-Override":T}:v;return{urlWithProxyAndProtocol:S,fetchMethod:$,fetchHeaders:A,body:b,credentials:iZ(S,a),mode:Bv(S)?"same-origin":"cors",clientCert:x,clientKey:C,resolvedUrl:f}}async function oZ(t,e,n,r,i){const s=cg(t),o=s.data;if(o.type.get()!==De.Step){console.warn("not an operation tab");return}const{collectionId:a,workflowId:l,response:c,requestError:u,isProcessingRequest:f}=o,h=t.collections.find(x=>x.id.get()===a.get()),p=h?.workflows.find(x=>x.workflowId.get()===l.get()),m=Ss(e.get({noproxy:!0}));f.set(!0);const g=s.id.get();Xf.get(g)?.abort();const O=new AbortController;Xf.set(g,O);const{signal:v}=O,b=()=>Xf.get(g)===O;try{const x=await sZ({store:t,step:e,settings:n,workflow:p,collection:h,signal:v}),C=Date.now(),S={signal:v,method:x.fetchMethod,headers:x.fetchHeaders,body:x.body,mode:x.mode,credentials:x.credentials,clientCert:x.clientCert,clientKey:x.clientKey},T=await xo(x.urlWithProxyAndProtocol,S),k=Date.now()-C,$=await Cxe(T,k);if(!b())return;u.set(null),c.set($);const A=Ss(c.value);r?.(m,A),i?.({outcome:"success",status:$.status,duration:$.duration,size:$.size})}catch(x){if(!b()||(c.set(null),x.name==="AbortError"))return;u.set(x.message||String(x));const C=Ss(c.value);r?.(m,C),i?.({outcome:"error",error:x.message||String(x)})}finally{b()&&(Xf.delete(g),f.set(!1))}}async function Rxe({store:t,step:e,settings:n,workflow:r,collection:i,fileName:s,onProgress:o}){const a=await sZ({store:t,step:e,settings:n,workflow:r,collection:i}),l={method:a.fetchMethod,headers:a.fetchHeaders,body:a.body,mode:a.mode,credentials:a.credentials,clientCert:a.clientCert,clientKey:a.clientKey},{clientCert:c,clientKey:u}=l,f=pn(),h=s||"response";let p=null;if(f){const{open:T}=await Promise.resolve().then(()=>require("./replay-index-DenMrfEa.js")),k=await T({directory:!0,multiple:!1});if(!k)return;const $=Array.isArray(k)?k[0]:k;p=await Ixe($,h)}const m=await xo(a.urlWithProxyAndProtocol,l),g=m.headers.get("content-length"),O=g?Number.parseInt(g,10):void 0,v=Number.isFinite(O)?O:void 0,b=m.headers.get("content-type")??void 0;let x;if(m.body?.getReader){const T=m.body.getReader(),k=[];let $=0;for(;;){const{done:A,value:z}=await T.read();if(A)break;if(z){const M=new Uint8Array(z.byteLength);M.set(z),k.push(M.buffer),$+=z.byteLength,o?.({receivedBytes:$,totalBytes:v,done:!1})}}x=new Blob(k,{type:b}),o?.({receivedBytes:$,totalBytes:v,done:!0})}else x=await m.blob(),o?.({receivedBytes:x.size,totalBytes:v,done:!0});if(f){const{writeFile:T}=await Promise.resolve().then(()=>nb),k=new Uint8Array(await x.arrayBuffer());if(!p)return;await T(p,k);return}const C=window.URL.createObjectURL(x),S=document.createElement("a");S.href=C,S.download=h,S.rel="noopener",S.click(),window.URL.revokeObjectURL(C)}async function jxe(t,e,n,r,i){const s=al(t),a=[...Array.from(e?.security||[]),...Array.from(t.security)].findLast(l=>l.securityType.get()===te.DigestAuth);if(a){const l=Cb(n),c=await xo(l,{signal:i,method:s.toUpperCase(),credentials:iZ(l,r),mode:Bv(l)?"same-origin":"cors"}),u=fxe(c.headers.get("WWW-Authenticate")||"");a[te.DigestAuth].merge({nonce:u.nonce,realm:u.realm,qop:u.qop,algorithm:u.algorithm,opaque:u.opaque,cnonce:crypto.randomUUID(),nc:"00000001"})}}function _xe(t,e,n,r,i){return[...e?.security.get()||[],...t.security.get()].map(s=>{switch(s.securityType){case te.BasicAuth:{const o=s[te.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+btoa(`${mr(o.username,r,i)}:${mr(o.password,r,i)}`),active:!0,in:"header"}}case te.DigestAuth:{const o=Rd(r);return{id:"",key:"Authorization",value:hxe(t.get(),e?.get(),n?.get(),o,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===wi.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(s=>!!s)}function Dxe(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(C=>C.in==="query"),f=c.filter(C=>C.in==="header"),h=c.filter(C=>C.in==="cookie"),p=r?.path!==n.path,m=n.method.toLowerCase()!==r?.method.toLowerCase(),g=n.body?.mediaTypes&&n.body?.mediaTypes?.[i.type]===void 0,O=!f.every(C=>o.some(S=>!Gl(S)&&S.key===C.name)),v=!h.every(C=>a.some(S=>!Gl(S)&&S.key===C.name)),b=!u.every(C=>l.some(S=>!Gl(S)&&S.key===C.name)),x=Uue(t,e,n);return!p&&!m&&!g&&!O&&!v&&!b&&!x}function O$(t,e,n={}){const{requestBody:r}=t,s=al(t).toUpperCase();if(s==="GET"||s==="HEAD"||s==="OPTIONS")return null;try{switch(r.type.get()){case"JSON":return structuredClone(mr(r.content.get(),e,n));case"multipart/form-data":return zxe(t,e,n);case"application/x-www-form-urlencoded":return Mxe(t,e,n);case"application/octet-stream":return r.binary.get();default:return mr(r.content.get(),e,n)}}catch(o){console.error(o)}}function v$(t,e,n={}){const{requestBody:r}=t,i=O$(t,e,n);if(i===null)return null;switch(r.type.get()){default:return i;case"multipart/form-data":return Vxe(i);case"application/x-www-form-urlencoded":return Nxe(i);case"application/octet-stream":return r.binary.ornull?.file.get()??null}}function Nxe(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function Mxe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData["application/x-www-form-urlencoded"];return fZ(s.get()).forEach(o=>{const a=mr(o.value,e,n);i.push({key:mr(o.key,e,n),value:a,type:"text"})}),i}function zxe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData["multipart/form-data"];return fZ(s.get()).forEach(({type:o,files:a,value:l,key:c})=>{const u=mr(c,e,n);if(o==="file"&&a)for(const f of a)i.push({key:u,value:f,type:o});else if(l){const f=mr(l,e,n);i.push({key:u,value:f,type:o})}}),i}function Vxe(t){const e=new FormData;return t.forEach(({key:n,value:r,type:i})=>{i==="file"?e.append(n,r.file):r&&e.append(n,r)}),e}function aZ(t,e,n){return t.filter(r=>{const{securityType:i,[te.APIKey]:s}=r;return i===te.APIKey&&s.location===e&&!!s.name}).map(r=>{const{[te.APIKey]:i}=r;return{id:"",key:i.name,value:i.key,active:!0,in:n}})}function Z_(t=[]){return aZ(t,wi.Query,"query")}function lZ(t,e,n){const r=n?.components.parameters.get();return Ba("query",[Z_(e?.security.get()),Z_(t.security.get()),gn(e?.parameters.queryParameters.get(),r),gn(t.parameters.queryParameters.get(),r)])}function cZ(t,e,n,r,i={}){return lZ(t,e,n).map(o=>{const a=mr(o.value,r,i),l=X_(a,o.allowReserved);return`${X_(o.key)}=${l}`}).join("&")}function uZ(t,e,n,r,i={}){return lZ(t,e,n).reduce((o,a)=>{const l=mr(a.value,r,i),c=mr(a.key,r,i);return o[c]=l,o},{})}function Lxe(t){const e=t.split("?")[0],n=Exe(e),r=/^\{[^\s]+\}$/,i=n.filter(s=>r.test(s)).map(s=>s.slice(1,-1));return new Set(i)}function Pb(t,e,n,r,i={}){const s=Zxe(t,r,i),o=_xe(t,e,n,r,i),a=Xxe(t,e,n,r,i),l=n?.components.parameters.get();return Ba("header",[s,o,a,gn(e?.parameters.headers.get(),l),gn(t.parameters.headers.get(),l)]).reduce((f,{key:h,value:p})=>(f[h]=mr(p,r,i),f),{})}function Xxe(t,e,n,r,i={}){const o=dZ(t,e,n).map(a=>`${a.key}=${mr(a.value,r,i)}`).join("; ");return o?[{id:"",key:"Cookie",value:o,active:!0,in:"header"},{id:"",key:"X-Redocly-Cookie",value:o,active:!0,in:"header"}]:[]}function Wxe(t,e,n,r,i={}){return dZ(t,e,n).reduce((o,a)=>{const l=mr(a.value,r,i);return{...o,[mr(a.key,r,i)]:l}},{})}function q_(t=[]){return aZ(t,wi.Cookie,"cookie")}function dZ(t,e,n){const r=n?.components.parameters.get();return Ba("cookie",[q_(e?.security.get()),q_(t.security.get()),gn(e?.parameters.cookies.get(),r),gn(t.parameters.cookies.get(),r)])}function fZ(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}function Zxe(t,e,n={}){const{requestBody:r}=t,i=v$(t,e,n);return["binary","multipart/form-data"].includes(r.type.get())?[]:rZ(i)?[]:[{id:"",key:"Content-Type",value:r.type.get(),active:!0,in:"header"}]}function mr(t,e,n={}){return e?Xu(t,Rd(e)?.inputs,n):t}function qxe(t,e){return mxe(t)||Bv(t)||!!(e&&Bv(Cb(t),e))}function Uxe({proxyUrl:t,resolvedUrl:e,ignoreProxy:n,queryParameters:r=""}){const i=t!=="/"?D1(t):t;let s;return n||!i?s=e:s=`${i}/${e}`,r&&(s+=`?${r}`),s}function y$(t){return t.flatMap(e=>{const n=e.id.get();return(e.paths?.keys??[]).flatMap(i=>{const s=e.paths.nested(i),a=(s.keys??[]).filter(u=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(u.toLowerCase())).map(u=>{const f=s.nested(u),h=f.operationId.get()||"",p=f.summary.get();return{apiId:n,path:i,method:u,operationId:h,summary:p,isAdditionalOperation:!1}}),l=s.additionalOperations?.get(),c=l?Object.entries(l).map(([u,f])=>({apiId:n,path:i,method:u,operationId:f.operationId||"",summary:f.summary,isAdditionalOperation:!0})):[];return[...a,...c]})})}const hZ=(t,e,n)=>{if(!e)return null;const{apiId:r,method:i,path:s}=e,o=t.find(l=>l.id.get()===r);if(!o)return null;if(n)try{return n(s,i,o.get({noproxy:!0}))??null}catch(l){console.error("Failed to convert operation to replay value",l)}const a=o.paths?.nested(s)?.nested(i)?.ornull;return a?{id:a.operationId.get()??"",name:a.summary.get()??"",method:i,path:s,href:"",operationId:a.operationId.get(),parameters:[],servers:[],security:[]}:null};function cg({tabsState:{activeTabIdx:t,tabs:e}}){return e[t?.get()??0]}function Bxe(t){const{environments:e,apis:n,tabsState:{tabs:r}}=t,i=r.filter(l=>l.data.type.get()===De.Step),s=y$(n),o=i.map(l=>{const{collectionId:c,workflowId:u,satisfiesScheme:f}=l.data.get(),h=l.data.draftStep.ornull;if(h===null)return null;const{operationId:p,apiId:m}=h.get().operation??{};if(!f||!p)return null;const g=t.collections.find(k=>k.id.get()===c),O=g?.workflows.find(k=>k.workflowId.get()===u),v=s.find(k=>k.operationId===p&&k.apiId===m);if(!v)return null;const b=Pb(h,O,g,t),x=v$(h,t),C=Wxe(h,O,g,t),S=uZ(h,O,g,t),T=h.requestBody.activeExampleName;return{apiPath:{path:v.path,method:v.method},requestValues:{cookie:C,header:b,query:S,body:x},activeExampleName:T.get()}}).filter(l=>l!==null),a=Rd(t);return{operations:o,environment:a?.name,environments:Object.fromEntries(e.get().map(l=>[l.name,{...Object.fromEntries(l.inputs.filter(({isSecret:c})=>!c).map(({name:c,value:u})=>[c,u])),...Object.fromEntries(l.servers.map(({apiId:c,value:u})=>[c,u]))}]))}}function Fxe(t){return t.filter(e=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(e.toLowerCase()))}function Yxe(t){const e=new Map;return(t.paths?.keys??[]).forEach(r=>{const i=t.paths.nested(r);Fxe(i.keys).forEach(a=>{const l=i.nested(a),c=l.tags?.get()||[],u=l.summary?.get(),f=l.operationId?.get();(c.length?c:["Untagged"]).forEach(p=>{const m=e.get(p)??[];m.push({path:r,method:a,summary:u,operationId:f,isAdditionalOperation:!1}),e.set(p,m)})});const o=i.additionalOperations?.get();o&&Object.entries(o).forEach(([a,l])=>{const c=l.tags||[],u=l.summary,f=l.operationId;(c.length?c:["Untagged"]).forEach(p=>{const m=e.get(p)??[];m.push({path:r,method:a,summary:u,operationId:f,isAdditionalOperation:!0}),e.set(p,m)})})}),e}function Gxe({apiId:t,apiTitle:e,tagToOperations:n}){return Array.from(n.entries()).map(([i,s])=>{const o=s.map(a=>({id:b$({apiId:t,method:a.method,path:a.path}),name:a.summary||a.path,apiTitle:e,type:"operation",apiId:t,path:a.path,tagName:i,method:a.method,summary:a.summary,isAdditionalOperation:a.isAdditionalOperation}));return o.length===0?null:{id:`${t}-${i}`,name:i,apiTitle:e,type:"tag",apiId:t,tagName:i,children:o}}).filter(Boolean)}function pZ(t){const e=t.id.get(),n=t.info?.title?.get()||e,r=Yxe(t),i=Gxe({apiId:e,apiTitle:n,tagToOperations:r});return i.length===0?null:{id:e,name:n,apiTitle:n,type:"api",apiId:e,api:t,children:i}}const b$=({apiId:t,method:e,path:n})=>`${t}-${e.toUpperCase()}-${n}`;function Hxe(t){const e=t.data.get();switch(e.type){case De.Workflow:return`${e.collectionId}/${e.workflowId}`;case De.Collection:return e.collectionId;case De.Step:return`${e.collectionId}/${e.workflowId}/${e.stepId}`;case De.WorkflowRun:return`${e.collectionId}/${e.workflowId}`}}function Jxe(t){const e=t.data.get();if(e.type!==De.Step)return;const{apiId:n,path:r,method:i}=e.draftStep?.operation??{};if(!(!n||!r||!i))return b$({apiId:n,path:r,method:i})}function va(t){const e=He(),n=cg(e);return!n.get()||t&&!xn(n.data.get(),t)?{tab:null,tabDataId:void 0,apiNodeId:void 0}:{tab:n,tabDataId:Hxe(n),apiNodeId:Jxe(n)}}function Kxe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return y.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const kb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Wd(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function x$(t){return"nodeType"in t}function Gr(t){var e,n;return t?Wd(t)?t:x$(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function S$(t){const{Document:e}=Gr(t);return t instanceof e}function ug(t){return Wd(t)?!1:t instanceof Gr(t).HTMLElement}function gZ(t){return t instanceof Gr(t).SVGElement}function Zd(t){return t?Wd(t)?t.document:x$(t)?S$(t)?t:ug(t)||gZ(t)?t.ownerDocument:document:document:document}const rs=kb?y.useLayoutEffect:y.useEffect;function Tb(t){const e=y.useRef(t);return rs(()=>{e.current=t}),y.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}function eSe(){const t=y.useRef(null),e=y.useCallback((r,i)=>{t.current=setInterval(r,i)},[]),n=y.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function gp(t,e){e===void 0&&(e=[t]);const n=y.useRef(t);return rs(()=>{n.current!==t&&(n.current=t)},e),n}function dg(t,e){const n=y.useRef();return y.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function Fv(t){const e=Tb(t),n=y.useRef(null),r=y.useCallback(i=>{i!==n.current&&e?.(i,n.current),n.current=i},[]);return[n,r]}function Yv(t){const e=y.useRef();return y.useEffect(()=>{e.current=t},[t]),e.current}let fS={};function fg(t,e){return y.useMemo(()=>{if(e)return e;const n=fS[t]==null?0:fS[t]+1;return fS[t]=n,t+"-"+n},[t,e])}function mZ(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const a=Object.entries(o);for(const[l,c]of a){const u=s[l];u!=null&&(s[l]=u+t*c)}return s},{...e})}}const Wu=mZ(1),Gv=mZ(-1);function tSe(t){return"clientX"in t&&"clientY"in t}function $b(t){if(!t)return!1;const{KeyboardEvent:e}=Gr(t.target);return e&&t instanceof e}function nSe(t){if(!t)return!1;const{TouchEvent:e}=Gr(t.target);return e&&t instanceof e}function Hv(t){if(nSe(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return tSe(t)?{x:t.clientX,y:t.clientY}:null}const ll=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[ll.Translate.toString(t),ll.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),U_="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function rSe(t){return t.matches(U_)?t:t.querySelector(U_)}const iSe={display:"none"};function sSe(t){let{id:e,value:n}=t;return U.default.createElement("div",{id:e,style:iSe},n)}function oSe(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const i={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return U.default.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function aSe(){const[t,e]=y.useState("");return{announce:y.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const OZ=y.createContext(null);function lSe(t){const e=y.useContext(OZ);y.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function cSe(){const[t]=y.useState(()=>new Set),e=y.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[y.useCallback(r=>{let{type:i,event:s}=r;t.forEach(o=>{var a;return(a=o[i])==null?void 0:a.call(o,s)})},[t]),e]}const uSe={draggable:`
|
|
765
|
+
`,ln=(t,e,n=new Set)=>{const r=d$(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.findLast(f=>f.name===l),u=t.slice(i,c?o:a);if(i=a,c){n.add(l);const f=ln(c.value,e,n);return n.delete(l),[u.length?u:null,f||t.slice(o,a)]}return[u.length?u:null]});return t.slice(i).length&&s.push(t.slice(i)),s.join("")};function q0e(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function U0e(t,e){const n=qW(t);if(!n.length)return d.jsx(L_,{children:t});let r=0;const i=n.flatMap(({start:s,end:o})=>{const a=t.slice(r,s),l=q0e(t.slice(s,o),e);return r=o,[a.length?a:null,l]});return t.slice(r).length&&i.push(t.slice(r)),d.jsx(L_,{children:i.join("")})}class B0e{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 hp{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-DGQjzDy4.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 xb={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t};function Bl(t){if(t!==void 0)try{return JSON.parse(JSON.stringify(t))}catch{return}}function F0e(t,e){if(typeof t!="string"||t===""||!(!e||/json/i.test(e)))return t;try{return JSON.parse(t)}catch{return t}}function Y0e(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:F0e(t.body,n),header:e,contentType:n,time:t.duration}}async function f$(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(()=>yY);for(const{key:i,value:s,active:o}of t)if(!(!i||!s||!o))try{n[i]=r(s,e,xb)}catch{}return n}function G0e(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:Bl(i?.request)??null,response:Bl(i?.response)??null,outputs:Bl(i?.outputs)??{}}))}let UW=0;const XC=new Set;function H0e(){UW+=1;for(const t of XC)t()}function J0e(){return UW}function K0e(t){return XC.add(t),()=>{XC.delete(t)}}const exe=10080*60*1e3;async function h$(t){const e=ws.getInstance();if(e&&!(!t.collectionId||!t.workflowId||!t.stepId))try{await e.upsert({id:dp(),date:Date.now(),...t}),H0e()}catch(n){console.error("Failed to persist step context:",n)}}async function txe(t,e,n){if(ws.getInstance())for(const i of G0e(n,e))await h$({collectionId:t,workflowId:e,...i})}class ws{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=hp.getInstance(),i=new n(r);this.instance=new B0e(i)}static getInstance(){return this.instance}static close(){this.instance=null}}const nxe={__replayClearedOutput:!0};function BW(t){return typeof t=="object"&&t!==null&&t.__replayClearedOutput===!0}async function FW(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 f$(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))BW(i[o])&&delete i[o];n[r.stepId]={request:r.request??void 0,response:r.response??void 0,outputs:i}}return n}function YW(t){if(t!==void 0)return typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t)}const rxe=/\{\$steps\.[^}\s]+\}|^\$steps\.[^}\s]+$/g;function p$(t){const e=new RegExp(rxe),n=[];let r;for(;(r=e.exec(t))!==null;)n.push({start:r.index,end:r.index+r[0].length});return n}const ixe=/^\{?\$steps\.([^.{}\s]+)\.(outputs|request|response)\.([^{}\s#]+)(?:#\/([^{}\s]*))?\}?$/;function GW(t){const e=ixe.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 sxe=/^(\{?)(\$steps\.[^.{}\s]+\.(?:request|response)\.[^{}\s#]+)#\/([^{}\s]*)(\}?)$/;function oxe(t,e){const n=sxe.exec(t);if(!n)return;const[,r,i,s,o]=n;if(!!r!=!!o)return;let a;try{a=Ja(`${r}${i}${o}`,{$steps:e},xb)}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 YW(l)}function HW(t,e){if(!t||!t.includes("$steps"))return t;const n=p$(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=oxe(s,e);if(c!==void 0)l=c;else try{const u=YW(Ja(s,{$steps:e},xb));u!==void 0&&(l=u)}catch{}i.push(l),r=a}return i.push(t.slice(r)),i.join("")}function JW(t,e,n){const s=t.collections.find(a=>a.id.get()===e)?.workflows.find(a=>a.workflowId.get()===n)?.steps.get({noproxy:!0});if(!s)return{};const o={};for(const a of s)o[a.stepId]=a.outputs??[];return o}async function KW(t,e){if(!t.response)return{hasValue:!1};const n=await f$([e],{$response:t.response,$request:t.request??void 0});return e.key in n?{hasValue:!0,value:n[e.key]}:{hasValue:!1}}async function axe(t,e){if(!e)return!1;const n=t.outputs?.[e.key];if(n===void 0||BW(n))return!1;const r=await KW(t,e);return r.hasValue?JSON.stringify(r.value)!==JSON.stringify(n):!1}async function lxe(t,e){return e?(await KW(t,e)).hasValue:!1}const cxe=/\$steps\.([^.\s"'}]+)\./g;function uxe(t){if(!t||!t.includes("$steps."))return[];const e=new Set;for(const n of t.matchAll(cxe))e.add(n[1]);return[...e]}function g$(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.get({noproxy:!0})),s(e?.get({noproxy:!0})),s(n?.components.parameters.get({noproxy:!0}));for(const o of r?.inputs??[])o.value&&i.push(o.value);return uxe(i.join("\0"))}async function Sb(t,e,n,r){const i=ws.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 FW(o,JW(t,e,n)):{}}function Xu(t,e,n){return HW(ln(t,e),n)}function eZ(t){return K8(t)}const tZ="New Step";function WC({name:t=tZ,workflow:e}={}){let n=t.replaceAll(" ","-");if(!e)return n;const r=dxe(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function dxe(t){return t.steps.filter(e=>e.state.get()!==At.Draft).map(e=>e.stepId.get())}function Co({name:t=tZ,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:s,dynamicReplayValues:o,xOperation:a}={}){if(!n){const c=s?mT(s,o):null,u=[os()];return{stepId:WC({name:t,workflow:r}),description:t,outputs:[],successCriteria:[],state:e?At.Draft:At.Normal,parameters:{pathParameters:[],queryParameters:a?zp(a.url):[],headers:[],cookies:[]},requestBody:np(),xOperation:a??(i?null:{method:"GET",url:""}),security:u,operation:i??null,...c}}const l=n.get({noproxy:!0});return{stepId:WC({name:t,workflow:r}),description:l.description,outputs:l.outputs,successCriteria:l.successCriteria,state:e?At.Draft:At.Normal,parameters:l.parameters,requestBody:l.requestBody,xOperation:l.xOperation,security:l.security,operation:l.operation}}function al(t){return eZ(t)?t.xOperation?.ornull?.method.get()??t.operation.ornull?.method.get()??"":t.xOperation?.method??t.operation?.method??""}function pp(t){return eZ(t)?t.xOperation?.ornull?.url.get()??t.operation.ornull?.nested("path").get()??"":t.xOperation?.url??t.operation?.path??""}function wb(t,e,n,r,i){const{inputs:s,servers:o}=r,a=iK(Ba("path",[gn(e?.parameters.pathParameters,n?.components.parameters),gn(t.parameters.pathParameters,n?.components.parameters)]),r.inputs,i),l=t.xOperation??null,c=t.operation??null;let u="",f="";if(l)f=l.method,u=lA(l.url,a);else if(c){const m=o.find(O=>O.apiId===c.apiId);f=c.method==="x-query"?"query":c.method,u=(m?.value?b4(m.value,m.variables):"")+lA(c.path,a)}const h=u.split("?")[0];return{url:Xu(h,s,i??{}),method:f.toUpperCase()}}function m$(t,{collectionId:e,workflowId:n,stepId:r}){return t.collections.find(a=>a.id.get()===e)?.workflows.find(a=>a.workflowId.get()===n)?.steps.find(a=>a.stepId.get()===r)??null}function fxe(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 hxe(t,e,n,r,i={}){const{inputs:s}=r,{requestBody:{content:o}}=t,{url:a,method:l}=wb(t,e,n,r,i),c=[...e?.security||[],...t.security].findLast($=>$.securityType===te.DigestAuth);if(!c)return"";const{username:u,password:f,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,opaque:b}=c[te.DigestAuth],x=Xu(u,s,i),{pathname:C,search:S}=new URL(a),T=S?`${C}${S}`:C,k=pxe({username:x,password:Xu(f,s,i),uri:T,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,method:l,bodyContent:Xu(o,s,i)});return`Digest username="${x}", realm="${h}", nonce="${p}", uri="${T}", qop=${O}, nc=${v}, cnonce="${m}", response="${k}", algorithm=${g}${b?`, opaque="${b}"`:""}`}function pxe(t){const{username:e,password:n,realm:r,nonce:i,cnonce:s,algorithm:o,qop:a,nc:l,uri:c,method:u,bodyContent:f}=t,h=gxe(o),p=o?.endsWith("-sess")?h(`${h(`${e}:${r}:${n}`)}:${i}:${s}`):h(`${e}:${r}:${n}`),m=a?.includes("auth-int")?h(`${u}:${c}:${h(f)}`):h(`${u}:${c}`);return h(`${p}:${i}:${l}:${s}:${a}:${m}`).toString()}function gxe(t){return t?.replace("-sess","")==="SHA-256"?e=>Ch(XM(e)):e=>Ch(wy(e))}const xo=window.__TAURI__?.http.fetch??globalThis.fetch;function mxe(t){try{const n=new URL(t).hostname;return n==="localhost"||n==="127.0.0.1"}catch{return!1}}function Bv(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function Oxe(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 vxe=["json","xml","html","text"],yxe=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function dS(t,e){return t.get(e)??t.get(e.toLowerCase())}function bxe(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function xxe(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 Sxe(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function wxe(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return yxe.some(r=>n.includes(r))?!0:n.startsWith("application/")?!vxe.some(r=>n.includes(r)):!1}async function Cxe(t,e){const n=dS(t.headers,"content-type")?.split(";")[0].trim(),r=dS(t.headers,"content-disposition"),i=bxe(dS(t.headers,"content-length")),s=wxe(n,r),o=Oxe(document.cookie);if(s){const h={fileName:xxe(r)||Sxe(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 Pxe=":/?#[]@!$&'()*+,;=",kxe=new Set(["!","'","(",")","*"]);function Txe(t){return kxe.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function X_(t,e=!1){let n=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return n;const r=[...Pxe].map(i=>({char:i,encoded:Txe(i)}));for(const{char:i,encoded:s}of r)n=n.split(s).join(i);return n}function W_(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 nZ(t,e){let n=W_(t);const r=e.find(({host:i,port:s})=>W_(`https://${i}:${s}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}function $xe(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function Ixe(t,e){const{exists:n}=await Promise.resolve().then(()=>nb),{join:r}=await Promise.resolve().then(()=>yX),{baseName:i,extension:s}=$xe(e);let o=0;for(;;){const a=o===0?"":` (${o})`,l=`${i}${a}${s}`,c=await r(t,l);if(!await n(c))return c;o+=1}}function Exe(t){return t.split(/(\{[^}]+\}|\/)/g).filter(e=>e!=="")}const Xf=new Map;function Axe(t){Xf.get(t)?.abort()}function rZ(t){return t?t instanceof FormData||t instanceof URLSearchParams?t.entries().next().done===!0:!1:!0}function Qxe(t){if(!rZ(t))return t}function Cb(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function iZ(t,e){if(!e)return"same-origin";try{const n=new URL(e).origin;return new URL(Cb(t)).origin===n?"include":"same-origin"}catch{return"same-origin"}}async function sZ({store:t,step:e,settings:n,workflow:r,collection:i,signal:s}){const{corsProxyUrl:o,credentialOrigin:a,certificates:l}=n.get(),c=Rd(t),u=await Sb(t,i?.id.get(),r?.workflowId.get(),g$(e,r,i,c)),{url:f,method:h}=wb(e.get(),r?.get(),i?.get(),c,u),p=o||"",m=cZ(e,r,i,t,u),g=qxe(f,a),O=Uxe({proxyUrl:p,resolvedUrl:f,ignoreProxy:g,queryParameters:m});await jxe(e,r??void 0,O,a,s);const v=Pb(e,r??void 0,i??void 0,t,u),b=Qxe(v$(e,t,u)),{clientCert:x,clientKey:C}=nZ(f,l||[]),S=Cb(O),T=h.toUpperCase(),k=!Ld.includes(T),$=k?"POST":T,A=k?{...v,"X-HTTP-Method-Override":T}:v;return{urlWithProxyAndProtocol:S,fetchMethod:$,fetchHeaders:A,body:b,credentials:iZ(S,a),mode:Bv(S)?"same-origin":"cors",clientCert:x,clientKey:C,resolvedUrl:f}}async function oZ(t,e,n,r,i){const s=cg(t),o=s.data;if(o.type.get()!==De.Step){console.warn("not an operation tab");return}const{collectionId:a,workflowId:l,response:c,requestError:u,isProcessingRequest:f}=o,h=t.collections.find(x=>x.id.get()===a.get()),p=h?.workflows.find(x=>x.workflowId.get()===l.get()),m=Ss(e.get({noproxy:!0}));f.set(!0);const g=s.id.get();Xf.get(g)?.abort();const O=new AbortController;Xf.set(g,O);const{signal:v}=O,b=()=>Xf.get(g)===O;try{const x=await sZ({store:t,step:e,settings:n,workflow:p,collection:h,signal:v}),C=Date.now(),S={signal:v,method:x.fetchMethod,headers:x.fetchHeaders,body:x.body,mode:x.mode,credentials:x.credentials,clientCert:x.clientCert,clientKey:x.clientKey},T=await xo(x.urlWithProxyAndProtocol,S),k=Date.now()-C,$=await Cxe(T,k);if(!b())return;u.set(null),c.set($);const A=Ss(c.value);r?.(m,A),i?.({outcome:"success",status:$.status,duration:$.duration,size:$.size})}catch(x){if(!b()||(c.set(null),x.name==="AbortError"))return;u.set(x.message||String(x));const C=Ss(c.value);r?.(m,C),i?.({outcome:"error",error:x.message||String(x)})}finally{b()&&(Xf.delete(g),f.set(!1))}}async function Rxe({store:t,step:e,settings:n,workflow:r,collection:i,fileName:s,onProgress:o}){const a=await sZ({store:t,step:e,settings:n,workflow:r,collection:i}),l={method:a.fetchMethod,headers:a.fetchHeaders,body:a.body,mode:a.mode,credentials:a.credentials,clientCert:a.clientCert,clientKey:a.clientKey},{clientCert:c,clientKey:u}=l,f=pn(),h=s||"response";let p=null;if(f){const{open:T}=await Promise.resolve().then(()=>require("./replay-index-DJwfdo0s.js")),k=await T({directory:!0,multiple:!1});if(!k)return;const $=Array.isArray(k)?k[0]:k;p=await Ixe($,h)}const m=await xo(a.urlWithProxyAndProtocol,l),g=m.headers.get("content-length"),O=g?Number.parseInt(g,10):void 0,v=Number.isFinite(O)?O:void 0,b=m.headers.get("content-type")??void 0;let x;if(m.body?.getReader){const T=m.body.getReader(),k=[];let $=0;for(;;){const{done:A,value:z}=await T.read();if(A)break;if(z){const M=new Uint8Array(z.byteLength);M.set(z),k.push(M.buffer),$+=z.byteLength,o?.({receivedBytes:$,totalBytes:v,done:!1})}}x=new Blob(k,{type:b}),o?.({receivedBytes:$,totalBytes:v,done:!0})}else x=await m.blob(),o?.({receivedBytes:x.size,totalBytes:v,done:!0});if(f){const{writeFile:T}=await Promise.resolve().then(()=>nb),k=new Uint8Array(await x.arrayBuffer());if(!p)return;await T(p,k);return}const C=window.URL.createObjectURL(x),S=document.createElement("a");S.href=C,S.download=h,S.rel="noopener",S.click(),window.URL.revokeObjectURL(C)}async function jxe(t,e,n,r,i){const s=al(t),a=[...Array.from(e?.security||[]),...Array.from(t.security)].findLast(l=>l.securityType.get()===te.DigestAuth);if(a){const l=Cb(n),c=await xo(l,{signal:i,method:s.toUpperCase(),credentials:iZ(l,r),mode:Bv(l)?"same-origin":"cors"}),u=fxe(c.headers.get("WWW-Authenticate")||"");a[te.DigestAuth].merge({nonce:u.nonce,realm:u.realm,qop:u.qop,algorithm:u.algorithm,opaque:u.opaque,cnonce:crypto.randomUUID(),nc:"00000001"})}}function _xe(t,e,n,r,i){return[...e?.security.get()||[],...t.security.get()].map(s=>{switch(s.securityType){case te.BasicAuth:{const o=s[te.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+btoa(`${mr(o.username,r,i)}:${mr(o.password,r,i)}`),active:!0,in:"header"}}case te.DigestAuth:{const o=Rd(r);return{id:"",key:"Authorization",value:hxe(t.get(),e?.get(),n?.get(),o,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===wi.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(s=>!!s)}function Dxe(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(C=>C.in==="query"),f=c.filter(C=>C.in==="header"),h=c.filter(C=>C.in==="cookie"),p=r?.path!==n.path,m=n.method.toLowerCase()!==r?.method.toLowerCase(),g=n.body?.mediaTypes&&n.body?.mediaTypes?.[i.type]===void 0,O=!f.every(C=>o.some(S=>!Gl(S)&&S.key===C.name)),v=!h.every(C=>a.some(S=>!Gl(S)&&S.key===C.name)),b=!u.every(C=>l.some(S=>!Gl(S)&&S.key===C.name)),x=Uue(t,e,n);return!p&&!m&&!g&&!O&&!v&&!b&&!x}function O$(t,e,n={}){const{requestBody:r}=t,s=al(t).toUpperCase();if(s==="GET"||s==="HEAD"||s==="OPTIONS")return null;try{switch(r.type.get()){case"JSON":return structuredClone(mr(r.content.get(),e,n));case"multipart/form-data":return zxe(t,e,n);case"application/x-www-form-urlencoded":return Mxe(t,e,n);case"application/octet-stream":return r.binary.get();default:return mr(r.content.get(),e,n)}}catch(o){console.error(o)}}function v$(t,e,n={}){const{requestBody:r}=t,i=O$(t,e,n);if(i===null)return null;switch(r.type.get()){default:return i;case"multipart/form-data":return Vxe(i);case"application/x-www-form-urlencoded":return Nxe(i);case"application/octet-stream":return r.binary.ornull?.file.get()??null}}function Nxe(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function Mxe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData["application/x-www-form-urlencoded"];return fZ(s.get()).forEach(o=>{const a=mr(o.value,e,n);i.push({key:mr(o.key,e,n),value:a,type:"text"})}),i}function zxe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData["multipart/form-data"];return fZ(s.get()).forEach(({type:o,files:a,value:l,key:c})=>{const u=mr(c,e,n);if(o==="file"&&a)for(const f of a)i.push({key:u,value:f,type:o});else if(l){const f=mr(l,e,n);i.push({key:u,value:f,type:o})}}),i}function Vxe(t){const e=new FormData;return t.forEach(({key:n,value:r,type:i})=>{i==="file"?e.append(n,r.file):r&&e.append(n,r)}),e}function aZ(t,e,n){return t.filter(r=>{const{securityType:i,[te.APIKey]:s}=r;return i===te.APIKey&&s.location===e&&!!s.name}).map(r=>{const{[te.APIKey]:i}=r;return{id:"",key:i.name,value:i.key,active:!0,in:n}})}function Z_(t=[]){return aZ(t,wi.Query,"query")}function lZ(t,e,n){const r=n?.components.parameters.get();return Ba("query",[Z_(e?.security.get()),Z_(t.security.get()),gn(e?.parameters.queryParameters.get(),r),gn(t.parameters.queryParameters.get(),r)])}function cZ(t,e,n,r,i={}){return lZ(t,e,n).map(o=>{const a=mr(o.value,r,i),l=X_(a,o.allowReserved);return`${X_(o.key)}=${l}`}).join("&")}function uZ(t,e,n,r,i={}){return lZ(t,e,n).reduce((o,a)=>{const l=mr(a.value,r,i),c=mr(a.key,r,i);return o[c]=l,o},{})}function Lxe(t){const e=t.split("?")[0],n=Exe(e),r=/^\{[^\s]+\}$/,i=n.filter(s=>r.test(s)).map(s=>s.slice(1,-1));return new Set(i)}function Pb(t,e,n,r,i={}){const s=Zxe(t,r,i),o=_xe(t,e,n,r,i),a=Xxe(t,e,n,r,i),l=n?.components.parameters.get();return Ba("header",[s,o,a,gn(e?.parameters.headers.get(),l),gn(t.parameters.headers.get(),l)]).reduce((f,{key:h,value:p})=>(f[h]=mr(p,r,i),f),{})}function Xxe(t,e,n,r,i={}){const o=dZ(t,e,n).map(a=>`${a.key}=${mr(a.value,r,i)}`).join("; ");return o?[{id:"",key:"Cookie",value:o,active:!0,in:"header"},{id:"",key:"X-Redocly-Cookie",value:o,active:!0,in:"header"}]:[]}function Wxe(t,e,n,r,i={}){return dZ(t,e,n).reduce((o,a)=>{const l=mr(a.value,r,i);return{...o,[mr(a.key,r,i)]:l}},{})}function q_(t=[]){return aZ(t,wi.Cookie,"cookie")}function dZ(t,e,n){const r=n?.components.parameters.get();return Ba("cookie",[q_(e?.security.get()),q_(t.security.get()),gn(e?.parameters.cookies.get(),r),gn(t.parameters.cookies.get(),r)])}function fZ(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}function Zxe(t,e,n={}){const{requestBody:r}=t,i=v$(t,e,n);return["binary","multipart/form-data"].includes(r.type.get())?[]:rZ(i)?[]:[{id:"",key:"Content-Type",value:r.type.get(),active:!0,in:"header"}]}function mr(t,e,n={}){return e?Xu(t,Rd(e)?.inputs,n):t}function qxe(t,e){return mxe(t)||Bv(t)||!!(e&&Bv(Cb(t),e))}function Uxe({proxyUrl:t,resolvedUrl:e,ignoreProxy:n,queryParameters:r=""}){const i=t!=="/"?D1(t):t;let s;return n||!i?s=e:s=`${i}/${e}`,r&&(s+=`?${r}`),s}function y$(t){return t.flatMap(e=>{const n=e.id.get();return(e.paths?.keys??[]).flatMap(i=>{const s=e.paths.nested(i),a=(s.keys??[]).filter(u=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(u.toLowerCase())).map(u=>{const f=s.nested(u),h=f.operationId.get()||"",p=f.summary.get();return{apiId:n,path:i,method:u,operationId:h,summary:p,isAdditionalOperation:!1}}),l=s.additionalOperations?.get(),c=l?Object.entries(l).map(([u,f])=>({apiId:n,path:i,method:u,operationId:f.operationId||"",summary:f.summary,isAdditionalOperation:!0})):[];return[...a,...c]})})}const hZ=(t,e,n)=>{if(!e)return null;const{apiId:r,method:i,path:s}=e,o=t.find(l=>l.id.get()===r);if(!o)return null;if(n)try{return n(s,i,o.get({noproxy:!0}))??null}catch(l){console.error("Failed to convert operation to replay value",l)}const a=o.paths?.nested(s)?.nested(i)?.ornull;return a?{id:a.operationId.get()??"",name:a.summary.get()??"",method:i,path:s,href:"",operationId:a.operationId.get(),parameters:[],servers:[],security:[]}:null};function cg({tabsState:{activeTabIdx:t,tabs:e}}){return e[t?.get()??0]}function Bxe(t){const{environments:e,apis:n,tabsState:{tabs:r}}=t,i=r.filter(l=>l.data.type.get()===De.Step),s=y$(n),o=i.map(l=>{const{collectionId:c,workflowId:u,satisfiesScheme:f}=l.data.get(),h=l.data.draftStep.ornull;if(h===null)return null;const{operationId:p,apiId:m}=h.get().operation??{};if(!f||!p)return null;const g=t.collections.find(k=>k.id.get()===c),O=g?.workflows.find(k=>k.workflowId.get()===u),v=s.find(k=>k.operationId===p&&k.apiId===m);if(!v)return null;const b=Pb(h,O,g,t),x=v$(h,t),C=Wxe(h,O,g,t),S=uZ(h,O,g,t),T=h.requestBody.activeExampleName;return{apiPath:{path:v.path,method:v.method},requestValues:{cookie:C,header:b,query:S,body:x},activeExampleName:T.get()}}).filter(l=>l!==null),a=Rd(t);return{operations:o,environment:a?.name,environments:Object.fromEntries(e.get().map(l=>[l.name,{...Object.fromEntries(l.inputs.filter(({isSecret:c})=>!c).map(({name:c,value:u})=>[c,u])),...Object.fromEntries(l.servers.map(({apiId:c,value:u})=>[c,u]))}]))}}function Fxe(t){return t.filter(e=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(e.toLowerCase()))}function Yxe(t){const e=new Map;return(t.paths?.keys??[]).forEach(r=>{const i=t.paths.nested(r);Fxe(i.keys).forEach(a=>{const l=i.nested(a),c=l.tags?.get()||[],u=l.summary?.get(),f=l.operationId?.get();(c.length?c:["Untagged"]).forEach(p=>{const m=e.get(p)??[];m.push({path:r,method:a,summary:u,operationId:f,isAdditionalOperation:!1}),e.set(p,m)})});const o=i.additionalOperations?.get();o&&Object.entries(o).forEach(([a,l])=>{const c=l.tags||[],u=l.summary,f=l.operationId;(c.length?c:["Untagged"]).forEach(p=>{const m=e.get(p)??[];m.push({path:r,method:a,summary:u,operationId:f,isAdditionalOperation:!0}),e.set(p,m)})})}),e}function Gxe({apiId:t,apiTitle:e,tagToOperations:n}){return Array.from(n.entries()).map(([i,s])=>{const o=s.map(a=>({id:b$({apiId:t,method:a.method,path:a.path}),name:a.summary||a.path,apiTitle:e,type:"operation",apiId:t,path:a.path,tagName:i,method:a.method,summary:a.summary,isAdditionalOperation:a.isAdditionalOperation}));return o.length===0?null:{id:`${t}-${i}`,name:i,apiTitle:e,type:"tag",apiId:t,tagName:i,children:o}}).filter(Boolean)}function pZ(t){const e=t.id.get(),n=t.info?.title?.get()||e,r=Yxe(t),i=Gxe({apiId:e,apiTitle:n,tagToOperations:r});return i.length===0?null:{id:e,name:n,apiTitle:n,type:"api",apiId:e,api:t,children:i}}const b$=({apiId:t,method:e,path:n})=>`${t}-${e.toUpperCase()}-${n}`;function Hxe(t){const e=t.data.get();switch(e.type){case De.Workflow:return`${e.collectionId}/${e.workflowId}`;case De.Collection:return e.collectionId;case De.Step:return`${e.collectionId}/${e.workflowId}/${e.stepId}`;case De.WorkflowRun:return`${e.collectionId}/${e.workflowId}`}}function Jxe(t){const e=t.data.get();if(e.type!==De.Step)return;const{apiId:n,path:r,method:i}=e.draftStep?.operation??{};if(!(!n||!r||!i))return b$({apiId:n,path:r,method:i})}function va(t){const e=He(),n=cg(e);return!n.get()||t&&!xn(n.data.get(),t)?{tab:null,tabDataId:void 0,apiNodeId:void 0}:{tab:n,tabDataId:Hxe(n),apiNodeId:Jxe(n)}}function Kxe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return y.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const kb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Wd(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function x$(t){return"nodeType"in t}function Gr(t){var e,n;return t?Wd(t)?t:x$(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function S$(t){const{Document:e}=Gr(t);return t instanceof e}function ug(t){return Wd(t)?!1:t instanceof Gr(t).HTMLElement}function gZ(t){return t instanceof Gr(t).SVGElement}function Zd(t){return t?Wd(t)?t.document:x$(t)?S$(t)?t:ug(t)||gZ(t)?t.ownerDocument:document:document:document}const rs=kb?y.useLayoutEffect:y.useEffect;function Tb(t){const e=y.useRef(t);return rs(()=>{e.current=t}),y.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}function eSe(){const t=y.useRef(null),e=y.useCallback((r,i)=>{t.current=setInterval(r,i)},[]),n=y.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function gp(t,e){e===void 0&&(e=[t]);const n=y.useRef(t);return rs(()=>{n.current!==t&&(n.current=t)},e),n}function dg(t,e){const n=y.useRef();return y.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function Fv(t){const e=Tb(t),n=y.useRef(null),r=y.useCallback(i=>{i!==n.current&&e?.(i,n.current),n.current=i},[]);return[n,r]}function Yv(t){const e=y.useRef();return y.useEffect(()=>{e.current=t},[t]),e.current}let fS={};function fg(t,e){return y.useMemo(()=>{if(e)return e;const n=fS[t]==null?0:fS[t]+1;return fS[t]=n,t+"-"+n},[t,e])}function mZ(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const a=Object.entries(o);for(const[l,c]of a){const u=s[l];u!=null&&(s[l]=u+t*c)}return s},{...e})}}const Wu=mZ(1),Gv=mZ(-1);function tSe(t){return"clientX"in t&&"clientY"in t}function $b(t){if(!t)return!1;const{KeyboardEvent:e}=Gr(t.target);return e&&t instanceof e}function nSe(t){if(!t)return!1;const{TouchEvent:e}=Gr(t.target);return e&&t instanceof e}function Hv(t){if(nSe(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return tSe(t)?{x:t.clientX,y:t.clientY}:null}const ll=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[ll.Translate.toString(t),ll.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),U_="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function rSe(t){return t.matches(U_)?t:t.querySelector(U_)}const iSe={display:"none"};function sSe(t){let{id:e,value:n}=t;return U.default.createElement("div",{id:e,style:iSe},n)}function oSe(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const i={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return U.default.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function aSe(){const[t,e]=y.useState("");return{announce:y.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const OZ=y.createContext(null);function lSe(t){const e=y.useContext(OZ);y.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function cSe(){const[t]=y.useState(()=>new Set),e=y.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[y.useCallback(r=>{let{type:i,event:s}=r;t.forEach(o=>{var a;return(a=o[i])==null?void 0:a.call(o,s)})},[t]),e]}const uSe={draggable:`
|
|
766
766
|
To pick up a draggable item, press the space bar.
|
|
767
767
|
While dragging, use the arrow keys to move the item.
|
|
768
768
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
769
769
|
`},dSe={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function fSe(t){let{announcements:e=dSe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=uSe}=t;const{announce:s,announcement:o}=aSe(),a=fg("DndLiveRegion"),[l,c]=y.useState(!1);if(y.useEffect(()=>{c(!0)},[]),lSe(y.useMemo(()=>({onDragStart(f){let{active:h}=f;s(e.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;e.onDragMove&&s(e.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;s(e.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;s(e.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;s(e.onDragCancel({active:h,over:p}))}}),[s,e])),!l)return null;const u=U.default.createElement(U.default.Fragment,null,U.default.createElement(sSe,{id:r,value:i.draggable}),U.default.createElement(oSe,{id:a,announcement:o}));return n?ro.createPortal(u,n):u}var Gn;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Gn||(Gn={}));function Jv(){}function hSe(t,e){return y.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function pSe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return y.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const Es=Object.freeze({x:0,y:0});function gSe(t,e){const n=Hv(t);if(!n)return"0 0";const r={x:(n.x-e.left)/e.width*100,y:(n.y-e.top)/e.height*100};return r.x+"% "+r.y+"%"}function mSe(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function OSe(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function vSe(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),i=Math.min(e.left+e.width,t.left+t.width),s=Math.min(e.top+e.height,t.top+t.height),o=i-r,a=s-n;if(r<i&&n<s){const l=e.width*e.height,c=t.width*t.height,u=o*a,f=u/(l+c-u);return Number(f.toFixed(4))}return 0}const ySe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=[];for(const s of r){const{id:o}=s,a=n.get(o);if(a){const l=vSe(a,e);l>0&&i.push({id:o,data:{droppableContainer:s,value:l}})}}return i.sort(mSe)};function bSe(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function vZ(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Es}function xSe(t){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];return i.reduce((o,a)=>({...o,top:o.top+t*a.y,bottom:o.bottom+t*a.y,left:o.left+t*a.x,right:o.right+t*a.x}),{...n})}}const SSe=xSe(1);function yZ(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function wSe(t,e,n){const r=yZ(e);if(!r)return t;const{scaleX:i,scaleY:s,x:o,y:a}=r,l=t.left-o-(1-i)*parseFloat(n),c=t.top-a-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),u=i?t.width/i:t.width,f=s?t.height/s:t.height;return{width:u,height:f,top:c,right:l+u,bottom:c+f,left:l}}const CSe={ignoreTransform:!1};function qd(t,e){e===void 0&&(e=CSe);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:u}=Gr(t).getComputedStyle(t);c&&(n=wSe(n,c,u))}const{top:r,left:i,width:s,height:o,bottom:a,right:l}=n;return{top:r,left:i,width:s,height:o,bottom:a,right:l}}function B_(t){return qd(t,{ignoreTransform:!0})}function PSe(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function kSe(t,e){return e===void 0&&(e=Gr(t).getComputedStyle(t)),e.position==="fixed"}function TSe(t,e){e===void 0&&(e=Gr(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const s=e[i];return typeof s=="string"?n.test(s):!1})}function w$(t,e){const n=[];function r(i){if(e!=null&&n.length>=e||!i)return n;if(S$(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!ug(i)||gZ(i)||n.includes(i))return n;const s=Gr(t).getComputedStyle(i);return i!==t&&TSe(i,s)&&n.push(i),kSe(i,s)?n:r(i.parentNode)}return t?r(t):n}function bZ(t){const[e]=w$(t,1);return e??null}function hS(t){return!kb||!t?null:Wd(t)?t:x$(t)?S$(t)||t===Zd(t).scrollingElement?window:ug(t)?t:null:null}function xZ(t){return Wd(t)?t.scrollX:t.scrollLeft}function SZ(t){return Wd(t)?t.scrollY:t.scrollTop}function ZC(t){return{x:xZ(t),y:SZ(t)}}var tr;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(tr||(tr={}));function wZ(t){return!kb||!t?!1:t===document.scrollingElement}function CZ(t){const e={x:0,y:0},n=wZ(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},i=t.scrollTop<=e.y,s=t.scrollLeft<=e.x,o=t.scrollTop>=r.y,a=t.scrollLeft>=r.x;return{isTop:i,isLeft:s,isBottom:o,isRight:a,maxScroll:r,minScroll:e}}const $Se={x:.2,y:.2};function ISe(t,e,n,r,i){let{top:s,left:o,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=$Se);const{isTop:c,isBottom:u,isLeft:f,isRight:h}=CZ(t),p={x:0,y:0},m={x:0,y:0},g={height:e.height*i.y,width:e.width*i.x};return!c&&s<=e.top+g.height?(p.y=tr.Backward,m.y=r*Math.abs((e.top+g.height-s)/g.height)):!u&&l>=e.bottom-g.height&&(p.y=tr.Forward,m.y=r*Math.abs((e.bottom-g.height-l)/g.height)),!h&&a>=e.right-g.width?(p.x=tr.Forward,m.x=r*Math.abs((e.right-g.width-a)/g.width)):!f&&o<=e.left+g.width&&(p.x=tr.Backward,m.x=r*Math.abs((e.left+g.width-o)/g.width)),{direction:p,speed:m}}function ESe(t){if(t===document.scrollingElement){const{innerWidth:s,innerHeight:o}=window;return{top:0,left:0,right:s,bottom:o,width:s,height:o}}const{top:e,left:n,right:r,bottom:i}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:i,width:t.clientWidth,height:t.clientHeight}}function PZ(t){return t.reduce((e,n)=>Wu(e,ZC(n)),Es)}function ASe(t){return t.reduce((e,n)=>e+xZ(n),0)}function QSe(t){return t.reduce((e,n)=>e+SZ(n),0)}function kZ(t,e){if(e===void 0&&(e=qd),!t)return;const{top:n,left:r,bottom:i,right:s}=e(t);bZ(t)&&(i<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const RSe=[["x",["left","right"],ASe],["y",["top","bottom"],QSe]];class C${constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=w$(n),i=PZ(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,o,a]of RSe)for(const l of o)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=i[s]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ph{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var i;(i=this.target)==null||i.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function jSe(t){const{EventTarget:e}=Gr(t);return t instanceof e?t:Zd(t)}function pS(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var Li;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Li||(Li={}));function F_(t){t.preventDefault()}function _Se(t){t.stopPropagation()}var Yt;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter"})(Yt||(Yt={}));const TZ={start:[Yt.Space,Yt.Enter],cancel:[Yt.Esc],end:[Yt.Space,Yt.Enter]},DSe=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case Yt.Right:return{...n,x:n.x+25};case Yt.Left:return{...n,x:n.x-25};case Yt.Down:return{...n,y:n.y+25};case Yt.Up:return{...n,y:n.y-25}}};class $Z{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new ph(Zd(n)),this.windowListeners=new ph(Gr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Li.Resize,this.handleCancel),this.windowListeners.add(Li.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Li.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&kZ(r),n(Es)}handleKeyDown(e){if($b(e)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:s=TZ,coordinateGetter:o=DSe,scrollBehavior:a="smooth"}=i,{code:l}=e;if(s.end.includes(l)){this.handleEnd(e);return}if(s.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:Es;this.referenceCoordinates||(this.referenceCoordinates=u);const f=o(e,{active:n,context:r.current,currentCoordinates:u});if(f){const h=Gv(f,u),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const g of m){const O=e.code,{isTop:v,isRight:b,isLeft:x,isBottom:C,maxScroll:S,minScroll:T}=CZ(g),k=ESe(g),$={x:Math.min(O===Yt.Right?k.right-k.width/2:k.right,Math.max(O===Yt.Right?k.left:k.left+k.width/2,f.x)),y:Math.min(O===Yt.Down?k.bottom-k.height/2:k.bottom,Math.max(O===Yt.Down?k.top:k.top+k.height/2,f.y))},A=O===Yt.Right&&!b||O===Yt.Left&&!x,z=O===Yt.Down&&!C||O===Yt.Up&&!v;if(A&&$.x!==f.x){const M=g.scrollLeft+h.x,Q=O===Yt.Right&&M<=S.x||O===Yt.Left&&M>=T.x;if(Q&&!h.y){g.scrollTo({left:M,behavior:a});return}Q?p.x=g.scrollLeft-M:p.x=O===Yt.Right?g.scrollLeft-S.x:g.scrollLeft-T.x,p.x&&g.scrollBy({left:-p.x,behavior:a});break}else if(z&&$.y!==f.y){const M=g.scrollTop+h.y,Q=O===Yt.Down&&M<=S.y||O===Yt.Up&&M>=T.y;if(Q&&!h.x){g.scrollTo({top:M,behavior:a});return}Q?p.y=g.scrollTop-M:p.y=O===Yt.Down?g.scrollTop-S.y:g.scrollTop-T.y,p.y&&g.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(e,Wu(Gv(f,this.referenceCoordinates),p))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}$Z.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=TZ,onActivation:i}=e,{active:s}=n;const{code:o}=t.nativeEvent;if(r.start.includes(o)){const a=s.activatorNode.current;return a&&t.target!==a?!1:(t.preventDefault(),i?.({event:t.nativeEvent}),!0)}return!1}}];function Y_(t){return!!(t&&"distance"in t)}function G_(t){return!!(t&&"delay"in t)}class P${constructor(e,n,r){var i;r===void 0&&(r=jSe(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:s}=e,{target:o}=s;this.props=e,this.events=n,this.document=Zd(o),this.documentListeners=new ph(this.document),this.listeners=new ph(r),this.windowListeners=new ph(Gr(o)),this.initialCoordinates=(i=Hv(s))!=null?i:Es,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(Li.Resize,this.handleCancel),this.windowListeners.add(Li.DragStart,F_),this.windowListeners.add(Li.VisibilityChange,this.handleCancel),this.windowListeners.add(Li.ContextMenu,F_),this.documentListeners.add(Li.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(G_(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}if(Y_(n))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Li.Click,_Se,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Li.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:i,props:s}=this,{onMove:o,options:{activationConstraint:a}}=s;if(!i)return;const l=(n=Hv(e))!=null?n:Es,c=Gv(i,l);if(!r&&a){if(Y_(a)){if(a.tolerance!=null&&pS(c,a.tolerance))return this.handleCancel();if(pS(c,a.distance))return this.handleStart()}return G_(a)&&pS(c,a.tolerance)?this.handleCancel():void 0}e.cancelable&&e.preventDefault(),o(l)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===Yt.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const NSe={move:{name:"pointermove"},end:{name:"pointerup"}};class k$ extends P${constructor(e){const{event:n}=e,r=Zd(n.target);super(e,NSe,r)}}k$.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const MSe={move:{name:"mousemove"},end:{name:"mouseup"}};var qC;(function(t){t[t.RightClick=2]="RightClick"})(qC||(qC={}));class zSe extends P${constructor(e){super(e,MSe,Zd(e.event.target))}}zSe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===qC.RightClick?!1:(r?.({event:n}),!0)}}];const gS={move:{name:"touchmove"},end:{name:"touchend"}};class VSe extends P${constructor(e){super(e,gS)}static setup(){return window.addEventListener(gS.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(gS.move.name,e)};function e(){}}}VSe.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var gh;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(gh||(gh={}));var Kv;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Kv||(Kv={}));function LSe(t){let{acceleration:e,activator:n=gh.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:o=5,order:a=Kv.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:h}=t;const p=WSe({delta:f,disabled:!s}),[m,g]=eSe(),O=y.useRef({x:0,y:0}),v=y.useRef({x:0,y:0}),b=y.useMemo(()=>{switch(n){case gh.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case gh.DraggableRect:return i}},[n,i,l]),x=y.useRef(null),C=y.useCallback(()=>{const T=x.current;if(!T)return;const k=O.current.x*v.current.x,$=O.current.y*v.current.y;T.scrollBy(k,$)},[]),S=y.useMemo(()=>a===Kv.TreeOrder?[...c].reverse():c,[a,c]);y.useEffect(()=>{if(!s||!c.length||!b){g();return}for(const T of S){if(r?.(T)===!1)continue;const k=c.indexOf(T),$=u[k];if(!$)continue;const{direction:A,speed:z}=ISe(T,$,b,e,h);for(const M of["x","y"])p[M][A[M]]||(z[M]=0,A[M]=0);if(z.x>0||z.y>0){g(),x.current=T,m(C,o),O.current=z,v.current=A;return}}O.current={x:0,y:0},v.current={x:0,y:0},g()},[e,C,r,g,s,o,JSON.stringify(b),JSON.stringify(p),m,c,S,u,JSON.stringify(h)])}const XSe={x:{[tr.Backward]:!1,[tr.Forward]:!1},y:{[tr.Backward]:!1,[tr.Forward]:!1}};function WSe(t){let{delta:e,disabled:n}=t;const r=Yv(e);return dg(i=>{if(n||!r||!i)return XSe;const s={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[tr.Backward]:i.x[tr.Backward]||s.x===-1,[tr.Forward]:i.x[tr.Forward]||s.x===1},y:{[tr.Backward]:i.y[tr.Backward]||s.y===-1,[tr.Forward]:i.y[tr.Forward]||s.y===1}}},[n,e,r])}function ZSe(t,e){const n=e!==null?t.get(e):void 0,r=n?n.node.current:null;return dg(i=>{var s;return e===null?null:(s=r??i)!=null?s:null},[r,e])}function qSe(t,e){return y.useMemo(()=>t.reduce((n,r)=>{const{sensor:i}=r,s=i.activators.map(o=>({eventName:o.eventName,handler:e(o.handler,r)}));return[...n,...s]},[]),[t,e])}var mp;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(mp||(mp={}));var UC;(function(t){t.Optimized="optimized"})(UC||(UC={}));const H_=new Map;function USe(t,e){let{dragging:n,dependencies:r,config:i}=e;const[s,o]=y.useState(null),{frequency:a,measure:l,strategy:c}=i,u=y.useRef(t),f=O(),h=gp(f),p=y.useCallback(function(v){v===void 0&&(v=[]),!h.current&&o(b=>b===null?v:b.concat(v.filter(x=>!b.includes(x))))},[h]),m=y.useRef(null),g=dg(v=>{if(f&&!n)return H_;if(!v||v===H_||u.current!==t||s!=null){const b=new Map;for(let x of t){if(!x)continue;if(s&&s.length>0&&!s.includes(x.id)&&x.rect.current){b.set(x.id,x.rect.current);continue}const C=x.node.current,S=C?new C$(l(C),C):null;x.rect.current=S,S&&b.set(x.id,S)}return b}return v},[t,s,n,f,l]);return y.useEffect(()=>{u.current=t},[t]),y.useEffect(()=>{f||p()},[n,f]),y.useEffect(()=>{s&&s.length>0&&o(null)},[JSON.stringify(s)]),y.useEffect(()=>{f||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},a))},[a,f,p,...r]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:s!=null};function O(){switch(c){case mp.Always:return!1;case mp.BeforeDragging:return n;default:return!n}}}function T$(t,e){return dg(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function BSe(t,e){return T$(t,e)}function FSe(t){let{callback:e,disabled:n}=t;const r=Tb(e),i=y.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return y.useEffect(()=>()=>i?.disconnect(),[i]),i}function Ib(t){let{callback:e,disabled:n}=t;const r=Tb(e),i=y.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return y.useEffect(()=>()=>i?.disconnect(),[i]),i}function YSe(t){return new C$(qd(t),t)}function J_(t,e,n){e===void 0&&(e=YSe);const[r,i]=y.useReducer(a,null),s=FSe({callback(l){if(t)for(const c of l){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(t)){i();break}}}}),o=Ib({callback:i});return rs(()=>{i(),t?(o?.observe(t),s?.observe(document.body,{childList:!0,subtree:!0})):(o?.disconnect(),s?.disconnect())},[t]),r;function a(l){if(!t)return null;if(t.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=e(t);return JSON.stringify(l)===JSON.stringify(u)?l:u}}function GSe(t){const e=T$(t);return vZ(t,e)}const K_=[];function HSe(t){const e=y.useRef(t),n=dg(r=>t?r&&r!==K_&&t&&e.current&&t.parentNode===e.current.parentNode?r:w$(t):K_,[t]);return y.useEffect(()=>{e.current=t},[t]),n}function JSe(t){const[e,n]=y.useState(null),r=y.useRef(t),i=y.useCallback(s=>{const o=hS(s.target);o&&n(a=>a?(a.set(o,ZC(o)),new Map(a)):null)},[]);return y.useEffect(()=>{const s=r.current;if(t!==s){o(s);const a=t.map(l=>{const c=hS(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,ZC(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=t}return()=>{o(t),o(s)};function o(a){a.forEach(l=>{const c=hS(l);c?.removeEventListener("scroll",i)})}},[i,t]),y.useMemo(()=>t.length?e?Array.from(e.values()).reduce((s,o)=>Wu(s,o),Es):PZ(t):Es,[t,e])}function e5(t,e){e===void 0&&(e=[]);const n=y.useRef(null);return y.useEffect(()=>{n.current=null},e),y.useEffect(()=>{const r=t!==Es;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?Gv(t,n.current):Es}function KSe(t){y.useEffect(()=>{if(!kb)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function e1e(t,e){return y.useMemo(()=>t.reduce((n,r)=>{let{eventName:i,handler:s}=r;return n[i]=o=>{s(o,e)},n},{}),[t,e])}function IZ(t){return y.useMemo(()=>t?PSe(t):null,[t])}const mS=[];function t1e(t,e){e===void 0&&(e=qd);const[n]=t,r=IZ(n?Gr(n):null),[i,s]=y.useReducer(a,mS),o=Ib({callback:s});return t.length>0&&i===mS&&s(),rs(()=>{t.length?t.forEach(l=>o?.observe(l)):(o?.disconnect(),s())},[t]),i;function a(){return t.length?t.map(l=>wZ(l)?r:new C$(e(l),l)):mS}}function EZ(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return ug(e)?e:t}function n1e(t){let{measure:e}=t;const[n,r]=y.useState(null),i=y.useCallback(c=>{for(const{target:u}of c)if(ug(u)){r(f=>{const h=e(u);return f?{...f,width:h.width,height:h.height}:h});break}},[e]),s=Ib({callback:i}),o=y.useCallback(c=>{const u=EZ(c);s?.disconnect(),u&&s?.observe(u),r(u?e(u):null)},[e,s]),[a,l]=Fv(o);return y.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const r1e=[{sensor:k$,options:{}},{sensor:$Z,options:{}}],i1e={current:{}},dO={draggable:{measure:B_},droppable:{measure:B_,strategy:mp.WhileDragging,frequency:UC.Optimized},dragOverlay:{measure:qd}};class mh extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const s1e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new mh,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Jv},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:dO,measureDroppableContainers:Jv,windowRect:null,measuringScheduled:!1},AZ={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Jv,draggableNodes:new Map,over:null,measureDroppableContainers:Jv},hg=y.createContext(AZ),QZ=y.createContext(s1e);function o1e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new mh}}}function a1e(t,e){switch(e.type){case Gn.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Gn.DragMove:return t.draggable.active?{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}}:t;case Gn.DragEnd:case Gn.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Gn.RegisterDroppable:{const{element:n}=e,{id:r}=n,i=new mh(t.droppable.containers);return i.set(r,n),{...t,droppable:{...t.droppable,containers:i}}}case Gn.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const o=new mh(t.droppable.containers);return o.set(n,{...s,disabled:i}),{...t,droppable:{...t.droppable,containers:o}}}case Gn.UnregisterDroppable:{const{id:n,key:r}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const s=new mh(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function l1e(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:i}=y.useContext(hg),s=Yv(r),o=Yv(n?.id);return y.useEffect(()=>{if(!e&&!r&&s&&o!=null){if(!$b(s)||document.activeElement===s.target)return;const a=i.get(o);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const f=rSe(u);if(f){f.focus();break}}})}},[r,e,i,o,s]),null}function RZ(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((i,s)=>s({transform:i,...r}),n):n}function c1e(t){return y.useMemo(()=>({draggable:{...dO.draggable,...t?.draggable},droppable:{...dO.droppable,...t?.droppable},dragOverlay:{...dO.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function u1e(t){let{activeNode:e,measure:n,initialRect:r,config:i=!0}=t;const s=y.useRef(!1),{x:o,y:a}=typeof i=="boolean"?{x:i,y:i}:i;rs(()=>{if(!o&&!a||!e){s.current=!1;return}if(s.current||!r)return;const c=e?.node.current;if(!c||c.isConnected===!1)return;const u=n(c),f=vZ(u,r);if(o||(f.x=0),a||(f.y=0),s.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=bZ(c);h&&h.scrollBy({top:f.y,left:f.x})}},[e,o,a,r,n])}const Eb=y.createContext({...Es,scaleX:1,scaleY:1});var Va;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Va||(Va={}));const d1e=y.memo(function(e){var n,r,i,s;let{id:o,accessibility:a,autoScroll:l=!0,children:c,sensors:u=r1e,collisionDetection:f=ySe,measuring:h,modifiers:p,...m}=e;const g=y.useReducer(a1e,void 0,o1e),[O,v]=g,[b,x]=cSe(),[C,S]=y.useState(Va.Uninitialized),T=C===Va.Initialized,{draggable:{active:k,nodes:$,translate:A},droppable:{containers:z}}=O,M=k?$.get(k):null,Q=y.useRef({initial:null,translated:null}),_=y.useMemo(()=>{var Te;return k!=null?{id:k,data:(Te=M?.data)!=null?Te:i1e,rect:Q}:null},[k,M]),j=y.useRef(null),[D,I]=y.useState(null),[V,L]=y.useState(null),B=gp(m,Object.values(m)),Z=fg("DndDescribedBy",o),q=y.useMemo(()=>z.getEnabled(),[z]),F=c1e(h),{droppableRects:Y,measureDroppableContainers:re,measuringScheduled:ee}=USe(q,{dragging:T,dependencies:[A.x,A.y],config:F.droppable}),se=ZSe($,k),J=y.useMemo(()=>V?Hv(V):null,[V]),Oe=xe(),ge=BSe(se,F.draggable.measure);u1e({activeNode:k?$.get(k):null,config:Oe.layoutShiftCompensation,initialRect:ge,measure:F.draggable.measure});const ye=J_(se,F.draggable.measure,ge),je=J_(se?se.parentElement:null),fe=y.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:$,draggingNode:null,draggingNodeRect:null,droppableContainers:z,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ae=z.getNodeFor((n=fe.current.over)==null?void 0:n.id),be=n1e({measure:F.dragOverlay.measure}),Ye=(r=be.nodeRef.current)!=null?r:se,Je=T?(i=be.rect)!=null?i:ye:null,yt=!!(be.nodeRef.current&&be.rect),gt=GSe(yt?null:ye),It=IZ(Ye?Gr(Ye):null),Qt=HSe(T?Ae??se:null),Ke=t1e(Qt),ut=RZ(p,{transform:{x:A.x-gt.x,y:A.y-gt.y,scaleX:1,scaleY:1},activatorEvent:V,active:_,activeNodeRect:ye,containerNodeRect:je,draggingNodeRect:Je,over:fe.current.over,overlayNodeRect:be.rect,scrollableAncestors:Qt,scrollableAncestorRects:Ke,windowRect:It}),kt=J?Wu(J,A):null,dt=JSe(Qt),un=e5(dt),Dt=e5(dt,[ye]),dn=Wu(ut,un),P=Je?SSe(Je,ut):null,H=_&&P?f({active:_,collisionRect:P,droppableRects:Y,droppableContainers:q,pointerCoordinates:kt}):null,ce=OSe(H,"id"),[he,ae]=y.useState(null),we=yt?ut:Wu(ut,Dt),R=bSe(we,(s=he?.rect)!=null?s:null,ye),G=y.useCallback((Te,$e)=>{let{sensor:Ee,options:Re}=$e;if(j.current==null)return;const ze=$.get(j.current);if(!ze)return;const Ue=Te.nativeEvent,Tn=new Ee({active:j.current,activeNode:ze,event:Ue,options:Re,context:fe,onStart(_e){const it=j.current;if(it==null)return;const Jt=$.get(it);if(!Jt)return;const{onDragStart:Kn}=B.current,Vn={active:{id:it,data:Jt.data,rect:Q}};ro.unstable_batchedUpdates(()=>{Kn?.(Vn),S(Va.Initializing),v({type:Gn.DragStart,initialCoordinates:_e,active:it}),b({type:"onDragStart",event:Vn})})},onMove(_e){v({type:Gn.DragMove,coordinates:_e})},onEnd:Gt(Gn.DragEnd),onCancel:Gt(Gn.DragCancel)});ro.unstable_batchedUpdates(()=>{I(Tn),L(Te.nativeEvent)});function Gt(_e){return async function(){const{active:Jt,collisions:Kn,over:Vn,scrollAdjustedTranslate:Ro}=fe.current;let di=null;if(Jt&&Ro){const{cancelDrop:vr}=B.current;di={activatorEvent:Ue,active:Jt,collisions:Kn,delta:Ro,over:Vn},_e===Gn.DragEnd&&typeof vr=="function"&&await Promise.resolve(vr(di))&&(_e=Gn.DragCancel)}j.current=null,ro.unstable_batchedUpdates(()=>{v({type:_e}),S(Va.Uninitialized),ae(null),I(null),L(null);const vr=_e===Gn.DragEnd?"onDragEnd":"onDragCancel";if(di){const Hr=B.current[vr];Hr?.(di),b({type:vr,event:di})}})}}},[$]),de=y.useCallback((Te,$e)=>(Ee,Re)=>{const ze=Ee.nativeEvent,Ue=$.get(Re);if(j.current!==null||!Ue||ze.dndKit||ze.defaultPrevented)return;const Tn={active:Ue};Te(Ee,$e.options,Tn)===!0&&(ze.dndKit={capturedBy:$e.sensor},j.current=Re,G(Ee,$e))},[$,G]),le=qSe(u,de);KSe(u),rs(()=>{ye&&C===Va.Initializing&&S(Va.Initialized)},[ye,C]),y.useEffect(()=>{const{onDragMove:Te}=B.current,{active:$e,activatorEvent:Ee,collisions:Re,over:ze}=fe.current;if(!$e||!Ee)return;const Ue={active:$e,activatorEvent:Ee,collisions:Re,delta:{x:dn.x,y:dn.y},over:ze};ro.unstable_batchedUpdates(()=>{Te?.(Ue),b({type:"onDragMove",event:Ue})})},[dn.x,dn.y]),y.useEffect(()=>{const{active:Te,activatorEvent:$e,collisions:Ee,droppableContainers:Re,scrollAdjustedTranslate:ze}=fe.current;if(!Te||j.current==null||!$e||!ze)return;const{onDragOver:Ue}=B.current,Tn=Re.get(ce),Gt=Tn&&Tn.rect.current?{id:Tn.id,rect:Tn.rect.current,data:Tn.data,disabled:Tn.disabled}:null,_e={active:Te,activatorEvent:$e,collisions:Ee,delta:{x:ze.x,y:ze.y},over:Gt};ro.unstable_batchedUpdates(()=>{ae(Gt),Ue?.(_e),b({type:"onDragOver",event:_e})})},[ce]),rs(()=>{fe.current={activatorEvent:V,active:_,activeNode:se,collisionRect:P,collisions:H,droppableRects:Y,draggableNodes:$,draggingNode:Ye,draggingNodeRect:Je,droppableContainers:z,over:he,scrollableAncestors:Qt,scrollAdjustedTranslate:dn},Q.current={initial:Je,translated:P}},[_,se,H,P,$,Ye,Je,Y,z,he,Qt,dn]),LSe({...Oe,delta:A,draggingRect:P,pointerCoordinates:kt,scrollableAncestors:Qt,scrollableAncestorRects:Ke});const ue=y.useMemo(()=>({active:_,activeNode:se,activeNodeRect:ye,activatorEvent:V,collisions:H,containerNodeRect:je,dragOverlay:be,draggableNodes:$,droppableContainers:z,droppableRects:Y,over:he,measureDroppableContainers:re,scrollableAncestors:Qt,scrollableAncestorRects:Ke,measuringConfiguration:F,measuringScheduled:ee,windowRect:It}),[_,se,ye,V,H,je,be,$,z,Y,he,re,Qt,Ke,F,ee,It]),Se=y.useMemo(()=>({activatorEvent:V,activators:le,active:_,activeNodeRect:ye,ariaDescribedById:{draggable:Z},dispatch:v,draggableNodes:$,over:he,measureDroppableContainers:re}),[V,le,_,ye,v,Z,$,he,re]);return U.default.createElement(OZ.Provider,{value:x},U.default.createElement(hg.Provider,{value:Se},U.default.createElement(QZ.Provider,{value:ue},U.default.createElement(Eb.Provider,{value:R},c)),U.default.createElement(l1e,{disabled:a?.restoreFocus===!1})),U.default.createElement(fSe,{...a,hiddenTextDescribedById:Z}));function xe(){const Te=D?.autoScrollEnabled===!1,$e=typeof l=="object"?l.enabled===!1:l===!1,Ee=T&&!Te&&!$e;return typeof l=="object"?{...l,enabled:Ee}:{enabled:Ee}}}),f1e=y.createContext(null),t5="button",h1e="Droppable";function p1e(t){let{id:e,data:n,disabled:r=!1,attributes:i}=t;const s=fg(h1e),{activators:o,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:h}=y.useContext(hg),{role:p=t5,roleDescription:m="draggable",tabIndex:g=0}=i??{},O=l?.id===e,v=y.useContext(O?Eb:f1e),[b,x]=Fv(),[C,S]=Fv(),T=e1e(o,e),k=gp(n);rs(()=>(f.set(e,{id:e,key:s,node:b,activatorNode:C,data:k}),()=>{const A=f.get(e);A&&A.key===s&&f.delete(e)}),[f,e]);const $=y.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":r,"aria-pressed":O&&p===t5?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,g,O,m,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:$,isDragging:O,listeners:r?void 0:T,node:b,over:h,setNodeRef:x,setActivatorNodeRef:S,transform:v}}function jZ(){return y.useContext(QZ)}const g1e="Droppable",m1e={timeout:25};function O1e(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:i}=t;const s=fg(g1e),{active:o,dispatch:a,over:l,measureDroppableContainers:c}=y.useContext(hg),u=y.useRef({disabled:n}),f=y.useRef(!1),h=y.useRef(null),p=y.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:O}={...m1e,...i},v=gp(g??r),b=y.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(v.current)?v.current:[v.current]),p.current=null},O)},[O]),x=Ib({callback:b,disabled:m||!o}),C=y.useCallback(($,A)=>{x&&(A&&(x.unobserve(A),f.current=!1),$&&x.observe($))},[x]),[S,T]=Fv(C),k=gp(e);return y.useEffect(()=>{!x||!S.current||(x.disconnect(),f.current=!1,x.observe(S.current))},[S,x]),rs(()=>(a({type:Gn.RegisterDroppable,element:{id:r,key:s,disabled:n,node:S,rect:h,data:k}}),()=>a({type:Gn.UnregisterDroppable,key:s,id:r})),[r]),y.useEffect(()=>{n!==u.current.disabled&&(a({type:Gn.SetDroppableDisabled,id:r,key:s,disabled:n}),u.current.disabled=n)},[r,s,n,a]),{active:o,rect:h,isOver:l?.id===r,node:S,over:l,setNodeRef:T}}function v1e(t){let{animation:e,children:n}=t;const[r,i]=y.useState(null),[s,o]=y.useState(null),a=Yv(n);return!n&&!r&&a&&i(a),rs(()=>{if(!s)return;const l=r?.key,c=r?.props.id;if(l==null||c==null){i(null);return}Promise.resolve(e(c,s)).then(()=>{i(null)})},[e,r,s]),U.default.createElement(U.default.Fragment,null,n,r?y.cloneElement(r,{ref:o}):null)}const y1e={x:0,y:0,scaleX:1,scaleY:1};function b1e(t){let{children:e}=t;return U.default.createElement(hg.Provider,{value:AZ},U.default.createElement(Eb.Provider,{value:y1e},e))}const x1e={position:"fixed",touchAction:"none"},S1e=t=>$b(t)?"transform 250ms ease":void 0,w1e=y.forwardRef((t,e)=>{let{as:n,activatorEvent:r,adjustScale:i,children:s,className:o,rect:a,style:l,transform:c,transition:u=S1e}=t;if(!a)return null;const f=i?c:{...c,scaleX:1,scaleY:1},h={...x1e,width:a.width,height:a.height,top:a.top,left:a.left,transform:ll.Transform.toString(f),transformOrigin:i&&r?gSe(r,a):void 0,transition:typeof u=="function"?u(r):u,...l};return U.default.createElement(n,{className:o,style:h,ref:e},s)}),C1e=t=>e=>{let{active:n,dragOverlay:r}=e;const i={},{styles:s,className:o}=t;if(s!=null&&s.active)for(const[a,l]of Object.entries(s.active))l!==void 0&&(i[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(s!=null&&s.dragOverlay)for(const[a,l]of Object.entries(s.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(const[l,c]of Object.entries(i))n.node.style.setProperty(l,c);o!=null&&o.active&&n.node.classList.remove(o.active)}},P1e=t=>{let{transform:{initial:e,final:n}}=t;return[{transform:ll.Transform.toString(e)},{transform:ll.Transform.toString(n)}]},k1e={duration:250,easing:"ease",keyframes:P1e,sideEffects:C1e({styles:{active:{opacity:"0"}}})};function T1e(t){let{config:e,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=t;return Tb((s,o)=>{if(e===null)return;const a=n.get(s);if(!a)return;const l=a.node.current;if(!l)return;const c=EZ(o);if(!c)return;const{transform:u}=Gr(o).getComputedStyle(o),f=yZ(u);if(!f)return;const h=typeof e=="function"?e:$1e(e);return kZ(l,i.draggable.measure),h({active:{id:s,data:a.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:o,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:f})})}function $1e(t){const{duration:e,easing:n,sideEffects:r,keyframes:i}={...k1e,...t};return s=>{let{active:o,dragOverlay:a,transform:l,...c}=s;if(!e)return;const u={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},f={scaleX:l.scaleX!==1?o.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?o.rect.height*l.scaleY/a.rect.height:1},h={x:l.x-u.x,y:l.y-u.y,...f},p=i({...c,active:o,dragOverlay:a,transform:{initial:l,final:h}}),[m]=p,g=p[p.length-1];if(JSON.stringify(m)===JSON.stringify(g))return;const O=r?.({active:o,dragOverlay:a,...c}),v=a.node.animate(p,{duration:e,easing:n,fill:"forwards"});return new Promise(b=>{v.onfinish=()=>{O?.(),b()}})}}let n5=0;function I1e(t){return y.useMemo(()=>{if(t!=null)return n5++,n5},[t])}const E1e=U.default.memo(t=>{let{adjustScale:e=!1,children:n,dropAnimation:r,style:i,transition:s,modifiers:o,wrapperElement:a="div",className:l,zIndex:c=999}=t;const{activatorEvent:u,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:m,droppableContainers:g,dragOverlay:O,over:v,measuringConfiguration:b,scrollableAncestors:x,scrollableAncestorRects:C,windowRect:S}=jZ(),T=y.useContext(Eb),k=I1e(f?.id),$=RZ(o,{activatorEvent:u,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:O.rect,over:v,overlayNodeRect:O.rect,scrollableAncestors:x,scrollableAncestorRects:C,transform:T,windowRect:S}),A=T$(h),z=T1e({config:r,draggableNodes:m,droppableContainers:g,measuringConfiguration:b}),M=A?O.setRef:void 0;return U.default.createElement(b1e,null,U.default.createElement(v1e,{animation:z},f&&k?U.default.createElement(w1e,{key:k,id:f.id,ref:M,as:a,activatorEvent:u,adjustScale:e,className:l,transition:s,rect:A,style:{zIndex:c,...i},transform:$},n):null))});function _Z(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function A1e(t,e){return t.reduce((n,r,i)=>{const s=e.get(r);return s&&(n[i]=s),n},Array(t.length))}function ym(t){return t!==null&&t>=0}function Q1e(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function R1e(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const bm={scaleX:1,scaleY:1},j1e=t=>{var e;let{rects:n,activeNodeRect:r,activeIndex:i,overIndex:s,index:o}=t;const a=(e=n[i])!=null?e:r;if(!a)return null;const l=_1e(n,o,i);if(o===i){const c=n[s];return c?{x:i<s?c.left+c.width-(a.left+a.width):c.left-a.left,y:0,...bm}:null}return o>i&&o<=s?{x:-a.width-l,y:0,...bm}:o<i&&o>=s?{x:a.width+l,y:0,...bm}:{x:0,y:0,...bm}};function _1e(t,e,n){const r=t[e],i=t[e-1],s=t[e+1];return!r||!i&&!s?0:n<e?i?r.left-(i.left+i.width):s.left-(r.left+r.width):s?s.left-(r.left+r.width):r.left-(i.left+i.width)}const DZ=t=>{let{rects:e,activeIndex:n,overIndex:r,index:i}=t;const s=_Z(e,r,n),o=e[i],a=s[i];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},NZ="Sortable",MZ=U.default.createContext({activeIndex:-1,containerId:NZ,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:DZ,disabled:{draggable:!1,droppable:!1}});function D1e(t){let{children:e,id:n,items:r,strategy:i=DZ,disabled:s=!1}=t;const{active:o,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=jZ(),f=fg(NZ,n),h=a.rect!==null,p=y.useMemo(()=>r.map(T=>typeof T=="object"&&"id"in T?T.id:T),[r]),m=o!=null,g=o?p.indexOf(o.id):-1,O=c?p.indexOf(c.id):-1,v=y.useRef(p),b=!Q1e(p,v.current),x=O!==-1&&g===-1||b,C=R1e(s);rs(()=>{b&&m&&u(p)},[b,p,m,u]),y.useEffect(()=>{v.current=p},[p]);const S=y.useMemo(()=>({activeIndex:g,containerId:f,disabled:C,disableTransforms:x,items:p,overIndex:O,useDragOverlay:h,sortedRects:A1e(p,l),strategy:i}),[g,f,C.draggable,C.droppable,x,p,O,l,h,i]);return U.default.createElement(MZ.Provider,{value:S},e)}const N1e=t=>{let{id:e,items:n,activeIndex:r,overIndex:i}=t;return _Z(n,r,i).indexOf(e)},M1e=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:i,items:s,newIndex:o,previousItems:a,previousContainerId:l,transition:c}=t;return!c||!r||a!==s&&i===o?!1:n?!0:o!==i&&e===l},z1e={duration:200,easing:"ease"},zZ="transform",V1e=ll.Transition.toString({property:zZ,duration:0,easing:"linear"}),L1e={roleDescription:"sortable"};function X1e(t){let{disabled:e,index:n,node:r,rect:i}=t;const[s,o]=y.useState(null),a=y.useRef(n);return rs(()=>{if(!e&&n!==a.current&&r.current){const l=i.current;if(l){const c=qd(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&o(u)}}n!==a.current&&(a.current=n)},[e,n,r,i]),y.useEffect(()=>{s&&o(null)},[s]),s}function W1e(t){let{animateLayoutChanges:e=M1e,attributes:n,disabled:r,data:i,getNewIndex:s=N1e,id:o,strategy:a,resizeObserverConfig:l,transition:c=z1e}=t;const{items:u,containerId:f,activeIndex:h,disabled:p,disableTransforms:m,sortedRects:g,overIndex:O,useDragOverlay:v,strategy:b}=y.useContext(MZ),x=Z1e(r,p),C=u.indexOf(o),S=y.useMemo(()=>({sortable:{containerId:f,index:C,items:u},...i}),[f,i,C,u]),T=y.useMemo(()=>u.slice(u.indexOf(o)),[u,o]),{rect:k,node:$,isOver:A,setNodeRef:z}=O1e({id:o,data:S,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...l}}),{active:M,activatorEvent:Q,activeNodeRect:_,attributes:j,setNodeRef:D,listeners:I,isDragging:V,over:L,setActivatorNodeRef:B,transform:Z}=p1e({id:o,data:S,attributes:{...L1e,...n},disabled:x.draggable}),q=Kxe(z,D),F=!!M,Y=F&&!m&&ym(h)&&ym(O),re=!v&&V,ee=re&&Y?Z:null,J=Y?ee??(a??b)({rects:g,activeNodeRect:_,activeIndex:h,overIndex:O,index:C}):null,Oe=ym(h)&&ym(O)?s({id:o,items:u,activeIndex:h,overIndex:O}):C,ge=M?.id,ye=y.useRef({activeId:ge,items:u,newIndex:Oe,containerId:f}),je=u!==ye.current.items,fe=e({active:M,containerId:f,isDragging:V,isSorting:F,id:o,index:C,items:u,newIndex:ye.current.newIndex,previousItems:ye.current.items,previousContainerId:ye.current.containerId,transition:c,wasDragging:ye.current.activeId!=null}),Ae=X1e({disabled:!fe,index:C,node:$,rect:k});return y.useEffect(()=>{F&&ye.current.newIndex!==Oe&&(ye.current.newIndex=Oe),f!==ye.current.containerId&&(ye.current.containerId=f),u!==ye.current.items&&(ye.current.items=u)},[F,Oe,f,u]),y.useEffect(()=>{if(ge===ye.current.activeId)return;if(ge&&!ye.current.activeId){ye.current.activeId=ge;return}const Ye=setTimeout(()=>{ye.current.activeId=ge},50);return()=>clearTimeout(Ye)},[ge]),{active:M,activeIndex:h,attributes:j,data:S,rect:k,index:C,newIndex:Oe,items:u,isOver:A,isSorting:F,isDragging:V,listeners:I,node:$,overIndex:O,over:L,setNodeRef:q,setActivatorNodeRef:B,setDroppableNodeRef:z,setDraggableNodeRef:D,transform:Ae??J,transition:be()};function be(){if(Ae||je&&ye.current.newIndex===C)return V1e;if(!(re&&!$b(Q)||!c)&&(F||fe))return ll.Transition.toString({...c,property:zZ})}}function Z1e(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}Yt.Down,Yt.Right,Yt.Up,Yt.Left;const Le=w.default.div`
|
|
770
770
|
border-right: 1px solid var(--border-color-secondary);
|
|
771
771
|
align-self: stretch;
|
|
772
|
-
`;function q1e(){const t=y.useRef(null),[e,n]=y.useState(!1);return jP.useMount(()=>{const r=t.current,i=()=>{r&&n(r.scrollWidth>r.clientWidth)};i();const s=new MutationObserver(()=>{i()});return r&&s.observe(r,{childList:!0,subtree:!0,attributes:!1}),window.addEventListener("resize",i),()=>{r&&s.disconnect(),window.removeEventListener("resize",i)}}),{containerRef:t,hasScrollbar:e}}const et={SECURITY:"Security",BODY:"Body",PATH:"Path",QUERY:"Query",HEADERS:"Headers",COOKIES:"Cookies",COMPONENTS:"Components",SOURCES:"Sources",STEP_SETTINGS:"Step settings",WORKFLOW_SETTINGS:"Workflow settings",COLLECTION_SETTINGS:"Collection settings"};function r5(t){return t.some(e=>!!(e.key||e.value||e.files?.length))}function U1e({type:t,formData:e,content:n}){if($v.includes(t)){const r=r5(e["multipart/form-data"]),i=r5(e["application/x-www-form-urlencoded"]);return!r&&!i}return Due.includes(t)?n.length===0:!0}function VZ(t){const{disableCollectionsTab:e}=Yr();return y.useMemo(()=>{const n=[{name:et.SECURITY,icon:d.jsx(xM.SecurityIcon,{})},{name:et.BODY,icon:d.jsx(kp.CodeIcon,{})},{name:et.PATH,icon:d.jsx(bM.DataRefineryIcon,{})},{name:et.QUERY,icon:d.jsx(yM.DataFormatIcon,{})},{name:et.HEADERS,icon:d.jsx(DP.TableBuiltIcon,{})},{name:et.COOKIES,icon:d.jsx(_P.CookieIcon,{})}];return!e.get()&&!t&&n.push({name:et.STEP_SETTINGS,icon:d.jsx(Tp.SettingsCogIcon,{})}),n},[e,t])}function Fl(t){return U1e(t.requestBody)?et.QUERY:et.BODY}function BC(t){return t.type==="step"}function FC(t){return t.type==="workflow"}function $$(t,e){const n=[],r=[];for(const s of e)s.active&&Ep(s)?n.push(s):r.push(s);return[...t.map((s,o)=>{const l=n[o]?.id??s.id;return{...s,id:l}}),...r]}function B1e(){return structuredClone({id:crypto.randomUUID(),state:Cn.Normal,data:{stepId:null,collectionId:null,workflowId:null,historyId:null,type:De.Step,draftStep:Co(),response:null,activeTabIdx:0,requestError:null,isProcessingRequest:!1,satisfiesScheme:!0}})}function F1e(t){return t!==void 0&&t.data?.type?.get()===De.Step}function Y1e(t,e){const n=e.data.collectionId.get(),r=e.data.workflowId.get(),i=e.data.stepId.get();return n&&r&&i?m$(t,{collectionId:n,workflowId:r,stepId:i})??e.data.draftStep.ornull:e.data.draftStep.ornull}function G1e(t,e,n,r,i,s){const o=a=>a??"";return o(t)===r&&o(e)===i&&o(n)===s}const YC="New workflow";function LZ({name:t=YC,collection:e}){let r=(t.trim().replace(/[^a-zA-Z0-9\-_\s]/g,"").replace(/\s+/g," ")||YC).replaceAll(" ","-").toLowerCase();if(!e)return r;const i=H1e(e);if(i.includes(r)){let s=1;for(;i.includes(`${r}-${s}`);)s++;r=`${r}-${s}`}return r}function H1e(t){return t.workflows.filter(e=>e.state.get()!==At.Draft).map(e=>e.workflowId.get())}function I$({name:t=YC,isDraft:e=!1,collection:n}={}){return{workflowId:LZ({name:t,collection:n}),summary:t,steps:[],state:e?At.Draft:At.Normal,outputs:[],parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},security:[os()]}}function J1e(t,e){const n=new Set,{pathParameters:r,queryParameters:i,headers:s,cookies:o}=t.parameters.get(),a=t.outputs.get();for(const{value:l}of[...gn([...r,...i,...s,...o],e?.components.parameters.get()),...a])for(const c of Qa(l))n.add(c);return t.steps.forEach(l=>{const c=l.security.get();for(const O of c)switch(O.securityType){case te.BasicAuth:case te.DigestAuth:for(const b of[O[O.securityType].username,O[O.securityType].password])for(const x of Qa(b))n.add(x);break;case te.JWT:for(const b of Qa(O[O.securityType].token))n.add(b);break;case te.APIKey:for(const b of Qa(O[O.securityType].key))n.add(b);break;case te.OAuth2:case te.OpenIDConnect:const v=O[O.securityType];for(const b of Qa(v[v.grantType].accessToken))n.add(b);break}const{pathParameters:u,queryParameters:f,headers:h,cookies:p}=l.parameters.get(),m=l.outputs.get();for(const{value:O}of[...gn([...u,...f,...h,...p],e?.components.parameters.get()),...m])for(const v of Qa(O))n.add(v);const g=l.requestBody.get();switch(g.type){case"multipart/form-data":case"application/x-www-form-urlencoded":{for(const{value:O}of g.formData[g.type])for(const v of Qa(O))n.add(v);break}case"application/octet-stream":break;default:for(const O of Qa(g.content))n.add(O)}}),n}function XZ(t,e,n){const r=J1e(t,n);if(r.size===0){t.inputs.set(Ot);return}t.inputs.set(i=>{const s=typeof i=="object"&&i?.properties||{};return{type:"object",properties:Object.fromEntries(Array.from(r).map(o=>{const a=e.inputs.find(l=>l.name.get()===o)?.isSecret;return[o,a?{type:"string",format:"password"}:s[o]||{type:"string"}]}))}})}function Ud(t){return t.summary||t.workflowId||"Untitled Workflow"}function WZ(t,{collectionId:e,workflowId:n}){return t.collections.find(s=>s.id.get()===e)?.workflows.find(s=>s.workflowId.get()===n)??null}function kc(){const{apis:t}=He(),{convertOperationToReplayValue:e}=Or();return{getApiOperation:y.useCallback(r=>hZ(t,r,e),[t,e])}}function ZZ(t){const e=(t.match(/{([^}]+)}/g)||[]).map(n=>n.slice(1,-1));return Array.from(new Set(e))}function K1e(t){const e=t.servers.ornull?.[0];if(!e)return{url:"",variables:[]};const n=e.url.get(),i=ZZ(n).map(s=>({name:s,value:e.variables.ornull?.[s]?.default.get()||""}));return{url:n,variables:i}}function qZ(){const t=He();function e(n){const r=t.apis.find(o=>o.id.get()===n);if(!r){console.error(`API ${n} not found`);return}const{url:i,variables:s}=K1e(r);t.environments.forEach(o=>{o.servers.find(l=>l.apiId.get()===n)||o.servers.merge([{apiId:n,value:i,variables:s}])})}return{attachApiServerToEnvironments:e}}const E$="New collection";function A$({name:t=E$,collections:e,isDraft:n=!1}={}){return{id:UZ({name:t,collections:e}),srcType:oi.FS,arazzo:"1.0.1",info:{version:"1.0.0",title:t},workflows:[],state:n?At.Draft:At.Normal,components:{inputs:{},parameters:{}},sourceDescriptions:[]}}function i5(t=E$){return`collections/${t.replaceAll(" ","-").toLowerCase()}.arazzo.yaml`}function UZ({name:t=E$,collections:e}={}){let n=i5(t);if(!e?.length)return n;const r=ewe(e);let i=1;for(;r.includes(n);)n=i5(`${t}-${i}`),i++;return n}function ewe(t){return t.filter(e=>e.state.get()!==At.Draft).map(e=>e.id.get())}function BZ(t,e){return t.collections.find(r=>r.id.get()===e)??null}function twe({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 vl(){const t=He(),{attachApiServerToEnvironments:e}=qZ();async function n({collectionId:o,apiId:a}){const l=t.collections.find(u=>u.id.get()===o);if(!l)return;if(!l.sourceDescriptions.get({noproxy:!0}).some(u=>u.apiId===a)){const f=t.apis.find(p=>p.id.get()===a)?.info.title.get(),h=Xi(a)?a:await Wt.relative(`/${o}/..`,`/${a}`);l.sourceDescriptions.set(p=>p.some(m=>m.apiId===a)?p:[...p,{name:twe({apiName:f,sourceDescriptions:p}),url:h,apiId:a}])}e(a)}function r(o){return BZ(t,o)}function i(o,a){const l=o.sourceDescriptions.get({noproxy:!0}).filter(c=>a.name!==c.name);o.sourceDescriptions.set(l)}function s(o,a){const l=new Set(a.map(c=>`${c.workflowId??""}\0${c.stepId}`));o.workflows.forEach(c=>{const u=c.workflowId.get({noproxy:!0});c.steps.forEach(f=>{const h=f.stepId.get({noproxy:!0}),p=`${u}\0${h}`;if(!l.has(p))return;const m=f.operation.get({noproxy:!0});m&&(f.xOperation.set({method:m.method,url:m.path}),f.operation.set(null))})})}return{attachApiToCollection:n,getCollection:r,removeSourceDescription:i,disconnectStepsFromSource:s}}function Bd(t){const e=He();return t?e.collections.find(r=>r.id.get()===t)??null:null}const Ir={all:["history"],lists:()=>[...Ir.all,"list"],list:t=>[...Ir.lists(),t],recent:(t,e)=>[...Ir.all,"recent",t,e],detail:t=>[...Ir.all,"detail",t],count:t=>[...Ir.all,"count",t]};class s5{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 GC=(t,e)=>e.some(n=>t instanceof n);let o5,a5;function nwe(){return o5||(o5=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function rwe(){return a5||(a5=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const HC=new WeakMap,OS=new WeakMap,Ab=new WeakMap;function iwe(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(Kl(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return Ab.set(e,t),e}function swe(t){if(HC.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)});HC.set(t,e)}let JC={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return HC.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Kl(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 FZ(t){JC=t(JC)}function owe(t){return rwe().includes(t)?function(...e){return t.apply(KC(this),e),Kl(this.request)}:function(...e){return Kl(t.apply(KC(this),e))}}function awe(t){return typeof t=="function"?owe(t):(t instanceof IDBTransaction&&swe(t),GC(t,nwe())?new Proxy(t,JC):t)}function Kl(t){if(t instanceof IDBRequest)return iwe(t);if(OS.has(t))return OS.get(t);const e=awe(t);return e!==t&&(OS.set(t,e),Ab.set(e,t)),e}const KC=t=>Ab.get(t);function lwe(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=Kl(o);return r&&o.addEventListener("upgradeneeded",l=>{r(Kl(o.result),l.oldVersion,l.newVersion,Kl(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 cwe=["get","getKey","getAll","getAllKeys","count"],uwe=["put","add","delete","clear"],vS=new Map;function l5(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(vS.get(e))return vS.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=uwe.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||cwe.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 vS.set(e,s),s}FZ(t=>({...t,get:(e,n,r)=>l5(e,n)||t.get(e,n,r),has:(e,n)=>!!l5(e,n)||t.has(e,n)}));const dwe=["continue","continuePrimaryKey","advance"],c5={},eP=new WeakMap,YZ=new WeakMap,fwe={get(t,e){if(!dwe.includes(e))return t[e];let n=c5[e];return n||(n=c5[e]=function(...r){eP.set(this,YZ.get(this)[e](...r))}),n}};async function*hwe(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const n=new Proxy(e,fwe);for(YZ.set(n,e),Ab.set(n,KC(e));e;)yield n,e=await(eP.get(n)||e.continue()),eP.delete(n)}function u5(t,e){return e===Symbol.asyncIterator&&GC(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&GC(t,[IDBIndex,IDBObjectStore])}FZ(t=>({...t,get(e,n,r){return u5(e,n)?hwe:t.get(e,n,r)},has(e,n){return u5(e,n)||t.has(e,n)}}));class Q${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 Q$(e,n,r)}async initialize(){this.db||(this.db=await lwe(this.dbName,this.version,{upgrade:e=>{this.setupCallback(e)}}))}async close(){this.db&&(this.db.close(),this.db=null)}}const pwe=1;class R${constructor(e){this.indexedDB=e}indexedDB;static create(e){const n=`replay-history-${e}`,r=Q$.createInstance(n,pwe,this.setupDatabase);return new R$(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)}}function gwe(t){return{data:t.data.map(e=>({...e,step:{...e.step,security:e.step.security.securities}})),version:2}}const mwe=2;function Owe(t){const e=JSON.parse(t);let n;return e.version===1?n=gwe(e):n=e,n.version!==mwe&&console.warn(`Unknown history version ${n.version}, attempting migration anyway`),n.data.map(r=>({...r,type:"step"}))}const yS="history.json",vwe="history.json.backup";class ywe{static async migrateFromStorage(e,n,r){try{const i=await e.get(yS);if(!i||i.trim()==="")return{migrated:!1,itemCount:0};const s=Owe(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(yS,vwe)}catch{await e.remove(yS)}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-ICQ2nRWO.js")),s=new i(e.systemFilesDir);return this.migrateFromStorage(s,n,"JSON file")}else{const i=new N1(e.systemFilesDir);return this.migrateFromStorage(i,n,"localStorage")}}}class Ha{static instance=null;static async initialize(e,n){this.close(),this.instance=await bwe(e,n)}static getInstance(){if(!this.instance)throw new Error("HistoryService not initialized");return this.instance}static close(){this.instance=null}}async function bwe(t,e){if(e){const{HistorySqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-HistorySqliteDBStorage-BrILW8Fu.js")),r=hp.getInstance(),i=new n(r);return new s5(i)}else{const n=R$.create(t.id);return new s5(n)}}function xwe(t){return Zr.useQuery({queryKey:Ir.list(t),queryFn:async()=>Ha.getInstance().getAll(t)})}function GZ(){const t=Zr.useQueryClient();return Zr.useMutation({mutationFn:async e=>{await Ha.getInstance().addItem(e)},onMutate:e=>{t.setQueryData(Ir.detail(e.id),e)},onSuccess:()=>{t.invalidateQueries({queryKey:Ir.lists()}),t.invalidateQueries({queryKey:Ir.count()})},onError:(e,n)=>{t.removeQueries({queryKey:Ir.detail(n.id)}),console.error("Failed to add history item:",e)}})}function Swe(){const t=Zr.useQueryClient();return Zr.useMutation({mutationFn:async e=>{await Ha.getInstance().deleteItem(e)},onSuccess:(e,n)=>{t.removeQueries({queryKey:Ir.detail(n)}),t.invalidateQueries({queryKey:Ir.lists()}),t.invalidateQueries({queryKey:Ir.count()})},onError:(e,n)=>{console.error(`Failed to delete history item ${n}:`,e)}})}function wwe(){const t=Zr.useQueryClient();return Zr.useMutation({mutationFn:async()=>{await Ha.getInstance().clear()},onSuccess:()=>{t.invalidateQueries({queryKey:Ir.all})},onError:e=>{console.error("Failed to clear history:",e)}})}function Cwe(t){return t?{...t,bodyNotStored:!0,body:"",arrayBuffer:new ArrayBuffer(0)}:null}function Pwe(){const t=GZ();return y.useCallback(({step:e,response:n})=>{const r=Cwe(n),i={id:crypto.randomUUID(),date:Date.now(),type:"step",step:e,response:r,statusCode:n?.status??null};t.mutate(i)},[t])}function kwe(){const t=GZ();return y.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 Twe(){const t=Zr.useQueryClient();async function e(n){return t.ensureQueryData({queryKey:Ir.detail(n),queryFn:()=>Ha.getInstance().getById(n)})}return{getHistoryItem:e}}function j$(){const t=He();return{getStep:n=>m$(t,n)}}function $we({collectionId:t,workflowId:e,stepId:n}){const i=He().collections.find(a=>a.id.get()===t);if(!i)return null;const s=i.workflows.find(a=>a.workflowId.get()===e);return s?s.steps.find(a=>a.stepId.get()===n)??null:null}function _$(t){const e=t?.collectionId.get()??null,n=t?.workflowId.get()??null,r=t?.stepId.get()??null,s=$we({collectionId:e,workflowId:n,stepId:r})||t?.draftStep.ornull;return s||null}function Qb(){const t=He();return{getWorkflow:({collectionId:n,workflowId:r})=>WZ(t,{collectionId:n,workflowId:r})}}function yl({collectionId:t,workflowId:e}){const r=He().collections.find(s=>s.id.get()===t);return r?r.workflows.find(s=>s.workflowId.get()===e)??null:null}function tP(){return{STATUS_CODE_CHECK:"error",SCHEMA_CHECK:"error",CONTENT_TYPE_CHECK:"error"}}const Iwe=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function Ewe(){const{project:{userFilesDir:t}}=He(),{certificates:e}=Yr(),n=zt(),{getCollection:r}=vl();return{execute:async(s,o,a)=>{const l=r(s),c=t.get(),{inputs:u,servers:f}=n.get(),h=l?.sourceDescriptions.get()??[],p=`${c}/${s}`,[{createConfig:m},{ExternalResolver:g}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-DCvqReXK.js")),Promise.resolve().then(()=>require("./replay-external-resolver-Ds5-nzcf.js"))]),O=new g,v=u.map(S=>JSON.stringify({[S.name]:S.value})),b=Awe(f,h),{run:x}=await Promise.resolve().then(()=>require("./replay-respect-run-B0ZG-ZH7.js")),C=await x({files:[p],workflow:o?[o]:[],fetch:(S,T)=>{const k=Iwe(S),{clientCert:$,clientKey:A}=nZ(k,e?e.get({noproxy:!0}):[]);return xo(k,{...T,clientCert:$,clientKey:A})},logger:xb,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async S=>{if(!await wT(S))throw new Error(`File ${S} doesn't exist or isn't readable.`);try{const k=await ST(S),$=new TextEncoder().encode(k);return new File([$],await yT(S))}catch(k){throw new Error(`Failed to read file ${S}: ${k}`)}}},envVariables:{},config:await m({}),externalRefResolver:O,input:v,server:b,severity:JSON.stringify(a),skipLint:!0,noSecretsMasking:!0});try{await txe(s,o,C?.[0]?.ctx)}catch(S){console.error("Failed to persist workflow step context:",S)}return C}}}function Awe(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 Qwe="com.redocly.tab.openFailed";function Pu(t){return{stepId:null,collectionId:null,workflowId:null,historyId:null,type:De.Step,draftStep:null,response:null,requestError:null,isProcessingRequest:!1,satisfiesScheme:!0,...t}}function nP(t,e){const n=t.draftStep?.xOperation;return n?.method===e.method&&n?.url===e.url}function Rwe(t,e){const n=t.draftStep.ornull,r=n?.xOperation.ornull;if(!(!n||!r)){if(e.url&&r.url.get()!==e.url){r.url.set(e.url);const i=n.parameters.queryParameters.get({noproxy:!0});n.parameters.queryParameters.set($$(zp(e.url),i))}r.method.get()!==e.method&&r.method.set(e.method)}}function zn(){const{activeTabIdx:t,tabs:e}=Ol(),{dynamicReplayValues:n}=Or(),{getStep:r}=j$(),{getHistoryItem:i}=Twe(),{getWorkflow:s}=Qb(),{getCollection:o}=vl(),{getApiOperation:a}=kc(),{sendEvent:l}=Fe(),c=zt(),u=y.useCallback((Q,_,j,D)=>{console.warn(`[useTabHandlers] ${Q}`,D),l(Qwe,[{...me("tab",_),reason:j,...D}])},[l]),f=y.useCallback((Q,_)=>{const j=e[Q];j&&j.ornull!==null&&j.state&&j.state.set(_)},[e]),h=y.useCallback(Q=>{t.set(Q)},[t]),p=y.useCallback(()=>{e.merge([B1e()]),t.set(e.length-1)},[e,t]),m=y.useCallback(Q=>{const _=[...e.get({noproxy:!0}).filter(D=>D.state!==Cn.Preview)];_.push(Q),e.set(_);const j=_.length-1;return t.set(j),j},[e,t]),g=y.useCallback(Q=>{const _=a(Q),j=D$(Q,_,n);m(j)},[m,n,a]),O=y.useCallback((Q,_)=>{const j=e.get(),D=L=>j.findIndex(({data:B})=>xn(B,De.Step)&&L(B)),I=L=>e[L].data;if(_){const L=D(Z=>Z.sourceFile===_);if(L!==-1){Rwe(I(L),Q),h(L);return}const B=D(Z=>!Z.sourceFile&&nP(Z,Q));if(B!==-1){I(B).merge({sourceFile:_}),h(B);return}}else{const L=D(B=>nP(B,Q));if(L!==-1){h(L);return}}const V=Co({xOperation:Q,name:_??void 0});m({id:crypto.randomUUID(),state:Cn.Normal,data:Pu({draftStep:V,activeTabName:Fl(V),sourceFile:_??null})})},[e,h,m]),v=y.useCallback(async Q=>{t.set(Math.max(0,Q-1)),await new Promise(_=>setTimeout(()=>{e[Q].set(Ot),_()}))},[t,e]),b=y.useCallback(()=>{e.set([]),t.set(0)},[t,e]);function x({collectionId:Q,workflowId:_,stepId:j}){const D=e.get({noproxy:!0}),I=new Set;for(let V=0;V<D.length;V++){const L=D[V].data;switch(L.type){case De.Step:L.collectionId===Q&&L.workflowId===_&&L.stepId===j&&I.add(V);break;case De.Workflow:case De.WorkflowRun:L.collectionId===Q&&L.workflowId===_&&!j&&I.add(V);break;case De.Collection:L.collectionId===Q&&!_&&!j&&I.add(V);break}}I.size&&(e.merge(Object.fromEntries(I.values().map(V=>[V,Ot]))),t.set(0))}const C=y.useCallback(async Q=>{const _=e.get().find(({data:j})=>xn(j,De.Step)&&j.historyId===Q);if(_)t.set(e.get().indexOf(_));else{const j=await i(Q);if(!j||!BC(j)){u("Step history not found","stepHistoryTab","step_history_not_found",{historyId:Q});return}const D=j.step;m({id:crypto.randomUUID(),state:Cn.Preview,data:Pu({historyId:Q,draftStep:structuredClone(D),response:structuredClone(j.response),activeTabName:Fl(D)})})}},[t,e,m,i,u]),S=y.useCallback(({collectionId:Q,activeTabName:_})=>{const j=e.findIndex(D=>{const I=D.data.get();return xn(I,De.Collection)&&I.collectionId===Q});if(j!==-1)t.set(j);else{if(!o(Q)){u("Collection not found","collectionTab","collection_not_found",{collectionId:Q});return}m({id:crypto.randomUUID(),state:Cn.Preview,data:{collectionId:Q,type:De.Collection,activeTabName:_??et.COLLECTION_SETTINGS}})}},[t,e,m,o,u]),T=y.useCallback(({collectionId:Q,workflowId:_})=>{if(!s({collectionId:Q,workflowId:_})){u("Workflow not found","workflowRunTab","workflow_not_found",{collectionId:Q,workflowId:_});return}m({id:crypto.randomUUID(),state:Cn.Normal,data:{collectionId:Q,workflowId:_,historyId:null,runDate:null,type:De.WorkflowRun,result:null,severitySettings:tP()}})},[m,s,u]),k=y.useCallback(async(Q,{state:_=Cn.Preview}={})=>{const j=e.get().find(({data:D})=>xn(D,De.WorkflowRun)&&D.historyId===Q);if(j){const D=e.get().indexOf(j);_===Cn.Normal&&j.state===Cn.Preview&&f(D,Cn.Normal),t.set(D)}else{const D=await i(Q);if(!D||!FC(D)){u("Workflow history not found","workflowHistoryTab","workflow_history_not_found",{historyId:Q});return}m({id:crypto.randomUUID(),state:_,data:{collectionId:D.collectionId,workflowId:D.workflowId,historyId:Q,runDate:D.date,type:De.WorkflowRun,result:structuredClone(D.workflowResult),severitySettings:tP(),label:Ud(D.workflow),secretValues:c.get().inputs.filter(I=>I.isSecret&&I.value).map(I=>String(I.value))}})}},[t,e,m,f,i,u,c]),$=y.useCallback(({collectionId:Q,workflowId:_,activeTabName:j})=>{const D=e.findIndex(I=>{const V=I.data.get();return xn(V,De.Workflow)&&V.workflowId===_&&V.collectionId===Q});if(D!==-1){const I=e[D].data;j&&I.activeTabName.set(j),t.set(D)}else{if(!s({collectionId:Q,workflowId:_})){u("Workflow not found","workflowTab","workflow_not_found",{collectionId:Q,workflowId:_});return}m({id:crypto.randomUUID(),state:Cn.Preview,data:{collectionId:Q,workflowId:_,type:De.Workflow,activeTabName:j??et.WORKFLOW_SETTINGS}})}},[t,e,m,s,u]),A=y.useCallback(({collectionId:Q,workflowId:_,stepId:j,state:D})=>{const I=e.get().find(({data:V})=>xn(V,De.Step)&&V.collectionId===Q&&V.workflowId===_&&V.stepId===j&&V.historyId===null);if(I)t.set(e.get().indexOf(I));else{const V=r({collectionId:Q,workflowId:_,stepId:j});if(!V){u("Step not found","stepTab","step_not_found",{collectionId:Q,workflowId:_,stepId:j});return}const L=V.get({noproxy:!0});m({id:crypto.randomUUID(),state:D??Cn.Preview,data:Pu({stepId:j,collectionId:Q,workflowId:_,activeTabName:Fl(L)})})}},[t,e,r,m,u]),z=y.useCallback(({step:Q})=>{m({id:crypto.randomUUID(),state:Cn.Normal,data:Pu({stepId:Q.stepId??null,workflowId:Q.workflowId??null,draftStep:structuredClone(Q),activeTabName:Fl(Q)})})},[m]),M=y.useCallback((Q,_)=>{if(Q===_)return;const j=t.get(),D=[...e.get({noproxy:!0})],I=D[j]?.id,[V]=D.splice(Q,1);if(D.splice(_,0,V),e.set(D),I){const L=D.findIndex(B=>B.id===I);t.set(L)}},[t,e]);return{handleNewTabOpen:p,addNewTab:m,openStepTabFromOperation:g,openStepTabFromXOperation:O,handleTabChange:h,handleTabClose:v,handleCloseAllTabs:b,handleCloseByDataId:x,openCollectionTab:S,openWorkflowTab:$,openWorkflowRunTab:T,openWorkflowRunTabFromHistory:k,openStepTabFromHistory:C,openStepTabFromCollection:A,openStepTab:z,handleTabReorder:M,changeTabState:f}}function D$(t,e,n){const r=Co({operation:t,apiOperation:e,dynamicReplayValues:n});return{id:crypto.randomUUID(),state:Cn.Preview,data:Pu({draftStep:r,activeTabName:Fl(r)})}}function jwe(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.left>=r.left&&n.right<=r.right}const _we=({transform:t})=>({...t,y:0}),Dwe=({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))},Tc=(t,e="currentColor")=>t?.startsWith("--")?`var(${t})`:t||e,Nwe=t=>d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",...t,children:[d.jsx("path",{d:"M10.8623 6.60461C11.0548 6.64292 11.2314 6.73734 11.3701 6.8761C11.5089 7.01487 11.6033 7.19144 11.6416 7.38391C11.6799 7.57633 11.661 7.77588 11.5859 7.95715C11.5108 8.13849 11.3829 8.29342 11.2197 8.40247C11.0566 8.51141 10.8651 8.5694 10.6689 8.56946C10.4939 8.5686 10.3221 8.52031 10.1729 8.42883L9.40625 9.19739C9.58461 9.44901 9.67969 9.75029 9.67969 10.0587C9.67965 10.3669 9.5844 10.6676 9.40625 10.9191L10.1729 11.6886C10.3221 11.5971 10.4938 11.5479 10.6689 11.547C10.865 11.5471 11.0567 11.6052 11.2197 11.714C11.3829 11.823 11.5108 11.9781 11.5859 12.1593C11.6611 12.3406 11.6799 12.541 11.6416 12.7335C11.6033 12.9259 11.5088 13.1026 11.3701 13.2413C11.2314 13.38 11.0547 13.4745 10.8623 13.5128C10.6698 13.5511 10.4704 13.5313 10.2891 13.4562C10.1078 13.3811 9.95279 13.2541 9.84375 13.0909C9.7347 12.9277 9.67578 12.7355 9.67578 12.5392C9.6767 12.3641 9.7258 12.1923 9.81738 12.0431L9.04883 11.2765C8.79719 11.4549 8.49595 11.5509 8.1875 11.5509C7.87917 11.5509 7.57871 11.4548 7.32715 11.2765L6.55762 12.0431C6.6492 12.1923 6.6983 12.3641 6.69922 12.5392C6.69922 12.7354 6.6412 12.9278 6.53223 13.0909C6.42318 13.2541 6.26728 13.3811 6.08594 13.4562C5.90468 13.5312 5.7051 13.5511 5.5127 13.5128C5.32032 13.4745 5.14359 13.38 5.00488 13.2413C4.86618 13.1026 4.77174 12.9259 4.7334 12.7335C4.69511 12.541 4.71493 12.3406 4.79004 12.1593C4.86518 11.9782 4.99222 11.8229 5.15527 11.714C5.31843 11.605 5.51083 11.547 5.70703 11.547C5.88211 11.5479 6.05389 11.597 6.20312 11.6886L6.96973 10.9191C6.79143 10.6675 6.69535 10.367 6.69531 10.0587C6.69531 9.75027 6.79134 9.44902 6.96973 9.19739L6.20312 8.42883C6.0539 8.52041 5.88211 8.56853 5.70703 8.56946C5.51075 8.56946 5.31847 8.51151 5.15527 8.40247C4.99211 8.29342 4.86514 8.13846 4.79004 7.95715C4.71493 7.77581 4.69511 7.57642 4.7334 7.38391C4.77168 7.19148 4.86618 7.01486 5.00488 6.8761C5.14358 6.7374 5.32034 6.64296 5.5127 6.60461C5.70502 6.56636 5.90473 6.58534 6.08594 6.66028C6.26728 6.73539 6.42318 6.86329 6.53223 7.02649C6.64104 7.18953 6.69917 7.38125 6.69922 7.57727C6.69836 7.7524 6.64917 7.92407 6.55762 8.07336L7.32715 8.83997C7.57865 8.66181 7.87929 8.56656 8.1875 8.56653C8.49595 8.56653 8.79719 8.66158 9.04883 8.83997L9.81738 8.07336C9.72588 7.9241 9.67664 7.75235 9.67578 7.57727C9.67583 7.38112 9.7348 7.1896 9.84375 7.02649C9.9528 6.86329 10.1077 6.73539 10.2891 6.66028C10.4703 6.58526 10.6699 6.56634 10.8623 6.60461ZM5.60938 12.0529C5.51328 12.0721 5.42476 12.1193 5.35547 12.1886C5.28617 12.2579 5.23889 12.3464 5.21973 12.4425C5.20058 12.5388 5.21049 12.6389 5.24805 12.7296C5.28559 12.8202 5.34915 12.8978 5.43066 12.9523C5.51226 13.0068 5.60889 13.0353 5.70703 13.0353C5.83843 13.0352 5.96467 12.9836 6.05762 12.8907C6.15067 12.7977 6.20312 12.6708 6.20312 12.5392C6.20305 12.4412 6.1736 12.3453 6.11914 12.2638C6.06462 12.1822 5.98712 12.1187 5.89648 12.0812C5.80581 12.0436 5.70563 12.0337 5.60938 12.0529ZM10.5723 12.0529C10.476 12.072 10.3868 12.1192 10.3174 12.1886C10.2481 12.2579 10.2008 12.3464 10.1816 12.4425C10.1625 12.5388 10.1724 12.6389 10.21 12.7296C10.2475 12.8202 10.3111 12.8978 10.3926 12.9523C10.4742 13.0068 10.5708 13.0353 10.6689 13.0353C10.8004 13.0352 10.9266 12.9836 11.0195 12.8907C11.1126 12.7977 11.165 12.6708 11.165 12.5392C11.165 12.4412 11.1355 12.3453 11.0811 12.2638C11.0265 12.1823 10.949 12.1187 10.8584 12.0812C10.7679 12.0437 10.6684 12.0338 10.5723 12.0529ZM5.80371 7.09094C5.70746 7.0718 5.60727 7.08171 5.5166 7.11926C5.42601 7.15683 5.34843 7.22033 5.29395 7.30188C5.2395 7.3834 5.21 7.47924 5.20996 7.57727C5.20996 7.70887 5.26241 7.83578 5.35547 7.92883C5.44852 8.02183 5.57548 8.07336 5.70703 8.07336C5.80501 8.07328 5.90095 8.04479 5.98242 7.99036C6.06394 7.93589 6.12747 7.85825 6.16504 7.7677C6.2026 7.67703 6.21251 7.57684 6.19336 7.48059C6.17421 7.38441 6.12694 7.29605 6.05762 7.22668C5.9883 7.15736 5.89985 7.11013 5.80371 7.09094ZM10.6689 7.08118C10.5373 7.08118 10.4104 7.13363 10.3174 7.22668C10.2245 7.31967 10.1729 7.44586 10.1729 7.57727C10.1729 7.67541 10.2013 7.77204 10.2559 7.85364C10.3104 7.9351 10.388 7.99873 10.4785 8.03625C10.5692 8.07381 10.6694 8.08372 10.7656 8.06457C10.8617 8.04544 10.9502 7.99808 11.0195 7.92883C11.0889 7.85944 11.1361 7.7702 11.1553 7.67395C11.1743 7.57784 11.1644 7.47835 11.127 7.38782C11.0894 7.29719 11.0259 7.21968 10.9443 7.16516C10.8628 7.11069 10.767 7.08123 10.6689 7.08118Z"}),d.jsx("path",{d:"M10.5 0.880005C10.9812 0.880005 11.375 1.27375 11.375 1.755V5.88489C11.375 5.95116 11.3212 6.005 11.2549 6.005H10.6201C10.5538 6.005 10.5 5.95116 10.5 5.88489V1.755H7V4.38C7 4.86125 6.60625 5.255 6.125 5.255H3.5V13.0099C3.5 13.0762 3.44616 13.13 3.37988 13.13H2.74512C2.67884 13.13 2.625 13.0762 2.625 13.0099V4.38C2.625 4.24875 2.66836 4.16086 2.75586 4.07336L5.81836 1.01086C5.90586 0.923364 5.99375 0.880005 6.125 0.880005H10.5ZM3.6748 4.38H6.125V1.92981L3.6748 4.38Z"})]}),Rb=w.default(Nwe)`
|
|
772
|
+
`;function q1e(){const t=y.useRef(null),[e,n]=y.useState(!1);return jP.useMount(()=>{const r=t.current,i=()=>{r&&n(r.scrollWidth>r.clientWidth)};i();const s=new MutationObserver(()=>{i()});return r&&s.observe(r,{childList:!0,subtree:!0,attributes:!1}),window.addEventListener("resize",i),()=>{r&&s.disconnect(),window.removeEventListener("resize",i)}}),{containerRef:t,hasScrollbar:e}}const et={SECURITY:"Security",BODY:"Body",PATH:"Path",QUERY:"Query",HEADERS:"Headers",COOKIES:"Cookies",COMPONENTS:"Components",SOURCES:"Sources",STEP_SETTINGS:"Step settings",WORKFLOW_SETTINGS:"Workflow settings",COLLECTION_SETTINGS:"Collection settings"};function r5(t){return t.some(e=>!!(e.key||e.value||e.files?.length))}function U1e({type:t,formData:e,content:n}){if($v.includes(t)){const r=r5(e["multipart/form-data"]),i=r5(e["application/x-www-form-urlencoded"]);return!r&&!i}return Due.includes(t)?n.length===0:!0}function VZ(t){const{disableCollectionsTab:e}=Yr();return y.useMemo(()=>{const n=[{name:et.SECURITY,icon:d.jsx(xM.SecurityIcon,{})},{name:et.BODY,icon:d.jsx(kp.CodeIcon,{})},{name:et.PATH,icon:d.jsx(bM.DataRefineryIcon,{})},{name:et.QUERY,icon:d.jsx(yM.DataFormatIcon,{})},{name:et.HEADERS,icon:d.jsx(DP.TableBuiltIcon,{})},{name:et.COOKIES,icon:d.jsx(_P.CookieIcon,{})}];return!e.get()&&!t&&n.push({name:et.STEP_SETTINGS,icon:d.jsx(Tp.SettingsCogIcon,{})}),n},[e,t])}function Fl(t){return U1e(t.requestBody)?et.QUERY:et.BODY}function BC(t){return t.type==="step"}function FC(t){return t.type==="workflow"}function $$(t,e){const n=[],r=[];for(const s of e)s.active&&Ep(s)?n.push(s):r.push(s);return[...t.map((s,o)=>{const l=n[o]?.id??s.id;return{...s,id:l}}),...r]}function B1e(){return structuredClone({id:crypto.randomUUID(),state:Cn.Normal,data:{stepId:null,collectionId:null,workflowId:null,historyId:null,type:De.Step,draftStep:Co(),response:null,activeTabIdx:0,requestError:null,isProcessingRequest:!1,satisfiesScheme:!0}})}function F1e(t){return t!==void 0&&t.data?.type?.get()===De.Step}function Y1e(t,e){const n=e.data.collectionId.get(),r=e.data.workflowId.get(),i=e.data.stepId.get();return n&&r&&i?m$(t,{collectionId:n,workflowId:r,stepId:i})??e.data.draftStep.ornull:e.data.draftStep.ornull}function G1e(t,e,n,r,i,s){const o=a=>a??"";return o(t)===r&&o(e)===i&&o(n)===s}const YC="New workflow";function LZ({name:t=YC,collection:e}){let r=(t.trim().replace(/[^a-zA-Z0-9\-_\s]/g,"").replace(/\s+/g," ")||YC).replaceAll(" ","-").toLowerCase();if(!e)return r;const i=H1e(e);if(i.includes(r)){let s=1;for(;i.includes(`${r}-${s}`);)s++;r=`${r}-${s}`}return r}function H1e(t){return t.workflows.filter(e=>e.state.get()!==At.Draft).map(e=>e.workflowId.get())}function I$({name:t=YC,isDraft:e=!1,collection:n}={}){return{workflowId:LZ({name:t,collection:n}),summary:t,steps:[],state:e?At.Draft:At.Normal,outputs:[],parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},security:[os()]}}function J1e(t,e){const n=new Set,{pathParameters:r,queryParameters:i,headers:s,cookies:o}=t.parameters.get(),a=t.outputs.get();for(const{value:l}of[...gn([...r,...i,...s,...o],e?.components.parameters.get()),...a])for(const c of Qa(l))n.add(c);return t.steps.forEach(l=>{const c=l.security.get();for(const O of c)switch(O.securityType){case te.BasicAuth:case te.DigestAuth:for(const b of[O[O.securityType].username,O[O.securityType].password])for(const x of Qa(b))n.add(x);break;case te.JWT:for(const b of Qa(O[O.securityType].token))n.add(b);break;case te.APIKey:for(const b of Qa(O[O.securityType].key))n.add(b);break;case te.OAuth2:case te.OpenIDConnect:const v=O[O.securityType];for(const b of Qa(v[v.grantType].accessToken))n.add(b);break}const{pathParameters:u,queryParameters:f,headers:h,cookies:p}=l.parameters.get(),m=l.outputs.get();for(const{value:O}of[...gn([...u,...f,...h,...p],e?.components.parameters.get()),...m])for(const v of Qa(O))n.add(v);const g=l.requestBody.get();switch(g.type){case"multipart/form-data":case"application/x-www-form-urlencoded":{for(const{value:O}of g.formData[g.type])for(const v of Qa(O))n.add(v);break}case"application/octet-stream":break;default:for(const O of Qa(g.content))n.add(O)}}),n}function XZ(t,e,n){const r=J1e(t,n);if(r.size===0){t.inputs.set(Ot);return}t.inputs.set(i=>{const s=typeof i=="object"&&i?.properties||{};return{type:"object",properties:Object.fromEntries(Array.from(r).map(o=>{const a=e.inputs.find(l=>l.name.get()===o)?.isSecret;return[o,a?{type:"string",format:"password"}:s[o]||{type:"string"}]}))}})}function Ud(t){return t.summary||t.workflowId||"Untitled Workflow"}function WZ(t,{collectionId:e,workflowId:n}){return t.collections.find(s=>s.id.get()===e)?.workflows.find(s=>s.workflowId.get()===n)??null}function kc(){const{apis:t}=He(),{convertOperationToReplayValue:e}=Or();return{getApiOperation:y.useCallback(r=>hZ(t,r,e),[t,e])}}function ZZ(t){const e=(t.match(/{([^}]+)}/g)||[]).map(n=>n.slice(1,-1));return Array.from(new Set(e))}function K1e(t){const e=t.servers.ornull?.[0];if(!e)return{url:"",variables:[]};const n=e.url.get(),i=ZZ(n).map(s=>({name:s,value:e.variables.ornull?.[s]?.default.get()||""}));return{url:n,variables:i}}function qZ(){const t=He();function e(n){const r=t.apis.find(o=>o.id.get()===n);if(!r){console.error(`API ${n} not found`);return}const{url:i,variables:s}=K1e(r);t.environments.forEach(o=>{o.servers.find(l=>l.apiId.get()===n)||o.servers.merge([{apiId:n,value:i,variables:s}])})}return{attachApiServerToEnvironments:e}}const E$="New collection";function A$({name:t=E$,collections:e,isDraft:n=!1}={}){return{id:UZ({name:t,collections:e}),srcType:oi.FS,arazzo:"1.0.1",info:{version:"1.0.0",title:t},workflows:[],state:n?At.Draft:At.Normal,components:{inputs:{},parameters:{}},sourceDescriptions:[]}}function i5(t=E$){return`collections/${t.replaceAll(" ","-").toLowerCase()}.arazzo.yaml`}function UZ({name:t=E$,collections:e}={}){let n=i5(t);if(!e?.length)return n;const r=ewe(e);let i=1;for(;r.includes(n);)n=i5(`${t}-${i}`),i++;return n}function ewe(t){return t.filter(e=>e.state.get()!==At.Draft).map(e=>e.id.get())}function BZ(t,e){return t.collections.find(r=>r.id.get()===e)??null}function twe({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 vl(){const t=He(),{attachApiServerToEnvironments:e}=qZ();async function n({collectionId:o,apiId:a}){const l=t.collections.find(u=>u.id.get()===o);if(!l)return;if(!l.sourceDescriptions.get({noproxy:!0}).some(u=>u.apiId===a)){const f=t.apis.find(p=>p.id.get()===a)?.info.title.get(),h=Xi(a)?a:await Wt.relative(`/${o}/..`,`/${a}`);l.sourceDescriptions.set(p=>p.some(m=>m.apiId===a)?p:[...p,{name:twe({apiName:f,sourceDescriptions:p}),url:h,apiId:a}])}e(a)}function r(o){return BZ(t,o)}function i(o,a){const l=o.sourceDescriptions.get({noproxy:!0}).filter(c=>a.name!==c.name);o.sourceDescriptions.set(l)}function s(o,a){const l=new Set(a.map(c=>`${c.workflowId??""}\0${c.stepId}`));o.workflows.forEach(c=>{const u=c.workflowId.get({noproxy:!0});c.steps.forEach(f=>{const h=f.stepId.get({noproxy:!0}),p=`${u}\0${h}`;if(!l.has(p))return;const m=f.operation.get({noproxy:!0});m&&(f.xOperation.set({method:m.method,url:m.path}),f.operation.set(null))})})}return{attachApiToCollection:n,getCollection:r,removeSourceDescription:i,disconnectStepsFromSource:s}}function Bd(t){const e=He();return t?e.collections.find(r=>r.id.get()===t)??null:null}const Ir={all:["history"],lists:()=>[...Ir.all,"list"],list:t=>[...Ir.lists(),t],recent:(t,e)=>[...Ir.all,"recent",t,e],detail:t=>[...Ir.all,"detail",t],count:t=>[...Ir.all,"count",t]};class s5{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 GC=(t,e)=>e.some(n=>t instanceof n);let o5,a5;function nwe(){return o5||(o5=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function rwe(){return a5||(a5=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const HC=new WeakMap,OS=new WeakMap,Ab=new WeakMap;function iwe(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(Kl(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return Ab.set(e,t),e}function swe(t){if(HC.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)});HC.set(t,e)}let JC={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return HC.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Kl(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 FZ(t){JC=t(JC)}function owe(t){return rwe().includes(t)?function(...e){return t.apply(KC(this),e),Kl(this.request)}:function(...e){return Kl(t.apply(KC(this),e))}}function awe(t){return typeof t=="function"?owe(t):(t instanceof IDBTransaction&&swe(t),GC(t,nwe())?new Proxy(t,JC):t)}function Kl(t){if(t instanceof IDBRequest)return iwe(t);if(OS.has(t))return OS.get(t);const e=awe(t);return e!==t&&(OS.set(t,e),Ab.set(e,t)),e}const KC=t=>Ab.get(t);function lwe(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=Kl(o);return r&&o.addEventListener("upgradeneeded",l=>{r(Kl(o.result),l.oldVersion,l.newVersion,Kl(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 cwe=["get","getKey","getAll","getAllKeys","count"],uwe=["put","add","delete","clear"],vS=new Map;function l5(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(vS.get(e))return vS.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=uwe.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||cwe.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 vS.set(e,s),s}FZ(t=>({...t,get:(e,n,r)=>l5(e,n)||t.get(e,n,r),has:(e,n)=>!!l5(e,n)||t.has(e,n)}));const dwe=["continue","continuePrimaryKey","advance"],c5={},eP=new WeakMap,YZ=new WeakMap,fwe={get(t,e){if(!dwe.includes(e))return t[e];let n=c5[e];return n||(n=c5[e]=function(...r){eP.set(this,YZ.get(this)[e](...r))}),n}};async function*hwe(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const n=new Proxy(e,fwe);for(YZ.set(n,e),Ab.set(n,KC(e));e;)yield n,e=await(eP.get(n)||e.continue()),eP.delete(n)}function u5(t,e){return e===Symbol.asyncIterator&&GC(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&GC(t,[IDBIndex,IDBObjectStore])}FZ(t=>({...t,get(e,n,r){return u5(e,n)?hwe:t.get(e,n,r)},has(e,n){return u5(e,n)||t.has(e,n)}}));class Q${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 Q$(e,n,r)}async initialize(){this.db||(this.db=await lwe(this.dbName,this.version,{upgrade:e=>{this.setupCallback(e)}}))}async close(){this.db&&(this.db.close(),this.db=null)}}const pwe=1;class R${constructor(e){this.indexedDB=e}indexedDB;static create(e){const n=`replay-history-${e}`,r=Q$.createInstance(n,pwe,this.setupDatabase);return new R$(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)}}function gwe(t){return{data:t.data.map(e=>({...e,step:{...e.step,security:e.step.security.securities}})),version:2}}const mwe=2;function Owe(t){const e=JSON.parse(t);let n;return e.version===1?n=gwe(e):n=e,n.version!==mwe&&console.warn(`Unknown history version ${n.version}, attempting migration anyway`),n.data.map(r=>({...r,type:"step"}))}const yS="history.json",vwe="history.json.backup";class ywe{static async migrateFromStorage(e,n,r){try{const i=await e.get(yS);if(!i||i.trim()==="")return{migrated:!1,itemCount:0};const s=Owe(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(yS,vwe)}catch{await e.remove(yS)}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-CLzYSck7.js")),s=new i(e.systemFilesDir);return this.migrateFromStorage(s,n,"JSON file")}else{const i=new N1(e.systemFilesDir);return this.migrateFromStorage(i,n,"localStorage")}}}class Ha{static instance=null;static async initialize(e,n){this.close(),this.instance=await bwe(e,n)}static getInstance(){if(!this.instance)throw new Error("HistoryService not initialized");return this.instance}static close(){this.instance=null}}async function bwe(t,e){if(e){const{HistorySqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-HistorySqliteDBStorage-BrILW8Fu.js")),r=hp.getInstance(),i=new n(r);return new s5(i)}else{const n=R$.create(t.id);return new s5(n)}}function xwe(t){return Zr.useQuery({queryKey:Ir.list(t),queryFn:async()=>Ha.getInstance().getAll(t)})}function GZ(){const t=Zr.useQueryClient();return Zr.useMutation({mutationFn:async e=>{await Ha.getInstance().addItem(e)},onMutate:e=>{t.setQueryData(Ir.detail(e.id),e)},onSuccess:()=>{t.invalidateQueries({queryKey:Ir.lists()}),t.invalidateQueries({queryKey:Ir.count()})},onError:(e,n)=>{t.removeQueries({queryKey:Ir.detail(n.id)}),console.error("Failed to add history item:",e)}})}function Swe(){const t=Zr.useQueryClient();return Zr.useMutation({mutationFn:async e=>{await Ha.getInstance().deleteItem(e)},onSuccess:(e,n)=>{t.removeQueries({queryKey:Ir.detail(n)}),t.invalidateQueries({queryKey:Ir.lists()}),t.invalidateQueries({queryKey:Ir.count()})},onError:(e,n)=>{console.error(`Failed to delete history item ${n}:`,e)}})}function wwe(){const t=Zr.useQueryClient();return Zr.useMutation({mutationFn:async()=>{await Ha.getInstance().clear()},onSuccess:()=>{t.invalidateQueries({queryKey:Ir.all})},onError:e=>{console.error("Failed to clear history:",e)}})}function Cwe(t){return t?{...t,bodyNotStored:!0,body:"",arrayBuffer:new ArrayBuffer(0)}:null}function Pwe(){const t=GZ();return y.useCallback(({step:e,response:n})=>{const r=Cwe(n),i={id:crypto.randomUUID(),date:Date.now(),type:"step",step:e,response:r,statusCode:n?.status??null};t.mutate(i)},[t])}function kwe(){const t=GZ();return y.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 Twe(){const t=Zr.useQueryClient();async function e(n){return t.ensureQueryData({queryKey:Ir.detail(n),queryFn:()=>Ha.getInstance().getById(n)})}return{getHistoryItem:e}}function j$(){const t=He();return{getStep:n=>m$(t,n)}}function $we({collectionId:t,workflowId:e,stepId:n}){const i=He().collections.find(a=>a.id.get()===t);if(!i)return null;const s=i.workflows.find(a=>a.workflowId.get()===e);return s?s.steps.find(a=>a.stepId.get()===n)??null:null}function _$(t){const e=t?.collectionId.get()??null,n=t?.workflowId.get()??null,r=t?.stepId.get()??null,s=$we({collectionId:e,workflowId:n,stepId:r})||t?.draftStep.ornull;return s||null}function Qb(){const t=He();return{getWorkflow:({collectionId:n,workflowId:r})=>WZ(t,{collectionId:n,workflowId:r})}}function yl({collectionId:t,workflowId:e}){const r=He().collections.find(s=>s.id.get()===t);return r?r.workflows.find(s=>s.workflowId.get()===e)??null:null}function tP(){return{STATUS_CODE_CHECK:"error",SCHEMA_CHECK:"error",CONTENT_TYPE_CHECK:"error"}}const Iwe=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function Ewe(){const{project:{userFilesDir:t}}=He(),{certificates:e}=Yr(),n=zt(),{getCollection:r}=vl();return{execute:async(s,o,a)=>{const l=r(s),c=t.get(),{inputs:u,servers:f}=n.get(),h=l?.sourceDescriptions.get()??[],p=`${c}/${s}`,[{createConfig:m},{ExternalResolver:g}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-Dxk-kqkZ.js")),Promise.resolve().then(()=>require("./replay-external-resolver-CjM7Da6t.js"))]),O=new g,v=u.map(S=>JSON.stringify({[S.name]:S.value})),b=Awe(f,h),{run:x}=await Promise.resolve().then(()=>require("./replay-respect-run-DNFoFnJU.js")),C=await x({files:[p],workflow:o?[o]:[],fetch:(S,T)=>{const k=Iwe(S),{clientCert:$,clientKey:A}=nZ(k,e?e.get({noproxy:!0}):[]);return xo(k,{...T,clientCert:$,clientKey:A})},logger:xb,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async S=>{if(!await wT(S))throw new Error(`File ${S} doesn't exist or isn't readable.`);try{const k=await ST(S),$=new TextEncoder().encode(k);return new File([$],await yT(S))}catch(k){throw new Error(`Failed to read file ${S}: ${k}`)}}},envVariables:{},config:await m({}),externalRefResolver:O,input:v,server:b,severity:JSON.stringify(a),skipLint:!0,noSecretsMasking:!0});try{await txe(s,o,C?.[0]?.ctx)}catch(S){console.error("Failed to persist workflow step context:",S)}return C}}}function Awe(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 Qwe="com.redocly.tab.openFailed";function Pu(t){return{stepId:null,collectionId:null,workflowId:null,historyId:null,type:De.Step,draftStep:null,response:null,requestError:null,isProcessingRequest:!1,satisfiesScheme:!0,...t}}function nP(t,e){const n=t.draftStep?.xOperation;return n?.method===e.method&&n?.url===e.url}function Rwe(t,e){const n=t.draftStep.ornull,r=n?.xOperation.ornull;if(!(!n||!r)){if(e.url&&r.url.get()!==e.url){r.url.set(e.url);const i=n.parameters.queryParameters.get({noproxy:!0});n.parameters.queryParameters.set($$(zp(e.url),i))}r.method.get()!==e.method&&r.method.set(e.method)}}function zn(){const{activeTabIdx:t,tabs:e}=Ol(),{dynamicReplayValues:n}=Or(),{getStep:r}=j$(),{getHistoryItem:i}=Twe(),{getWorkflow:s}=Qb(),{getCollection:o}=vl(),{getApiOperation:a}=kc(),{sendEvent:l}=Fe(),c=zt(),u=y.useCallback((Q,_,j,D)=>{console.warn(`[useTabHandlers] ${Q}`,D),l(Qwe,[{...me("tab",_),reason:j,...D}])},[l]),f=y.useCallback((Q,_)=>{const j=e[Q];j&&j.ornull!==null&&j.state&&j.state.set(_)},[e]),h=y.useCallback(Q=>{t.set(Q)},[t]),p=y.useCallback(()=>{e.merge([B1e()]),t.set(e.length-1)},[e,t]),m=y.useCallback(Q=>{const _=[...e.get({noproxy:!0}).filter(D=>D.state!==Cn.Preview)];_.push(Q),e.set(_);const j=_.length-1;return t.set(j),j},[e,t]),g=y.useCallback(Q=>{const _=a(Q),j=D$(Q,_,n);m(j)},[m,n,a]),O=y.useCallback((Q,_)=>{const j=e.get(),D=L=>j.findIndex(({data:B})=>xn(B,De.Step)&&L(B)),I=L=>e[L].data;if(_){const L=D(Z=>Z.sourceFile===_);if(L!==-1){Rwe(I(L),Q),h(L);return}const B=D(Z=>!Z.sourceFile&&nP(Z,Q));if(B!==-1){I(B).merge({sourceFile:_}),h(B);return}}else{const L=D(B=>nP(B,Q));if(L!==-1){h(L);return}}const V=Co({xOperation:Q,name:_??void 0});m({id:crypto.randomUUID(),state:Cn.Normal,data:Pu({draftStep:V,activeTabName:Fl(V),sourceFile:_??null})})},[e,h,m]),v=y.useCallback(async Q=>{t.set(Math.max(0,Q-1)),await new Promise(_=>setTimeout(()=>{e[Q].set(Ot),_()}))},[t,e]),b=y.useCallback(()=>{e.set([]),t.set(0)},[t,e]);function x({collectionId:Q,workflowId:_,stepId:j}){const D=e.get({noproxy:!0}),I=new Set;for(let V=0;V<D.length;V++){const L=D[V].data;switch(L.type){case De.Step:L.collectionId===Q&&L.workflowId===_&&L.stepId===j&&I.add(V);break;case De.Workflow:case De.WorkflowRun:L.collectionId===Q&&L.workflowId===_&&!j&&I.add(V);break;case De.Collection:L.collectionId===Q&&!_&&!j&&I.add(V);break}}I.size&&(e.merge(Object.fromEntries(I.values().map(V=>[V,Ot]))),t.set(0))}const C=y.useCallback(async Q=>{const _=e.get().find(({data:j})=>xn(j,De.Step)&&j.historyId===Q);if(_)t.set(e.get().indexOf(_));else{const j=await i(Q);if(!j||!BC(j)){u("Step history not found","stepHistoryTab","step_history_not_found",{historyId:Q});return}const D=j.step;m({id:crypto.randomUUID(),state:Cn.Preview,data:Pu({historyId:Q,draftStep:structuredClone(D),response:structuredClone(j.response),activeTabName:Fl(D)})})}},[t,e,m,i,u]),S=y.useCallback(({collectionId:Q,activeTabName:_})=>{const j=e.findIndex(D=>{const I=D.data.get();return xn(I,De.Collection)&&I.collectionId===Q});if(j!==-1)t.set(j);else{if(!o(Q)){u("Collection not found","collectionTab","collection_not_found",{collectionId:Q});return}m({id:crypto.randomUUID(),state:Cn.Preview,data:{collectionId:Q,type:De.Collection,activeTabName:_??et.COLLECTION_SETTINGS}})}},[t,e,m,o,u]),T=y.useCallback(({collectionId:Q,workflowId:_})=>{if(!s({collectionId:Q,workflowId:_})){u("Workflow not found","workflowRunTab","workflow_not_found",{collectionId:Q,workflowId:_});return}m({id:crypto.randomUUID(),state:Cn.Normal,data:{collectionId:Q,workflowId:_,historyId:null,runDate:null,type:De.WorkflowRun,result:null,severitySettings:tP()}})},[m,s,u]),k=y.useCallback(async(Q,{state:_=Cn.Preview}={})=>{const j=e.get().find(({data:D})=>xn(D,De.WorkflowRun)&&D.historyId===Q);if(j){const D=e.get().indexOf(j);_===Cn.Normal&&j.state===Cn.Preview&&f(D,Cn.Normal),t.set(D)}else{const D=await i(Q);if(!D||!FC(D)){u("Workflow history not found","workflowHistoryTab","workflow_history_not_found",{historyId:Q});return}m({id:crypto.randomUUID(),state:_,data:{collectionId:D.collectionId,workflowId:D.workflowId,historyId:Q,runDate:D.date,type:De.WorkflowRun,result:structuredClone(D.workflowResult),severitySettings:tP(),label:Ud(D.workflow),secretValues:c.get().inputs.filter(I=>I.isSecret&&I.value).map(I=>String(I.value))}})}},[t,e,m,f,i,u,c]),$=y.useCallback(({collectionId:Q,workflowId:_,activeTabName:j})=>{const D=e.findIndex(I=>{const V=I.data.get();return xn(V,De.Workflow)&&V.workflowId===_&&V.collectionId===Q});if(D!==-1){const I=e[D].data;j&&I.activeTabName.set(j),t.set(D)}else{if(!s({collectionId:Q,workflowId:_})){u("Workflow not found","workflowTab","workflow_not_found",{collectionId:Q,workflowId:_});return}m({id:crypto.randomUUID(),state:Cn.Preview,data:{collectionId:Q,workflowId:_,type:De.Workflow,activeTabName:j??et.WORKFLOW_SETTINGS}})}},[t,e,m,s,u]),A=y.useCallback(({collectionId:Q,workflowId:_,stepId:j,state:D})=>{const I=e.get().find(({data:V})=>xn(V,De.Step)&&V.collectionId===Q&&V.workflowId===_&&V.stepId===j&&V.historyId===null);if(I)t.set(e.get().indexOf(I));else{const V=r({collectionId:Q,workflowId:_,stepId:j});if(!V){u("Step not found","stepTab","step_not_found",{collectionId:Q,workflowId:_,stepId:j});return}const L=V.get({noproxy:!0});m({id:crypto.randomUUID(),state:D??Cn.Preview,data:Pu({stepId:j,collectionId:Q,workflowId:_,activeTabName:Fl(L)})})}},[t,e,r,m,u]),z=y.useCallback(({step:Q})=>{m({id:crypto.randomUUID(),state:Cn.Normal,data:Pu({stepId:Q.stepId??null,workflowId:Q.workflowId??null,draftStep:structuredClone(Q),activeTabName:Fl(Q)})})},[m]),M=y.useCallback((Q,_)=>{if(Q===_)return;const j=t.get(),D=[...e.get({noproxy:!0})],I=D[j]?.id,[V]=D.splice(Q,1);if(D.splice(_,0,V),e.set(D),I){const L=D.findIndex(B=>B.id===I);t.set(L)}},[t,e]);return{handleNewTabOpen:p,addNewTab:m,openStepTabFromOperation:g,openStepTabFromXOperation:O,handleTabChange:h,handleTabClose:v,handleCloseAllTabs:b,handleCloseByDataId:x,openCollectionTab:S,openWorkflowTab:$,openWorkflowRunTab:T,openWorkflowRunTabFromHistory:k,openStepTabFromHistory:C,openStepTabFromCollection:A,openStepTab:z,handleTabReorder:M,changeTabState:f}}function D$(t,e,n){const r=Co({operation:t,apiOperation:e,dynamicReplayValues:n});return{id:crypto.randomUUID(),state:Cn.Preview,data:Pu({draftStep:r,activeTabName:Fl(r)})}}function jwe(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.left>=r.left&&n.right<=r.right}const _we=({transform:t})=>({...t,y:0}),Dwe=({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))},Tc=(t,e="currentColor")=>t?.startsWith("--")?`var(${t})`:t||e,Nwe=t=>d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",...t,children:[d.jsx("path",{d:"M10.8623 6.60461C11.0548 6.64292 11.2314 6.73734 11.3701 6.8761C11.5089 7.01487 11.6033 7.19144 11.6416 7.38391C11.6799 7.57633 11.661 7.77588 11.5859 7.95715C11.5108 8.13849 11.3829 8.29342 11.2197 8.40247C11.0566 8.51141 10.8651 8.5694 10.6689 8.56946C10.4939 8.5686 10.3221 8.52031 10.1729 8.42883L9.40625 9.19739C9.58461 9.44901 9.67969 9.75029 9.67969 10.0587C9.67965 10.3669 9.5844 10.6676 9.40625 10.9191L10.1729 11.6886C10.3221 11.5971 10.4938 11.5479 10.6689 11.547C10.865 11.5471 11.0567 11.6052 11.2197 11.714C11.3829 11.823 11.5108 11.9781 11.5859 12.1593C11.6611 12.3406 11.6799 12.541 11.6416 12.7335C11.6033 12.9259 11.5088 13.1026 11.3701 13.2413C11.2314 13.38 11.0547 13.4745 10.8623 13.5128C10.6698 13.5511 10.4704 13.5313 10.2891 13.4562C10.1078 13.3811 9.95279 13.2541 9.84375 13.0909C9.7347 12.9277 9.67578 12.7355 9.67578 12.5392C9.6767 12.3641 9.7258 12.1923 9.81738 12.0431L9.04883 11.2765C8.79719 11.4549 8.49595 11.5509 8.1875 11.5509C7.87917 11.5509 7.57871 11.4548 7.32715 11.2765L6.55762 12.0431C6.6492 12.1923 6.6983 12.3641 6.69922 12.5392C6.69922 12.7354 6.6412 12.9278 6.53223 13.0909C6.42318 13.2541 6.26728 13.3811 6.08594 13.4562C5.90468 13.5312 5.7051 13.5511 5.5127 13.5128C5.32032 13.4745 5.14359 13.38 5.00488 13.2413C4.86618 13.1026 4.77174 12.9259 4.7334 12.7335C4.69511 12.541 4.71493 12.3406 4.79004 12.1593C4.86518 11.9782 4.99222 11.8229 5.15527 11.714C5.31843 11.605 5.51083 11.547 5.70703 11.547C5.88211 11.5479 6.05389 11.597 6.20312 11.6886L6.96973 10.9191C6.79143 10.6675 6.69535 10.367 6.69531 10.0587C6.69531 9.75027 6.79134 9.44902 6.96973 9.19739L6.20312 8.42883C6.0539 8.52041 5.88211 8.56853 5.70703 8.56946C5.51075 8.56946 5.31847 8.51151 5.15527 8.40247C4.99211 8.29342 4.86514 8.13846 4.79004 7.95715C4.71493 7.77581 4.69511 7.57642 4.7334 7.38391C4.77168 7.19148 4.86618 7.01486 5.00488 6.8761C5.14358 6.7374 5.32034 6.64296 5.5127 6.60461C5.70502 6.56636 5.90473 6.58534 6.08594 6.66028C6.26728 6.73539 6.42318 6.86329 6.53223 7.02649C6.64104 7.18953 6.69917 7.38125 6.69922 7.57727C6.69836 7.7524 6.64917 7.92407 6.55762 8.07336L7.32715 8.83997C7.57865 8.66181 7.87929 8.56656 8.1875 8.56653C8.49595 8.56653 8.79719 8.66158 9.04883 8.83997L9.81738 8.07336C9.72588 7.9241 9.67664 7.75235 9.67578 7.57727C9.67583 7.38112 9.7348 7.1896 9.84375 7.02649C9.9528 6.86329 10.1077 6.73539 10.2891 6.66028C10.4703 6.58526 10.6699 6.56634 10.8623 6.60461ZM5.60938 12.0529C5.51328 12.0721 5.42476 12.1193 5.35547 12.1886C5.28617 12.2579 5.23889 12.3464 5.21973 12.4425C5.20058 12.5388 5.21049 12.6389 5.24805 12.7296C5.28559 12.8202 5.34915 12.8978 5.43066 12.9523C5.51226 13.0068 5.60889 13.0353 5.70703 13.0353C5.83843 13.0352 5.96467 12.9836 6.05762 12.8907C6.15067 12.7977 6.20312 12.6708 6.20312 12.5392C6.20305 12.4412 6.1736 12.3453 6.11914 12.2638C6.06462 12.1822 5.98712 12.1187 5.89648 12.0812C5.80581 12.0436 5.70563 12.0337 5.60938 12.0529ZM10.5723 12.0529C10.476 12.072 10.3868 12.1192 10.3174 12.1886C10.2481 12.2579 10.2008 12.3464 10.1816 12.4425C10.1625 12.5388 10.1724 12.6389 10.21 12.7296C10.2475 12.8202 10.3111 12.8978 10.3926 12.9523C10.4742 13.0068 10.5708 13.0353 10.6689 13.0353C10.8004 13.0352 10.9266 12.9836 11.0195 12.8907C11.1126 12.7977 11.165 12.6708 11.165 12.5392C11.165 12.4412 11.1355 12.3453 11.0811 12.2638C11.0265 12.1823 10.949 12.1187 10.8584 12.0812C10.7679 12.0437 10.6684 12.0338 10.5723 12.0529ZM5.80371 7.09094C5.70746 7.0718 5.60727 7.08171 5.5166 7.11926C5.42601 7.15683 5.34843 7.22033 5.29395 7.30188C5.2395 7.3834 5.21 7.47924 5.20996 7.57727C5.20996 7.70887 5.26241 7.83578 5.35547 7.92883C5.44852 8.02183 5.57548 8.07336 5.70703 8.07336C5.80501 8.07328 5.90095 8.04479 5.98242 7.99036C6.06394 7.93589 6.12747 7.85825 6.16504 7.7677C6.2026 7.67703 6.21251 7.57684 6.19336 7.48059C6.17421 7.38441 6.12694 7.29605 6.05762 7.22668C5.9883 7.15736 5.89985 7.11013 5.80371 7.09094ZM10.6689 7.08118C10.5373 7.08118 10.4104 7.13363 10.3174 7.22668C10.2245 7.31967 10.1729 7.44586 10.1729 7.57727C10.1729 7.67541 10.2013 7.77204 10.2559 7.85364C10.3104 7.9351 10.388 7.99873 10.4785 8.03625C10.5692 8.07381 10.6694 8.08372 10.7656 8.06457C10.8617 8.04544 10.9502 7.99808 11.0195 7.92883C11.0889 7.85944 11.1361 7.7702 11.1553 7.67395C11.1743 7.57784 11.1644 7.47835 11.127 7.38782C11.0894 7.29719 11.0259 7.21968 10.9443 7.16516C10.8628 7.11069 10.767 7.08123 10.6689 7.08118Z"}),d.jsx("path",{d:"M10.5 0.880005C10.9812 0.880005 11.375 1.27375 11.375 1.755V5.88489C11.375 5.95116 11.3212 6.005 11.2549 6.005H10.6201C10.5538 6.005 10.5 5.95116 10.5 5.88489V1.755H7V4.38C7 4.86125 6.60625 5.255 6.125 5.255H3.5V13.0099C3.5 13.0762 3.44616 13.13 3.37988 13.13H2.74512C2.67884 13.13 2.625 13.0762 2.625 13.0099V4.38C2.625 4.24875 2.66836 4.16086 2.75586 4.07336L5.81836 1.01086C5.90586 0.923364 5.99375 0.880005 6.125 0.880005H10.5ZM3.6748 4.38H6.125V1.92981L3.6748 4.38Z"})]}),Rb=w.default(Nwe)`
|
|
773
773
|
path {
|
|
774
774
|
fill: ${({color:t})=>Tc(t)};
|
|
775
775
|
}
|
|
@@ -3535,7 +3535,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
|
|
|
3535
3535
|
gap: var(--spacing-xs);
|
|
3536
3536
|
`,TO={[cr.SIMPLE]:{label:"Simple",tooltipContent:"Success criteria conditions in the form of basic literals, operators, and loose comparisons"},[cr.REGEX]:{label:"Regex",tooltipContent:"Regex patterns used as success criteria conditions"},[cr.JSONPATH]:{label:"JSONPath",tooltipContent:"JSONPath expressions as success criteria conditions"},[cr.XPATH]:{label:"XPath",tooltipContent:"XPath expressions as success criteria conditions"}},eNe=Object.keys(TO);function tNe({successCriteria:t}){const{sendEvent:e}=Fe(),n=s=>{e("com.redocly.button.click",[{...me("button","addSuccessCriteria"),source:"workflow",action:"add_success_criteria",success_criteria_type:s}]),t.set(o=>[...o||[],{...iX(s)}])},r=y.useMemo(()=>t.filter(s=>s.get()!==void 0),[t]),i=s=>{e("com.redocly.button.click",[{...me("button","removeSuccessCriteria"),source:"workflow",action:"remove_success_criteria",success_criteria_type:s.get().type,condition:s.get().condition}]),s.set(Ot)};return d.jsxs(d.Fragment,{children:[d.jsxs(Po,{children:["Success criteria",d.jsx(si,{content:"List of conditions required to complete the step."})]}),r.map(s=>d.jsx(y.Fragment,{children:d.jsx(YDe,{successCriteria:s,label:TO[s.get().type].label,tooltipContent:TO[s.get().type].tooltipContent,additionalActions:d.jsx($i,{"data-testid":"remove-success-criteria-button",variant:"text",icon:d.jsx(En.TrashCanIcon,{}),onClick:()=>i(s)})})},s.get().id)),d.jsx(nNe,{renderInput:()=>d.jsx(pe.Button,{variant:"outlined",icon:d.jsx(sr.AddIcon,{}),iconPosition:"left",size:"small",children:"Add success criteria"}),dataTestId:"workflow-step-success-criteria-select",options:eNe.map(s=>({element:TO[s].label,label:s,value:s})),onChange:s=>{n(s)},placement:"top",hideCheckmarkIcon:!0})]})}const nNe=w.default(bc.Select)`
|
|
3537
3537
|
border-radius: var(--border-radius-md);
|
|
3538
|
-
`;function rNe({step:t,workflowId:e,collectionId:n}){const{handleIdChange:r}=Ol(),i=t.stepId.get();return d.jsx(d.Fragment,{children:d.jsxs(YU,{children:[d.jsx(Po,{children:"Info"}),d.jsxs(Nt,{children:[d.jsxs(Nt.Row,{children:[d.jsx(Nt.Cell,{children:d.jsxs(ec,{children:["Step ID",d.jsx(si,{content:"This step's unique identifier"})]})}),d.jsx(Nt.Cell,{$readonly:!0,children:d.jsx(yP,{attribute:t.stepId,editorTitle:"Change step ID",placeholder:"Add step ID",onSave:s=>{n&&e&&r({collectionId:n,workflowId:e,stepId:i},{collectionId:n,workflowId:e,stepId:s})}})})]}),d.jsxs(Nt.Row,{children:[d.jsx(Nt.Cell,{children:d.jsxs(ec,{children:["Description",d.jsx(si,{content:"The step's purpose in the workflow."})]})}),d.jsx(Nt.Cell,{children:d.jsx(z$,{state:t.description,placeholder:"Add description"})})]})]}),d.jsxs(qu,{children:[d.jsx(Po,{children:"Operation"}),d.jsx(qDe,{step:t,collectionId:n})]}),d.jsx(qu,{children:d.jsx(FU,{outputs:t.outputs,tooltipText:"Data generated in this step that can be used in the next steps."})}),d.jsx(qu,{children:d.jsx(tNe,{successCriteria:t.successCriteria})})]})})}const iNe=["text","file"];function sNe({onParameterChange:t,files:e}){const n=y.useRef(null),r=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(pn())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-
|
|
3538
|
+
`;function rNe({step:t,workflowId:e,collectionId:n}){const{handleIdChange:r}=Ol(),i=t.stepId.get();return d.jsx(d.Fragment,{children:d.jsxs(YU,{children:[d.jsx(Po,{children:"Info"}),d.jsxs(Nt,{children:[d.jsxs(Nt.Row,{children:[d.jsx(Nt.Cell,{children:d.jsxs(ec,{children:["Step ID",d.jsx(si,{content:"This step's unique identifier"})]})}),d.jsx(Nt.Cell,{$readonly:!0,children:d.jsx(yP,{attribute:t.stepId,editorTitle:"Change step ID",placeholder:"Add step ID",onSave:s=>{n&&e&&r({collectionId:n,workflowId:e,stepId:i},{collectionId:n,workflowId:e,stepId:s})}})})]}),d.jsxs(Nt.Row,{children:[d.jsx(Nt.Cell,{children:d.jsxs(ec,{children:["Description",d.jsx(si,{content:"The step's purpose in the workflow."})]})}),d.jsx(Nt.Cell,{children:d.jsx(z$,{state:t.description,placeholder:"Add description"})})]})]}),d.jsxs(qu,{children:[d.jsx(Po,{children:"Operation"}),d.jsx(qDe,{step:t,collectionId:n})]}),d.jsx(qu,{children:d.jsx(FU,{outputs:t.outputs,tooltipText:"Data generated in this step that can be used in the next steps."})}),d.jsx(qu,{children:d.jsx(tNe,{successCriteria:t.successCriteria})})]})})}const iNe=["text","file"];function sNe({onParameterChange:t,files:e}){const n=y.useRef(null),r=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(pn())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-DJwfdo0s.js")),l=await a({multiple:!0});if(!l)return;const u=(Array.isArray(l)?l:[l]).map(Kp),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=y.useCallback(()=>{t(null)},[t]),o=y.useMemo(()=>{if(!e)return null;if(e.length===1)return d.jsx(eN,{icon:d.jsx(ai.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsx(tN,{children:e[0].file.name})});if(e.length>1)return d.jsx(eN,{icon:d.jsx(ai.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsxs(tN,{children:[e.length," files"]})})},[e,s]);return d.jsx(oNe,{children:d.jsxs(aNe,{children:[d.jsx(lNe,{children:o||d.jsx(dNe,{children:"Add files here"})}),d.jsxs(cNe,{children:[d.jsx(uNe,{onClick:i,variant:"secondary",size:"small","data-testid":"add-button",icon:d.jsx(sr.AddIcon,{color:"--button-content-color"})}),d.jsx("input",{"data-testid":"file-input",hidden:!0,ref:n,type:"file",multiple:!0,accept:"files/*",onChange:r})]})]})})}const oNe=w.default.div`
|
|
3539
3539
|
position: relative;
|
|
3540
3540
|
display: flex;
|
|
3541
3541
|
flex-grow: 1;
|
|
@@ -3674,7 +3674,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
|
|
|
3674
3674
|
`,wNe=w.default.div`
|
|
3675
3675
|
display: flex;
|
|
3676
3676
|
justify-content: center;
|
|
3677
|
-
`,GU=t=>t==="file"?d.jsx(k8.FileIcon,{size:"14px"}):d.jsx(P8.CharacterIcon,{size:"14px"}),CNe=iNe.map(t=>({label:d.jsxs(fNe,{children:[GU(t),d.jsx(xNe,{children:t})]}),value:t}));function nN({isLast:t,index:e,parameter:n,onKeyChange:r,onValueChange:i,onActiveChange:s,onTypeChange:o,onFilesChange:a,environment:l,keyName:c,enableInputTypeSelection:u,autoCompleteOptions:f,actions:h}){const{value:p,key:m,active:g,type:O,files:v}=n,b=t?"form-data-name-ghost":`form-data-name-${e}`,x=t?"form-data-value-ghost":`form-data-value-${e}`,C=t?"form-data-checkbox-ghost":`form-data-checkbox-${e}`;return d.jsxs(mNe,{children:[d.jsx(ONe,{children:!t&&d.jsxs(d.Fragment,{children:[d.jsx(vNe,{"data-testid":C,type:"checkbox",checked:g,onChange:({target:S})=>s(S.checked)}),d.jsx(yNe,{checked:g})]})}),d.jsx(Le,{}),d.jsxs(d.Fragment,{children:[d.jsx(Pt,{dataTestId:b,placeholder:`${t?"New ":""}${c}`,value:m,environment:l,onChange:r}),u&&d.jsx(wNe,{children:d.jsx(SNe,{options:CNe,value:{label:GU(O),value:O,active:!0},onChange:({value:S})=>o(S),withArrow:!1,size:"small"})})]}),d.jsx(Le,{}),O==="file"?d.jsx(sNe,{files:v,onParameterChange:a}):d.jsx(Pt,{dataTestId:x,placeholder:"Value",value:p,environment:l,options:f,onChange:i}),d.jsx(Le,{}),d.jsx(bNe,{children:!t&&h(e)})]})}function PNe({title:t,enableInputTypeSelection:e=!1,onParameterChange:n,actions:r,formElements:i,keyName:s,environment:o,createEmptyParameter:a}){const l=ui(),{ghostState:c,ghostValue:u,promoteGhost:f}=MU({elements:i,createEmptyParameter:a,onParameterChange:n}),h={environment:o,keyName:s,enableInputTypeSelection:e,autoCompleteOptions:l,actions:r};return d.jsxs(hNe,{children:[t&&d.jsx(pNe,{children:t}),d.jsx(gNe,{children:[...i.map((p,m)=>{const g=p.get();return d.jsx(nN,{isLast:!1,index:m,parameter:g,onKeyChange:O=>{p.nested("key").set(O),n?.(p)},onValueChange:O=>{p.nested("value").set(O),n?.(p)},onActiveChange:O=>{p.active.set(O),n?.(p)},onTypeChange:O=>{p.nested("type").set(O),n?.(p)},onFilesChange:O=>{p.nested("files").set(O),n?.(p)},...h},g.id)}),a?d.jsx(nN,{isLast:!0,index:i.length,parameter:u,onKeyChange:p=>f({key:p}),onValueChange:p=>f({value:p}),onActiveChange:p=>c.active.set(p),onTypeChange:p=>c.type.set(p),onFilesChange:p=>f({files:p}),...h},u.id):null]})]})}function kNe({data:t,type:e}){const n=zt(),r=t[e];function i(s){r[s].set(Ot)}return d.jsx(PNe,{keyName:"Param",formElements:r,environment:n,enableInputTypeSelection:e!==Hn["application/x-www-form-urlencoded"],createEmptyParameter:nK,actions:s=>d.jsx($i,{onClick:()=>i(s),variant:"text",icon:d.jsx(En.TrashCanIcon,{})})})}const TNe=({data:t})=>{const e=t.get(),[n,r]=y.useState(!1),i=y.useRef(null),s=l=>{const c=l.target.files?.[0];if(c){r(!0);const u=new FileReader;u.onload=()=>{r(!1),t.set({absolutePath:null,file:c})},u.readAsDataURL(c)}},o=async()=>{if(pn())try{const{open:l}=await Promise.resolve().then(()=>require("./replay-index-
|
|
3677
|
+
`,GU=t=>t==="file"?d.jsx(k8.FileIcon,{size:"14px"}):d.jsx(P8.CharacterIcon,{size:"14px"}),CNe=iNe.map(t=>({label:d.jsxs(fNe,{children:[GU(t),d.jsx(xNe,{children:t})]}),value:t}));function nN({isLast:t,index:e,parameter:n,onKeyChange:r,onValueChange:i,onActiveChange:s,onTypeChange:o,onFilesChange:a,environment:l,keyName:c,enableInputTypeSelection:u,autoCompleteOptions:f,actions:h}){const{value:p,key:m,active:g,type:O,files:v}=n,b=t?"form-data-name-ghost":`form-data-name-${e}`,x=t?"form-data-value-ghost":`form-data-value-${e}`,C=t?"form-data-checkbox-ghost":`form-data-checkbox-${e}`;return d.jsxs(mNe,{children:[d.jsx(ONe,{children:!t&&d.jsxs(d.Fragment,{children:[d.jsx(vNe,{"data-testid":C,type:"checkbox",checked:g,onChange:({target:S})=>s(S.checked)}),d.jsx(yNe,{checked:g})]})}),d.jsx(Le,{}),d.jsxs(d.Fragment,{children:[d.jsx(Pt,{dataTestId:b,placeholder:`${t?"New ":""}${c}`,value:m,environment:l,onChange:r}),u&&d.jsx(wNe,{children:d.jsx(SNe,{options:CNe,value:{label:GU(O),value:O,active:!0},onChange:({value:S})=>o(S),withArrow:!1,size:"small"})})]}),d.jsx(Le,{}),O==="file"?d.jsx(sNe,{files:v,onParameterChange:a}):d.jsx(Pt,{dataTestId:x,placeholder:"Value",value:p,environment:l,options:f,onChange:i}),d.jsx(Le,{}),d.jsx(bNe,{children:!t&&h(e)})]})}function PNe({title:t,enableInputTypeSelection:e=!1,onParameterChange:n,actions:r,formElements:i,keyName:s,environment:o,createEmptyParameter:a}){const l=ui(),{ghostState:c,ghostValue:u,promoteGhost:f}=MU({elements:i,createEmptyParameter:a,onParameterChange:n}),h={environment:o,keyName:s,enableInputTypeSelection:e,autoCompleteOptions:l,actions:r};return d.jsxs(hNe,{children:[t&&d.jsx(pNe,{children:t}),d.jsx(gNe,{children:[...i.map((p,m)=>{const g=p.get();return d.jsx(nN,{isLast:!1,index:m,parameter:g,onKeyChange:O=>{p.nested("key").set(O),n?.(p)},onValueChange:O=>{p.nested("value").set(O),n?.(p)},onActiveChange:O=>{p.active.set(O),n?.(p)},onTypeChange:O=>{p.nested("type").set(O),n?.(p)},onFilesChange:O=>{p.nested("files").set(O),n?.(p)},...h},g.id)}),a?d.jsx(nN,{isLast:!0,index:i.length,parameter:u,onKeyChange:p=>f({key:p}),onValueChange:p=>f({value:p}),onActiveChange:p=>c.active.set(p),onTypeChange:p=>c.type.set(p),onFilesChange:p=>f({files:p}),...h},u.id):null]})]})}function kNe({data:t,type:e}){const n=zt(),r=t[e];function i(s){r[s].set(Ot)}return d.jsx(PNe,{keyName:"Param",formElements:r,environment:n,enableInputTypeSelection:e!==Hn["application/x-www-form-urlencoded"],createEmptyParameter:nK,actions:s=>d.jsx($i,{onClick:()=>i(s),variant:"text",icon:d.jsx(En.TrashCanIcon,{})})})}const TNe=({data:t})=>{const e=t.get(),[n,r]=y.useState(!1),i=y.useRef(null),s=l=>{const c=l.target.files?.[0];if(c){r(!0);const u=new FileReader;u.onload=()=>{r(!1),t.set({absolutePath:null,file:c})},u.readAsDataURL(c)}},o=async()=>{if(pn())try{const{open:l}=await Promise.resolve().then(()=>require("./replay-index-DJwfdo0s.js")),c=await l();if(!c)return;const u=await Kp(c);t.set(u)}catch(l){console.error("Failed to open file dialog or read file:",l)}else i.current?.click()},a=()=>{t.set(null)};return n?d.jsxs($Ne,{children:[d.jsx(Oy.SpinnerIcon,{}),"Loading..."]}):e&&e.file?.name?d.jsxs(INe,{children:[d.jsxs(ENe,{children:[d.jsx($8.DocumentBlankIcon,{size:"16px"}),d.jsx(ANe,{children:e.file?.name})]}),d.jsx($i,{onClick:a,icon:d.jsx(En.TrashCanIcon,{})})]}):d.jsx(HU,{children:!e&&d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"file",hidden:!0,ref:i,onChange:s}),d.jsx(pe.Button,{type:"button",variant:"text",onClick:o,icon:d.jsx(T8.CloudUploadIcon,{}),children:"Upload file"})]})})},HU=w.default.div`
|
|
3678
3678
|
display: flex;
|
|
3679
3679
|
align-items: center;
|
|
3680
3680
|
justify-content: flex-start;
|
|
@@ -6054,7 +6054,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
|
|
|
6054
6054
|
display: inline-block;
|
|
6055
6055
|
color: var(--text-color-secondary);
|
|
6056
6056
|
margin-left: var(--spacing-xs);
|
|
6057
|
-
`,OXe="request",vXe=new Set(["replay:","redocly-replay:"]),yXe=8*1024,bXe=4*1024,$P=1024,xXe=new Set([kn.JSON,kn.XML,kn.HTML,kn.Text]);function IP(t){return d$(t).length>0}function SXe(t,e,n){return{id:crypto.randomUUID(),key:e,value:n,in:t,active:!0}}function ZB(t,e){return!t||t.length>$P||e.length>$P||IP(e)}function o1(t,e,n){const r=[];for(const[i,s]of t){if(!i.startsWith(e))continue;const o=i.slice(e.length);if(ZB(o,s))return null;r.push(SXe(n,o,s))}return r}function wXe(t){if(t.length>yXe)return null;let e;try{e=new URL(t)}catch{return null}if(!vXe.has(e.protocol)||e.hostname.toLowerCase()!==OXe)return null;const n=e.searchParams,r=n.get("url");if(!r||IP(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(!Ld.includes(s))return null;const o=o1(n,"header.","header"),a=o1(n,"query.","query"),l=o1(n,"cookie.","cookie");if(!o||!a||!l)return null;const c=zp(r);if(c.some(p=>ZB(p.key,p.value)))return null;const u=n.get("body");if(u!==null&&(u.length>bXe||IP(u)))return null;const f=n.get("contentType")?.trim();if(f&&!xXe.has(f))return null;const h=n.get("env")?.trim();return h&&h.length>$P?null:{xOperation:{method:s,url:r},headers:o,queryParameters:[...c,...a],cookies:l,...u!==null&&{body:{content:u,...f&&{type:f}}},...h&&{environment:h}}}function CXe(t){return t.stepId===null&&t.collectionId===null&&t.workflowId===null&&t.historyId===null&&!t.sourceFile}function PXe({onEnvironmentNotFound:t}={}){const{tabs:e,activeTabIdx:n}=Ol(),{addNewTab:r}=zn(),{environments:i,activeEnvironmentId:s}=He();return y.useCallback(o=>{const l=e.get().findIndex(({data:h})=>xn(h,De.Step)&&CXe(h)&&nP(h,o.xOperation));let c;if(l!==-1)c=l,n.set(c);else{const h=Co({xOperation:o.xOperation});c=r({id:crypto.randomUUID(),state:Cn.Normal,data:Pu({draftStep:h,activeTabName:Fl(h)})})}const u=e[c]?.data;u&&(u.response.set(null),u.requestError.set(null),u.isProcessingRequest.set(!1));const f=u?.draftStep.ornull;f&&(f.parameters.headers.set(o.headers),f.parameters.queryParameters.set(o.queryParameters),f.parameters.cookies.set(o.cookies),f.requestBody.set(np()),o.body&&f.requestBody.merge({content:o.body.content,...o.body.type&&{type:o.body.type}})),o.environment&&(i.get().some(p=>p.name===o.environment)?s.set(o.environment):t?.(o.environment))},[e,n,r,i,s,t])}const kXe="com.redocly.deepLink.opened";let YN=!1;function TXe(){const{warning:t}=wM.useToast(),e=Fe(),n=PXe({onEnvironmentNotFound:i=>t(`Environment "${i}" not found`)}),r=y.useRef(n);r.current=n,y.useEffect(()=>{let i,s=!1;const o=a=>{const l=a[0]&&wXe(a[0]);l&&(r.current(l),e.sendEvent(kXe,[{...me("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-3lwhSmvi.js")),c=await a(o);if(s){c();return}if(i=c,!YN){const u=await l();if(s)return;YN=!0,u?.[0]&&o(u)}})(),()=>{s=!0,i?.()}},[])}function $Xe(t){const e=t||"default";return{id:Ch(wy(e)),systemFilesDir:O1.join("/replay",e),userFilesDir:O1.join("/projects",e)}}async function IXe(t){if(!t)throw new Error("Tauri project: userFilesDir is required");const e=Ch(wy(t)),n=await EXe(),r=await vT(n,"replay",e);return{id:e,systemFilesDir:r,userFilesDir:t}}async function EXe(){if(!zC)return vC();try{return await hX()}catch{return vC()}}function EP(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 AXe=[{suffix:st.SecurityVariablesEnvSuffix.Token,getValue:t=>t.token&&Object.prototype.hasOwnProperty.call(t.token,"access_token")?t.token.access_token:void 0},{suffix:st.SecurityVariablesEnvSuffix.Username,getValue:t=>t.username},{suffix:st.SecurityVariablesEnvSuffix.Password,getValue:t=>t.password},{suffix:st.SecurityVariablesEnvSuffix.ClientId,getValue:t=>t.client_id},{suffix:st.SecurityVariablesEnvSuffix.ClientSecret,getValue:t=>t.client_secret}];function qB(t,e){const n=[];for(const r of t?.flat()||[]){const i=e[r.id]??e.default;if(!i)continue;const s=r.id;for(const o of AXe){const a=o.getValue(i);hk(a)&&n.push({name:s+o.suffix,value:a})}}return n}function QXe(t){const e=new Set,n=Object.values(st.SecurityVariablesEnvSuffix);for(const r of t.security?.flat()||[])if(r.id)for(const i of n)e.add(r.id+i);return e}function RXe(t,e){const n=new Set,r=QXe(t),i=s=>{if(s.security)for(const{name:o}of qB(t.security,s.security))n.add(o);for(const[o,a]of Object.entries(s.envVariables||{}))hk(a)&&r.has(o)&&n.add(o)};if(dy.isDirectConfigureRequestValues(e))return i(e),n;for(const s of Object.values(e))s&&i(s);return n}function jXe(t,e){const n=e.query??{},r=[],i=(s,o)=>{typeof o=="string"&&r.push({name:s,value:o})};for(const s of t.parameters){if(s.in!=="querystring")continue;const o=_4(s),a=new Set(o.map(l=>l.name));for(const l of a)i(l,n[l]);for(const[l,c]of Object.entries(n))for(const u of a)if(l.startsWith(`${u}[`)){i(l,c);break}}return r}function _Xe(t,e,n){const r=aK(t,n);if(!r)return[];const i=new Map,s=(o,a,l=!1)=>{i.set(o,{name:o,value:a,isSecret:l})};for(const[o,a]of Object.entries(r.envVariables||{}))s(o,a);for(const{name:o,value:a}of jXe(e,r))s(o,a);for(const o of e.parameters){const a=N4[o.in];if(!a)continue;const l=r[a]?.[o.name];hk(l)&&s(o.name,String(l))}if(r.security)for(const{name:o,value:a}of qB(e.security,r.security))s(o,a,!0);return Array.from(i.values())}function DXe(t,e){return t.find(n=>n.name===e)}function NXe(t,e,n){const r=Object.entries(e.variables??{}).map(([i,s])=>{const o=n?.variables.find(a=>a.name===i)?.value;return{name:i,value:o??s.default??""}});return{apiId:t,value:n?.value||e.url,specUrl:e.url,variables:r}}function MXe(t,e,n,r,i,s){const{servers:o,parameters:a}=e,l=a.filter(C=>C.in==="path"),c=VXe(e),u=new Set,f=l.map(C=>{const S=C.example?String(C.example):"";return u.add(C.name),{name:C.name,value:S,isSecret:!1}}),h=C=>c.map(S=>{const T=e.security?.flat().find($=>{const A=$.id;return S.name.startsWith(A)});let k="";if(T){const $=T.serverValues?.[C];$&&($["x-defaultUsername"]&&S.name.endsWith(st.SecurityVariablesEnvSuffix.Username)?k=$["x-defaultUsername"]:$["x-defaultPassword"]&&S.name.endsWith(st.SecurityVariablesEnvSuffix.Password)?k=$["x-defaultPassword"]:$["x-defaultClientId"]&&S.name.endsWith(st.SecurityVariablesEnvSuffix.ClientId)?k=$["x-defaultClientId"]:$["x-defaultClientSecret"]&&S.name.endsWith(st.SecurityVariablesEnvSuffix.ClientSecret)?k=$["x-defaultClientSecret"]:$["x-defaultAccessToken"]&&(k=$["x-defaultAccessToken"])),k||(T["x-defaultUsername"]&&S.name.endsWith(st.SecurityVariablesEnvSuffix.Username)?k=T["x-defaultUsername"]:T["x-defaultPassword"]&&S.name.endsWith(st.SecurityVariablesEnvSuffix.Password)?k=T["x-defaultPassword"]:T["x-defaultClientId"]&&S.name.endsWith(st.SecurityVariablesEnvSuffix.ClientId)?k=T["x-defaultClientId"]:T["x-defaultClientSecret"]&&S.name.endsWith(st.SecurityVariablesEnvSuffix.ClientSecret)?k=T["x-defaultClientSecret"]:T["x-defaultAccessToken"]&&(k=T["x-defaultAccessToken"]))}return u.add(S.name),{name:S.name,value:S.value||k||"",isSecret:S.isSecret}}),p=(C,S)=>{const T=DXe(n,S),k=T?.servers.find(D=>D.apiId===t),$=NXe(t,C,k),A=h(C.url),z=_Xe(i,e,C.url),M=z.map(D=>D.name),Q=T?.inputs.filter(D=>D.value&&!M.includes(D.name))||[];for(const D of z)u.add(D.name);const _=XXe(LXe(Q,f,A,z),r?.[S]),j=(T?.servers??[]).filter(D=>D.apiId!==t).map(D=>({...D,variables:D.variables.map(I=>({...I}))}));return{name:S,inputs:_,servers:[$,...j],state:At.Normal}},m=WXe(o),g=C=>C.name||C.description||C.url,O=m.map(C=>p(C,g(C))),v=new Set(O.map(C=>C.name)),b=m.find(C=>g(C)===s?.baseEnvironment)??m[0],x=(s?.names??[]).filter(C=>C.trim()&&!v.has(C)).map(C=>p(b,C));return{generatedInputs:u,environments:[...O,...x],synthesizedEnvironmentNames:new Set(x.map(C=>C.name))}}function zXe({envs:t,synthesizedEnvironmentNames:e,existingEnvironments:n,allowedEnvironments:r,selectedEnvironment:i,activeEnvironmentId:s}){if(r?.length){const l=t.filter(c=>e.has(c.name)||r.includes(c.name));return{newEnvironments:l,predefinedEnvironmentNames:new Set(l.map(c=>c.name)),activeEnvName:l.find(c=>c.name===i)?.name||l[0]?.name||""}}const o=new Set(t.map(l=>l.name)),a=[...t,...n.filter(l=>!o.has(l.name))];return{newEnvironments:a,predefinedEnvironmentNames:o,activeEnvName:a.find(l=>l.name===s)?.name||a.find(l=>l.name===i)?.name||a[0]?.name||""}}function VXe(t){const e=[];return(t.security?.flat()||[]).forEach(r=>{const i=tb(r),s=r.id;(i===te.BasicAuth||i===te.DigestAuth)&&(e.push(vs(s+st.SecurityVariablesEnvSuffix.Username,!1)),e.push(vs(s+st.SecurityVariablesEnvSuffix.Password))),i===te.JWT&&e.push(vs(s+st.SecurityVariablesEnvSuffix.JWTToken)),i===te.APIKey&&e.push(vs(s+st.SecurityVariablesEnvSuffix.APIKey)),i===te.OAuth2&&(e.push(vs(s+st.SecurityVariablesEnvSuffix.Token)),OT(r).forEach(a=>{e.push(vs(s+st.SecurityVariablesEnvSuffix.ClientId)),[K.Implicit,K.ClientCredentialsWithJwtAssertion].includes(a)||e.push(vs(s+st.SecurityVariablesEnvSuffix.ClientSecret)),a===K.ClientCredentialsWithJwtAssertion&&e.push(vs(s+st.SecurityVariablesEnvSuffix.ClientAssertion))})),i===te.OpenIDConnect&&(e.push(vs(s+st.SecurityVariablesEnvSuffix.Token)),e.push(vs(s+st.SecurityVariablesEnvSuffix.ClientId)),e.push(vs(s+st.SecurityVariablesEnvSuffix.ClientSecret)))}),e}function vs(t,e=!0){return{name:t,value:"",isSecret:e}}function LXe(...t){const e=new Map;for(const n of t)for(const r of n){const i=e.get(r.name);e.set(r.name,{name:r.name,value:r.value||i?.value||"",isSecret:r.isSecret||i?.isSecret||!1})}return Array.from(e.values())}function AP(t){return typeof t=="string"?{value:t}:t}function XXe(t,e){if(!e)return t;const n=new Set(t.map(s=>s.name)),r=t.map(s=>{const o=e[s.name];if(o===void 0)return s;const{value:a,isSecret:l}=AP(o);return{...s,value:a,...l!==void 0&&{isSecret:l}}}),i=Object.entries(e).filter(([s])=>!n.has(s)).map(([s,o])=>{const{value:a,isSecret:l}=AP(o);return{name:s,value:a,isSecret:l??!1}});return[...r,...i]}function WXe(t){const n=y4(Sd.IS_BROWSER?window.location.href:globalThis.SSR_HOSTNAME||"");t.length===0&&(t=[{url:"/"}]);function r(i){return AJ(n,i)}return t.map(i=>({...i,url:r(i.url),description:i.description||""}))}function Qm(t,e){if(e.size===0)return;const n=t.get({noproxy:!0});for(let r=0;r<n.length;r++){const i=n[r];!Ep(i)||!i.key||!e.has(i.key)||t[r].merge({value:`$inputs.${i.key}`,active:!0})}}function UB(t,e,n){if(typeof e=="string"){const i=ts(e);i&&n.has(i)&&t.set(e);return}if(!e||typeof e!="object"||Array.isArray(e))return;const r=t;for(const[i,s]of Object.entries(e)){const o=r[i];o&&UB(o,s,n)}}function ZXe(t,e,n){if(n.size===0)return;const r=t.get({noproxy:!0});for(const i of e){if(!i.securitySchemeId)continue;const s=r.findIndex(o=>o.securitySchemeId===i.securitySchemeId);s!==-1&&UB(t[s],i,n)}}function qXe(t,e,n){const r=pT(e.parameters,"in");Qm(t.parameters.pathParameters,Tu(r.path,"path",n)),Qm(t.parameters.queryParameters,M4(r.query,r.querystring,n)),Qm(t.parameters.headers,Tu(r.header,"header",n)),Qm(t.parameters.cookies,Tu(r.cookie,"cookie",n)),ZXe(t.security,eb(e),RXe(e,n))}function GN(t,e,n){if(!t||!t.paths||Object.keys(t.paths).length===0)return{operations:null,error:0};const{operations:r}=UXe(t,e,n);return{operations:r}}function UXe(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}=HN(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}=HN(i,o,t,c,e,!0,n);u&&r.push(u)})}return{operations:r}}function HN(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:rde(a,s,i,l)}}const JN=(t,e,n)=>t.find(r=>{if(e&&r.operationId===e)return!0;if(n&&r.apiPath){const{path:i,method:s}=IX({operationPath:n,parsedSourceDescriptions:[]});return r.apiPath.path===i&&r.apiPath.method===s}return!1});class BXe{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 QP{static instance=null;static async initialize(e,n){this.close(),this.instance=await FXe(e,n)}static getInstance(){if(!this.instance)throw new Error("AiChatService not initialized");return this.instance}static close(){this.instance=null}}async function FXe(t,e){if(e){const{AiChatSqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-AiChatSqliteDBStorage-yawoZunX.js")),r=hp.getInstance(),i=new n(r);return new BXe(i)}else throw new Error("Not implemented")}const ou="ai-chat",a1="detail",YXe="title",KN="infinite-history",BB={all:()=>[ou],details:()=>[ou,a1],detail:t=>[ou,a1,t],detailTitle:t=>[ou,a1,t,YXe],infiniteHistories:()=>[ou,KN],infiniteHistory:t=>[ou,KN,t]},MI=({children:t,settings:e,api:n,activeOperationId:r,activeOperationPointer:i,onLoad:s})=>{const o=y.useContext(LT),a=Fe(),l=Zr.useQueryClient(),c=y.useRef(e);c.current=e;const u=y.useMemo(async()=>{const h=pn()?await IXe(e.storageKey):$Xe(e.storageKey);e.layout!=="preview"&&pn()&&sp.initialize();const{isInitialized:p}=await o.init(h,e,a);if(e.layout!=="preview"){if(pn()){const S=`${h.systemFilesDir}/replay.db`;await hp.initialize(S),await QP.initialize(h,pn())}await Ha.initialize(h,pn()),await ws.initialize(pn());try{await ws.getInstance()?.pruneOlderThan(Date.now()-exe)}catch(S){console.error("Failed to prune step context:",S)}try{const S=await ywe.migrate(h,Ha.getInstance(),pn());S.migrated&&a.sendEvent("com.redocly.history.migration",[{...me("migration","historyMigration","storage"),status:"success",itemCount:S.itemCount}])}catch(S){console.error("History migration failed:",S),a.sendEvent("com.redocly.history.migration",[{...me("migration","historyMigration","storage"),status:"error",error:S instanceof Error?S.message:"Unknown error"}])}}if(!p)return;if(!n){o.environments.length===0&&o.environments.set(tk);return}const m=EP(n,[]),{operations:g}=GN(n,m,e.convertOperationToReplayValue);if(!g?.length||!g[0].collectionPath?.split("/")?.[0]||(o.apis.set([{id:m,srcType:oi.FS,...n}]),o.predefinedApiId.set(m),!r&&!i))return;const v=JN(g,r,i),{path:b,method:x}=v?.apiPath||{};if(!v||!b||!x)return;const C=e.convertOperationToReplayValue?.(b,x,n);C&&eM(o,m,C,c.current),JXe(o,{apiId:m,path:b,method:x,operationId:v.operationId,isAdditionalOperation:v.isAdditionalOperation},C,e.dynamicReplayValues)},[e.storageKey]);y.useEffect(()=>{if(e.layout!=="preview")return l.invalidateQueries({queryKey:Ir.all}),l.invalidateQueries({queryKey:BB.all()}),l.invalidateQueries({queryKey:sg.all}),()=>{Ha.close(),QP.close(),sp.close(),ws.close(),pn()&&hp.close().catch(h=>{console.error("Failed to close SqliteDBConnection:",h)})}},[e.storageKey,e.layout,l]),y.useEffect(()=>{if(!n||!e.convertOperationToReplayValue)return;const h=EP(n,[]),{operations:p}=GN(n,h,e.convertOperationToReplayValue);if(!p?.length)return;const m=JN(p,r,i),{path:g,method:O}=m?.apiPath||{};if(!m||!g||!O)return;const v=e.convertOperationToReplayValue(g,O,n);v&&eM(o,h,v,e)},[e.convertOperationToReplayValue,e.predefinedEnvValues,e.gateEnvironments,e.dynamicReplayValues,e.allowedEnvironments,e.selectedEnvironment,n,r,i]);const f=e.layout==="preview"?null:d.jsx(pXe,{projectPath:e.storageKey});return d.jsx(y.Suspense,{fallback:f,children:d.jsx(GXe,{initStore:u,settings:e,api:n,onLoad:s,children:t})})};function GXe({initStore:t,children:e,settings:n,api:r,onLoad:i}){return y.use(t),b0e(n,r),y.useEffect(()=>{i?.()},[]),d.jsxs(U.default.Fragment,{children:[pn()&&d.jsx(HXe,{}),e]},n.storageKey)}function HXe(){return TXe(),null}const eM=(t,e,n,r)=>{const i=t.environments.get({noproxy:!0}),{environments:s,generatedInputs:o,synthesizedEnvironmentNames:a}=MXe(e,n,i,r.predefinedEnvValues,r.dynamicReplayValues,r.gateEnvironments);t.predefinedInputNames.set(o);const{newEnvironments:l,predefinedEnvironmentNames:c,activeEnvName:u}=zXe({envs:s,synthesizedEnvironmentNames:a,existingEnvironments:i,allowedEnvironments:r.allowedEnvironments,selectedEnvironment:r.selectedEnvironment,activeEnvironmentId:t.activeEnvironmentId.get()});t.predefinedEnvironmentNames.set(c),_1(l,t.environments.get({noproxy:!0}))||t.environments.set(l),t.activeEnvironmentId.set(u)},JXe=(t,e,n,r)=>{const i=t.tabsState.tabs.get().findIndex(({data:s})=>xn(s,De.Step)&&s.draftStep?.operation?.apiId===e.apiId&&s.draftStep?.operation?.path===e.path&&s.draftStep?.operation?.method===e.method);if(i!==-1){const s=t.tabsState.tabs[i],o=s.data.get();if(n&&r&&xn(o,De.Step)){const l=s.data.draftStep.ornull;l&&qXe(l,n,r)}t.tabsState.activeTabIdx.set(i)}else{const s=D$(e,n,r);t.tabsState.tabs.merge([{...s,state:Cn.Normal}]),t.tabsState.activeTabIdx.set(t.tabsState.tabs.length-1)}};function KXe(t){const e=y.useMemo(()=>DM(w7({defaultEnvironments:[]}),NM(S7(!0))),[]);return d.jsx(Zr.QueryClientProvider,{client:fb(),children:d.jsx(Yhe,{value:e,children:d.jsx(bb.Provider,{value:t.settings,children:d.jsx(MI,{...t,children:d.jsx(_B,{onError:n=>console.error(n),children:d.jsx(e7e,{...t})})})})})})}function e7e(t){return t.settings.disableDraft=!0,d.jsx(y.StrictMode,{children:d.jsxs(t7e,{children:[d.jsx(n7e,{children:d.jsx(NI,{})}),d.jsx(xh,{hideTabs:!0})]})})}const t7e=w.default.div`
|
|
6057
|
+
`,OXe="request",vXe=new Set(["replay:","redocly-replay:"]),yXe=8*1024,bXe=4*1024,$P=1024,xXe=new Set([kn.JSON,kn.XML,kn.HTML,kn.Text]);function IP(t){return d$(t).length>0}function SXe(t,e,n){return{id:crypto.randomUUID(),key:e,value:n,in:t,active:!0}}function ZB(t,e){return!t||t.length>$P||e.length>$P||IP(e)}function o1(t,e,n){const r=[];for(const[i,s]of t){if(!i.startsWith(e))continue;const o=i.slice(e.length);if(ZB(o,s))return null;r.push(SXe(n,o,s))}return r}function wXe(t){if(t.length>yXe)return null;let e;try{e=new URL(t)}catch{return null}if(!vXe.has(e.protocol)||e.hostname.toLowerCase()!==OXe)return null;const n=e.searchParams,r=n.get("url");if(!r||IP(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(!Ld.includes(s))return null;const o=o1(n,"header.","header"),a=o1(n,"query.","query"),l=o1(n,"cookie.","cookie");if(!o||!a||!l)return null;const c=zp(r);if(c.some(p=>ZB(p.key,p.value)))return null;const u=n.get("body");if(u!==null&&(u.length>bXe||IP(u)))return null;const f=n.get("contentType")?.trim();if(f&&!xXe.has(f))return null;const h=n.get("env")?.trim();return h&&h.length>$P?null:{xOperation:{method:s,url:r},headers:o,queryParameters:[...c,...a],cookies:l,...u!==null&&{body:{content:u,...f&&{type:f}}},...h&&{environment:h}}}function CXe(t){return t.stepId===null&&t.collectionId===null&&t.workflowId===null&&t.historyId===null&&!t.sourceFile}function PXe({onEnvironmentNotFound:t}={}){const{tabs:e,activeTabIdx:n}=Ol(),{addNewTab:r}=zn(),{environments:i,activeEnvironmentId:s}=He();return y.useCallback(o=>{const l=e.get().findIndex(({data:h})=>xn(h,De.Step)&&CXe(h)&&nP(h,o.xOperation));let c;if(l!==-1)c=l,n.set(c);else{const h=Co({xOperation:o.xOperation});c=r({id:crypto.randomUUID(),state:Cn.Normal,data:Pu({draftStep:h,activeTabName:Fl(h)})})}const u=e[c]?.data;u&&(u.response.set(null),u.requestError.set(null),u.isProcessingRequest.set(!1));const f=u?.draftStep.ornull;f&&(f.parameters.headers.set(o.headers),f.parameters.queryParameters.set(o.queryParameters),f.parameters.cookies.set(o.cookies),f.requestBody.set(np()),o.body&&f.requestBody.merge({content:o.body.content,...o.body.type&&{type:o.body.type}})),o.environment&&(i.get().some(p=>p.name===o.environment)?s.set(o.environment):t?.(o.environment))},[e,n,r,i,s,t])}const kXe="com.redocly.deepLink.opened";let YN=!1;function TXe(){const{warning:t}=wM.useToast(),e=Fe(),n=PXe({onEnvironmentNotFound:i=>t(`Environment "${i}" not found`)}),r=y.useRef(n);r.current=n,y.useEffect(()=>{let i,s=!1;const o=a=>{const l=a[0]&&wXe(a[0]);l&&(r.current(l),e.sendEvent(kXe,[{...me("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-3lwhSmvi.js")),c=await a(o);if(s){c();return}if(i=c,!YN){const u=await l();if(s)return;YN=!0,u?.[0]&&o(u)}})(),()=>{s=!0,i?.()}},[])}function $Xe(t){const e=t||"default";return{id:Ch(wy(e)),systemFilesDir:O1.join("/replay",e),userFilesDir:O1.join("/projects",e)}}async function IXe(t){if(!t)throw new Error("Tauri project: userFilesDir is required");const e=Ch(wy(t)),n=await EXe(),r=await vT(n,"replay",e);return{id:e,systemFilesDir:r,userFilesDir:t}}async function EXe(){if(!zC)return vC();try{return await hX()}catch{return vC()}}function EP(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 AXe=[{suffix:st.SecurityVariablesEnvSuffix.Token,getValue:t=>t.token&&Object.prototype.hasOwnProperty.call(t.token,"access_token")?t.token.access_token:void 0},{suffix:st.SecurityVariablesEnvSuffix.Username,getValue:t=>t.username},{suffix:st.SecurityVariablesEnvSuffix.Password,getValue:t=>t.password},{suffix:st.SecurityVariablesEnvSuffix.ClientId,getValue:t=>t.client_id},{suffix:st.SecurityVariablesEnvSuffix.ClientSecret,getValue:t=>t.client_secret}];function qB(t,e){const n=[];for(const r of t?.flat()||[]){const i=e[r.id]??e.default;if(!i)continue;const s=r.id;for(const o of AXe){const a=o.getValue(i);hk(a)&&n.push({name:s+o.suffix,value:a})}}return n}function QXe(t){const e=new Set,n=Object.values(st.SecurityVariablesEnvSuffix);for(const r of t.security?.flat()||[])if(r.id)for(const i of n)e.add(r.id+i);return e}function RXe(t,e){const n=new Set,r=QXe(t),i=s=>{if(s.security)for(const{name:o}of qB(t.security,s.security))n.add(o);for(const[o,a]of Object.entries(s.envVariables||{}))hk(a)&&r.has(o)&&n.add(o)};if(dy.isDirectConfigureRequestValues(e))return i(e),n;for(const s of Object.values(e))s&&i(s);return n}function jXe(t,e){const n=e.query??{},r=[],i=(s,o)=>{typeof o=="string"&&r.push({name:s,value:o})};for(const s of t.parameters){if(s.in!=="querystring")continue;const o=_4(s),a=new Set(o.map(l=>l.name));for(const l of a)i(l,n[l]);for(const[l,c]of Object.entries(n))for(const u of a)if(l.startsWith(`${u}[`)){i(l,c);break}}return r}function _Xe(t,e,n){const r=aK(t,n);if(!r)return[];const i=new Map,s=(o,a,l=!1)=>{i.set(o,{name:o,value:a,isSecret:l})};for(const[o,a]of Object.entries(r.envVariables||{}))s(o,a);for(const{name:o,value:a}of jXe(e,r))s(o,a);for(const o of e.parameters){const a=N4[o.in];if(!a)continue;const l=r[a]?.[o.name];hk(l)&&s(o.name,String(l))}if(r.security)for(const{name:o,value:a}of qB(e.security,r.security))s(o,a,!0);return Array.from(i.values())}function DXe(t,e){return t.find(n=>n.name===e)}function NXe(t,e,n){const r=Object.entries(e.variables??{}).map(([i,s])=>{const o=n?.variables.find(a=>a.name===i)?.value;return{name:i,value:o??s.default??""}});return{apiId:t,value:n?.value||e.url,specUrl:e.url,variables:r}}function MXe(t,e,n,r,i,s){const{servers:o,parameters:a}=e,l=a.filter(C=>C.in==="path"),c=VXe(e),u=new Set,f=l.map(C=>{const S=C.example?String(C.example):"";return u.add(C.name),{name:C.name,value:S,isSecret:!1}}),h=C=>c.map(S=>{const T=e.security?.flat().find($=>{const A=$.id;return S.name.startsWith(A)});let k="";if(T){const $=T.serverValues?.[C];$&&($["x-defaultUsername"]&&S.name.endsWith(st.SecurityVariablesEnvSuffix.Username)?k=$["x-defaultUsername"]:$["x-defaultPassword"]&&S.name.endsWith(st.SecurityVariablesEnvSuffix.Password)?k=$["x-defaultPassword"]:$["x-defaultClientId"]&&S.name.endsWith(st.SecurityVariablesEnvSuffix.ClientId)?k=$["x-defaultClientId"]:$["x-defaultClientSecret"]&&S.name.endsWith(st.SecurityVariablesEnvSuffix.ClientSecret)?k=$["x-defaultClientSecret"]:$["x-defaultAccessToken"]&&(k=$["x-defaultAccessToken"])),k||(T["x-defaultUsername"]&&S.name.endsWith(st.SecurityVariablesEnvSuffix.Username)?k=T["x-defaultUsername"]:T["x-defaultPassword"]&&S.name.endsWith(st.SecurityVariablesEnvSuffix.Password)?k=T["x-defaultPassword"]:T["x-defaultClientId"]&&S.name.endsWith(st.SecurityVariablesEnvSuffix.ClientId)?k=T["x-defaultClientId"]:T["x-defaultClientSecret"]&&S.name.endsWith(st.SecurityVariablesEnvSuffix.ClientSecret)?k=T["x-defaultClientSecret"]:T["x-defaultAccessToken"]&&(k=T["x-defaultAccessToken"]))}return u.add(S.name),{name:S.name,value:S.value||k||"",isSecret:S.isSecret}}),p=(C,S)=>{const T=DXe(n,S),k=T?.servers.find(D=>D.apiId===t),$=NXe(t,C,k),A=h(C.url),z=_Xe(i,e,C.url),M=z.map(D=>D.name),Q=T?.inputs.filter(D=>D.value&&!M.includes(D.name))||[];for(const D of z)u.add(D.name);const _=XXe(LXe(Q,f,A,z),r?.[S]),j=(T?.servers??[]).filter(D=>D.apiId!==t).map(D=>({...D,variables:D.variables.map(I=>({...I}))}));return{name:S,inputs:_,servers:[$,...j],state:At.Normal}},m=WXe(o),g=C=>C.name||C.description||C.url,O=m.map(C=>p(C,g(C))),v=new Set(O.map(C=>C.name)),b=m.find(C=>g(C)===s?.baseEnvironment)??m[0],x=(s?.names??[]).filter(C=>C.trim()&&!v.has(C)).map(C=>p(b,C));return{generatedInputs:u,environments:[...O,...x],synthesizedEnvironmentNames:new Set(x.map(C=>C.name))}}function zXe({envs:t,synthesizedEnvironmentNames:e,existingEnvironments:n,allowedEnvironments:r,selectedEnvironment:i,activeEnvironmentId:s}){if(r?.length){const l=t.filter(c=>e.has(c.name)||r.includes(c.name));return{newEnvironments:l,predefinedEnvironmentNames:new Set(l.map(c=>c.name)),activeEnvName:l.find(c=>c.name===i)?.name||l[0]?.name||""}}const o=new Set(t.map(l=>l.name)),a=[...t,...n.filter(l=>!o.has(l.name))];return{newEnvironments:a,predefinedEnvironmentNames:o,activeEnvName:a.find(l=>l.name===s)?.name||a.find(l=>l.name===i)?.name||a[0]?.name||""}}function VXe(t){const e=[];return(t.security?.flat()||[]).forEach(r=>{const i=tb(r),s=r.id;(i===te.BasicAuth||i===te.DigestAuth)&&(e.push(vs(s+st.SecurityVariablesEnvSuffix.Username,!1)),e.push(vs(s+st.SecurityVariablesEnvSuffix.Password))),i===te.JWT&&e.push(vs(s+st.SecurityVariablesEnvSuffix.JWTToken)),i===te.APIKey&&e.push(vs(s+st.SecurityVariablesEnvSuffix.APIKey)),i===te.OAuth2&&(e.push(vs(s+st.SecurityVariablesEnvSuffix.Token)),OT(r).forEach(a=>{e.push(vs(s+st.SecurityVariablesEnvSuffix.ClientId)),[K.Implicit,K.ClientCredentialsWithJwtAssertion].includes(a)||e.push(vs(s+st.SecurityVariablesEnvSuffix.ClientSecret)),a===K.ClientCredentialsWithJwtAssertion&&e.push(vs(s+st.SecurityVariablesEnvSuffix.ClientAssertion))})),i===te.OpenIDConnect&&(e.push(vs(s+st.SecurityVariablesEnvSuffix.Token)),e.push(vs(s+st.SecurityVariablesEnvSuffix.ClientId)),e.push(vs(s+st.SecurityVariablesEnvSuffix.ClientSecret)))}),e}function vs(t,e=!0){return{name:t,value:"",isSecret:e}}function LXe(...t){const e=new Map;for(const n of t)for(const r of n){const i=e.get(r.name);e.set(r.name,{name:r.name,value:r.value||i?.value||"",isSecret:r.isSecret||i?.isSecret||!1})}return Array.from(e.values())}function AP(t){return typeof t=="string"?{value:t}:t}function XXe(t,e){if(!e)return t;const n=new Set(t.map(s=>s.name)),r=t.map(s=>{const o=e[s.name];if(o===void 0)return s;const{value:a,isSecret:l}=AP(o);return{...s,value:a,...l!==void 0&&{isSecret:l}}}),i=Object.entries(e).filter(([s])=>!n.has(s)).map(([s,o])=>{const{value:a,isSecret:l}=AP(o);return{name:s,value:a,isSecret:l??!1}});return[...r,...i]}function WXe(t){const n=y4(Sd.IS_BROWSER?window.location.href:globalThis.SSR_HOSTNAME||"");t.length===0&&(t=[{url:"/"}]);function r(i){return AJ(n,i)}return t.map(i=>({...i,url:r(i.url),description:i.description||""}))}function Qm(t,e){if(e.size===0)return;const n=t.get({noproxy:!0});for(let r=0;r<n.length;r++){const i=n[r];!Ep(i)||!i.key||!e.has(i.key)||t[r].merge({value:`$inputs.${i.key}`,active:!0})}}function UB(t,e,n){if(typeof e=="string"){const i=ts(e);i&&n.has(i)&&t.set(e);return}if(!e||typeof e!="object"||Array.isArray(e))return;const r=t;for(const[i,s]of Object.entries(e)){const o=r[i];o&&UB(o,s,n)}}function ZXe(t,e,n){if(n.size===0)return;const r=t.get({noproxy:!0});for(const i of e){if(!i.securitySchemeId)continue;const s=r.findIndex(o=>o.securitySchemeId===i.securitySchemeId);s!==-1&&UB(t[s],i,n)}}function qXe(t,e,n){const r=pT(e.parameters,"in");Qm(t.parameters.pathParameters,Tu(r.path,"path",n)),Qm(t.parameters.queryParameters,M4(r.query,r.querystring,n)),Qm(t.parameters.headers,Tu(r.header,"header",n)),Qm(t.parameters.cookies,Tu(r.cookie,"cookie",n)),ZXe(t.security,eb(e),RXe(e,n))}function GN(t,e,n){if(!t||!t.paths||Object.keys(t.paths).length===0)return{operations:null,error:0};const{operations:r}=UXe(t,e,n);return{operations:r}}function UXe(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}=HN(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}=HN(i,o,t,c,e,!0,n);u&&r.push(u)})}return{operations:r}}function HN(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:rde(a,s,i,l)}}const JN=(t,e,n)=>t.find(r=>{if(e&&r.operationId===e)return!0;if(n&&r.apiPath){const{path:i,method:s}=IX({operationPath:n,parsedSourceDescriptions:[]});return r.apiPath.path===i&&r.apiPath.method===s}return!1});class BXe{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 QP{static instance=null;static async initialize(e,n){this.close(),this.instance=await FXe(e,n)}static getInstance(){if(!this.instance)throw new Error("AiChatService not initialized");return this.instance}static close(){this.instance=null}}async function FXe(t,e){if(e){const{AiChatSqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-AiChatSqliteDBStorage-C-rkQ3jG.js")),r=hp.getInstance(),i=new n(r);return new BXe(i)}else throw new Error("Not implemented")}const ou="ai-chat",a1="detail",YXe="title",KN="infinite-history",BB={all:()=>[ou],details:()=>[ou,a1],detail:t=>[ou,a1,t],detailTitle:t=>[ou,a1,t,YXe],infiniteHistories:()=>[ou,KN],infiniteHistory:t=>[ou,KN,t]},MI=({children:t,settings:e,api:n,activeOperationId:r,activeOperationPointer:i,onLoad:s})=>{const o=y.useContext(LT),a=Fe(),l=Zr.useQueryClient(),c=y.useRef(e);c.current=e;const u=y.useMemo(async()=>{const h=pn()?await IXe(e.storageKey):$Xe(e.storageKey);e.layout!=="preview"&&pn()&&sp.initialize();const{isInitialized:p}=await o.init(h,e,a);if(e.layout!=="preview"){if(pn()){const S=`${h.systemFilesDir}/replay.db`;await hp.initialize(S),await QP.initialize(h,pn())}await Ha.initialize(h,pn()),await ws.initialize(pn());try{await ws.getInstance()?.pruneOlderThan(Date.now()-exe)}catch(S){console.error("Failed to prune step context:",S)}try{const S=await ywe.migrate(h,Ha.getInstance(),pn());S.migrated&&a.sendEvent("com.redocly.history.migration",[{...me("migration","historyMigration","storage"),status:"success",itemCount:S.itemCount}])}catch(S){console.error("History migration failed:",S),a.sendEvent("com.redocly.history.migration",[{...me("migration","historyMigration","storage"),status:"error",error:S instanceof Error?S.message:"Unknown error"}])}}if(!p)return;if(!n){o.environments.length===0&&o.environments.set(tk);return}const m=EP(n,[]),{operations:g}=GN(n,m,e.convertOperationToReplayValue);if(!g?.length||!g[0].collectionPath?.split("/")?.[0]||(o.apis.set([{id:m,srcType:oi.FS,...n}]),o.predefinedApiId.set(m),!r&&!i))return;const v=JN(g,r,i),{path:b,method:x}=v?.apiPath||{};if(!v||!b||!x)return;const C=e.convertOperationToReplayValue?.(b,x,n);C&&eM(o,m,C,c.current),JXe(o,{apiId:m,path:b,method:x,operationId:v.operationId,isAdditionalOperation:v.isAdditionalOperation},C,e.dynamicReplayValues)},[e.storageKey]);y.useEffect(()=>{if(e.layout!=="preview")return l.invalidateQueries({queryKey:Ir.all}),l.invalidateQueries({queryKey:BB.all()}),l.invalidateQueries({queryKey:sg.all}),()=>{Ha.close(),QP.close(),sp.close(),ws.close(),pn()&&hp.close().catch(h=>{console.error("Failed to close SqliteDBConnection:",h)})}},[e.storageKey,e.layout,l]),y.useEffect(()=>{if(!n||!e.convertOperationToReplayValue)return;const h=EP(n,[]),{operations:p}=GN(n,h,e.convertOperationToReplayValue);if(!p?.length)return;const m=JN(p,r,i),{path:g,method:O}=m?.apiPath||{};if(!m||!g||!O)return;const v=e.convertOperationToReplayValue(g,O,n);v&&eM(o,h,v,e)},[e.convertOperationToReplayValue,e.predefinedEnvValues,e.gateEnvironments,e.dynamicReplayValues,e.allowedEnvironments,e.selectedEnvironment,n,r,i]);const f=e.layout==="preview"?null:d.jsx(pXe,{projectPath:e.storageKey});return d.jsx(y.Suspense,{fallback:f,children:d.jsx(GXe,{initStore:u,settings:e,api:n,onLoad:s,children:t})})};function GXe({initStore:t,children:e,settings:n,api:r,onLoad:i}){return y.use(t),b0e(n,r),y.useEffect(()=>{i?.()},[]),d.jsxs(U.default.Fragment,{children:[pn()&&d.jsx(HXe,{}),e]},n.storageKey)}function HXe(){return TXe(),null}const eM=(t,e,n,r)=>{const i=t.environments.get({noproxy:!0}),{environments:s,generatedInputs:o,synthesizedEnvironmentNames:a}=MXe(e,n,i,r.predefinedEnvValues,r.dynamicReplayValues,r.gateEnvironments);t.predefinedInputNames.set(o);const{newEnvironments:l,predefinedEnvironmentNames:c,activeEnvName:u}=zXe({envs:s,synthesizedEnvironmentNames:a,existingEnvironments:i,allowedEnvironments:r.allowedEnvironments,selectedEnvironment:r.selectedEnvironment,activeEnvironmentId:t.activeEnvironmentId.get()});t.predefinedEnvironmentNames.set(c),_1(l,t.environments.get({noproxy:!0}))||t.environments.set(l),t.activeEnvironmentId.set(u)},JXe=(t,e,n,r)=>{const i=t.tabsState.tabs.get().findIndex(({data:s})=>xn(s,De.Step)&&s.draftStep?.operation?.apiId===e.apiId&&s.draftStep?.operation?.path===e.path&&s.draftStep?.operation?.method===e.method);if(i!==-1){const s=t.tabsState.tabs[i],o=s.data.get();if(n&&r&&xn(o,De.Step)){const l=s.data.draftStep.ornull;l&&qXe(l,n,r)}t.tabsState.activeTabIdx.set(i)}else{const s=D$(e,n,r);t.tabsState.tabs.merge([{...s,state:Cn.Normal}]),t.tabsState.activeTabIdx.set(t.tabsState.tabs.length-1)}};function KXe(t){const e=y.useMemo(()=>DM(w7({defaultEnvironments:[]}),NM(S7(!0))),[]);return d.jsx(Zr.QueryClientProvider,{client:fb(),children:d.jsx(Yhe,{value:e,children:d.jsx(bb.Provider,{value:t.settings,children:d.jsx(MI,{...t,children:d.jsx(_B,{onError:n=>console.error(n),children:d.jsx(e7e,{...t})})})})})})}function e7e(t){return t.settings.disableDraft=!0,d.jsx(y.StrictMode,{children:d.jsxs(t7e,{children:[d.jsx(n7e,{children:d.jsx(NI,{})}),d.jsx(xh,{hideTabs:!0})]})})}const t7e=w.default.div`
|
|
6058
6058
|
display: flex;
|
|
6059
6059
|
flex-direction: column;
|
|
6060
6060
|
max-height: 80vh;
|
|
@@ -6939,7 +6939,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
|
|
|
6939
6939
|
border-right: ${({$isOverlayLayout:t})=>t?"1px solid var(--border-color-secondary)":"none"};
|
|
6940
6940
|
width: 100%;
|
|
6941
6941
|
user-select: none;
|
|
6942
|
-
`;function hM({children:t}){const{apps:{apiId:e}}=He(),{sendEvent:n}=Fe(),{tabsParams:r}=l0(e.get(),!1),[i,s]=y.useState(r[0]?.key||null),o=y.useCallback(l=>{s(l),n("com.redocly.tab.change",[{...me("tab","sidePanelTab"),source:"side_panel",name:l}])},[n]),a={tabsParams:r,activeTab:i,onTabChange:o};return d.jsx(o8.Provider,{value:a,children:t})}function Sqe(){const[t,e]=y.useState(()=>{const n=document.documentElement.clientWidth;return pM(n)});return y.useEffect(()=>{const n=()=>{const r=document.documentElement.clientWidth;e(pM(r))};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t}function pM(t){return t>=1512?24:t>=1280?28:t>=1024?32:35}const wqe={isOpen:!1,openPanel:()=>{},closePanel:()=>{}},l8=y.createContext(wqe);function c8(){return y.useContext(l8)}const Cqe=y.lazy(()=>Promise.resolve().then(()=>require("./replay-AiPanel-
|
|
6942
|
+
`;function hM({children:t}){const{apps:{apiId:e}}=He(),{sendEvent:n}=Fe(),{tabsParams:r}=l0(e.get(),!1),[i,s]=y.useState(r[0]?.key||null),o=y.useCallback(l=>{s(l),n("com.redocly.tab.change",[{...me("tab","sidePanelTab"),source:"side_panel",name:l}])},[n]),a={tabsParams:r,activeTab:i,onTabChange:o};return d.jsx(o8.Provider,{value:a,children:t})}function Sqe(){const[t,e]=y.useState(()=>{const n=document.documentElement.clientWidth;return pM(n)});return y.useEffect(()=>{const n=()=>{const r=document.documentElement.clientWidth;e(pM(r))};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t}function pM(t){return t>=1512?24:t>=1280?28:t>=1024?32:35}const wqe={isOpen:!1,openPanel:()=>{},closePanel:()=>{}},l8=y.createContext(wqe);function c8(){return y.useContext(l8)}const Cqe=y.lazy(()=>Promise.resolve().then(()=>require("./replay-AiPanel-DzGN1t86.js")).then(t=>({default:t.AiPanel}))),Pqe=20,kqe=25,Tqe=40;function $qe({panel:t,panelProps:e}){const[n,r]=y.useState(!1),{layout:i,aiEnabled:s}=Or(),o=Sqe(),{isOpen:a,openPanel:l,closePanel:c}=c8(),{panelProps:u,panel:f}=Wb(!a),h=s===!0,p=i==="overlay",{onCollapse:m,onExpand:g,...O}=u;return y.useEffect(()=>{a&&f.isCollapsed&&f.expand(),!a&&!f.isCollapsed&&f.collapse()},[f,a]),i==="preview"?d.jsx(xh,{hideTabs:!0}):p?d.jsx(hM,{children:d.jsxs(gM,{direction:"horizontal",autoSaveId:"replay-layout-overlay",children:[d.jsx(Af,{id:"main-panel",defaultSize:75,minSize:55,$isResizing:n,children:d.jsx(xh,{})}),d.jsx(yh,{direction:"vertical",onDragging:r}),d.jsx(Af,{id:"content-panel",defaultSize:30,minSize:o,...e,$isResizing:n,children:d.jsx(fM,{isOverlayLayout:p})}),d.jsx(uM,{panel:t,isOverlayLayout:p})]})}):d.jsx(hM,{children:d.jsxs(gM,{direction:"horizontal",autoSaveId:"replay-layout",children:[d.jsx(uM,{panel:t,isOverlayLayout:p}),d.jsx(Af,{id:"content-panel",defaultSize:30,minSize:o,...e,$isResizing:n,children:d.jsx(fM,{isOverlayLayout:p})}),d.jsx(yh,{direction:"vertical",onDragging:r}),d.jsx(Af,{id:"main-panel",defaultSize:70,minSize:Tqe,$isResizing:n,children:d.jsx(xh,{})}),h&&d.jsxs(d.Fragment,{children:[d.jsx(yh,{direction:"vertical",onDragging:r}),d.jsx(Af,{...O,id:"ai-panel",defaultSize:a?kqe:0,collapsedSize:0,minSize:Pqe,maxSize:50,$isResizing:n,onCollapse:()=>{m?.(),c()},onExpand:()=>{g?.(),l()},children:d.jsx(y.Suspense,{fallback:null,children:d.jsx(Cqe,{})})})]})]})})}const gM=w.default(Xb)`
|
|
6943
6943
|
padding: 0 var(--spacing-xs);
|
|
6944
6944
|
`,Af=w.default(md)`
|
|
6945
6945
|
transition-property: ${t=>t.$isResizing?"none":"flex-grow"};
|
|
@@ -6949,7 +6949,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
|
|
|
6949
6949
|
@media (prefers-reduced-motion: reduce) {
|
|
6950
6950
|
transition-duration: 0s;
|
|
6951
6951
|
}
|
|
6952
|
-
`,Iqe=y.lazy(()=>Promise.resolve().then(()=>require("./replay-AiChatProvider-
|
|
6952
|
+
`,Iqe=y.lazy(()=>Promise.resolve().then(()=>require("./replay-AiChatProvider-TF1u9E5L.js")).then(t=>({default:t.AiChatProvider}))),Eqe=({className:t,renderProjectSelect:e})=>{const{isMobile:n,closeButton:r}=Ao(),i=Wb(!1),{layout:s,aiEnabled:o}=Or(),{configFileError:a}=He(),l=s==="preview",c=o===!0,u=a.get({noproxy:!0}),f=u?d.jsx(aqe,{error:u}):null,h=n?f||d.jsx(HZe,{}):d.jsxs(d.Fragment,{children:[!l&&d.jsx(c7e,{}),f||d.jsx($qe,{panel:i.panel,panelProps:i.panelProps})]});return d.jsxs(d.Fragment,{children:[!n&&!l&&r,d.jsx(Qqe,{className:t,isPreviewLayout:l,children:d.jsx(_B,{onError:p=>console.error(p),children:d.jsx(sqe,{children:d.jsx(oqe,{renderProjectSelect:e,children:c?d.jsx(y.Suspense,{fallback:null,children:d.jsx(Iqe,{children:h})}):h})})})})]})};function u8({className:t,renderProjectSelect:e}){return d.jsx(Eqe,{className:t,renderProjectSelect:e})}function Aqe({className:t,renderProjectSelect:e}){return d.jsx(s8,{children:d.jsx(u8,{className:t,renderProjectSelect:e})})}const Qqe=w.default.div`
|
|
6953
6953
|
display: flex;
|
|
6954
6954
|
flex-direction: column;
|
|
6955
6955
|
height: 100vh;
|
|
@@ -6979,4 +6979,4 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
|
|
|
6979
6979
|
@media (max-width: ${Ar}px) {
|
|
6980
6980
|
width: 100vw;
|
|
6981
6981
|
}
|
|
6982
|
-
`;async function Zqe(t,e,n,r){const{validateApiKey:i}=await Promise.resolve().then(()=>require("./replay-validate-key-
|
|
6982
|
+
`;async function Zqe(t,e,n,r){const{validateApiKey:i}=await Promise.resolve().then(()=>require("./replay-validate-key-D4M7QvCw.js"));return i(t,e,n,r)}async function qqe(){return(await Promise.resolve().then(()=>require("./replay-agent-loop-Cm1iS9G2.js"))).AgentLoop}exports.AI_PROVIDERS=eq;exports.AiChatContext=nq;exports.AiChatServiceFactory=QP;exports.AiPanelContext=l8;exports.Builder=Ai;exports.CriterionType=cr;exports.DEFAULT_ENVIRONMENTS=tk;exports.DEFAULT_MAX_RETRIES=sCe;exports.DEFAULT_MAX_STEPS=iCe;exports.Divider=ot;exports.EmbeddedReplay=KXe;exports.GRANT_TYPE_MAP=zue;exports.ItemState=At;exports.JsonPointerLib=$h;exports.MAX_OUTPUT_TOKENS_FOR_VALIDATION=aCe;exports.Markdown=oU;exports.Modal=is;exports.OAUTH2_SECURITY=mC;exports.PathUtils=Wt;exports.REPLAY_CHANGE_PREVIEW_SNAPSHOT_KEY=cCe;exports.REPLAY_MESSAGE_METADATA_NS=lCe;exports.REQUEST_METHODS=Ld;exports.REUNITE_AI_PROVIDER=N$;exports.REUNITE_MODEL_OPTION=rP;exports.Replay=Vqe;exports.ReplayOverlay=Xqe;exports.RootStorage=x7;exports.SECRET_MASK=cI;exports.SecurityFlows=K;exports.SecurityTypes=te;exports.SourceType=oi;exports.StyledSpinner=l$;exports.TAB_NAMES=et;exports.TOOL_CALL_MESSAGES_TO_KEEP=oCe;exports.TabDataType=De;exports.TabState=Cn;exports.TelemetryClient=VW;exports.TextContentType=kn;exports.VerticalDivider=Le;exports.aiChatKeys=BB;exports.apiUrlToApiId=$X;exports.applyThemeToDOM=mje;exports.bgRed=GF;exports.blue=BF;exports.bold=LF;exports.bytesToHex=Ch;exports.clearNotificationsForSource=Mu;exports.cloneObject=Ss;exports.context=mo;exports.createResource=me;exports.createTabFromOperation=D$;exports.dayjs=yg;exports.defaultAiChatContextValue=tq;exports.dim=XF;exports.dirname=mX;exports.evaluateRuntimeExpression=Ja;exports.evaluateRuntimeExpressionPayload=Hf;exports.exists=wT;exports.extname=OX;exports.fetch=xo;exports.getAPIKeyLocation=AX;exports.getActiveTab=cg;exports.getApiOperationFromStore=hZ;exports.getCollectionFromStore=BZ;exports.getCurrentTheme=Jb;exports.getDefaultExportFromCjs=ha;exports.getEmptyCriterionObject=iX;exports.getEmptyRequestParameter=BO;exports.getEmptySingleSecurity=os;exports.getNewCollection=A$;exports.getNewStep=Co;exports.getNewWorkflow=I$;exports.getOperationsList=y$;exports.getStepFailures=V4e;exports.getStepForActiveStepTab=Y1e;exports.getStepFromStore=m$;exports.getStepMethod=al;exports.getStepUrl=pp;exports.getValueFromContext=kh;exports.getWorkflowFromStore=WZ;exports.getWorkflowRunVerdict=PI;exports.gray=YF;exports.green=qF;exports.hasAllStepPassed=CI;exports.inverse=ZF;exports.invoke=qe;exports.isAbsolute=vX;exports.isAbsoluteUrl=v4;exports.isInlineRequestParameter=Ep;exports.isPlainObject=Pd;exports.isTabStepState=F1e;exports.isTabType=xn;exports.isTauriApp=pn;exports.isWebUrl=Xi;exports.join=vT;exports.loadAgentLoop=qqe;exports.loadAndBundleDefinition=qO;exports.makeProviderRecord=uCe;exports.makeRequest=oZ;exports.markdownParserMarked=sU;exports.maskSecretsInText=Yd;exports.md5=wy;exports.mergeUrlParametersWithPreviousParameters=$$;exports.mkdir=bX;exports.module=ZM;exports.none=Ot;exports.path=O1;exports.pathBrowserifyExports=_a;exports.readDir=xX;exports.readTextFile=ST;exports.red=_r;exports.remove=wX;exports.rename=CX;exports.reportParseError=VT;exports.requireFastDeepEqual=UM;exports.resolve=gX;exports.resolvePath=aY;exports.resolveTheme=gje;exports.resolveWorkflowReference=GM;exports.sep=pX;exports.sha256=XM;exports.stringToQueryParameters=zp;exports.tabStepUidsMatch=G1e;exports.toCompactJson=ede;exports.trace=Nr;exports.transformCallback=W3;exports.tty=qM;exports.ulid=dp;exports.underline=WF;exports.useActiveTab=va;exports.useAiChatContext=gg;exports.useAiPanel=c8;exports.useApiOperation=kc;exports.useCollections=vl;exports.useGlobalStore=He;exports.useRunWorkflow=vB;exports.useSettingsContext=Or;exports.useSettingsState=Yr;exports.useSteps=j$;exports.useTabHandlers=zn;exports.useTelemetry=Fe;exports.useTelemetryClient=C0e;exports.useWorkflows=Qb;exports.validateApiKey=Zqe;exports.white=FF;exports.writeTextFile=PX;exports.yaml=el;exports.yellow=UF;
|