@redocly/replay 0.22.0-next.2 → 0.22.0-next.3

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.
@@ -159,7 +159,7 @@ ${o.message}`})}}}}),hde=({filePath:t})=>({Info:{leave(e,{report:n,location:r,co
159
159
  ${o.message}`,location:r.child("description")})}}}}),mde=t=>({Info:{leave(e){if(typeof t!="object"||Array.isArray(t)||t===null)throw new Error('"info-override" decorator should be called with an object');const{severity:n,...r}=t;Object.assign(e,r)}}});function gde(t){return Array.isArray(t)&&t.length===0}const AMe="x-internal",yde=({internalFlagProperty:t=AMe})=>{function e(r,i,o){const{parent:s,key:a}=i;let c=!1;if(Array.isArray(r))for(let d=0;d<r.length;d++){if(No(r[d])&&i.resolve(r[d]).node?.[t]){if(rn(s.discriminator?.mapping))for(const g in s.discriminator.mapping)o?.[g]===r[d].$ref&&delete s.discriminator.mapping[g];r.splice(d,1),c=!0,d--}r[d]?.[t]&&(r.splice(d,1),c=!0,d--)}else if(rn(r))for(const d of Object.keys(r)){if(No(r[d])){const p=i.resolve(r[d]);rn(p.node)&&p.node?.[t]&&(delete r[d],c=!0)}rn(r[d])&&r[d]?.[t]&&(delete r[d],c=!0)}c&&(OA(r)||gde(r))&&delete s[a]}let n={};return{DiscriminatorMapping:{enter:r=>{n=JSON.parse(JSON.stringify(r))}},any:{enter:(r,i)=>{e(r,i,n)}}}};function Ode(t,e,n){const{parent:r,key:i}=e;let o=!1;if(Array.isArray(t))for(let s=0;s<t.length;s++){if(No(t[s])){const a=e.resolve(t[s]);n(a.node)&&(t.splice(s,1),o=!0,s--)}n(t[s])&&(t.splice(s,1),o=!0,s--)}else if(rn(t))for(const s of Object.keys(t)){if(t=t,No(t[s])){const a=e.resolve(t[s]);n(a.node)&&(delete t[s],o=!0)}n(t[s])&&(delete t[s],o=!0)}o&&(OA(t)||gde(t))&&delete r[i]}function vde(t,e,n){return t===void 0||e===void 0?!1:!Array.isArray(e)&&!Array.isArray(t)?t===e:(e=wF(e),t=wF(t),n==="any"?e.some(r=>t.includes(r)):n==="all"?e.every(r=>t.includes(r)):!1)}function wF(t){return Array.isArray(t)?t:[t]}const $Me="any",bde=({property:t,value:e,matchStrategy:n})=>{const r=n||$Me,i=o=>o?.[t]&&!vde(o?.[t],e,r);return{any:{enter:(o,s)=>{Ode(o,s,i)}}}},kMe="any",xde=({property:t,value:e,matchStrategy:n})=>{const r=n||kMe,i=o=>vde(o?.[t],e,r);return{any:{enter:(o,s)=>{Ode(o,s,i)}}}},RMe=({operationIds:t})=>({Operation:{enter(e,n){const r=e.operationId;if(!r)return;const i=t[r];if(i){if(i.responses&&e.responses)for(const o of Object.keys(i.responses)){const s=CF(e.responses[o],n.resolve);s&&(s.content=s.content?s.content:{},Object.keys(i.responses[o]).forEach(a=>{const c=i.responses[o][a];s.content[a]={...s.content[a],examples:SF(TA(c,n.config?.configPath))}}),e.responses[o]=s)}if(i.request&&e.requestBody){const o=CF(e.requestBody,n.resolve);if(!o)return;o.content=o.content?o.content:{},Object.keys(i.request).forEach(s=>{const a=i.request[s];o.content[s]={...o.content[s],examples:SF(TA(a,n.config?.configPath))}}),e.requestBody=o}}}}});function CF(t,e){if(!No(t))return t;const n=e(t);return n.error?void 0:JSON.parse(JSON.stringify(n.node))}function _Me(t,e){return e in t}const Sde=()=>{const t=new Map;function e(r,i,o){t.set(r.absolutePointer,{usedIn:t.get(r.absolutePointer)?.usedIn??[],componentType:i,name:o})}function n(r,i){const o=i.length;for(const[s,{usedIn:a,name:c,componentType:d}]of t)if(!a.some(g=>!i.some(O=>g.absolutePointer.startsWith(O)&&(g.absolutePointer.length===O.length||g.absolutePointer[O.length]==="/")))&&d&&r.components&&_Me(r.components,d)){i.push(s);const g=r.components[d];delete g[c],t.delete(s),OA(g)&&delete r.components[d]}return i.length>o?n(r,i):i.length}return{ref:{leave(r,{location:i,type:o,resolve:s,key:a}){if(["Schema","Header","Parameter","Response","Example","RequestBody","MediaTypesMap"].includes(o.name)){const c=s(r);if(!c.location)return;const[d,p]=c.location.absolutePointer.split("#",2);if(!p)return;const g=p.split("/").slice(0,4).join("/"),O=`${d}#${g}`,v=t.get(O);v?v.usedIn.push(i):t.set(O,{usedIn:[i],name:a.toString()})}}},Root:{leave(r,i){const o=i.getVisitorData();o.removedCount=n(r,[]),OA(r.components)&&delete r.components}},NamedSchemas:{Schema(r,{location:i,key:o}){r.allOf||e(i,"schemas",o.toString())}},NamedParameters:{Parameter(r,{location:i,key:o}){e(i,"parameters",o.toString())}},NamedResponses:{Response(r,{location:i,key:o}){e(i,"responses",o.toString())}},NamedExamples:{Example(r,{location:i,key:o}){e(i,"examples",o.toString())}},NamedRequestBodies:{RequestBody(r,{location:i,key:o}){e(i,"requestBodies",o.toString())}},NamedHeaders:{Header(r,{location:i,key:o}){e(i,"headers",o.toString())}},NamedMediaTypes:{MediaTypesMap(r,{location:i,key:o}){e(i,"mediaTypes",o.toString())}}}},IMe={"operation-description-override":fde,"tag-description-override":pde,"info-description-override":hde,"info-override":mde,"remove-x-internal":yde,"remove-unused-components":Sde,"filter-in":bde,"filter-out":xde,"media-type-examples-override":RMe},wde=()=>{const t=new Map;function e(r,i,o){t.set(r.absolutePointer,{usedIn:t.get(r.absolutePointer)?.usedIn??[],componentType:i,name:o})}function n(r,i){const o=i.length;for(const[s,{usedIn:a,name:c,componentType:d}]of t)!a.some(g=>!i.some(O=>g.absolutePointer.startsWith(O)&&(g.absolutePointer.length===O.length||g.absolutePointer[O.length]==="/")))&&d&&(i.push(s),delete r[d][c],t.delete(s),OA(r[d])&&delete r[d]);return i.length>o?n(r,i):i.length}return{ref:{leave(r,{location:i,type:o,resolve:s,key:a}){if(["Schema","Parameter","Response","SecurityScheme"].includes(o.name)){const c=s(r);if(!c.location)return;const[d,p]=c.location.absolutePointer.split("#",2);if(!p)return;const g=p.split("/").slice(0,3).join("/"),O=`${d}#${g}`,v=t.get(O);v?v.usedIn.push(i):t.set(O,{usedIn:[i],name:a.toString()})}}},Root:{leave(r,i){const o=i.getVisitorData();o.removedCount=n(r,[])}},NamedSchemas:{Schema(r,{location:i,key:o}){r.allOf||e(i,"definitions",o.toString())}},NamedParameters:{Parameter(r,{location:i,key:o}){e(i,"parameters",o.toString())}},NamedResponses:{Response(r,{location:i,key:o}){e(i,"responses",o.toString())}},NamedSecuritySchemes:{SecurityScheme(r,{location:i,key:o}){e(i,"securityDefinitions",o.toString())}}}},jMe={"operation-description-override":fde,"tag-description-override":pde,"info-description-override":hde,"info-override":mde,"remove-x-internal":yde,"remove-unused-components":wde,"filter-in":bde,"filter-out":xde},QMe={},DMe={},MMe={},NMe={},zMe={},qMe={recommended:tDe,"recommended-strict":nDe,minimal:iDe,all:rDe,spec:oDe},TF={id:"",rules:{oas3:N5e,oas2:B5e,async2:G5e,async3:J5e,arazzo1:vMe,overlay1:xMe,openrpc1:EMe},preprocessors:{oas3:z5e,oas2:X5e,async2:W5e,async3:K5e,arazzo1:bMe,overlay1:SMe,openrpc1:PMe},decorators:{oas3:IMe,oas2:jMe,async2:QMe,async3:DMe,arazzo1:MMe,overlay1:NMe,openrpc1:zMe},configs:qMe};function LMe(t){return!Su(t)}function UMe(){return new Promise(t=>{setTimeout(t)})}function YP(t,e){return t+"::"+e}class ew{constructor(e,n,r){this.absoluteRef=e,this.body=n,this.mimeType=r}getAst(e){return this._ast===void 0&&(this._ast=e(this.body,{filename:this.absoluteRef})??void 0,this._ast&&this._ast.kind===0&&this._ast.value===""&&this._ast.startPosition!==1&&(this._ast.startPosition=1,this._ast.endPosition=1)),this._ast}getLines(){return this._lines===void 0&&(this._lines=this.body.split(/\r\n|[\n\r]/g)),this._lines}}class L6 extends Error{constructor(e){super(e.message),this.originalError=e,Object.setPrototypeOf(this,L6.prototype)}}function VMe(t,e){const n=new ew(e,t);try{return{source:n,parsed:M6(t,{filename:e})}}catch(r){throw new Dw(r,n)}}class L5{constructor(e={http:{headers:[]}}){this.config=e,this.cache=new Map}getFiles(){return new Set(Array.from(this.cache.keys()))}resolveExternalRef(e,n){return ws(n)?n:e&&ws(e)?new URL(n,e).href:Si.resolve(e?Si.dirname(e):process.cwd(),n)}async loadExternalRef(e){try{if(ws(e)){const{body:n,mimeType:r}=await $ae(e,this.config.http);return new ew(e,n,r)}else{if((void 0)(e).isDirectory())throw new Error(`Expected a file but received a folder at ${e}.`);const n=await(void 0).readFile(e,"utf-8");return new ew(e,n.replace(/\r\n/g,`
160
160
  `))}}catch(n){throw n.message=n.message.replace(", lstat",""),new L6(n)}}parseDocument(e,n=!1){const r=e.absoluteRef.substr(e.absoluteRef.lastIndexOf("."));if(![".json",".json",".yml",".yaml"].includes(r)&&!e.mimeType?.match(/(json|yaml|openapi)/)&&!n)return{source:e,parsed:e.body};try{return{source:e,parsed:M6(e.body,{filename:e.absoluteRef})}}catch(i){throw new Dw(i,e)}}async resolveDocument(e,n,r=!1){const i=this.resolveExternalRef(e,n),o=this.cache.get(i);if(o)return o;const s=this.loadExternalRef(i).then(a=>this.parseDocument(a,r));return this.cache.set(i,s),s}}function EF(t,e){return{prev:t,node:e}}function BMe(t,e){for(;t;){if(t.node===e)return!0;t=t.prev}return!1}const FE={name:"unknown",properties:{}},XMe={name:"scalar",properties:{}};async function EA(t){const{rootDocument:e,externalRefResolver:n,rootType:r}=t,i=new Map,o=new Set,s=[];c(e.parsed,e,"#/",r);let a;do a=await Promise.all(s);while(s.length!==a.length);return i;function c(d,p,g,O){const v=p.source.absoluteRef,w=new Map;S(d,O,v+g);function S(T,E,$){if(typeof T!="object"||T===null)return;const _=`${E.name}::${$}`;if(o.has(_))return;o.add(_);const[R,Q]=Object.entries(T).find(([D])=>D==="$anchor")||[];if(Q&&w.set(`#${Q}`,T),Array.isArray(T)){const D=E.items;if(D===void 0&&E!==FE&&E!==zb)return;const q=typeof D=="function";for(let Z=0;Z<T.length;Z++){let Y=q?D(T[Z],sS($,Z)):D;if(Y===void 0&&E!==FE&&E!==zb)continue;const G=Y?.directResolveAs?{$ref:T[Z]}:T[Z];Y=Y?.directResolveAs||Y,S(G,qb(Y)?Y:FE,sS($,Z))}return}for(const D of Object.keys(T)){let q=T[D],Z=CO(E.properties,D);Z===void 0&&(Z=E.additionalProperties),typeof Z=="function"&&(Z=Z(q,D)),Z===void 0&&(Z=FE),E.extensionsPrefix&&D.startsWith(E.extensionsPrefix)&&Z===FE&&(Z=zb),!qb(Z)&&Z?.directResolveAs&&(Z=Z.directResolveAs,q={$ref:q}),Z&&Z.name===void 0&&Z.resolvable!==!1&&(Z=XMe),!(!qb(Z)||typeof q!="object")&&S(q,Z,sS($,XP(D)))}if(No(T)){const D=C(p,T,{prev:null,node:T}).then(q=>{q.resolved&&c(q.node,q.document,q.nodePointer,E)});s.push(D)}if(kae(T)){const D=C(p,{$ref:T.externalValue},{prev:null,node:T}).then(q=>{q.resolved&&c(q.node,q.document,q.nodePointer,E)});s.push(D)}}async function C(T,E,$){if(BMe($.prev,E))throw new Error("Self-referencing circular pointer");if(TEe(E.$ref)){await UMe();const K={resolved:!0,isRemote:!1,node:w.get(E.$ref),document:T,nodePointer:E.$ref},re=YP(T.source.absoluteRef,E.$ref);return i.set(re,K),K}const{uri:_,pointer:R}=wEe(E.$ref),Q=_!==null&&n.resolveExternalRef(T.source.absoluteRef,_)!==T.source.absoluteRef;let D;try{D=Q?await n.resolveDocument(T.source.absoluteRef,_):T}catch(K){const re={resolved:!1,isRemote:Q,document:void 0,error:K},fe=YP(T.source.absoluteRef,E.$ref);return i.set(fe,re),re}let q={resolved:!0,document:D,isRemote:Q,node:T.parsed,nodePointer:"#/"},Z=D.parsed;const Y=R;for(const K of Y)if(typeof Z!="object"){Z=void 0;break}else if(Z[K]!==void 0)Z=Z[K],q.nodePointer=sS(q.nodePointer,XP(K));else if(No(Z)){if(q=await C(D,Z,EF($,Z)),D=q.document||D,typeof q.node!="object"){Z=void 0;break}Z=q.node[K],q.nodePointer=sS(q.nodePointer,XP(K))}else{Z=void 0;break}q.node=Z,q.document=D;const G=YP(T.source.absoluteRef,E.$ref);return q.document&&No(Z)&&(q=await C(q.document,Z,EF($,Z))),i.set(G,q),{...q}}}}const Xr=(t,e)=>{if(e)for(const n of Object.keys(e))rn(t[n])&&typeof e[n]=="string"?t[n]={...t[n],severity:e[n]}:t[n]=e[n]};function mi(t,e){if(e)for(const n of Object.keys(e))t.hasOwnProperty(n)&&(rn(t[n])&&typeof e[n]=="string"?t[n]={...t[n],severity:e[n]}:t[n]=e[n])}function ZMe(t){if(t.indexOf("/")>-1){const[e,n]=t.split("/");return{pluginId:e,configName:n}}else return{pluginId:"",configName:t}}function Io(t,e){if(!e)return t;const n={};for(const r of Object.keys(t))n[`${e}/${r}`]=t[r];return n}function Cde(t){const e={rules:{},oas2Rules:{},oas3_0Rules:{},oas3_1Rules:{},oas3_2Rules:{},async2Rules:{},async3Rules:{},arazzo1Rules:{},overlay1Rules:{},openrpc1Rules:{},preprocessors:{},oas2Preprocessors:{},oas3_0Preprocessors:{},oas3_1Preprocessors:{},oas3_2Preprocessors:{},async2Preprocessors:{},async3Preprocessors:{},arazzo1Preprocessors:{},overlay1Preprocessors:{},openrpc1Preprocessors:{},decorators:{},oas2Decorators:{},oas3_0Decorators:{},oas3_1Decorators:{},oas3_2Decorators:{},async2Decorators:{},async3Decorators:{},arazzo1Decorators:{},overlay1Decorators:{},openrpc1Decorators:{}};for(const n of t){if(rn(n)&&"extends"in n&&n.extends!==void 0)throw new Error(`'extends' is not supported in shared configs yet:
161
161
  ${JSON.stringify(n,null,2)}`);Xr(e.rules,n.rules),Xr(e.oas2Rules,n.oas2Rules),mi(e.oas2Rules,n.rules),Xr(e.oas3_0Rules,n.oas3_0Rules),mi(e.oas3_0Rules,n.rules),Xr(e.oas3_1Rules,n.oas3_1Rules),mi(e.oas3_1Rules,n.rules),Xr(e.oas3_2Rules,n.oas3_2Rules),mi(e.oas3_2Rules,n.rules),Xr(e.async2Rules,n.async2Rules),mi(e.async2Rules,n.rules),Xr(e.async3Rules,n.async3Rules),mi(e.async3Rules,n.rules),Xr(e.arazzo1Rules,n.arazzo1Rules),mi(e.arazzo1Rules,n.rules),Xr(e.overlay1Rules,n.overlay1Rules),mi(e.overlay1Rules,n.rules),Xr(e.openrpc1Rules,n.openrpc1Rules),mi(e.openrpc1Rules,n.rules),Xr(e.preprocessors,n.preprocessors),Xr(e.oas2Preprocessors,n.oas2Preprocessors),mi(e.oas2Preprocessors,n.preprocessors),Xr(e.oas3_0Preprocessors,n.oas3_0Preprocessors),mi(e.oas3_0Preprocessors,n.preprocessors),Xr(e.oas3_1Preprocessors,n.oas3_1Preprocessors),mi(e.oas3_1Preprocessors,n.preprocessors),Xr(e.oas3_2Preprocessors,n.oas3_2Preprocessors),mi(e.oas3_2Preprocessors,n.preprocessors),Xr(e.async2Preprocessors,n.async2Preprocessors),mi(e.async2Preprocessors,n.preprocessors),Xr(e.async3Preprocessors,n.async3Preprocessors),mi(e.async3Preprocessors,n.preprocessors),Xr(e.arazzo1Preprocessors,n.arazzo1Preprocessors),mi(e.arazzo1Preprocessors,n.preprocessors),Xr(e.overlay1Preprocessors,n.overlay1Preprocessors),mi(e.overlay1Preprocessors,n.preprocessors),Xr(e.openrpc1Preprocessors,n.openrpc1Preprocessors),mi(e.openrpc1Preprocessors,n.preprocessors),Xr(e.decorators,n.decorators),Xr(e.oas2Decorators,n.oas2Decorators),mi(e.oas2Decorators,n.decorators),Xr(e.oas3_0Decorators,n.oas3_0Decorators),mi(e.oas3_0Decorators,n.decorators),Xr(e.oas3_1Decorators,n.oas3_1Decorators),mi(e.oas3_1Decorators,n.decorators),Xr(e.oas3_2Decorators,n.oas3_2Decorators),mi(e.oas3_2Decorators,n.decorators),Xr(e.async2Decorators,n.async2Decorators),mi(e.async2Decorators,n.decorators),Xr(e.async3Decorators,n.async3Decorators),mi(e.async3Decorators,n.decorators),Xr(e.arazzo1Decorators,n.arazzo1Decorators),mi(e.arazzo1Decorators,n.decorators),Xr(e.overlay1Decorators,n.overlay1Decorators),mi(e.overlay1Decorators,n.decorators),Xr(e.openrpc1Decorators,n.openrpc1Decorators),mi(e.openrpc1Decorators,n.decorators)}return e}function YMe(t){return new Map(JSON.parse(JSON.stringify([...t])))}function PF(t){return rn(t)&&"id"in t}function GMe(t){return typeof t=="function"}function AF(t,e){return{prev:t,value:e}}function $F(t){return t?.prev??null}function WMe(t){const e={};for(;t.parent;)e[t.parent.type.name]=t.parent.activatedOn?.value.node,t=t.parent;return e}function FMe(t){const e={};for(;t.parent;)t.parent.activatedOn?.value.location&&(e[t.parent.type.name]=t.parent.activatedOn?.value.location),t=t.parent;return e}function tw(t){const{document:e,rootType:n,normalizedVisitors:r,resolvedRefMap:i,ctx:o}=t,s={},a=new Set;c(e.parsed,n,new ej(e.source,"#/"),void 0,"");function c(d,p,g,O,v){const w=(q,Z=C.source.absoluteRef)=>{if(!No(q))return{location:g,node:q};const Y=YP(Z,q.$ref),G=i.get(Y);if(!G)return{location:void 0,node:void 0};const{resolved:K,node:re,document:fe,nodePointer:de,error:H}=G;return{location:K?new ej(fe.source,de):H instanceof Dw?new ej(H.source,""):void 0,node:re,error:H}},S=g;let C=g;const{node:T,location:E,error:$}=w(d),_=new Set;if(No(d)){const q=r.ref.enter;for(const{visit:Z,ruleId:Y,severity:G,message:K,context:re}of q){_.add(re);const fe=Q.bind(void 0,Y,G,K);Z(d,{report:fe,resolve:w,rawNode:d,rawLocation:S,location:g,type:p,parent:O,key:v,parentLocations:{},specVersion:o.specVersion,config:o.config,getVisitorData:D.bind(void 0,Y)},{node:T,location:E,error:$}),E?.source.absoluteRef&&o.refTypes&&o.refTypes.set(E?.source.absoluteRef,p)}}if(T!==void 0&&E&&p.name!=="scalar"){C=E;const q=s[p.name]?.has?.(T);let Z=!1;const G=r.any.enter.concat(r[p.name]?.enter||[]),K=[];for(const{context:de,visit:H,skip:pe,ruleId:se,severity:ve,message:te}of G){if(a.has(`${C.absolutePointer}${C.pointer}`))break;if(de.isSkippedLevel)de.parent.activatedOn&&!de.parent.activatedOn.value.nextLevelTypeActivated&&!de.seen.has(d)&&(de.seen.add(d),Z=!0,K.push(de));else if(de.parent&&de.parent.activatedOn&&de.activatedOn?.value.withParentNode!==de.parent.activatedOn.value.node&&de.parent.activatedOn.value.nextLevelTypeActivated?.value!==p||!de.parent&&!q){K.push(de);const ee={node:T,location:E,nextLevelTypeActivated:null,withParentNode:de.parent?.activatedOn?.value.node,skipped:(de.parent?.activatedOn?.value.skipped||pe?.(T,v,{location:g,rawLocation:S,resolve:w,rawNode:d}))??!1};de.activatedOn=AF(de.activatedOn,ee);let ae=de.parent;for(;ae;)ae.activatedOn.value.nextLevelTypeActivated=AF(ae.activatedOn.value.nextLevelTypeActivated,p),ae=ae.parent;ee.skipped||(Z=!0,_.add(de),R(H,T,d,de,se,ve,te))}}if(Z||!q){if(s[p.name]=s[p.name]||new Set,s[p.name].add(T),Array.isArray(T)){const de=p.items;if(de!==void 0){const H=typeof de=="function";for(let pe=0;pe<T.length;pe++){let se=H?de(T[pe],E.child([pe]).absolutePointer):de,ve=T[pe];se?.directResolveAs&&(se=se.directResolveAs,ve={$ref:ve}),qb(se)&&c(ve,se,E.child([pe]),T,pe)}}}else if(rn(T)){const de=Object.keys(p.properties);p.additionalProperties?de.push(...Object.keys(T).filter(H=>!de.includes(H))):p.extensionsPrefix&&de.push(...Object.keys(T).filter(H=>H.startsWith(p.extensionsPrefix))),No(d)&&de.push(...Object.keys(d).filter(H=>H!=="$ref"&&!de.includes(H)));for(const H of de){let pe=T[H],se=E;pe===void 0&&(pe=d[H],se=g);let ve=CO(p.properties,H);if(ve===void 0&&(ve=p.additionalProperties),typeof ve=="function"&&(ve=ve(pe,H)),ve===void 0&&p.extensionsPrefix&&H.startsWith(p.extensionsPrefix)&&(ve=zb),!qb(ve)&&ve?.directResolveAs&&(ve=ve.directResolveAs,pe={$ref:pe}),ve&&ve.name===void 0&&ve.resolvable!==!1&&(ve={name:"scalar",properties:{}}),No(d[H])&&ve?.name==="scalar"){c(d[H],ve,g.child([H]),d,H);continue}!qb(ve)||ve.name==="scalar"&&!No(pe)||c(pe,ve,se.child([H]),T,H)}}}const re=r.any.leave,fe=(r[p.name]?.leave||[]).concat(re);for(const de of K.reverse())if(de.isSkippedLevel)de.seen.delete(T);else if(de.activatedOn=$F(de.activatedOn),de.parent){let H=de.parent;for(;H;)H.activatedOn.value.nextLevelTypeActivated=$F(H.activatedOn.value.nextLevelTypeActivated),H=H.parent}for(const{context:de,visit:H,ruleId:pe,severity:se,message:ve}of fe)!de.isSkippedLevel&&_.has(de)&&R(H,T,d,de,pe,se,ve)}if(C=g,No(d)){const q=r.ref.leave;for(const{visit:Z,ruleId:Y,severity:G,context:K,message:re}of q)if(_.has(K)){const fe=Q.bind(void 0,Y,G,re);Z(d,{report:fe,resolve:w,rawNode:d,rawLocation:S,location:g,type:p,parent:O,key:v,parentLocations:{},specVersion:o.specVersion,config:o.config,getVisitorData:D.bind(void 0,Y)},{node:T,location:E,error:$})}}function R(q,Z,Y,G,K,re,fe){const de=Q.bind(void 0,K,re,fe);q(Z,{report:de,resolve:w,rawNode:Y,location:C,rawLocation:S,type:p,parent:O,key:v,parentLocations:FMe(G),specVersion:o.specVersion,config:o.config,ignoreNextVisitorsOnNode:()=>{a.add(`${C.absolutePointer}${C.pointer}`)},getVisitorData:D.bind(void 0,K)},WMe(G),G)}function Q(q,Z,Y,G){const re=(G.location?Array.isArray(G.location)?G.location:[G.location]:[{...C,reportOnKey:!1}]).map(de=>({...C,reportOnKey:!1,...de})),fe=G.forceSeverity||Z;fe!=="off"&&o.problems.push({ruleId:G.ruleId||q,severity:fe,...G,message:Y?Y.replace("{{message}}",G.message):G.message,suggest:G.suggest||[],location:re})}function D(q){return o.visitorsData[q]=o.visitorsData[q]||{},o.visitorsData[q]}}}const HMe={Root:"DefinitionRoot",ServerVariablesMap:"ServerVariableMap",Paths:["PathMap","PathsMap"],CallbacksMap:"CallbackMap",MediaTypesMap:"MediaTypeMap",ExamplesMap:"ExampleMap",EncodingMap:"EncodingsMap",HeadersMap:"HeaderMap",LinksMap:"LinkMap",OAuth2Flows:"SecuritySchemeFlows",Responses:"ResponsesMap"};function nw(t,e){const n={};n.any={enter:[],leave:[]};for(const s of Object.keys(e))n[s]={enter:[],leave:[]};n.ref={enter:[],leave:[]};for(const{ruleId:s,severity:a,message:c,visitor:d}of t)o({ruleId:s,severity:a,message:c},d,null);for(const s of Object.keys(n))n[s].enter.sort((a,c)=>c.depth-a.depth),n[s].leave.sort((a,c)=>a.depth-c.depth);return n;function r(s,a,c,d,p=[]){if(p.includes(a))return;p=[...p,a];const g=new Set;for(const v of Object.values(a.properties)){if(v===c){O(s,p);continue}rn(v)&&v.name!==void 0&&g.add(v)}a.additionalProperties&&typeof a.additionalProperties!="function"&&(a.additionalProperties===c?O(s,p):a.additionalProperties.name!==void 0&&g.add(a.additionalProperties)),a.items&&typeof a.items!="function"&&(a.items===c?O(s,p):a.items.name!==void 0&&g.add(a.items)),a.extensionsPrefix&&g.add(zb);for(const v of Array.from(g.values()))r(s,v,c,d,p);function O(v,w){for(const S of w.slice(1))n[S.name]=n[S.name]||{enter:[],leave:[]},n[S.name].enter.push({...v,visit:()=>{},depth:0,context:{isSkippedLevel:!0,seen:new Set,parent:d}})}}function i(s,a){if(Array.isArray(a)){const c=a.find(d=>s[d])||void 0;return c&&s[c]}return s[a]}function o(s,a,c,d=0){const p=Object.keys(e);if(d===0)p.push("any"),p.push("ref");else{if(a.any)throw new Error("any() is allowed only on top level");if(a.ref)throw new Error("ref() is allowed only on top level")}for(const g of p){const O=a[g]||i(a,HMe[g]),v=n[g];if(!O)continue;let w,S,C;const T=rn(O);if(g==="ref"&&T&&O.skip)throw new Error("ref() visitor does not support skip");typeof O=="function"?w=O:T&&(w=O.enter,S=O.leave,C=O.skip);const E=(w?1:0)+(S?1:0)+(C?1:0),$=T&&Object.keys(O).length>E,_={activatedOn:null,type:e[g],parent:c,isSkippedLevel:!1};if($&&o(s,O,_,d+1),c&&r(s,c.type,e[g],c),w||T){if(w&&typeof w!="function")throw new Error("DEV: should be function");v.enter.push({...s,visit:w||(()=>{}),skip:C,depth:d,context:_})}if(S){if(typeof S!="function")throw new Error("DEV: should be function");v.leave.push({...s,visit:S,depth:d,context:_})}}}}function Tde({node:t,ctx:e,plugins:n}){if(!t.extends)return t;const r=(t.extends||[]).map(i=>{if(!ws(i)&&!Wb.extname(i))return aNe(i,n);const o=e.resolve({$ref:i});return o.location&&o.node!==void 0?o.node:null}).filter(Td);return Cde([...r.map(i=>Tde({node:i,ctx:e,plugins:n})),{...t,extends:void 0}])}function Q_(t,e){if(rn(t)&&Array.isArray(t.plugins)){const{plugins:n,rootConfigDir:r}=e.getVisitorData();n.push(...t.plugins.map(i=>Pde(i,e.location.source.absoluteRef.replace(/^file:\/\//,""),r)))}}const JMe=nw([{severity:"error",ruleId:Aue,visitor:{ref:{},ConfigGovernance:{leave(t,e){Q_(t,e)}},ConfigApisProperties:{leave(t,e){Q_(t,e)}},"rootRedoclyConfigSchema.scorecard.levels_items":{leave(t,e){Q_(t,e)}},ConfigRoot:{leave(t,e){Q_(t,e)}}}}],C$);function D_(t,e){if(rn(t)&&t.extends){const{plugins:n}=e.getVisitorData(),r=Tde({node:t,ctx:e,plugins:n});Object.assign(t,r),delete t.extends}}const KMe=nw([{severity:"error",ruleId:Pue,visitor:{ref:{leave(t,e,n){AL(t,n,e)}},ConfigGovernance:{leave(t,e){D_(t,e)}},ConfigApisProperties:{leave(t,e){D_(t,e)}},"rootRedoclyConfigSchema.scorecard.levels_items":{leave(t,e){D_(t,e)}},ConfigRoot:{leave(t,e){D_(t,e)}}}}],C$);function kF(t,e){switch(e){case"oas3":switch(t){case"Schema":return"schemas";case"Parameter":return"parameters";case"Response":return"responses";case"Example":return"examples";case"RequestBody":return"requestBodies";case"Header":return"headers";case"SecuritySchema":return"securitySchemes";case"Link":return"links";case"Callback":return"callbacks";case"MediaTypesMap":return"mediaTypes";default:return null}case"oas2":switch(t){case"Schema":return"definitions";case"Parameter":return"parameters";case"Response":return"responses";default:return null}case"async2":switch(t){case"Schema":return"schemas";case"Parameter":return"parameters";default:return null}case"async3":switch(t){case"Schema":return"schemas";case"Parameter":return"parameters";default:return null}case"arazzo1":switch(t){case"Root.workflows_items.parameters_items":case"Root.workflows_items.steps_items.parameters_items":return"parameters";default:return null}case"overlay1":return null;case"openrpc1":switch(t){case"ContentDescriptor":return"contentDescriptors";case"Schema":return"schemas";case"Example":return"examples";case"Link":return"links";case"ErrorObject":return"errors";case"ExamplePairing":return"examplePairingObjects";case"Tag":return"tags";default:return null}}}function eNe({version:t,dereference:e,rootDocument:n,resolvedRefMap:r,keepUrlRefs:i,componentRenamingConflicts:o="warn"}){let s,a;const c={ref:{leave(v,w,S){if(!S.location||S.node===void 0){ZP(S,w.report,w.location);return}if(S.location.source===n.source&&S.location.source===w.location.source&&w.type.name!=="scalar"&&!e){v.$ref!==S.location.pointer&&(v.$ref=S.location.pointer);return}if(i&&ws(v.$ref))return;const C=kF(w.type.name,t);C?e?(p(C,S,w),AL(v,S,w)):(v.$ref=p(C,S,w),d(v,S,w)):AL(v,S,w)}},Example:{leave(v,w){if(kae(v)&&v.value===void 0){const S=w.resolve({$ref:v.externalValue});if(!S.location||S.node===void 0){ZP(S,w.report,w.location);return}if(i&&ws(v.externalValue))return;v.value=w.resolve({$ref:v.externalValue}).node,delete v.externalValue}}},Root:{enter(v,w){a=w.location,t==="oas3"?s=v.components=v.components||{}:t==="oas2"?s=v:t==="async2"?s=v.components=v.components||{}:t==="async3"?s=v.components=v.components||{}:t==="arazzo1"?s=v.components=v.components||{}:t==="openrpc1"&&(s=v.components=v.components||{})}}};t==="oas3"&&(c.DiscriminatorMapping={leave(v,w){for(const S of Object.keys(v)){const C=v[S],T=w.resolve({$ref:C});if(!T.location||T.node===void 0){ZP(T,w.report,w.location.child(S));return}const E=kF("Schema",t);v[S]=p(E,T,w)}}});function d(v,w,S){const C=YP(S.location.source.absoluteRef,v.$ref);r.set(C,{document:n,isRemote:!1,node:w.node,nodePointer:v.$ref,resolved:!0})}function p(v,w,S){s[v]=s[v]||{};const C=O(w,v,S);return s[v][C]=w.node,t==="oas3"||t==="async2"||t==="async3"||t==="openrpc1"?`#/components/${v}/${C}`:`#/${v}/${C}`}function g(v,w,S){return No(v)&&S.resolve(v,a.absolutePointer).location?.absolutePointer===w.location.absolutePointer?!0:PL(v,w.node)}function O(v,w,S){const[C,T]=[v.location.source.absoluteRef,v.location.pointer],E=s[w];let $="";const _=T.slice(2).split("/").filter(Td);for(;_.length>0;)if($=_.pop()+($?`-${$}`:""),!E||!E[$]||g(E[$],v,S))return $;if($=CEe(C)+($?`_${$}`:""),!E[$]||g(E[$],v,S))return $;const R=$;let Q=2;for(;E[$]&&!g(E[$],v,S);)$=`${R}-${Q}`,Q++;return E[$]||S.report({message:`Two schemas are referenced with the same name but different content. Renamed ${R} to ${$}.`,location:S.location,forceSeverity:o}),$}return c}async function tNe(t){const{document:e,config:n,types:r,externalRefResolver:i,dereference:o=!1,removeUnusedComponents:s=!1,keepUrlRefs:a=!1,componentRenamingConflicts:c}=t,d=j5(e.parsed),p=Tue(d),g=n.getRulesForSpecVersion(p),O=u6(n.extendTypes(r,d),n),v=wQ(g,n,"preprocessors",d),w=wQ(g,n,"decorators",d),S={problems:[],specVersion:d,config:n,refTypes:new Map,visitorsData:{}};s&&!w.some(E=>E.ruleId==="remove-unused-components")&&w.push({severity:"error",ruleId:"remove-unused-components",visitor:p==="oas2"?wde():Sde()});let C=await EA({rootDocument:e,rootType:O.Root,externalRefResolver:i});v.length>0&&(tw({document:e,rootType:O.Root,normalizedVisitors:nw(v,O),resolvedRefMap:C,ctx:S}),C=await EA({rootDocument:e,rootType:O.Root,externalRefResolver:i}));const T=nw([{severity:"error",ruleId:"bundler",visitor:eNe({version:p,dereference:o,rootDocument:e,resolvedRefMap:C,keepUrlRefs:a,componentRenamingConflicts:c})},...w],O);return tw({document:e,rootType:O.Root,normalizedVisitors:T,resolvedRefMap:C,ctx:S}),{bundle:e,problems:S.problems.map(E=>n.addProblemToIgnore(E)),fileDependencies:i.getFiles(),rootType:O.Root,refTypes:S.refTypes,visitorsData:S.visitorsData}}function nNe(t,e,n){const r={plugins:[],rootConfigDir:n},i={problems:[],specVersion:"oas3_0",refTypes:new Map,visitorsData:{[Aue]:r}};return tw({document:t,rootType:C$.ConfigRoot,normalizedVisitors:JMe,resolvedRefMap:e,ctx:i}),r.plugins}function rNe(t,e,n){const r={plugins:n},i={problems:[],specVersion:"oas3_0",refTypes:new Map,visitorsData:{[Pue]:r}};return tw({document:t,rootType:C$.ConfigRoot,normalizedVisitors:KMe,resolvedRefMap:e,ctx:i}),t.parsed??{}}async function Ede(t){const{ref:e,doc:n,externalRefResolver:r=new L5(t.config.resolve),base:i=null}=t;if(!(e||n))throw new Error(`Document or reference is required.
162
- `);const o=n===void 0?await r.resolveDocument(i,e,!0):n;if(o instanceof Error)throw o;return t.collectSpecData?.(o.parsed),tNe({document:o,...t,externalRefResolver:r,types:x6(j5(o.parsed))})}const S4=new Map;async function iNe({rawConfigDocument:t,configPath:e,externalRefResolver:n,customExtends:r}){const i=t===void 0?HQe:t.parsed;if(r!==void 0&&rn(i)&&(i.extends=r),rn(i)&&i?.extends?.some(LMe))throw new Error("Configuration format not detected in extends: values must be strings.");const o=t??{source:new ew(e??"",JSON.stringify(i)),parsed:i},s=await EA({rootDocument:o,rootType:C$.ConfigRoot,externalRefResolver:n??new L5(Eue(i?.resolve))});let a=[],c,d="";Ou?c=[...(i?.plugins||[]).filter(v=>!Su(v)),TF]:(d=Si.dirname(e??""),a=nNe(o,s,d),c=[...await sNe(a.map(v=>RF(v)?v.absolutePath:v),d),TF]);const p=rNe(o,YMe(s),c);p.apis&&(p.apis=Object.fromEntries(Object.entries(p.apis).map(([O,v])=>{const w=Cde([p,v]);return[O,{...v,...w}]})));const g=a.length?a.map(O=>RF(O)&&O.isModule?O.rawPath:O.absolutePath&&Si.relative(d,O.absolutePath)).filter(Fb):void 0;return{resolvedConfig:{...p,plugins:g},resolvedRefMap:s,plugins:c}}function oNe(t){for(const e of eDe)(void 0)(Si.resolve(t,e))}function RF(t){return"isModule"in t}const Pde=(t,e,n)=>{if(!Su(t))return t;const r=Si.resolve(Si.dirname(e),t);return(void 0)(r)?{absolutePath:r,rawPath:t,isModule:!1}:{absolutePath:Tae.createRequire((typeof document>"u"?require("url").pathToFileURL(__filename).href:Sm&&Sm.tagName.toUpperCase()==="SCRIPT"&&Sm.src||new URL("replay-index-D90V7ymI.js",document.baseURI).href)??__dirname).resolve(t,{paths:[n,(typeof document>"u"?require("url").pathToFileURL(__filename).href:Sm&&Sm.tagName.toUpperCase()==="SCRIPT"&&Sm.src||new URL("replay-index-D90V7ymI.js",document.baseURI).href)?Si.dirname((void 0)(typeof document>"u"?require("url").pathToFileURL(__filename).href:Sm&&Sm.tagName.toUpperCase()==="SCRIPT"&&Sm.src||new URL("replay-index-D90V7ymI.js",document.baseURI).href)):__dirname]}),isModule:!0,rawPath:t}};async function sNe(t,e){if(!t)return[];const n=async a=>{if(!Su(a))return a;try{const c=Si.isAbsolute(a)?a:Pde(a,Si.join(e,FQe),e).absolutePath;if(!S4.has(c)){let d;if(typeof __webpack_require__=="function")d=__non_webpack_require__(c);else{const w=await import((void 0)(c).pathname);d=w.default||w}const p={contentDir:e},g=Array.isArray(d)?d:[d];for(const w of g)w?.id&&PF(w)&&yi.info(`Deprecated plugin format detected: ${w.id}
162
+ `);const o=n===void 0?await r.resolveDocument(i,e,!0):n;if(o instanceof Error)throw o;return t.collectSpecData?.(o.parsed),tNe({document:o,...t,externalRefResolver:r,types:x6(j5(o.parsed))})}const S4=new Map;async function iNe({rawConfigDocument:t,configPath:e,externalRefResolver:n,customExtends:r}){const i=t===void 0?HQe:t.parsed;if(r!==void 0&&rn(i)&&(i.extends=r),rn(i)&&i?.extends?.some(LMe))throw new Error("Configuration format not detected in extends: values must be strings.");const o=t??{source:new ew(e??"",JSON.stringify(i)),parsed:i},s=await EA({rootDocument:o,rootType:C$.ConfigRoot,externalRefResolver:n??new L5(Eue(i?.resolve))});let a=[],c,d="";Ou?c=[...(i?.plugins||[]).filter(v=>!Su(v)),TF]:(d=Si.dirname(e??""),a=nNe(o,s,d),c=[...await sNe(a.map(v=>RF(v)?v.absolutePath:v),d),TF]);const p=rNe(o,YMe(s),c);p.apis&&(p.apis=Object.fromEntries(Object.entries(p.apis).map(([O,v])=>{const w=Cde([p,v]);return[O,{...v,...w}]})));const g=a.length?a.map(O=>RF(O)&&O.isModule?O.rawPath:O.absolutePath&&Si.relative(d,O.absolutePath)).filter(Fb):void 0;return{resolvedConfig:{...p,plugins:g},resolvedRefMap:s,plugins:c}}function oNe(t){for(const e of eDe)(void 0)(Si.resolve(t,e))}function RF(t){return"isModule"in t}const Pde=(t,e,n)=>{if(!Su(t))return t;const r=Si.resolve(Si.dirname(e),t);return(void 0)(r)?{absolutePath:r,rawPath:t,isModule:!1}:{absolutePath:Tae.createRequire((typeof document>"u"?require("url").pathToFileURL(__filename).href:Sm&&Sm.tagName.toUpperCase()==="SCRIPT"&&Sm.src||new URL("replay-index-BlifZvsL.js",document.baseURI).href)??__dirname).resolve(t,{paths:[n,(typeof document>"u"?require("url").pathToFileURL(__filename).href:Sm&&Sm.tagName.toUpperCase()==="SCRIPT"&&Sm.src||new URL("replay-index-BlifZvsL.js",document.baseURI).href)?Si.dirname((void 0)(typeof document>"u"?require("url").pathToFileURL(__filename).href:Sm&&Sm.tagName.toUpperCase()==="SCRIPT"&&Sm.src||new URL("replay-index-BlifZvsL.js",document.baseURI).href)):__dirname]}),isModule:!0,rawPath:t}};async function sNe(t,e){if(!t)return[];const n=async a=>{if(!Su(a))return a;try{const c=Si.isAbsolute(a)?a:Pde(a,Si.join(e,FQe),e).absolutePath;if(!S4.has(c)){let d;if(typeof __webpack_require__=="function")d=__non_webpack_require__(c);else{const w=await import((void 0)(c).pathname);d=w.default||w}const p={contentDir:e},g=Array.isArray(d)?d:[d];for(const w of g)w?.id&&PF(w)&&yi.info(`Deprecated plugin format detected: ${w.id}
163
163
  `);const O=PF(d)?d:GMe(d)?await d(p):await d?.default?.(p),v=Array.isArray(O)?O:[O];O&&S4.set(c,v.map(w=>({...w,path:a,absolutePath:c})))}return S4.get(c)}catch(c){throw new Error(`Failed to load plugin "${a}": ${c.message}
164
164
 
165
165
  ${c.stack}`)}},r=new Map,i=oNe(e);i&&t.push(i);const o=new Set;return(await Promise.all(t.map(async a=>{if(Su(a)){if(ws(a))throw new Error(Tr.red("We don't support remote plugins yet."));if(o.has(a))return;o.add(a)}const c=await n(a);if(!c)return;const d=Array.isArray(c)?c:[c];return(await Promise.all(d.map(async p=>{if(!p)return;const g=p.id;if(typeof g!="string")throw new Error(Tr.red(`Plugin must define \`id\` property in ${Tr.blue(a.toString())}.`));const O=p.absolutePath??a.toString(),v=r.get(g);if(v){if(O!==v)throw new Error(Tr.red(`Plugin "id" must be unique. Plugin ${Tr.blue(O)} uses id "${Tr.blue(g)}" already seen in ${Tr.blue(O)}`));return}r.set(g,O);const w={id:g,...p.configs?{configs:p.configs}:{},...p.typeExtension?{typeExtension:p.typeExtension}:{}};if(p.rules){if(!p.rules.oas3&&!p.rules.oas2&&!p.rules.async2&&!p.rules.async3&&!p.rules.arazzo1&&!p.rules.overlay1&&!p.rules.openrpc1)throw new Error(`Plugin rules must have \`oas3\`, \`oas2\`, \`async2\`, \`async3\`, \`arazzo\`, \`overlay1\`, or \`openrpc1\` rules "${a}.`);w.rules={},p.rules.oas3&&(w.rules.oas3=Io(p.rules.oas3,g)),p.rules.oas2&&(w.rules.oas2=Io(p.rules.oas2,g)),p.rules.async2&&(w.rules.async2=Io(p.rules.async2,g)),p.rules.async3&&(w.rules.async3=Io(p.rules.async3,g)),p.rules.arazzo1&&(w.rules.arazzo1=Io(p.rules.arazzo1,g)),p.rules.overlay1&&(w.rules.overlay1=Io(p.rules.overlay1,g)),p.rules.openrpc1&&(w.rules.openrpc1=Io(p.rules.openrpc1,g))}if(p.preprocessors){if(!p.preprocessors.oas3&&!p.preprocessors.oas2&&!p.preprocessors.async2&&!p.preprocessors.async3&&!p.preprocessors.arazzo1&&!p.preprocessors.overlay1&&!p.preprocessors.openrpc1)throw new Error(`Plugin \`preprocessors\` must have \`oas3\`, \`oas2\`, \`async2\`, \`async3\`, \`arazzo1\`, \`overlay1\`, or \`openrpc1\` preprocessors "${a}.`);w.preprocessors={},p.preprocessors.oas3&&(w.preprocessors.oas3=Io(p.preprocessors.oas3,g)),p.preprocessors.oas2&&(w.preprocessors.oas2=Io(p.preprocessors.oas2,g)),p.preprocessors.async2&&(w.preprocessors.async2=Io(p.preprocessors.async2,g)),p.preprocessors.async3&&(w.preprocessors.async3=Io(p.preprocessors.async3,g)),p.preprocessors.arazzo1&&(w.preprocessors.arazzo1=Io(p.preprocessors.arazzo1,g)),p.preprocessors.overlay1&&(w.preprocessors.overlay1=Io(p.preprocessors.overlay1,g)),p.preprocessors.openrpc1&&(w.preprocessors.openrpc1=Io(p.preprocessors.openrpc1,g))}if(p.decorators){if(!p.decorators.oas3&&!p.decorators.oas2&&!p.decorators.async2&&!p.decorators.async3&&!p.decorators.arazzo1&&!p.decorators.overlay1&&!p.decorators.openrpc1)throw new Error(`Plugin \`decorators\` must have \`oas3\`, \`oas2\`, \`async2\`, \`async3\`, \`arazzo1\`, \`overlay1\`, or \`openrpc1\` decorators "${a}.`);w.decorators={},p.decorators.oas3&&(w.decorators.oas3=Io(p.decorators.oas3,g)),p.decorators.oas2&&(w.decorators.oas2=Io(p.decorators.oas2,g)),p.decorators.async2&&(w.decorators.async2=Io(p.decorators.async2,g)),p.decorators.async3&&(w.decorators.async3=Io(p.decorators.async3,g)),p.decorators.arazzo1&&(w.decorators.arazzo1=Io(p.decorators.arazzo1,g)),p.decorators.overlay1&&(w.decorators.overlay1=Io(p.decorators.overlay1,g)),p.decorators.openrpc1&&(w.decorators.openrpc1=Io(p.decorators.openrpc1,g))}return p.assertions&&(w.assertions=p.assertions),{...p,...w}}))).filter(Fb)}))).filter(Fb).flat()}function aNe(t,e){const{pluginId:n,configName:r}=ZMe(t),i=e.find(s=>s.id===n);if(!i)throw new Error(`Invalid config ${Tr.red(t)}: plugin ${n} is not included.`);const o=i.configs?.[r];if(!o)throw new Error(n?`Invalid config ${Tr.red(t)}: plugin ${n} doesn't export config with name ${r}.`:`Invalid config ${Tr.red(t)}: there is no such built-in config.`);return o}async function Ade(t,{configPath:e,externalRefResolver:n,ignore:r}={}){const o=VMe(typeof t=="string"?t:"",e??"");typeof t!="string"&&t&&(o.parsed=t);const{resolvedConfig:s,resolvedRefMap:a,plugins:c}=await iNe({rawConfigDocument:lNe(o),configPath:e,externalRefResolver:n});return new Q5(s,{configPath:e,document:o,resolvedRefMap:a,plugins:c,ignore:r})}function lNe(t){if(!t.parsed)return t;const{plugins:e,resolve:n,...r}=t.parsed,i={...structuredClone(r),plugins:e?.slice(),...n&&{resolve:{...n}}};return{...t,parsed:i}}var w4={},bf={},C4={},_F;function U5(){return _F||(_F=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e;(function(c){c[c.SCALAR=0]="SCALAR",c[c.MAPPING=1]="MAPPING",c[c.MAP=2]="MAP",c[c.SEQ=3]="SEQ",c[c.ANCHOR_REF=4]="ANCHOR_REF",c[c.INCLUDE_REF=5]="INCLUDE_REF"})(e=t.Kind||(t.Kind={}));function n(c,d){var p=d?d.endPosition:c.endPosition+1,g={key:c,value:d,startPosition:c.startPosition,endPosition:p,kind:e.MAPPING,parent:null,errors:[]};return g}t.newMapping=n;function r(c,d,p,g){return{errors:[],referencesAnchor:c,value:g,startPosition:d,endPosition:p,kind:e.ANCHOR_REF,parent:null}}t.newAnchorRef=r;function i(c){c===void 0&&(c="");var d={errors:[],startPosition:-1,endPosition:-1,value:""+c,kind:e.SCALAR,parent:null,doubleQuoted:!1,rawValue:""+c};return typeof c!="string"&&(d.valueObject=c),d}t.newScalar=i;function o(){return{errors:[],startPosition:-1,endPosition:-1,items:[],kind:e.SEQ,parent:null}}t.newItems=o;function s(){return o()}t.newSeq=s;function a(c){return{errors:[],startPosition:-1,endPosition:-1,mappings:c||[],kind:e.MAP,parent:null}}t.newMap=a})(C4)),C4}var Pm={},IF;function Mw(){if(IF)return Pm;IF=1,Object.defineProperty(Pm,"__esModule",{value:!0});function t(s){return typeof s>"u"||s===null}Pm.isNothing=t;function e(s){return typeof s=="object"&&s!==null}Pm.isObject=e;function n(s){return Array.isArray(s)?s:t(s)?[]:[s]}Pm.toArray=n;function r(s,a){var c,d,p,g;if(a)for(g=Object.keys(a),c=0,d=g.length;c<d;c+=1)p=g[c],s[p]=a[p];return s}Pm.extend=r;function i(s,a){var c="",d;for(d=0;d<a;d+=1)c+=s;return c}Pm.repeat=i;function o(s){return s===0&&Number.NEGATIVE_INFINITY===1/s}return Pm.isNegativeZero=o,Pm}var T4,jF;function A$(){if(jF)return T4;jF=1;var t=(function(){function e(n,r,i){r===void 0&&(r=null),i===void 0&&(i=!1),this.name="YAMLException",this.reason=n,this.mark=r,this.message=this.toString(!1),this.isWarning=i}return e.isInstance=function(n){if(n!=null&&n.getClassIdentifier&&typeof n.getClassIdentifier=="function")for(var r=0,i=n.getClassIdentifier();r<i.length;r++){var o=i[r];if(o==e.CLASS_IDENTIFIER)return!0}return!1},e.prototype.getClassIdentifier=function(){var n=[];return n.concat(e.CLASS_IDENTIFIER)},e.prototype.toString=function(n){n===void 0&&(n=!1);var r;return r="JS-YAML: "+(this.reason||"(unknown reason)"),!n&&this.mark&&(r+=" "+this.mark.toString()),r},e.CLASS_IDENTIFIER="yaml-ast-parser.YAMLException",e})();return T4=t,T4}var E4,QF;function cNe(){if(QF)return E4;QF=1;var t=Mw(),e=(function(){function n(r,i,o,s,a){this.name=r,this.buffer=i,this.position=o,this.line=s,this.column=a}return n.prototype.getSnippet=function(r,i){r===void 0&&(r=0),i===void 0&&(i=75);var o,s,a,c,d;if(!this.buffer)return null;for(r=r||4,i=i||75,o="",s=this.position;s>0&&`\0\r
@@ -345,7 +345,7 @@ You should wrap it with \`css\` like this:
345
345
  gap: var(--spacing-xs);
346
346
  `,nUe=U(DO)`
347
347
  width: 100%;
348
- `;function iM({input:t,onSave:e,onCancel:n,...r}){const[i,o]=M.useState(!!t.isSecret),s=({name:a,value:c})=>{e({...t,name:a,value:c,isSecret:i})};return y.jsx(ape,{variable:t,onSave:s,onCancel:n,maskValue:i,...r,children:y.jsx(RA,{children:y.jsx(vfe,{value:i,onChange:a=>o(a),title:"Make it secret"})})})}const XQ=()=>({name:"",value:"",isSecret:!1}),ro=t=>Cae+"$inputs."+t+l6,lpe=(t,e)=>e.inputs.find(n=>n.get().name===t.match(`^${S$}$`)?.[1]);function rUe({environments:t,activeEnvironmentId:e}){return t.get().find(r=>r.name===e.get())?.inputs||[]}function Vy(t){const e=new RegExp(S$,"g"),n=new Set;if(!t)return n;for(const[r,i,o]of t.matchAll(e)){const s=i||o;s&&n.add(s)}return n}function O0(t){const e=/^\{?\$inputs\.([^\}\s]+)\}?$/,n=t.match(e);return n?n[1]:null}function cj(t){const e=new Error(t);return e.source="ulid",e}const mV="0123456789ABCDEFGHJKMNPQRSTVWXYZ",GP=mV.length,EJ=Math.pow(2,48)-1,iUe=10,oUe=16;function sUe(t){let e=Math.floor(t()*GP);return e===GP&&(e=GP-1),mV.charAt(e)}function aUe(t,e){if(isNaN(t))throw new Error(t+" must be a number");if(t>EJ)throw cj("cannot encode time greater than "+EJ);if(t<0)throw cj("time must be positive");if(Number.isInteger(Number(t))===!1)throw cj("time must be an integer");let n,r="";for(;e>0;e--)n=t%GP,r=mV.charAt(n)+r,t=(t-n)/GP;return r}function lUe(t,e){let n="";for(;t>0;t--)n=sUe(e)+n;return n}function cUe(t=!1,e){e||(e=typeof window<"u"?window:null);const n=e&&(e.crypto||e.msCrypto);if(n)return()=>{const r=new Uint8Array(1);return n.getRandomValues(r),r[0]/255};try{const r=require("crypto");return()=>r.randomBytes(1).readUInt8()/255}catch{}if(t){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return()=>Math.random()}throw cj("secure crypto unusable, insecure Math.random not allowed")}function uUe(t){return t||(t=cUe()),function(n){return isNaN(n)&&(n=Date.now()),aUe(n,iUe)+lUe(oUe,t)}}const ZQ=uUe();function dUe(t){const{type:e,data:n,additionalData:r={},message:i,namespace:o,sourceDetails:s,actor:a,requestId:c,userIp:d,analyticsMetadata:p,origin:g,subjects:O,category:v="product",signal:w="log"}=t;let S,C;o&&n&&(Array.isArray(n)?C=n:typeof n=="object"&&"data"in n&&Array.isArray(n.data)&&(S=n)),!S&&!C&&(S=i);const T=s??S?.sourceDetails??null,E=a??S?.actor??T??null,$=!!(o&&(S||C)),_=`evt_${ZQ()}`.toLowerCase(),R=$?new Date:new Date().toISOString(),Q=o?`${o}.${e}`:e,q={specversion:"1.0",object:"event",datacontenttype:"application/json; charset=utf-8",origin:g??($||r.organizationId||r.projectId||r.origin==="api"?"api":"ui"),category:v,signal:w};if($){const Z=C??S?.data??[],Y=O||Z.map(K=>({id:K.id??"",object:K.object??"unknown",uri:K.uri??""})),G=Z[0]?.id??null;Object.assign(q,{...r,...S||{},id:_,type:Q,time:R,source:T?.uri??null,sourceDetails:T,actor:E,subject:G,subjects:Y,context:{ip:d},data:Z,requestId:c??"",analyticsMetadata:p})}else{const Z=r.request,Y=r.sourceDetails,G=Y?{id:Y.user??Y.id??`usr_${ZQ()}`,object:Y.object??"user",uri:Y.uri??""}:null,K=(Array.isArray(n)?n[0]:n)?.id??null;Object.assign(q,{...r,id:_,type:Q,time:R,source:Z?.source??r.source??null,sourceDetails:G,actor:G,subject:K,data:n})}return q}var fUe=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},jb="1.9.0",PJ=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function pUe(t){var e=new Set([t]),n=new Set,r=t.match(PJ);if(!r)return function(){return!1};var i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(c){return c===t};function o(a){return n.add(a),!1}function s(a){return e.add(a),!0}return function(c){if(e.has(c))return!0;if(n.has(c))return!1;var d=c.match(PJ);if(!d)return o(c);var p={major:+d[1],minor:+d[2],patch:+d[3],prerelease:d[4]};return p.prerelease!=null||i.major!==p.major?o(c):i.major===0?i.minor===p.minor&&i.patch<=p.patch?s(c):o(c):i.minor<=p.minor?s(c):o(c)}}var hUe=pUe(jb),mUe=jb.split(".")[0],MA=Symbol.for("opentelemetry.js.api."+mUe),NA=fUe;function I$(t,e,n,r){var i;r===void 0&&(r=!1);var o=NA[MA]=(i=NA[MA])!==null&&i!==void 0?i:{version:jb};if(!r&&o[t]){var s=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return n.error(s.stack||s.message),!1}if(o.version!==jb){var s=new Error("@opentelemetry/api: Registration of version v"+o.version+" for "+t+" does not match previously registered API v"+jb);return n.error(s.stack||s.message),!1}return o[t]=e,n.debug("@opentelemetry/api: Registered a global for "+t+" v"+jb+"."),!0}function Hb(t){var e,n,r=(e=NA[MA])===null||e===void 0?void 0:e.version;if(!(!r||!hUe(r)))return(n=NA[MA])===null||n===void 0?void 0:n[t]}function j$(t,e){e.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+jb+".");var n=NA[MA];n&&delete n[t]}var gUe=function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o},yUe=function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},OUe=(function(){function t(e){this._namespace=e.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return nP("debug",this._namespace,e)},t.prototype.error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return nP("error",this._namespace,e)},t.prototype.info=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return nP("info",this._namespace,e)},t.prototype.warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return nP("warn",this._namespace,e)},t.prototype.verbose=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return nP("verbose",this._namespace,e)},t})();function nP(t,e,n){var r=Hb("diag");if(r)return n.unshift(e),r[t].apply(r,yUe([],gUe(n),!1))}var yu;(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"})(yu||(yu={}));function vUe(t,e){t<yu.NONE?t=yu.NONE:t>yu.ALL&&(t=yu.ALL),e=e||{};function n(r,i){var o=e[r];return typeof o=="function"&&t>=i?o.bind(e):function(){}}return{error:n("error",yu.ERROR),warn:n("warn",yu.WARN),info:n("info",yu.INFO),debug:n("debug",yu.DEBUG),verbose:n("verbose",yu.VERBOSE)}}var bUe=function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o},xUe=function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},SUe="diag",ch=(function(){function t(){function e(i){return function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var a=Hb("diag");if(a)return a[i].apply(a,xUe([],bUe(o),!1))}}var n=this,r=function(i,o){var s,a,c;if(o===void 0&&(o={logLevel:yu.INFO}),i===n){var d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return n.error((s=d.stack)!==null&&s!==void 0?s:d.message),!1}typeof o=="number"&&(o={logLevel:o});var p=Hb("diag"),g=vUe((a=o.logLevel)!==null&&a!==void 0?a:yu.INFO,i);if(p&&!o.suppressOverrideMessage){var O=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";p.warn("Current logger will be overwritten from "+O),g.warn("Current logger will overwrite one already registered from "+O)}return I$("diag",g,n,!0)};n.setLogger=r,n.disable=function(){j$(SUe,n)},n.createComponentLogger=function(i){return new OUe(i)},n.verbose=e("verbose"),n.debug=e("debug"),n.info=e("info"),n.warn=e("warn"),n.error=e("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t})(),wUe=function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o},CUe=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},TUe=(function(){function t(e){this._entries=e?new Map(e):new Map}return t.prototype.getEntry=function(e){var n=this._entries.get(e);if(n)return Object.assign({},n)},t.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var n=wUe(e,2),r=n[0],i=n[1];return[r,i]})},t.prototype.setEntry=function(e,n){var r=new t(this._entries);return r._entries.set(e,n),r},t.prototype.removeEntry=function(e){var n=new t(this._entries);return n._entries.delete(e),n},t.prototype.removeEntries=function(){for(var e,n,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=new t(this._entries);try{for(var s=CUe(r),a=s.next();!a.done;a=s.next()){var c=a.value;o._entries.delete(c)}}catch(d){e={error:d}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return o},t.prototype.clear=function(){return new t},t})(),EUe=Symbol("BaggageEntryMetadata"),PUe=ch.instance();function AUe(t){return t===void 0&&(t={}),new TUe(new Map(Object.entries(t)))}function $Ue(t){return typeof t!="string"&&(PUe.error("Cannot create baggage metadata from unknown type: "+typeof t),t=""),{__TYPE__:EUe,toString:function(){return t}}}function gV(t){return Symbol.for(t)}var kUe=(function(){function t(e){var n=this;n._currentContext=e?new Map(e):new Map,n.getValue=function(r){return n._currentContext.get(r)},n.setValue=function(r,i){var o=new t(n._currentContext);return o._currentContext.set(r,i),o},n.deleteValue=function(r){var i=new t(n._currentContext);return i._currentContext.delete(r),i}}return t})(),uS=new kUe,v0=(function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),RUe=(function(){function t(){}return t.prototype.createGauge=function(e,n){return LUe},t.prototype.createHistogram=function(e,n){return UUe},t.prototype.createCounter=function(e,n){return qUe},t.prototype.createUpDownCounter=function(e,n){return VUe},t.prototype.createObservableGauge=function(e,n){return XUe},t.prototype.createObservableCounter=function(e,n){return BUe},t.prototype.createObservableUpDownCounter=function(e,n){return ZUe},t.prototype.addBatchObservableCallback=function(e,n){},t.prototype.removeBatchObservableCallback=function(e){},t})(),oM=(function(){function t(){}return t})(),_Ue=(function(t){v0(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.add=function(n,r){},e})(oM),IUe=(function(t){v0(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.add=function(n,r){},e})(oM),jUe=(function(t){v0(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.record=function(n,r){},e})(oM),QUe=(function(t){v0(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.record=function(n,r){},e})(oM),yV=(function(){function t(){}return t.prototype.addCallback=function(e){},t.prototype.removeCallback=function(e){},t})(),DUe=(function(t){v0(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(yV),MUe=(function(t){v0(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(yV),NUe=(function(t){v0(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(yV),zUe=new RUe,qUe=new _Ue,LUe=new jUe,UUe=new QUe,VUe=new IUe,BUe=new DUe,XUe=new MUe,ZUe=new NUe,YUe={get:function(t,e){if(t!=null)return t[e]},keys:function(t){return t==null?[]:Object.keys(t)}},GUe={set:function(t,e,n){t!=null&&(t[e]=n)}},WUe=function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o},FUe=function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},HUe=(function(){function t(){}return t.prototype.active=function(){return uS},t.prototype.with=function(e,n,r){for(var i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];return n.call.apply(n,FUe([r],WUe(i),!1))},t.prototype.bind=function(e,n){return n},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t})(),JUe=function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o},KUe=function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},cz="context",e7e=new HUe,sM=(function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(e){return I$(cz,e,ch.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(e,n,r){for(var i,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return(i=this._getContextManager()).with.apply(i,KUe([e,n,r],JUe(o),!1))},t.prototype.bind=function(e,n){return this._getContextManager().bind(e,n)},t.prototype._getContextManager=function(){return Hb(cz)||e7e},t.prototype.disable=function(){this._getContextManager().disable(),j$(cz,ch.instance())},t})(),ng;(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(ng||(ng={}));var cpe="0000000000000000",upe="00000000000000000000000000000000",dpe={traceId:upe,spanId:cpe,traceFlags:ng.NONE},WP=(function(){function t(e){e===void 0&&(e=dpe),this._spanContext=e}return t.prototype.spanContext=function(){return this._spanContext},t.prototype.setAttribute=function(e,n){return this},t.prototype.setAttributes=function(e){return this},t.prototype.addEvent=function(e,n){return this},t.prototype.addLink=function(e){return this},t.prototype.addLinks=function(e){return this},t.prototype.setStatus=function(e){return this},t.prototype.updateName=function(e){return this},t.prototype.end=function(e){},t.prototype.isRecording=function(){return!1},t.prototype.recordException=function(e,n){},t})(),OV=gV("OpenTelemetry Context Key SPAN");function vV(t){return t.getValue(OV)||void 0}function t7e(){return vV(sM.getInstance().active())}function bV(t,e){return t.setValue(OV,e)}function n7e(t){return t.deleteValue(OV)}function r7e(t,e){return bV(t,new WP(e))}function fpe(t){var e;return(e=vV(t))===null||e===void 0?void 0:e.spanContext()}var i7e=/^([0-9a-f]{32})$/i,o7e=/^[0-9a-f]{16}$/i;function ppe(t){return i7e.test(t)&&t!==upe}function s7e(t){return o7e.test(t)&&t!==cpe}function aM(t){return ppe(t.traceId)&&s7e(t.spanId)}function a7e(t){return new WP(t)}var uz=sM.getInstance(),hpe=(function(){function t(){}return t.prototype.startSpan=function(e,n,r){r===void 0&&(r=uz.active());var i=!!n?.root;if(i)return new WP;var o=r&&fpe(r);return l7e(o)&&aM(o)?new WP(o):new WP},t.prototype.startActiveSpan=function(e,n,r,i){var o,s,a;if(!(arguments.length<2)){arguments.length===2?a=n:arguments.length===3?(o=n,a=r):(o=n,s=r,a=i);var c=s??uz.active(),d=this.startSpan(e,o,c),p=bV(c,d);return uz.with(p,a,void 0,d)}},t})();function l7e(t){return typeof t=="object"&&typeof t.spanId=="string"&&typeof t.traceId=="string"&&typeof t.traceFlags=="number"}var c7e=new hpe,u7e=(function(){function t(e,n,r,i){this._provider=e,this.name=n,this.version=r,this.options=i}return t.prototype.startSpan=function(e,n,r){return this._getTracer().startSpan(e,n,r)},t.prototype.startActiveSpan=function(e,n,r,i){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},t.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):c7e},t})(),d7e=(function(){function t(){}return t.prototype.getTracer=function(e,n,r){return new hpe},t})(),f7e=new d7e,AJ=(function(){function t(){}return t.prototype.getTracer=function(e,n,r){var i;return(i=this.getDelegateTracer(e,n,r))!==null&&i!==void 0?i:new u7e(this,e,n,r)},t.prototype.getDelegate=function(){var e;return(e=this._delegate)!==null&&e!==void 0?e:f7e},t.prototype.setDelegate=function(e){this._delegate=e},t.prototype.getDelegateTracer=function(e,n,r){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(e,n,r)},t})(),YQ;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(YQ||(YQ={}));var p9;(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"})(p9||(p9={}));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={}));var Zm=sM.getInstance(),jr=ch.instance(),p7e=(function(){function t(){}return t.prototype.getMeter=function(e,n,r){return zUe},t})(),h7e=new p7e,dz="metrics",m7e=(function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalMeterProvider=function(e){return I$(dz,e,ch.instance())},t.prototype.getMeterProvider=function(){return Hb(dz)||h7e},t.prototype.getMeter=function(e,n,r){return this.getMeterProvider().getMeter(e,n,r)},t.prototype.disable=function(){j$(dz,ch.instance())},t})(),mpe=m7e.getInstance(),g7e=(function(){function t(){}return t.prototype.inject=function(e,n){},t.prototype.extract=function(e,n){return e},t.prototype.fields=function(){return[]},t})(),xV=gV("OpenTelemetry Baggage Key");function gpe(t){return t.getValue(xV)||void 0}function y7e(){return gpe(sM.getInstance().active())}function O7e(t,e){return t.setValue(xV,e)}function v7e(t){return t.deleteValue(xV)}var fz="propagation",b7e=new g7e,x7e=(function(){function t(){this.createBaggage=AUe,this.getBaggage=gpe,this.getActiveBaggage=y7e,this.setBaggage=O7e,this.deleteBaggage=v7e}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(e){return I$(fz,e,ch.instance())},t.prototype.inject=function(e,n,r){return r===void 0&&(r=GUe),this._getGlobalPropagator().inject(e,n,r)},t.prototype.extract=function(e,n,r){return r===void 0&&(r=YUe),this._getGlobalPropagator().extract(e,n,r)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){j$(fz,ch.instance())},t.prototype._getGlobalPropagator=function(){return Hb(fz)||b7e},t})(),FP=x7e.getInstance(),pz="trace",S7e=(function(){function t(){this._proxyTracerProvider=new AJ,this.wrapSpanContext=a7e,this.isSpanContextValid=aM,this.deleteSpan=n7e,this.getSpan=vV,this.getActiveSpan=t7e,this.getSpanContext=fpe,this.setSpan=bV,this.setSpanContext=r7e}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(e){var n=I$(pz,this._proxyTracerProvider,ch.instance());return n&&this._proxyTracerProvider.setDelegate(e),n},t.prototype.getTracerProvider=function(){return Hb(pz)||this._proxyTracerProvider},t.prototype.getTracer=function(e,n){return this.getTracerProvider().getTracer(e,n)},t.prototype.disable=function(){j$(pz,ch.instance()),this._proxyTracerProvider=new AJ},t})(),vc=S7e.getInstance();const ype=gV("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function w7e(t){return t.setValue(ype,!0)}function SV(t){return t.getValue(ype)===!0}const C7e="=",h9=";",m9=",",hz="baggage",T7e=180,E7e=4096,P7e=8192;function A7e(t){return t.reduce((e,n)=>{const r=`${e}${e!==""?m9:""}${n}`;return r.length>P7e?e:r},"")}function $7e(t){return t.getAllEntries().map(([e,n])=>{let r=`${encodeURIComponent(e)}=${encodeURIComponent(n.value)}`;return n.metadata!==void 0&&(r+=h9+n.metadata.toString()),r})}function k7e(t){const e=t.split(h9);if(e.length<=0)return;const n=e.shift();if(!n)return;const r=n.indexOf(C7e);if(r<=0)return;const i=decodeURIComponent(n.substring(0,r).trim()),o=decodeURIComponent(n.substring(r+1).trim());let s;return e.length>0&&(s=$Ue(e.join(h9))),{key:i,value:o,metadata:s}}class R7e{inject(e,n,r){const i=FP.getBaggage(e);if(!i||SV(e))return;const o=$7e(i).filter(a=>a.length<=E7e).slice(0,T7e),s=A7e(o);s.length>0&&r.set(n,hz,s)}extract(e,n,r){const i=r.get(n,hz),o=Array.isArray(i)?i.join(m9):i;if(!o)return e;const s={};return o.length===0||(o.split(m9).forEach(c=>{const d=k7e(c);if(d){const p={value:d.value};d.metadata&&(p.metadata=d.metadata),s[d.key]=p}}),Object.entries(s).length===0)?e:FP.setBaggage(e,FP.createBaggage(s))}fields(){return[hz]}}function uj(t){const e={};if(typeof t!="object"||t==null)return e;for(const[n,r]of Object.entries(t)){if(!_7e(n)){jr.warn(`Invalid attribute key: ${n}`);continue}if(!Ope(r)){jr.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?e[n]=r.slice():e[n]=r}return e}function _7e(t){return typeof t=="string"&&t.length>0}function Ope(t){return t==null?!0:Array.isArray(t)?I7e(t):vpe(t)}function I7e(t){let e;for(const n of t)if(n!=null){if(!e){if(vpe(n)){e=typeof n;continue}return!1}if(typeof n!==e)return!1}return!0}function vpe(t){switch(typeof t){case"number":case"boolean":case"string":return!0}return!1}function j7e(){return t=>{jr.error(Q7e(t))}}function Q7e(t){return typeof t=="string"?t:JSON.stringify(D7e(t))}function D7e(t){const e={};let n=t;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(r=>{if(e[r])return;const i=n[r];i&&(e[r]=String(i))}),n=Object.getPrototypeOf(n);return e}let M7e=j7e();function sw(t){try{M7e(t)}catch{}}const QS=performance,N7e="2.0.1",mz="exception.message",z7e="exception.stacktrace",gz="exception.type",q7e="service.name",g9="telemetry.sdk.language",L7e="webjs",y9="telemetry.sdk.name",O9="telemetry.sdk.version",U7e="process.runtime.name",yz={[y9]:"opentelemetry",[U7e]:"browser",[g9]:L7e,[O9]:N7e};const V7e=9,B7e=6,X7e=Math.pow(10,B7e),GQ=Math.pow(10,V7e);function SS(t){const e=t/1e3,n=Math.trunc(e),r=Math.round(t%1e3*X7e);return[n,r]}function bpe(){let t=QS.timeOrigin;if(typeof t!="number"){const e=QS;t=e.timing&&e.timing.fetchStart}return t}function Z7e(t){const e=SS(bpe()),n=SS(typeof t=="number"?t:QS.now());return Spe(e,n)}function Y7e(t,e){let n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=GQ),[n,r]}function G7e(t){return t[0]*GQ+t[1]}function xpe(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}function $J(t){return xpe(t)||typeof t=="number"||t instanceof Date}function Spe(t,e){const n=[t[0]+e[0],t[1]+e[1]];return n[1]>=GQ&&(n[1]-=GQ,n[0]+=1),n}var Vp;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(Vp||(Vp={}));class W7e{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields=="function"?n.fields():[]).reduce((n,r)=>n.concat(r),[])))}inject(e,n,r){for(const i of this._propagators)try{i.inject(e,n,r)}catch(o){jr.warn(`Failed to inject with ${i.constructor.name}. Err: ${o.message}`)}}extract(e,n,r){return this._propagators.reduce((i,o)=>{try{return o.extract(i,n,r)}catch(s){jr.warn(`Failed to extract with ${o.constructor.name}. Err: ${s.message}`)}return i},e)}fields(){return this._fields.slice()}}const v9="[_0-9a-z-*/]",F7e=`[a-z]${v9}{0,255}`,H7e=`[a-z0-9]${v9}{0,240}@[a-z]${v9}{0,13}`,J7e=new RegExp(`^(?:${F7e}|${H7e})$`),K7e=/^[ -~]{0,255}[!-~]$/,e6e=/,|=/;function t6e(t){return J7e.test(t)}function n6e(t){return K7e.test(t)&&!e6e.test(t)}const kJ=32,r6e=512,RJ=",",_J="=";class wV{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,n){const r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,n),r}unset(e){const n=this._clone();return n._internalState.delete(e),n}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,n)=>(e.push(n+_J+this.get(n)),e),[]).join(RJ)}_parse(e){e.length>r6e||(this._internalState=e.split(RJ).reverse().reduce((n,r)=>{const i=r.trim(),o=i.indexOf(_J);if(o!==-1){const s=i.slice(0,o),a=i.slice(o+1,r.length);t6e(s)&&n6e(a)&&n.set(s,a)}return n},new Map),this._internalState.size>kJ&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,kJ))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){const e=new wV;return e._internalState=new Map(this._internalState),e}}const Oz="traceparent",vz="tracestate",i6e="00",o6e="(?!ff)[\\da-f]{2}",s6e="(?![0]{32})[\\da-f]{32}",a6e="(?![0]{16})[\\da-f]{16}",l6e="[\\da-f]{2}",c6e=new RegExp(`^\\s?(${o6e})-(${s6e})-(${a6e})-(${l6e})(-.*)?\\s?$`);function u6e(t){const e=c6e.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}class d6e{inject(e,n,r){const i=vc.getSpanContext(e);if(!i||SV(e)||!aM(i))return;const o=`${i6e}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||ng.NONE).toString(16)}`;r.set(n,Oz,o),i.traceState&&r.set(n,vz,i.traceState.serialize())}extract(e,n,r){const i=r.get(n,Oz);if(!i)return e;const o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;const s=u6e(o);if(!s)return e;s.isRemote=!0;const a=r.get(n,vz);if(a){const c=Array.isArray(a)?a.join(","):a;s.traceState=new wV(typeof c=="string"?c:void 0)}return vc.setSpanContext(e,s)}fields(){return[Oz,vz]}}const f6e="[object Object]",p6e="[object Null]",h6e="[object Undefined]",m6e=Function.prototype,wpe=m6e.toString,g6e=wpe.call(Object),y6e=Object.getPrototypeOf,Cpe=Object.prototype,Tpe=Cpe.hasOwnProperty,Pb=Symbol?Symbol.toStringTag:void 0,Epe=Cpe.toString;function IJ(t){if(!O6e(t)||v6e(t)!==f6e)return!1;const e=y6e(t);if(e===null)return!0;const n=Tpe.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&wpe.call(n)===g6e}function O6e(t){return t!=null&&typeof t=="object"}function v6e(t){return t==null?t===void 0?h6e:p6e:Pb&&Pb in Object(t)?b6e(t):x6e(t)}function b6e(t){const e=Tpe.call(t,Pb),n=t[Pb];let r=!1;try{t[Pb]=void 0,r=!0}catch{}const i=Epe.call(t);return r&&(e?t[Pb]=n:delete t[Pb]),i}function x6e(t){return Epe.call(t)}const S6e=20;function w6e(...t){let e=t.shift();const n=new WeakMap;for(;t.length>0;)e=Ppe(e,t.shift(),0,n);return e}function bz(t){return WQ(t)?t.slice():t}function Ppe(t,e,n=0,r){let i;if(!(n>S6e)){if(n++,dj(t)||dj(e)||Ape(e))i=bz(e);else if(WQ(t)){if(i=t.slice(),WQ(e))for(let o=0,s=e.length;o<s;o++)i.push(bz(e[o]));else if(rP(e)){const o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){const c=o[s];i[c]=bz(e[c])}}}else if(rP(t))if(rP(e)){if(!C6e(t,e))return e;i=Object.assign({},t);const o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){const c=o[s],d=e[c];if(dj(d))typeof d>"u"?delete i[c]:i[c]=d;else{const p=i[c],g=d;if(jJ(t,c,r)||jJ(e,c,r))delete i[c];else{if(rP(p)&&rP(g)){const O=r.get(p)||[],v=r.get(g)||[];O.push({obj:t,key:c}),v.push({obj:e,key:c}),r.set(p,O),r.set(g,v)}i[c]=Ppe(i[c],d,n,r)}}}}else i=e;return i}}function jJ(t,e,n){const r=n.get(t[e])||[];for(let i=0,o=r.length;i<o;i++){const s=r[i];if(s.key===e&&s.obj===t)return!0}return!1}function WQ(t){return Array.isArray(t)}function Ape(t){return typeof t=="function"}function rP(t){return!dj(t)&&!WQ(t)&&!Ape(t)&&typeof t=="object"}function dj(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function C6e(t,e){return!(!IJ(t)||!IJ(e))}class T6e{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,n)=>{this._resolve=e,this._reject=n})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}class E6e{_callback;_that;_isCalled=!1;_deferred=new T6e;constructor(e,n){this._callback=e,this._that=n}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}function P6e(){return"unknown_service"}const PP=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";class FQ{_rawAttributes;_asyncAttributesPending=!1;_memoizedAttributes;static FromAttributeList(e){const n=new FQ({});return n._rawAttributes=QJ(e),n._asyncAttributesPending=e.filter(([r,i])=>PP(i)).length>0,n}constructor(e){const n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([r,i])=>(PP(i)&&(this._asyncAttributesPending=!0),[r,i])),this._rawAttributes=QJ(this._rawAttributes)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){const[n,r]=this._rawAttributes[e];this._rawAttributes[e]=[n,PP(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&jr.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const e={};for(const[n,r]of this._rawAttributes){if(PP(r)){jr.debug(`Unsettled resource attribute ${n} skipped`);continue}r!=null&&(e[n]??=r)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}merge(e){return e==null?this:FQ.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()])}}function $pe(t){return FQ.FromAttributeList(Object.entries(t))}function A6e(){return $pe({[q7e]:P6e(),[g9]:yz[g9],[y9]:yz[y9],[O9]:yz[O9]})}function QJ(t){return t.map(([e,n])=>PP(n)?[e,n.catch(r=>{jr.debug("promise rejection for resource attribute: %s - %s",e,r)})]:[e,n])}const $6e="exception";class k6e{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;name;status={code:exports.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){const n=Date.now();this._spanContext=e.spanContext,this._performanceStartTime=QS.now(),this._performanceOffset=n-(this._performanceStartTime+bpe()),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit||0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,this.links=e.links||[],this.startTime=this._getTime(e.startTime??n),this.resource=e.resource,this.instrumentationScope=e.scope,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,n){if(n==null||this._isSpanEnded())return this;if(e.length===0)return jr.warn(`Invalid attribute key: ${e}`),this;if(!Ope(n))return jr.warn(`Invalid attribute value set for key: ${e}`),this;const{attributeCountLimit:r}=this._spanLimits;return r!==void 0&&Object.keys(this.attributes).length>=r&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(n),this)}setAttributes(e){for(const[n,r]of Object.entries(e))this.setAttribute(n,r);return this}addEvent(e,n,r){if(this._isSpanEnded())return this;const{eventCountLimit:i}=this._spanLimits;if(i===0)return jr.warn("No events allowed."),this._droppedEventsCount++,this;i!==void 0&&this.events.length>=i&&(this._droppedEventsCount===0&&jr.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),$J(n)&&($J(r)||(r=n),n=void 0);const o=uj(n);return this.events.push({name:e,attributes:o,time:this._getTime(r),droppedAttributesCount:0}),this}addLink(e){return this.links.push(e),this}addLinks(e){return this.links.push(...e),this}setStatus(e){return this._isSpanEnded()?this:(this.status={...e},this.status.message!=null&&typeof e.message!="string"&&(jr.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`),delete this.status.message),this)}updateName(e){return this._isSpanEnded()?this:(this.name=e,this)}end(e){if(this._isSpanEnded()){jr.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this._ended=!0,this.endTime=this._getTime(e),this._duration=Y7e(this.startTime,this.endTime),this._duration[0]<0&&(jr.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&jr.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e=="number"&&e<=QS.now())return Z7e(e+this._performanceOffset);if(typeof e=="number")return SS(e);if(e instanceof Date)return SS(e.getTime());if(xpe(e))return e;if(this._startTimeProvided)return SS(Date.now());const n=QS.now()-this._performanceStartTime;return Spe(this.startTime,SS(n))}isRecording(){return this._ended===!1}recordException(e,n){const r={};typeof e=="string"?r[mz]=e:e&&(e.code?r[gz]=e.code.toString():e.name&&(r[gz]=e.name),e.message&&(r[mz]=e.message),e.stack&&(r[z7e]=e.stack)),r[gz]||r[mz]?this.addEvent($6e,r,n):jr.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){const e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);jr.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,n){return e.length<=n?e:e.substring(0,n)}_truncateToSize(e){const n=this._attributeValueLengthLimit;return n<=0?(jr.warn(`Attribute value limit must be positive, got ${n}`),e):typeof e=="string"?this._truncateToLimitUtil(e,n):Array.isArray(e)?e.map(r=>typeof r=="string"?this._truncateToLimitUtil(r,n):r):e}}var aw;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(aw||(aw={}));class HQ{shouldSample(){return{decision:aw.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class DS{shouldSample(){return{decision:aw.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class F_{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||(sw(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new DS),this._remoteParentSampled=e.remoteParentSampled??new DS,this._remoteParentNotSampled=e.remoteParentNotSampled??new HQ,this._localParentSampled=e.localParentSampled??new DS,this._localParentNotSampled=e.localParentNotSampled??new HQ}shouldSample(e,n,r,i,o,s){const a=vc.getSpanContext(e);return!a||!aM(a)?this._root.shouldSample(e,n,r,i,o,s):a.isRemote?a.traceFlags&ng.SAMPLED?this._remoteParentSampled.shouldSample(e,n,r,i,o,s):this._remoteParentNotSampled.shouldSample(e,n,r,i,o,s):a.traceFlags&ng.SAMPLED?this._localParentSampled.shouldSample(e,n,r,i,o,s):this._localParentNotSampled.shouldSample(e,n,r,i,o,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}class DJ{_ratio;_upperBound;constructor(e=0){this._ratio=e,this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,n){return{decision:ppe(n)&&this._accumulate(n)<this._upperBound?aw.RECORD_AND_SAMPLED:aw.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!="number"||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let n=0;for(let r=0;r<e.length/8;r++){const i=r*8,o=parseInt(e.slice(i,i+8),16);n=(n^o)>>>0}return n}}const MJ=1;function kpe(){return{sampler:Rpe(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function Rpe(){const t="parentbased_always_on";switch(t){case"always_on":return new DS;case"always_off":return new HQ;case"parentbased_always_on":return new F_({root:new DS});case"parentbased_always_off":return new F_({root:new HQ});case"traceidratio":return new DJ(NJ());case"parentbased_traceidratio":return new F_({root:new DJ(NJ())});default:return jr.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "parentbased_always_on".`),new F_({root:new DS})}}function NJ(){return jr.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${MJ}.`),MJ}const R6e=128,_6e=1/0;function I6e(t){const e={sampler:Rpe()},n=kpe(),r=Object.assign({},n,e,t);return r.generalLimits=Object.assign({},n.generalLimits,t.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,t.spanLimits||{}),r}function j6e(t){const e=Object.assign({},t.spanLimits);return e.attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??void 0??void 0??R6e,e.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??void 0??void 0??_6e,Object.assign({},t,{spanLimits:e})}class Q6e{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,n){this._exporter=e,this._maxExportBatchSize=typeof n?.maxExportBatchSize=="number"?n.maxExportBatchSize:512,this._maxQueueSize=typeof n?.maxQueueSize=="number"?n.maxQueueSize:2048,this._scheduledDelayMillis=typeof n?.scheduledDelayMillis=="number"?n.scheduledDelayMillis:5e3,this._exportTimeoutMillis=typeof n?.exportTimeoutMillis=="number"?n.exportTimeoutMillis:3e4,this._shutdownOnce=new E6e(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(jr.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,n){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&ng.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&jr.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(jr.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,n)=>{const r=[],i=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let o=0,s=i;o<s;o++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(n)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,n)=>{const r=setTimeout(()=>{n(new Error("Timeout"))},this._exportTimeoutMillis);Zm.with(w7e(Zm.active()),()=>{let i;this._finishedSpans.length<=this._maxExportBatchSize?(i=this._finishedSpans,this._finishedSpans=[]):i=this._finishedSpans.splice(0,this._maxExportBatchSize);const o=()=>this._exporter.export(i,a=>{clearTimeout(r),a.code===Vp.SUCCESS?e():n(a.error??new Error("BatchSpanProcessor: span export failed"))});let s=null;for(let a=0,c=i.length;a<c;a++){const d=i[a];d.resource.asyncAttributesPending&&d.resource.waitForAsyncAttributes&&(s??=[],s.push(d.resource.waitForAsyncAttributes()))}s===null?o():Promise.all(s).then(o,a=>{sw(a),n(a)})})})}_maybeStartTimer(){if(this._isExporting)return;const e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(n=>{this._isExporting=!1,sw(n)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),this._timer,void 0)}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}class D6e extends Q6e{_visibilityChangeListener;_pageHideListener;constructor(e,n){super(e,n),this.onInit(n)}onInit(e){e?.disableAutoFlushOnDocumentHide!==!0&&typeof document<"u"&&(this._visibilityChangeListener=()=>{document.visibilityState==="hidden"&&this.forceFlush().catch(n=>{sw(n)})},this._pageHideListener=()=>{this.forceFlush().catch(n=>{sw(n)})},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){typeof document<"u"&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}}const M6e=8,N6e=16;class z6e{generateTraceId=zJ(N6e);generateSpanId=zJ(M6e)}const H_=Array(32);function zJ(t){return function(){for(let n=0;n<t*2;n++)H_[n]=Math.floor(Math.random()*16)+48,H_[n]>=58&&(H_[n]+=39);return String.fromCharCode.apply(null,H_.slice(0,t*2))}}class q6e{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;constructor(e,n,r,i){const o=I6e(n);this._sampler=o.sampler,this._generalLimits=o.generalLimits,this._spanLimits=o.spanLimits,this._idGenerator=n.idGenerator||new z6e,this._resource=r,this._spanProcessor=i,this.instrumentationScope=e}startSpan(e,n={},r=Zm.active()){n.root&&(r=vc.deleteSpan(r));const i=vc.getSpan(r);if(SV(r))return jr.debug("Instrumentation suppressed, returning Noop Span"),vc.wrapSpanContext(dpe);const o=i?.spanContext(),s=this._idGenerator.generateSpanId();let a,c,d;!o||!vc.isSpanContextValid(o)?c=this._idGenerator.generateTraceId():(c=o.traceId,d=o.traceState,a=o);const p=n.kind??p9.INTERNAL,g=(n.links??[]).map(E=>({context:E.context,attributes:uj(E.attributes)})),O=uj(n.attributes),v=this._sampler.shouldSample(r,c,e,p,O,g);d=v.traceState??d;const w=v.decision===YQ.RECORD_AND_SAMPLED?ng.SAMPLED:ng.NONE,S={traceId:c,spanId:s,traceFlags:w,traceState:d};if(v.decision===YQ.NOT_RECORD)return jr.debug("Recording is off, propagating context in a non-recording span"),vc.wrapSpanContext(S);const C=uj(Object.assign(O,v.attributes));return new k6e({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:S,name:e,kind:p,links:g,parentSpanContext:a,attributes:C,startTime:n.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits})}startActiveSpan(e,n,r,i){let o,s,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(o=n,a=r):(o=n,s=r,a=i);const c=s??Zm.active(),d=this.startSpan(e,o,c),p=vc.setSpan(c,d);return Zm.with(p,a,void 0,d)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}class L6e{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){const e=[];for(const n of this._spanProcessors)e.push(n.forceFlush());return new Promise(n=>{Promise.all(e).then(()=>{n()}).catch(r=>{sw(r||new Error("MultiSpanProcessor: forceFlush failed")),n()})})}onStart(e,n){for(const r of this._spanProcessors)r.onStart(e,n)}onEnd(e){for(const n of this._spanProcessors)n.onEnd(e)}shutdown(){const e=[];for(const n of this._spanProcessors)e.push(n.shutdown());return new Promise((n,r)=>{Promise.all(e).then(()=>{n()},r)})}}var Ab;(function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"})(Ab||(Ab={}));class U6e{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){const n=w6e({},kpe(),j6e(e));this._resource=n.resource??A6e(),this._config=Object.assign({},n,{resource:this._resource});const r=[];e.spanProcessors?.length&&r.push(...e.spanProcessors),this._activeSpanProcessor=new L6e(r)}getTracer(e,n,r){const i=`${e}@${n||""}:${r?.schemaUrl||""}`;return this._tracers.has(i)||this._tracers.set(i,new q6e({name:e,version:n,schemaUrl:r?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(i)}forceFlush(){const e=this._config.forceFlushTimeoutMillis,n=this._activeSpanProcessor._spanProcessors.map(r=>new Promise(i=>{let o;const s=setTimeout(()=>{i(new Error(`Span processor did not completed within timeout period of ${e} ms`)),o=Ab.timeout},e);r.forceFlush().then(()=>{clearTimeout(s),o!==Ab.timeout&&(o=Ab.resolved,i(o))}).catch(a=>{clearTimeout(s),o=Ab.error,i(a)})}));return new Promise((r,i)=>{Promise.all(n).then(o=>{const s=o.filter(a=>a!==Ab.resolved);s.length>0?i(s):r()}).catch(o=>i([o]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}class V6e{_enabled=!1;_currentContext=uS;_bindFunction(e=uS,n){const r=this,i=function(...o){return r.with(e,()=>n.apply(this,o))};return Object.defineProperty(i,"length",{enumerable:!1,configurable:!0,writable:!1,value:n.length}),i}active(){return this._currentContext}bind(e,n){return e===void 0&&(e=this.active()),typeof n=="function"?this._bindFunction(e,n):n}disable(){return this._currentContext=uS,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=uS,this)}with(e,n,r,...i){const o=this._currentContext;this._currentContext=e||uS;try{return n.call(r,...i)}finally{this._currentContext=o}}}function B6e(t){if(t!==null){if(t===void 0){const e=new V6e;e.enable(),Zm.setGlobalContextManager(e);return}t.enable(),Zm.setGlobalContextManager(t)}}function X6e(t){if(t!==null){if(t===void 0){FP.setGlobalPropagator(new W7e({propagators:[new d6e,new R7e]}));return}FP.setGlobalPropagator(t)}}class Z6e extends U6e{constructor(e={}){super(e)}register(e={}){vc.setGlobalTracerProvider(this),X6e(e.propagator),B6e(e.contextManager)}}class Y6e{_delegate;constructor(e){this._delegate=e}export(e,n){this._delegate.export(e,n)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}class qJ extends Error{code;name="OTLPExporterError";data;constructor(e,n,r){super(e),this.data=r,this.code=n}}function G6e(t){if(Number.isFinite(t)&&t>0)return t;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${t}')`)}function W6e(t){if(t!=null)return()=>t}function F6e(t,e,n){return{timeoutMillis:G6e(t.timeoutMillis??e.timeoutMillis??n.timeoutMillis),concurrencyLimit:t.concurrencyLimit??e.concurrencyLimit??n.concurrencyLimit,compression:t.compression??e.compression??n.compression}}function H6e(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}class J6e{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(e);const n=()=>{const r=this._sendingPromises.indexOf(e);this._sendingPromises.splice(r,1)};e.then(n,n)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}function K6e(t){return new J6e(t.concurrencyLimit)}function eVe(t){return Object.prototype.hasOwnProperty.call(t,"partialSuccess")}function tVe(){return{handleResponse(t){t==null||!eVe(t)||t.partialSuccess==null||Object.keys(t.partialSuccess).length===0||jr.warn("Received Partial Success response:",JSON.stringify(t.partialSuccess))}}}class nVe{_transport;_serializer;_responseHandler;_promiseQueue;_timeout;_diagLogger;constructor(e,n,r,i,o){this._transport=e,this._serializer=n,this._responseHandler=r,this._promiseQueue=i,this._timeout=o,this._diagLogger=jr.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,n){if(this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit()){n({code:Vp.FAILED,error:new Error("Concurrent export limit reached")});return}const r=this._serializer.serializeRequest(e);if(r==null){n({code:Vp.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(r,this._timeout).then(i=>{if(i.status==="success"){if(i.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(i.data))}catch(o){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",o,i.data)}n({code:Vp.SUCCESS});return}else if(i.status==="failure"&&i.error){n({code:Vp.FAILED,error:i.error});return}else i.status==="retryable"?n({code:Vp.FAILED,error:new qJ("Export failed with retryable status")}):n({code:Vp.FAILED,error:new qJ("Export failed with unknown error")})},i=>n({code:Vp.FAILED,error:i})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function rVe(t,e){return new nVe(t.transport,t.serializer,tVe(),t.promiseHandler,e.timeout)}function _pe(t,e,n){return rVe({transport:n,serializer:e,promiseHandler:K6e(t)},{timeout:t.timeoutMillis})}function LJ(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:t-55}function Ipe(t){const e=new Uint8Array(t.length/2);let n=0;for(let r=0;r<t.length;r+=2){const i=LJ(t.charCodeAt(r)),o=LJ(t.charCodeAt(r+1));e[n++]=i<<4|o}return e}function jpe(t){const e=BigInt(1e9);return BigInt(t[0])*e+BigInt(t[1])}function iVe(t){const e=Number(BigInt.asUintN(32,t)),n=Number(BigInt.asUintN(32,t>>BigInt(32)));return{low:e,high:n}}function oVe(t){const e=jpe(t);return iVe(e)}function sVe(t){return jpe(t).toString()}const aVe=typeof BigInt<"u"?sVe:G7e;function UJ(t){return t}function lVe(t){if(t!==void 0)return Ipe(t)}const cVe={encodeHrTime:oVe,encodeSpanContext:Ipe,encodeOptionalSpanContext:lVe};function uVe(t){return t===void 0?cVe:{encodeHrTime:aVe,encodeSpanContext:UJ,encodeOptionalSpanContext:UJ}}function dVe(t){return{attributes:lM(t.attributes),droppedAttributesCount:0}}function fVe(t){return{name:t.name,version:t.version}}function lM(t){return Object.keys(t).map(e=>Qpe(e,t[e]))}function Qpe(t,e){return{key:t,value:Dpe(e)}}function Dpe(t){const e=typeof t;return e==="string"?{stringValue:t}:e==="number"?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:e==="boolean"?{boolValue:t}:t instanceof Uint8Array?{bytesValue:t}:Array.isArray(t)?{arrayValue:{values:t.map(Dpe)}}:e==="object"&&t!=null?{kvlistValue:{values:Object.entries(t).map(([n,r])=>Qpe(n,r))}}:{}}function pVe(t,e){const n=t.spanContext(),r=t.status,i=t.parentSpanContext?.spanId?e.encodeSpanContext(t.parentSpanContext?.spanId):void 0;return{traceId:e.encodeSpanContext(n.traceId),spanId:e.encodeSpanContext(n.spanId),parentSpanId:i,traceState:n.traceState?.serialize(),name:t.name,kind:t.kind==null?0:t.kind+1,startTimeUnixNano:e.encodeHrTime(t.startTime),endTimeUnixNano:e.encodeHrTime(t.endTime),attributes:lM(t.attributes),droppedAttributesCount:t.droppedAttributesCount,events:t.events.map(o=>mVe(o,e)),droppedEventsCount:t.droppedEventsCount,status:{code:r.code,message:r.message},links:t.links.map(o=>hVe(o,e)),droppedLinksCount:t.droppedLinksCount}}function hVe(t,e){return{attributes:t.attributes?lM(t.attributes):[],spanId:e.encodeSpanContext(t.context.spanId),traceId:e.encodeSpanContext(t.context.traceId),traceState:t.context.traceState?.serialize(),droppedAttributesCount:t.droppedAttributesCount||0}}function mVe(t,e){return{attributes:t.attributes?lM(t.attributes):[],name:t.name,timeUnixNano:e.encodeHrTime(t.time),droppedAttributesCount:t.droppedAttributesCount||0}}function gVe(t,e){const n=uVe(e);return{resourceSpans:OVe(t,n)}}function yVe(t){const e=new Map;for(const n of t){let r=e.get(n.resource);r||(r=new Map,e.set(n.resource,r));const i=`${n.instrumentationScope.name}@${n.instrumentationScope.version||""}:${n.instrumentationScope.schemaUrl||""}`;let o=r.get(i);o||(o=[],r.set(i,o)),o.push(n)}return e}function OVe(t,e){const n=yVe(t),r=[],i=n.entries();let o=i.next();for(;!o.done;){const[s,a]=o.value,c=[],d=a.values();let p=d.next();for(;!p.done;){const O=p.value;if(O.length>0){const v=O.map(w=>pVe(w,e));c.push({scope:fVe(O[0].instrumentationScope),spans:v,schemaUrl:O[0].instrumentationScope.schemaUrl})}p=d.next()}const g={resource:dVe(s),scopeSpans:c,schemaUrl:void 0};r.push(g),o=i.next()}return r}const vVe={serializeRequest:t=>{const e=gVe(t,{});return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};const e=new TextDecoder;return JSON.parse(e.decode(t))}},bVe=5,xVe=1e3,SVe=5e3,wVe=1.5,VJ=.2;function CVe(){return Math.random()*(2*VJ)-VJ}class TVe{_transport;constructor(e){this._transport=e}retry(e,n,r){return new Promise((i,o)=>{setTimeout(()=>{this._transport.send(e,n).then(i,o)},r)})}async send(e,n){const r=Date.now()+n;let i=await this._transport.send(e,n),o=bVe,s=xVe;for(;i.status==="retryable"&&o>0;){o--;const a=Math.max(Math.min(s,SVe)+CVe(),0);s=s*wVe;const c=i.retryInMillis??a,d=r-Date.now();if(c>d)return i;i=await this.retry(e,d,c)}return i}shutdown(){return this._transport.shutdown()}}function Mpe(t){return new TVe(t.transport)}function EVe(t){return[429,502,503,504].includes(t)}function PVe(t){if(t==null)return;const e=Number.parseInt(t,10);if(Number.isInteger(e))return e>0?e*1e3:-1;const n=new Date(t).getTime()-Date.now();return n>=0?n:0}class AVe{_parameters;constructor(e){this._parameters=e}send(e,n){return new Promise(r=>{const i=new XMLHttpRequest;i.timeout=n,i.open("POST",this._parameters.url);const o=this._parameters.headers();Object.entries(o).forEach(([s,a])=>{i.setRequestHeader(s,a)}),i.ontimeout=s=>{r({status:"failure",error:new Error("XHR request timed out")})},i.onreadystatechange=()=>{i.status>=200&&i.status<=299?(jr.debug("XHR success"),r({status:"success"})):i.status&&EVe(i.status)?r({status:"retryable",retryInMillis:PVe(i.getResponseHeader("Retry-After"))}):i.status!==0&&r({status:"failure",error:new Error("XHR request failed with non-retryable status")})},i.onabort=()=>{r({status:"failure",error:new Error("XHR request aborted")})},i.onerror=()=>{r({status:"failure",error:new Error("XHR request errored")})},i.send(e)})}shutdown(){}}function $Ve(t){return new AVe(t)}class kVe{_params;constructor(e){this._params=e}send(e){return new Promise(n=>{navigator.sendBeacon(this._params.url,new Blob([e],{type:this._params.blobType}))?(jr.debug("SendBeacon success"),n({status:"success"})):n({status:"failure",error:new Error("SendBeacon failed")})})}shutdown(){}}function RVe(t){return new kVe(t)}function _Ve(t,e){return _pe(t,e,Mpe({transport:$Ve(t)}))}function IVe(t,e){return _pe(t,e,Mpe({transport:RVe({url:t.url,blobType:t.headers()["Content-Type"]})}))}function jVe(t){return()=>{const e={};return Object.entries(t?.()??{}).forEach(([n,r])=>{typeof r<"u"?e[n]=String(r):jr.warn(`Header "${n}" has invalid value (${r}) and will be ignored`)}),e}}function QVe(t,e,n){const r={...n()},i={};return()=>(e!=null&&Object.assign(i,e()),t!=null&&Object.assign(i,t()),Object.assign(i,r))}function DVe(t){if(t!=null)try{return new URL(t),t}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${t}'`)}}function MVe(t,e,n){return{...F6e(t,e,n),headers:QVe(jVe(t.headers),e.headers,n.headers),url:DVe(t.url)??e.url??n.url,agentOptions:t.agentOptions??e.agentOptions??n.agentOptions}}function NVe(t,e){return{...H6e(),headers:()=>t,url:"http://localhost:4318/"+e,agentOptions:{keepAlive:!0}}}function zVe(t,e,n){return MVe({url:t.url,timeoutMillis:t.timeoutMillis,headers:W6e(t.headers),concurrencyLimit:t.concurrencyLimit},{},NVe(n,e))}function qVe(t,e,n,r){const i=!!t.headers||typeof navigator.sendBeacon!="function",o=zVe(t,n,r);return i?_Ve(o,e):IVe(o,e)}class LVe extends Y6e{constructor(e={}){super(qVe(e,vVe,"v1/traces",{"Content-Type":"application/json"}))}}const UVe="service.name",VVe="service.version";let Npe=class{emit(e){}};const BVe=new Npe;class XVe{getLogger(e,n,r){return new Npe}}const zpe=new XVe;class ZVe{constructor(e,n,r,i){this._provider=e,this.name=n,this.version=r,this.options=i}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;const e=this._provider.getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):BVe}}class BJ{getLogger(e,n,r){var i;return(i=this.getDelegateLogger(e,n,r))!==null&&i!==void 0?i:new ZVe(this,e,n,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:zpe}setDelegate(e){this._delegate=e}getDelegateLogger(e,n,r){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,n,r)}}const YVe=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},J_=Symbol.for("io.opentelemetry.js.api.logs"),iP=YVe;function GVe(t,e,n){return r=>r===t?e:n}const XJ=1;class CV{constructor(){this._proxyLoggerProvider=new BJ}static getInstance(){return this._instance||(this._instance=new CV),this._instance}setGlobalLoggerProvider(e){return iP[J_]?this.getLoggerProvider():(iP[J_]=GVe(XJ,e,zpe),this._proxyLoggerProvider.setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=iP[J_])===null||e===void 0?void 0:e.call(iP,XJ))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete iP[J_],this._proxyLoggerProvider=new BJ}}const qpe=CV.getInstance();function WVe(t,e,n,r){for(let i=0,o=t.length;i<o;i++){const s=t[i];e&&s.setTracerProvider(e),n&&s.setMeterProvider(n),r&&s.setLoggerProvider&&s.setLoggerProvider(r),s.getConfig().enabled||s.enable()}}function FVe(t){t.forEach(e=>e.disable())}function HVe(t){const e=t.tracerProvider||vc.getTracerProvider(),n=t.meterProvider||mpe.getMeterProvider(),r=t.loggerProvider||qpe.getLoggerProvider(),i=t.instrumentations?.flat()??[];return WVe(i,e,n,r),()=>{FVe(i)}}let Tu=console.error.bind(console);function oP(t,e,n){const r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}const Lpe=(t,e,n)=>{if(!t||!t[e]){Tu("no original function "+String(e)+" to wrap");return}if(!n){Tu("no wrapper function"),Tu(new Error().stack);return}const r=t[e];if(typeof r!="function"||typeof n!="function"){Tu("original object and wrapper must be functions");return}const i=n(r,e);return oP(i,"__original",r),oP(i,"__unwrap",()=>{t[e]===i&&oP(t,e,r)}),oP(i,"__wrapped",!0),oP(t,e,i),i},JVe=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{Tu("must provide one or more modules to patch"),Tu(new Error().stack);return}if(!(e&&Array.isArray(e))){Tu("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(i=>{Lpe(r,i,n)})})},Upe=(t,e)=>{if(!t||!t[e]){Tu("no function to unwrap."),Tu(new Error().stack);return}const n=t[e];if(!n.__unwrap)Tu("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}},KVe=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{Tu("must provide one or more modules to patch"),Tu(new Error().stack);return}if(!(e&&Array.isArray(e))){Tu("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{Upe(n,r)})})};class e8e{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=jr.createComponentLogger({namespace:e}),this._tracer=vc.getTracer(e,n),this._meter=mpe.getMeter(e,n),this._logger=qpe.getLogger(e,n),this._updateMetricInstruments()}_wrap=Lpe;_unwrap=Upe;_massWrap=JVe;_massUnwrap=KVe;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){const e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,n,r,i){if(e)try{e(r,i)}catch(o){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},o)}}}class t8e extends e8e{constructor(e,n,r){super(e,n,r),this._config.enabled&&this.enable()}}class n8e{span=void 0;constructor(e){this.span=e}get context(){return this.span?.context}error(e){this.span&&(this.span.setStatus(exports.SpanStatusCode.ERROR,e.message),this.span.recordException(e),this.span.end())}setAttribute(e,n){this.span&&this.span.setAttribute(e,n)}setStatus(e,n){this.span&&this.span.setStatus(e,n)}end(){this.span&&(this.span.setStatus(exports.SpanStatusCode.OK),this.span.end())}}const wS=t=>t.replace(/([A-Z])/g,"_$1").toLowerCase(),ZJ=t=>t.reduce((e,n)=>{if(!n||typeof n!="object")return e;const r=n.object;if(!r||typeof r!="string")return e;const i=e.notUpdated.find(({object:o})=>o===r);return i?(e.updated=[i,n],e.notUpdated=e.notUpdated.filter(({object:o})=>o!==r)):e.updated.some(({object:o})=>o===r)||e.notUpdated.push(n),e},{updated:[],notUpdated:[]}),K_=(t,e,n,r=!0)=>{for(const[i,o]of Object.entries(t))if(o!==void 0){const s=r?wS(i):i;n[`${e}${s}`]=o}},r8e=(t,e,n)=>{for(const[r,i]of Object.entries(t))i==null||typeof i=="object"||(n[`${e}.${wS(r)}`]=i)};class i8e{config=null;tracer=null;tracerProvider=null;initialized=!1;initTracer(e){throw new Error("initTracer must be implemented by the environment-specific client")}init(e){this.config=e,this.initTracer(e)}send(e){try{if(!this.tracer||!this.config)return;const n=e,r="time"in n&&n.time?new Date(n.time):new Date;this.tracer.startSpan(`event.${n.type}`,{attributes:this.processAttributes(n,r),startTime:r}).end(r)}catch(n){this.config?.isProd||console.error("Event reporting failed:",n)}}processAttributes(e,n){const r=e.data,i={...this.buildBaseAttributes(e,n),...this.extractFieldAttributes("project",e),...this.extractFieldAttributes("organization",e)};return this.processEventData(r,i),this.processSubjects(e,i),this.processExtensionAttributes(e,i),i}buildBaseAttributes(e,n){return{"cloudevents.event_id":ZQ(),"cloudevents.event_type":e.type,"cloudevents.event_source":e.source||void 0,"cloudevents.event_spec_version":e.specversion,"cloudevents.event_data_content_type":e.datacontenttype||"application/json; charset=utf-8","cloudevents.event_time":n.toISOString(),"cloudevents.event_subject":("subject"in e?e.subject:void 0)||"","cloudevents.page.uri":typeof location<"u"?location.href:void 0,"cloudevents.event_version":this.config?.version,"cloudevents.event_origin":this.config?.serviceName,"cloudevents.event_source_details.id":e.sourceDetails?.id||"anonymous","cloudevents.event_source_details.object":e.sourceDetails?.object||"anonymous","cloudevents.event_source_details.uri":e.sourceDetails?.uri||void 0,"cloudevents.metadata.user_id":("analyticsMetadata"in e?e.analyticsMetadata?.userId:void 0)||void 0,"cloudevents.metadata.user_ip_address":("analyticsMetadata"in e?e.analyticsMetadata?.userIpAddress:void 0)||void 0}}processEventData(e,n){!e||typeof e!="object"||(Array.isArray(e)?this.processArrayData(e,n):this.processObjectData(e,n))}processArrayData(e,n){e.some(i=>i&&typeof i=="object"&&typeof i.object=="string")?this.processEventBusStyleData(e,n):this.processSimpleArrayData(e,n)}processEventBusStyleData(e,n){const r=ZJ(e);r.updated.forEach((i,o)=>{const s=`cloudevents.event_data.${o===0?"after.":"before."}${i.object}.`;K_(i,s,n)}),r.notUpdated.forEach(i=>{const o=`cloudevents.event_data.${i.object}.`;K_(i,o,n)})}processSimpleArrayData(e,n){for(const r of e)if(!(!r||typeof r!="object"))for(const[i,o]of Object.entries(r)){if(o===void 0)continue;const s=wS(i);o!==null&&typeof o=="object"&&!Array.isArray(o)?r8e(o,`cloudevents.event_data.${s}`,n):n[`cloudevents.event_data.${s}`]=o}}processObjectData(e,n){for(const[r,i]of Object.entries(e)){if(i===void 0)continue;const o=wS(r);if(typeof i=="object"&&i!==null&&!Array.isArray(i))for(const[s,a]of Object.entries(i))a!==void 0&&(n[`cloudevents.event_data.${o}.${s}`]=a);else n[`cloudevents.event_data.${o}`]=i}}processSubjects(e,n){if(!("subjects"in e)||!Array.isArray(e.subjects))return;const r=ZJ(e.subjects);r.updated.forEach((i,o)=>{const s=`cloudevents.subjects.${o===0?"after.":"before."}${i.object}.`;K_(i,s,n,!1)}),r.notUpdated.forEach(i=>{const o=`cloudevents.subjects.${i.object}.`;K_(i,o,n,!1)})}processExtensionAttributes(e,n){const r=["id","source","type","specversion","time","datacontenttype","data","subject","sourceDetails","analyticsMetadata","context"];for(const[i,o]of Object.entries(e))if(!(r.includes(i)||o===void 0))if(o instanceof Object)for(const[s,a]of Object.entries(o))a!==void 0&&(n[`cloudevents.${i}.${s}`]=a);else n[`cloudevents.${i}`]=o}extractFieldAttributes(e,n){const r=n,i=`${e}Id`,o=`${e}Slug`;if(i in r&&o in r)return{[`cloudevents.${e}.id`]:r[i],[`cloudevents.${e}.slug`]:r[o]};const s=r.data;if(Array.isArray(s)&&s.length){const a=s.find(c=>c?.object===e);if(a)return{[`cloudevents.${e}.id`]:a.id,[`cloudevents.${e}.slug`]:a.slug}}return{}}startSpan(e,n){try{if(!this.tracer)return;let r;const i=e.time?new Date(e.time):new Date,o=this.tracer.startSpan(`event.${e.type}`,{attributes:this.processAttributes(e,i),root:!n},n);return n||(r=vc.setSpan(Zm.active(),o)),{end:()=>o.end(),setAttribute:(s,a)=>{o.setAttribute(`cloudevents.event_data.${wS(s)}`,a)},setStatus:(s,a)=>o.setStatus({code:s,message:a}),parentCtx:r}}catch(r){this.config?.isProd||console.error("Event reporting failed:",r);return}}startStepSpan(e){try{if(!this.tracer)return;const n=Zm.active(),r=e,i=r.time?new Date(r.time):new Date,o=this.tracer.startSpan(`event.${r.type}`,{attributes:this.processAttributes(r,i)},n),s=vc.setSpan(n,o);return{end:()=>o.end(),setAttribute:(a,c)=>{o.setAttribute(`cloudevents.event_data.${wS(a)}`,c)},setStatus:(a,c)=>o.setStatus({code:a,message:c}),recordException:a=>o.recordException(a),context:s}}catch(n){this.config?.isProd||console.error("Event reporting failed:",n);return}}traceStep(e){const n=this.startStepSpan(e);if(n)return new n8e(n)}async forceFlush(){return this.tracerProvider?.forceFlush()}async shutdown(){return this.tracerProvider?.shutdown()}}class o8e extends i8e{tracer=null;initialized=!1;constructor(){super()}initTracer(e){if(!e.collectorUrl&&!e.collectorTraceUrl)return;const n=`ses_${ZQ()}`,r=$pe({[UVe]:e.serviceName,[VVe]:e.serviceVersion,session_id:n}),i=e.collectorTraceUrl||`${e.collectorUrl}/v1/traces`;this.tracerProvider=new Z6e({resource:r,spanProcessors:[new D6e(new LVe({url:i,headers:{}}))]}),this.tracer=this.tracerProvider.getTracer(e.tracerName),this.tracerProvider.register(),HVe({instrumentations:e.instrumentations??[]}),this.initialized=!0}}class rO extends t8e{sendErrorEvent;originalConsoleError;constructor(e,n){super("errors","1.0",e||{}),this.sendErrorEvent=n}static toErrorEvent(e,n){return{type:"error",payload:[{handler:n,errorType:rO.getErrorType(e),message:rO.getErrorMessage(e),stack:rO.getErrorStack(e)}]}}enable(){window.addEventListener("error",this.onError),window.addEventListener("unhandledrejection",this.onUnhandledRejection),this.wrapConsoleError()}disable(){window.removeEventListener("error",this.onError),window.removeEventListener("unhandledrejection",this.onUnhandledRejection),this.unwrapConsoleError()}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>4096?n.substring(0,4096):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,o)=>o!==n).map(i=>String(i)).join(" ");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")};wrapConsoleError(){this.originalConsoleError=console.error,console.error=(...e)=>{try{const n=rO.combineConsoleErrorArgs(e);this.sendError(n,"console.error")}catch(n){process.env.NODE_ENV!=="production"&&this.originalConsoleError?.call(console,"Error reporting failed:",n)}this.originalConsoleError?.apply(console,e)}}unwrapConsoleError(){this.originalConsoleError&&(console.error=this.originalConsoleError,this.originalConsoleError=void 0)}sendError(e,n){this.sendErrorEvent(rO.toErrorEvent(e,n))}}class s8e{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>{},this.otelClient=new o8e,this.tracer={traceStep:(e,n)=>{const r=this.constructCloudEvent(e,n);return this.otelClient.traceStep(r)}}}updateCloudEventData=e=>{this.config?.disabled||(this.useCloudEventData=e)};send(e,n){try{if(!this.config?.otel.isProd)return;const i=e&&typeof e=="object"&&"type"in e&&"data"in e?e:this.constructCloudEvent(e,n);this.sendToOtelService(i)}catch(r){this.config?.otel.isProd||console.error("Event reporting failed:",r)}}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,instrumentations:[...e.otel.enableErrorInstrumentation===!0?[new rO(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);return this.otelClient.startSpan(i,r)}constructCloudEvent(e,n){const r=this.useCloudEventData();return dUe({type:e,additionalData:r,data:n})}sendToOtelService(e){this.config?.otel.isProd||console.log("CloudEvent to be sent to OTEL service:",e),this.otelClient.send(e)}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=rO.toErrorEvent(e,n);this.sendToOtelService({type:r.type,data:r.payload})}sendTabChangeMessage(e){this.send("tab.change",e)}sendButtonClickMessage(e){this.send("button.click",e)}sendTabOpenFailedMessage(e){this.send("tab.open_failed",e)}sendChangeMessage(e){this.send("change",e)}sendContentCopyMessage(e){this.send("content.copy",e)}sendRequestSendMessage(e){this.send("request.send",e)}sendTokenGenerateMessage(e){this.send("token.generate",e)}sendAppLifecycleMessage(e){this.send("app.lifecycle",e)}sendEnvironmentManagementMessage(e){this.send("environment.management",e)}sendServerManagementMessage(e){this.send("server.management",e)}sendInputManagementMessage(e){this.send("input.management",e)}sendNodeManagementMessage(e){this.send("node.management",e)}sendHistoryManagementMessage(e){this.send("history.management",e)}sendHistoryMigrationMessage(e){this.send("history.migration",e)}sendCredentialManagementMessage(e){this.send("credential.management",e)}sendPanelToggleMessage(e){this.send("panel.toggle",e)}sendWorkflowRunClickMessage(e){this.send("workflow.run.click",e)}sendWorkflowRunResultMessage(e){this.send("workflow.run.result",e)}sendStorageReadMessage(){this.send("storage.read")}sendStorageLoadUserStateMessage(){this.send("storage.loadUserState")}sendStorageDetectFilesMessage(){this.send("storage.detectFiles")}sendStorageLoadApisMessage(){this.send("storage.loadApis")}sendStorageParseApisMessage(){this.send("storage.parseApis")}sendStorageParseCollectionsMessage(){this.send("storage.parseCollections")}sendUpdaterCheckMessage(){this.send("updater.check")}sendUpdaterDownloadMessage(){this.send("updater.download")}sendUpdaterInstallMessage(){this.send("updater.install")}sendUpdaterProcessMessage(){this.send("updater.process")}sendErrorMessage(e){this.send("error",e)}sendCodeEditorSearchMessage(e){this.send("code_editor.search",e)}}const cM=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],a8e="https://cors.redocly.com/";function l8e(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function YJ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function GJ(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?YJ(Object(n),!0).forEach(function(r){l8e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):YJ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function xa(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var WJ=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),xz=function(){return Math.random().toString(36).substring(7).split("").join(".")},yO={INIT:"@@redux/INIT"+xz(),REPLACE:"@@redux/REPLACE"+xz(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+xz()}};function Vpe(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function c8e(t){if(t===void 0)return"undefined";if(t===null)return"null";var e=typeof t;switch(e){case"boolean":case"string":case"number":case"symbol":case"function":return e}if(Array.isArray(t))return"array";if(f8e(t))return"date";if(d8e(t))return"error";var n=u8e(t);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return e.slice(8,-1).toLowerCase().replace(/\s/g,"")}function u8e(t){return typeof t.constructor=="function"?t.constructor.name:null}function d8e(t){return t instanceof Error||typeof t.message=="string"&&t.constructor&&typeof t.constructor.stackTraceLimit=="number"}function f8e(t){return t instanceof Date?!0:typeof t.toDateString=="function"&&typeof t.getDate=="function"&&typeof t.setDate=="function"}function Fy(t){var e=typeof t;return process.env.NODE_ENV!=="production"&&(e=c8e(t)),e}function uM(t,e,n){var r;if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?xa(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(process.env.NODE_ENV==="production"?xa(1):"Expected the enhancer to be a function. Instead, received: '"+Fy(n)+"'");return n(uM)(t,e)}if(typeof t!="function")throw new Error(process.env.NODE_ENV==="production"?xa(2):"Expected the root reducer to be a function. Instead, received: '"+Fy(t)+"'");var i=t,o=e,s=[],a=s,c=!1;function d(){a===s&&(a=s.slice())}function p(){if(c)throw new Error(process.env.NODE_ENV==="production"?xa(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return o}function g(S){if(typeof S!="function")throw new Error(process.env.NODE_ENV==="production"?xa(4):"Expected the listener to be a function. Instead, received: '"+Fy(S)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?xa(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var C=!0;return d(),a.push(S),function(){if(C){if(c)throw new Error(process.env.NODE_ENV==="production"?xa(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");C=!1,d();var E=a.indexOf(S);a.splice(E,1),s=null}}}function O(S){if(!Vpe(S))throw new Error(process.env.NODE_ENV==="production"?xa(7):"Actions must be plain objects. Instead, the actual type was: '"+Fy(S)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof S.type>"u")throw new Error(process.env.NODE_ENV==="production"?xa(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error(process.env.NODE_ENV==="production"?xa(9):"Reducers may not dispatch actions.");try{c=!0,o=i(o,S)}finally{c=!1}for(var C=s=a,T=0;T<C.length;T++){var E=C[T];E()}return S}function v(S){if(typeof S!="function")throw new Error(process.env.NODE_ENV==="production"?xa(10):"Expected the nextReducer to be a function. Instead, received: '"+Fy(S));i=S,O({type:yO.REPLACE})}function w(){var S,C=g;return S={subscribe:function(E){if(typeof E!="object"||E===null)throw new Error(process.env.NODE_ENV==="production"?xa(11):"Expected the observer to be an object. Instead, received: '"+Fy(E)+"'");function $(){E.next&&E.next(p())}$();var _=C($);return{unsubscribe:_}}},S[WJ]=function(){return this},S}return O({type:yO.INIT}),r={dispatch:O,subscribe:g,getState:p,replaceReducer:v},r[WJ]=w,r}var p8e=uM;function b9(t){typeof console<"u"&&typeof console.error=="function"&&console.error(t);try{throw new Error(t)}catch{}}function h8e(t,e,n,r){var i=Object.keys(e),o=n&&n.type===yO.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(i.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!Vpe(t))return"The "+o+' has unexpected type of "'+Fy(t)+'". Expected argument to be an object with the following '+('keys: "'+i.join('", "')+'"');var s=Object.keys(t).filter(function(a){return!e.hasOwnProperty(a)&&!r[a]});if(s.forEach(function(a){r[a]=!0}),!(n&&n.type===yO.REPLACE)&&s.length>0)return"Unexpected "+(s.length>1?"keys":"key")+" "+('"'+s.join('", "')+'" found in '+o+". ")+"Expected to find one of the known reducer keys instead: "+('"'+i.join('", "')+'". Unexpected keys will be ignored.')}function m8e(t){Object.keys(t).forEach(function(e){var n=t[e],r=n(void 0,{type:yO.INIT});if(typeof r>"u")throw new Error(process.env.NODE_ENV==="production"?xa(12):'The slice reducer for key "'+e+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof n(void 0,{type:yO.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?xa(13):'The slice reducer for key "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle '"+yO.INIT+`' or other actions in "redux/*" `)+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}function g8e(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++){var i=e[r];process.env.NODE_ENV!=="production"&&typeof t[i]>"u"&&b9('No reducer provided for key "'+i+'"'),typeof t[i]=="function"&&(n[i]=t[i])}var o=Object.keys(n),s;process.env.NODE_ENV!=="production"&&(s={});var a;try{m8e(n)}catch(c){a=c}return function(d,p){if(d===void 0&&(d={}),a)throw a;if(process.env.NODE_ENV!=="production"){var g=h8e(d,n,p,s);g&&b9(g)}for(var O=!1,v={},w=0;w<o.length;w++){var S=o[w],C=n[S],T=d[S],E=C(T,p);if(typeof E>"u"){var $=p&&p.type;throw new Error(process.env.NODE_ENV==="production"?xa(14):"When called with an action of type "+($?'"'+String($)+'"':"(unknown type)")+', the slice reducer for key "'+S+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.')}v[S]=E,O=O||E!==T}return O=O||o.length!==Object.keys(d).length,O?v:d}}function FJ(t,e){return function(){return e(t.apply(this,arguments))}}function y8e(t,e){if(typeof t=="function")return FJ(t,e);if(typeof t!="object"||t===null)throw new Error(process.env.NODE_ENV==="production"?xa(16):"bindActionCreators expected an object or a function, but instead received: '"+Fy(t)+`'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?`);var n={};for(var r in t){var i=t[r];typeof i=="function"&&(n[r]=FJ(i,e))}return n}function Bpe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.length===0?function(r){return r}:e.length===1?e[0]:e.reduce(function(r,i){return function(){return r(i.apply(void 0,arguments))}})}function O8e(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(r){return function(){var i=r.apply(void 0,arguments),o=function(){throw new Error(process.env.NODE_ENV==="production"?xa(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},s={getState:i.getState,dispatch:function(){return o.apply(void 0,arguments)}},a=e.map(function(c){return c(s)});return o=Bpe.apply(void 0,a)(i.dispatch),GJ(GJ({},i),{},{dispatch:o})}}}function HJ(){}process.env.NODE_ENV!=="production"&&typeof HJ.name=="string"&&HJ.name!=="isCrushed"&&b9('You are currently using minified code outside of NODE_ENV === "production". This means that you are running a slower development build of Redux. You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) to ensure you have the correct code for your production build.');var v8e=Object.freeze({__proto__:null,__DO_NOT_USE__ActionTypes:yO,applyMiddleware:O8e,bindActionCreators:y8e,combineReducers:g8e,compose:Bpe,createStore:uM,legacy_createStore:p8e});function b8e(t){var e=t.default;if(typeof e=="function"){var n=function(){return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var x8e=b8e(v8e);x8e.compose;var S8e=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(t){return t}};function w8e(t,e,n){var r=!1,i=!1,o=uM(function(a,c){if(!i){var d=function(C){return Array.isArray(C)&&C.findIndex(function(T){return typeof T!="string"&&typeof T!="number"})===-1};if(c.type.startsWith("SET")){var p=function(C){try{r=!0,"value"in c?C.set(c.value):C.set(An)}finally{r=!1}};if(c.path){if(d(c.path)){c.path.length===0&&p(t);for(var g=t,O=!0,v=0,w=c.path;v<w.length;v++){var S=w[v];g[S]?g=g[S]:O=!1}O&&p(g)}}else p(t)}else c.type==="BREAKPOINT"&&n()}return t.promised||t.error?An:t.get({noproxy:!0})},S8e({name:"".concat(window.location.hostname,": ").concat(e),trace:!0,traceLimit:16,autoPause:!0,shouldHotReload:!1,features:{persist:!0,pause:!0,lock:!1,export:"custom",import:"custom",jump:!1,skip:!1,reorder:!1,dispatch:!0,test:!1}})),s=function(a,c){if(r)c&&c();else try{i=!0,o.dispatch(a)}finally{i=!1}};return s}function C8e(t){return function(){var e,n,r=!1;return{onInit:function(i,o){if(!(typeof window>"u"||!("__REDUX_DEVTOOLS_EXTENSION__"in window))){if(t?.key===void 0){if(o.identifier===void 0)throw Error("State is missing Identifiable extension or Devtools key option");e=o.identifier(i)}else e=t.key;n=w8e(i,e,function(){r=!r}),i.promise||n?.({type:"CREATE",state:i.get({noproxy:!0,stealth:!0})})}},onSet:function(i,o){if(n?.({type:"SET [".concat(i.path.join("/"),"]"),state:i.get({noproxy:!0,stealth:!0}),descriptor:o}),r)debugger},onDestroy:function(){n?.({type:"DESTROY"})}}}}var Er=(t=>(t.Normal="Normal",t.Edit="Edit",t.Draft="Draft",t))(Er||{});const Q$="default",Xpe=[{name:Q$,inputs:[],servers:[],state:Er.Normal}],Zpe={activeTabIdx:0,tabs:[]};var Lp=(t=>(t.Idle="idle",t.Loading="loading",t.Success="success",t.Error="error",t))(Lp||{});function Ym(t){const e=new WeakMap;function n(r){if(typeof r!="object"||r===null)return r;if(e.has(r))return e.get(r);const i=Array.isArray(r)?[]:{};e.set(r,i);for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&(i[o]=n(r[o]));return i}return n(t)}function x9(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!x9(t[i],e[i]))return!1;return!0}const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++){const o=n[i];if(!Object.prototype.hasOwnProperty.call(e,o)||!x9(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function JJ(t){return Object.keys(t).forEach(e=>{t[e]===void 0&&delete t[e]}),t}function T8e(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function ul(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}function Xs(){return!!window?.__TAURI__}async function KJ(t,e,n){const r=[],i=[];for(const o of t){const s=Promise.resolve().then(()=>n(o,t));if(r.push(s),e<=t.length){const a=s.then(()=>i.splice(i.indexOf(a),1));i.push(a),i.length>=e&&await Promise.race(i)}}return Promise.all(r)}const Zl={FS:"fs",WEB:"web"};async function hh(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}var S9;(function(t){t[t.Audio=1]="Audio",t[t.Cache=2]="Cache",t[t.Config=3]="Config",t[t.Data=4]="Data",t[t.LocalData=5]="LocalData",t[t.Document=6]="Document",t[t.Download=7]="Download",t[t.Picture=8]="Picture",t[t.Public=9]="Public",t[t.Video=10]="Video",t[t.Resource=11]="Resource",t[t.Temp=12]="Temp",t[t.AppConfig=13]="AppConfig",t[t.AppData=14]="AppData",t[t.AppLocalData=15]="AppLocalData",t[t.AppCache=16]="AppCache",t[t.AppLog=17]="AppLog",t[t.Desktop=18]="Desktop",t[t.Executable=19]="Executable",t[t.Font=20]="Font",t[t.Home=21]="Home",t[t.Runtime=22]="Runtime",t[t.Template=23]="Template"})(S9||(S9={}));var w9;(function(t){t[t.Start=0]="Start",t[t.Current=1]="Current",t[t.End=2]="End"})(w9||(w9={}));async function C9(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await hh("plugin:fs|mkdir",{path:t instanceof URL?t.toString():t,options:e})}async function TV(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await hh("plugin:fs|read_dir",{path:t instanceof URL?t.toString():t,options:e})}async function Ype(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await hh("plugin:fs|read_file",{path:t instanceof URL?t.toString():t,options:e});return n instanceof ArrayBuffer?new Uint8Array(n):Uint8Array.from(n)}async function dM(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await hh("plugin:fs|read_text_file",{path:t instanceof URL?t.toString():t,options:e})}async function Gpe(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await hh("plugin:fs|remove",{path:t instanceof URL?t.toString():t,options:e})}async function Wpe(t,e,n){if(t instanceof URL&&t.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await hh("plugin:fs|rename",{oldPath:t instanceof URL?t.toString():t,newPath:e instanceof URL?e.toString():e,options:n})}async function E8e(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await hh("plugin:fs|write_file",e,{headers:{path:t instanceof URL?t.toString():t,options:JSON.stringify(n)}})}async function Fpe(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await hh("plugin:fs|write_text_file",{path:t instanceof URL?t.toString():t,data:e,options:n})}async function fM(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await hh("plugin:fs|exists",{path:t instanceof URL?t.toString():t,options:e})}const EV=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return S9},get SeekMode(){return w9},exists:fM,mkdir:C9,readDir:TV,readFile:Ype,readTextFile:dM,remove:Gpe,rename:Wpe,writeFile:E8e,writeTextFile:Fpe},Symbol.toStringTag,{value:"Module"}));var zA;(function(t){t[t.Audio=1]="Audio",t[t.Cache=2]="Cache",t[t.Config=3]="Config",t[t.Data=4]="Data",t[t.LocalData=5]="LocalData",t[t.Document=6]="Document",t[t.Download=7]="Download",t[t.Picture=8]="Picture",t[t.Public=9]="Public",t[t.Video=10]="Video",t[t.Resource=11]="Resource",t[t.Temp=12]="Temp",t[t.AppConfig=13]="AppConfig",t[t.AppData=14]="AppData",t[t.AppLocalData=15]="AppLocalData",t[t.AppCache=16]="AppCache",t[t.AppLog=17]="AppLog",t[t.Desktop=18]="Desktop",t[t.Executable=19]="Executable",t[t.Font=20]="Font",t[t.Home=21]="Home",t[t.Runtime=22]="Runtime",t[t.Template=23]="Template"})(zA||(zA={}));async function Hpe(){return ul("plugin:path|resolve_directory",{directory:zA.AppData})}async function Jpe(){return ul("plugin:path|resolve_directory",{directory:zA.Desktop})}function PV(){return window.__TAURI_INTERNALS__.plugins.path.sep}async function Kpe(...t){return ul("plugin:path|resolve",{paths:t})}async function MS(...t){return ul("plugin:path|join",{paths:t})}async function ehe(t){return ul("plugin:path|dirname",{path:t})}async function the(t){return ul("plugin:path|extname",{path:t})}async function AV(t,e){return ul("plugin:path|basename",{path:t,ext:e})}async function nhe(t){return ul("plugin:path|is_absolute",{path:t})}const rhe=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return zA},appDataDir:Hpe,basename:AV,desktopDir:Jpe,dirname:ehe,extname:the,isAbsolute:nhe,join:MS,resolve:Kpe,sep:PV},Symbol.toStringTag,{value:"Module"}));class Fr{static utils=null;static async getUtils(){return Fr.utils||(Fr.utils=Xs()?await Promise.resolve().then(()=>require("./replay-tauri-path-BZnc0Dw-.js")):await Promise.resolve().then(()=>jTe)),Fr.utils}static async dirname(e){return(await Fr.getUtils()).dirname(e)}static async join(...e){return(await Fr.getUtils()).join(...e)}static async resolve(e){return(await Fr.getUtils()).resolve(e)}static async isAbsolute(e){return(await Fr.getUtils()).isAbsolute(e)}static async relative(e,n){return(await Fr.getUtils()).relative(e,n)}static async extname(e){return(await Fr.getUtils()).extname(e)}}const P8e=new Set(["node_modules"]);class T9{constructor(e){this.baseDir=e,this.initializeDirectory(e)}writeExcludedKeys=new Set;listeners=new Map;writeEndTimers=new Map;on(e,n){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e)?.add(n)}off(e,n){this.listeners.get(e)?.delete(n)}emit(e,n){this.listeners.get(e)?.forEach(r=>r(n))}async initializeDirectory(e){await C9(e,{recursive:!0})}setWriteExcludedKeys(e){this.writeExcludedKeys=e}async ls(e){const n=await this.getFullPath(e);return this.getDirEntryFilesRecursively(n)}async getDirEntryFilesRecursively(e){try{const n=[],r=await TV(e);for(const i of r)if(i.isDirectory){if(P8e.has(i.name))continue;const o=await MS(e,i.name),s=await this.getDirEntryFilesRecursively(o);n.push(...s)}else{const o=await MS(e,i.name),s=await Fr.relative(this.baseDir,o);n.push(s)}return n}catch(n){return n.includes("forbidden path")||console.error(n),[]}}async get(e){const n=await this.getFullPath(e);try{return await dM(n)}catch(r){return!r.includes("No such file or directory")&&!r.includes("forbidden path")&&console.error(r),null}}async has(e){const n=await this.getFullPath(e);return await fM(n)}async set(e,n){if(!this.writeExcludedKeys.has(e)){this.emit("write-start",e);try{const r=await this.getFullPath(e),i=PV(),o=r.split(i).slice(0,-1).join(i);await C9(o,{recursive:!0}),await Fpe(r,n)}finally{const r=this.writeEndTimers.get(e);r&&clearTimeout(r);const i=setTimeout(()=>{this.emit("write-end",e),this.writeEndTimers.delete(e)},1e3);this.writeEndTimers.set(e,i)}}}async remove(e){if(!this.writeExcludedKeys.has(e)){this.emit("write-start",e);try{const n=await this.getFullPath(e);await Gpe(n)}catch(n){!n.includes("No such file or directory")&&!n.includes("forbidden path")&&console.error(n)}finally{const n=this.writeEndTimers.get(e);n&&clearTimeout(n);const r=setTimeout(()=>{this.emit("write-end",e),this.writeEndTimers.delete(e)},1e3);this.writeEndTimers.set(e,r)}}}async rename(e,n){const r=await this.getFullPath(e),i=await this.getFullPath(n);await Wpe(r,i)}async getFullPath(e){return await MS(this.baseDir,e??"")}}class A8e{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 $8e{constructor(e){this.projectId=e}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 ihe{constructor(e){this.storage=e}itemIds=[];async getAbsolutePath(e){return await Fr.resolve(await Fr.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(o){return console.error(`Error parsing from ${i.type} ${i.uri}:`,o),null}}))).filter(i=>i!==null)}setItemIds(e){this.itemIds=e}async write(e){e.state===Er.Draft||e.srcType!==Zl.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 o in r){const s=parseInt(o);switch(r[o]){case"D":await this.remove(this.itemIds[s]);break;case"I":case"U":await this.write(n[s]);break}}return}const i=this.itemIds.filter(o=>!n.some(s=>s.id===o));await Promise.all([...n.map(o=>this.write(o)),...i.map(o=>this.remove(o))])}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 o=i.path[0];i.path.length===1&&i.actions&&i.actions.id==="U"&&await this.remove(this.itemIds[o]),i.path[1]&&i.path[1]==="id"&&await this.remove(this.itemIds[o]),await this.write(n[o])}this.itemIds=n.map(o=>o.id)}}class k8e extends ihe{parse(e){return{...e.content,id:e.uri,srcType:e.type,fileDependencies:e.fileDependencies}}async stringify(e){const{id:n,srcType:r,fileDependencies:i,...o}=e;return await Fr.extname(n)===".json"?JSON.stringify(o,null,2):eg.dump(o)}async write(e){await this.storage.has(e.id)||await super.write(e)}}var ol=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(ol||{});const ohe=1024;let R8e=0,$d=class{constructor(e,n){this.from=e,this.to=n}};class Bn{constructor(e={}){this.id=R8e++,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=dl.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Bn.closedBy=new Bn({deserialize:t=>t.split(" ")});Bn.openedBy=new Bn({deserialize:t=>t.split(" ")});Bn.group=new Bn({deserialize:t=>t.split(" ")});Bn.isolate=new Bn({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Bn.contextHash=new Bn({perNode:!0});Bn.lookAhead=new Bn({perNode:!0});Bn.mounted=new Bn({perNode:!0});class qA{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[Bn.mounted.id]}}const _8e=Object.create(null);class dl{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):_8e,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new dl(e.name||"",n,e.id,r);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(i)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[o[0].id]=o[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(Bn.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(Bn.group),o=-1;o<(i?i.length:0);o++){let s=n[o<0?r.name:i[o]];if(s)return s}}}}dl.none=new dl("",Object.create(null),0,8);class pM{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 o of e){let s=o(r);s&&(i||(i=Object.assign({},r.props)),i[s[0].id]=s[1])}n.push(i?new dl(r.name,i,r.id,r.flags):r)}return new pM(n)}}const eI=new WeakMap,eK=new WeakMap;var wi;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(wi||(wi={}));let Ti=class E9{constructor(e,n,r,i,o){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,o&&o.length){this.props=Object.create(null);for(let[s,a]of o)this.props[typeof s=="number"?s:s.id]=a}}toString(){let e=qA.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 JQ(this.topNode,e)}cursorAt(e,n=0,r=0){let i=eI.get(this)||this.topNode,o=new JQ(i);return o.moveTo(e,n),eI.set(this,o._tree),o}get topNode(){return new Md(this,0,0,null)}resolve(e,n=0){let r=LA(eI.get(this)||this.topNode,e,n,!1);return eI.set(this,r),r}resolveInner(e,n=0){let r=LA(eK.get(this)||this.topNode,e,n,!0);return eK.set(this,r),r}resolveStack(e,n=0){return Q8e(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:o=this.length}=e,s=e.mode||0,a=(s&wi.IncludeAnonymous)>0;for(let c=this.cursor(s|wi.IncludeAnonymous);;){let d=!1;if(c.from<=o&&c.to>=i&&(!a&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;d=!0}for(;d&&r&&(a||!c.type.isAnonymous)&&r(c),!c.nextSibling();){if(!c.parent())return;d=!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:RV(dl.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new E9(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new E9(dl.none,n,r,i)))}static build(e){return D8e(e)}};Ti.empty=new Ti(dl.none,[],[],0);class $V{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 $V(this.buffer,this.index)}}class EO{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return dl.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],o=i.name;if(/\W/.test(o)&&!i.isError&&(o=JSON.stringify(o)),e+=4,r==e)return o;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return o+"("+s.join(",")+")"}findChild(e,n,r,i,o){let{buffer:s}=this,a=-1;for(let c=e;c!=n&&!(she(o,i,s[c+1],s[c+2])&&(a=c,r>0));c=s[c+3]);return a}slice(e,n,r){let i=this.buffer,o=new Uint16Array(n-e),s=0;for(let a=e,c=0;a<n;){o[c++]=i[a++],o[c++]=i[a++]-r;let d=o[c++]=i[a++]-r;o[c++]=i[a++]-e,s=Math.max(s,d)}return new EO(o,s,this.set)}}function she(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 LA(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 s=!r&&t instanceof Md&&t.index<0?null:t.parent;if(!s)return t;t=s}let o=r?0:wi.IgnoreOverlays;if(r)for(let s=t,a=s.parent;a;s=a,a=s.parent)s instanceof Md&&s.index<0&&((i=a.enter(e,n,o))===null||i===void 0?void 0:i.from)!=s.from&&(t=a);for(;;){let s=t.enter(e,n,o);if(!s)return t;t=s}}class ahe{cursor(e=0){return new JQ(this,e)}getChild(e,n=null,r=null){let i=tK(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return tK(this,e,n,r)}resolve(e,n=0){return LA(this,e,n,!1)}resolveInner(e,n=0){return LA(this,e,n,!0)}matchContext(e){return P9(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 Md=class fj extends ahe{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,o=0){for(let s=this;;){for(let{children:a,positions:c}=s._tree,d=n>0?a.length:-1;e!=d;e+=n){let p=a[e],g=c[e]+s.from;if(she(i,r,g,g+p.length)){if(p instanceof EO){if(o&wi.ExcludeBuffers)continue;let O=p.findChild(0,p.buffer.length,n,r-g,i);if(O>-1)return new Wp(new I8e(s,p,e,g),null,O)}else if(o&wi.IncludeAnonymous||!p.type.isAnonymous||kV(p)){let O;if(!(o&wi.IgnoreMounts)&&(O=qA.get(p))&&!O.overlay)return new fj(O.tree,g,e,s);let v=new fj(p,g,e,s);return o&wi.IncludeAnonymous||!v.type.isAnonymous?v:v.nextChild(n<0?p.children.length-1:0,n,r,i)}}}if(o&wi.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+n:e=n<0?-1:s._parent._tree.children.length,s=s._parent,!s))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&wi.IgnoreOverlays)&&(i=qA.get(this._tree))&&i.overlay){let o=e-this.from;for(let{from:s,to:a}of i.overlay)if((n>0?s<=o:s<o)&&(n<0?a>=o:a>o))return new fj(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 tK(t,e,n,r){let i=t.cursor(),o=[];if(!i.firstChild())return o;if(n!=null){for(let s=!1;!s;)if(s=i.type.is(n),!i.nextSibling())return o}for(;;){if(r!=null&&i.type.is(r))return o;if(i.type.is(e)&&o.push(i.node),!i.nextSibling())return r==null?o:[]}}function P9(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 I8e{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class Wp extends ahe{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,o=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return o<0?null:new Wp(this.context,this,o)}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&wi.ExcludeBuffers)return null;let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return o<0?null:new Wp(this.context,this,o)}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 Wp(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 Wp(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,o=r.buffer[this.index+3];if(o>i){let s=r.buffer[this.index+1];e.push(r.slice(i,o,s)),n.push(0)}return new Ti(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function lhe(t){if(!t.length)return null;let e=0,n=t[0];for(let o=1;o<t.length;o++){let s=t[o];(s.from>n.from||s.to<n.to)&&(n=s,e=o)}let r=n instanceof Md&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new j8e(i,n)}class j8e{constructor(e,n){this.heads=e,this.node=n}get next(){return lhe(this.heads)}}function Q8e(t,e,n){let r=t.resolveInner(e,n),i=null;for(let o=r instanceof Md?r:r.context.parent;o;o=o.parent)if(o.index<0){let s=o.parent;(i||(i=[r])).push(s.resolve(e,n)),o=s}else{let s=qA.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let a=new Md(s.tree,s.overlay[0].from+o.from,-1,o);(i||(i=[r])).push(LA(a,e,n,!1))}}return i?lhe(i):r}class JQ{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 Md)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 Md?(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,o=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}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&wi.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&wi.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&wi.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 o=0;o<this.index;o++)if(i.buffer.buffer[o+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 o=n+e,s=e<0?-1:r._tree.children.length;o!=s;o+=e){let a=r._tree.children[o];if(this.mode&wi.IncludeAnonymous||a instanceof EO||!a.type.isAnonymous||kV(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,o=this.stack.length;o>=0;){for(let s=e;s;s=s._parent)if(s.index==i){if(i==this.index)return s;n=s,r=o+1;break e}i=this.stack[--o]}for(let i=r;i<this.stack.length;i++)n=new Wp(this.buffer,n,this.stack[i]);return this.bufferNode=new Wp(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 P9(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,o=this.stack.length-1;i>=0;o--){if(o<0)return P9(this._tree,e,i);let s=r[n.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[i]&&e[i]!=s.name)return!1;i--}}return!0}}function kV(t){return t.children.some(e=>e instanceof EO||!e.type.isAnonymous||kV(e))}function D8e(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=ohe,reused:o=[],minRepeatType:s=r.types.length}=t,a=Array.isArray(n)?new $V(n,n.length):n,c=r.types,d=0,p=0;function g(R,Q,D,q,Z,Y){let{id:G,start:K,end:re,size:fe}=a,de=p,H=d;for(;fe<0;)if(a.next(),fe==-1){let ee=o[G];D.push(ee),q.push(K-R);return}else if(fe==-3){d=G;return}else if(fe==-4){p=G;return}else throw new RangeError(`Unrecognized record size: ${fe}`);let pe=c[G],se,ve,te=K-R;if(re-K<=i&&(ve=C(a.pos-Q,Z))){let ee=new Uint16Array(ve.size-ve.skip),ae=a.pos-ve.size,ie=ee.length;for(;a.pos>ae;)ie=T(ve.start,ee,ie);se=new EO(ee,re-ve.start,r),te=ve.start-R}else{let ee=a.pos-fe;a.next();let ae=[],ie=[],B=G>=s?G:-1,W=0,le=re;for(;a.pos>ee;)B>=0&&a.id==B&&a.size>=0?(a.end<=le-i&&(w(ae,ie,K,W,a.end,le,B,de,H),W=ae.length,le=a.end),a.next()):Y>2500?O(K,ee,ae,ie):g(K,ee,ae,ie,B,Y+1);if(B>=0&&W>0&&W<ae.length&&w(ae,ie,K,W,K,le,B,de,H),ae.reverse(),ie.reverse(),B>-1&&W>0){let Oe=v(pe,H);se=RV(pe,ae,ie,0,ae.length,0,re-K,Oe,Oe)}else se=S(pe,ae,ie,re-K,de-re,H)}D.push(se),q.push(te)}function O(R,Q,D,q){let Z=[],Y=0,G=-1;for(;a.pos>Q;){let{id:K,start:re,end:fe,size:de}=a;if(de>4)a.next();else{if(G>-1&&re<G)break;G<0&&(G=fe-i),Z.push(K,re,fe),Y++,a.next()}}if(Y){let K=new Uint16Array(Y*4),re=Z[Z.length-2];for(let fe=Z.length-3,de=0;fe>=0;fe-=3)K[de++]=Z[fe],K[de++]=Z[fe+1]-re,K[de++]=Z[fe+2]-re,K[de++]=de;D.push(new EO(K,Z[2]-re,r)),q.push(re-R)}}function v(R,Q){return(D,q,Z)=>{let Y=0,G=D.length-1,K,re;if(G>=0&&(K=D[G])instanceof Ti){if(!G&&K.type==R&&K.length==Z)return K;(re=K.prop(Bn.lookAhead))&&(Y=q[G]+K.length+re)}return S(R,D,q,Z,Y,Q)}}function w(R,Q,D,q,Z,Y,G,K,re){let fe=[],de=[];for(;R.length>q;)fe.push(R.pop()),de.push(Q.pop()+D-Z);R.push(S(r.types[G],fe,de,Y-Z,K-Y,re)),Q.push(Z-D)}function S(R,Q,D,q,Z,Y,G){if(Y){let K=[Bn.contextHash,Y];G=G?[K].concat(G):[K]}if(Z>25){let K=[Bn.lookAhead,Z];G=G?[K].concat(G):[K]}return new Ti(R,Q,D,q,G)}function C(R,Q){let D=a.fork(),q=0,Z=0,Y=0,G=D.end-i,K={size:0,start:0,skip:0};e:for(let re=D.pos-R;D.pos>re;){let fe=D.size;if(D.id==Q&&fe>=0){K.size=q,K.start=Z,K.skip=Y,Y+=4,q+=4,D.next();continue}let de=D.pos-fe;if(fe<0||de<re||D.start<G)break;let H=D.id>=s?4:0,pe=D.start;for(D.next();D.pos>de;){if(D.size<0)if(D.size==-3)H+=4;else break e;else D.id>=s&&(H+=4);D.next()}Z=pe,q+=fe,Y+=H}return(Q<0||q==R)&&(K.size=q,K.start=Z,K.skip=Y),K.size>4?K:void 0}function T(R,Q,D){let{id:q,start:Z,end:Y,size:G}=a;if(a.next(),G>=0&&q<s){let K=D;if(G>4){let re=a.pos-(G-4);for(;a.pos>re;)D=T(R,Q,D)}Q[--D]=K,Q[--D]=Y-R,Q[--D]=Z-R,Q[--D]=q}else G==-3?d=q:G==-4&&(p=q);return D}let E=[],$=[];for(;a.pos>0;)g(t.start||0,t.bufferStart||0,E,$,-1,0);let _=(e=t.length)!==null&&e!==void 0?e:E.length?$[0]+E[0].length:0;return new Ti(c[t.topID],E.reverse(),$.reverse(),_)}const nK=new WeakMap;function pj(t,e){if(!t.isAnonymous||e instanceof EO||e.type!=t)return 1;let n=nK.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Ti)){n=1;break}n+=pj(t,r)}nK.set(e,n)}return n}function RV(t,e,n,r,i,o,s,a,c){let d=0;for(let w=r;w<i;w++)d+=pj(t,e[w]);let p=Math.ceil(d*1.5/8),g=[],O=[];function v(w,S,C,T,E){for(let $=C;$<T;){let _=$,R=S[$],Q=pj(t,w[$]);for($++;$<T;$++){let D=pj(t,w[$]);if(Q+D>=p)break;Q+=D}if($==_+1){if(Q>p){let D=w[_];v(D.children,D.positions,0,D.children.length,S[_]+E);continue}g.push(w[_])}else{let D=S[$-1]+w[$-1].length-R;g.push(RV(t,w,S,_,$,R,D,null,c))}O.push(R+E-o)}}return v(e,n,r,i,0),(a||c)(g,O,s)}class _V{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 Wp?this.setBuffer(e.context.buffer,e.index,n):e instanceof Md&&this.map.set(e.tree,n)}get(e){return e instanceof Wp?this.getBuffer(e.context.buffer,e.index):e instanceof Md?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 Gm{constructor(e,n,r,i,o=!1,s=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(o?1:0)|(s?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 Gm(0,e.length,e,0,!1,r)];for(let o of n)o.to>e.length&&i.push(o);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],o=1,s=e.length?e[0]:null;for(let a=0,c=0,d=0;;a++){let p=a<n.length?n[a]:null,g=p?p.fromA:1e9;if(g-c>=r)for(;s&&s.from<g;){let O=s;if(c>=O.from||g<=O.to||d){let v=Math.max(O.from,c)-d,w=Math.min(O.to,g)-d;O=v>=w?null:new Gm(v,w,O.tree,O.offset+d,a>0,!!p)}if(O&&i.push(O),s.to>g)break;s=o<e.length?e[o++]:null}if(!p)break;c=p.toA,d=p.toA-p.toB}return i}}let IV=class{startParse(e,n,r){return typeof e=="string"&&(e=new M8e(e)),r=r?r.length?r.map(i=>new $d(i.from,i.to)):[new $d(0,0)]:[new $d(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let o=i.advance();if(o)return o}}};class M8e{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 N8e(t){return(e,n,r,i)=>new q8e(e,t,n,r,i)}class rK{constructor(e,n,r,i,o){this.parser=e,this.parse=n,this.overlay=r,this.target=i,this.from=o}}function iK(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class z8e{constructor(e,n,r,i,o,s,a){this.parser=e,this.predicate=n,this.mounts=r,this.index=i,this.start=o,this.target=s,this.prev=a,this.depth=0,this.ranges=[]}}const A9=new Bn({perNode:!0});class q8e{constructor(e,n,r,i,o){this.nest=n,this.input=r,this.fragments=i,this.ranges=o,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 Ti(r.type,r.children,r.positions,r.length,r.propValues.concat([[A9,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[Bn.mounted.id]=new qA(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 V8e(this.fragments),n=null,r=null,i=new JQ(new Md(this.baseTree,this.ranges[0].from,0,null),wi.IncludeAnonymous|wi.IgnoreMounts);e:for(let o,s;;){let a=!0,c;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)a=!1;else if(e.hasNode(i)){if(n){let d=n.mounts.find(p=>p.frag.from<=i.from&&p.frag.to>=i.to&&p.mount.overlay);if(d)for(let p of d.mount.overlay){let g=p.from+d.pos,O=p.to+d.pos;g>=i.from&&O<=i.to&&!n.ranges.some(v=>v.from<O&&v.to>g)&&n.ranges.push({from:g,to:O})}}a=!1}else if(r&&(s=L8e(r.ranges,i.from,i.to)))a=s!=2;else if(!i.type.isAnonymous&&(o=this.nest(i,this.input))&&(i.from<i.to||!o.overlay)){i.tree||U8e(i);let d=e.findMounts(i.from,o.parser);if(typeof o.overlay=="function")n=new z8e(o.parser,o.overlay,d,this.inner.length,i.from,i.tree,n);else{let p=aK(this.ranges,o.overlay||(i.from<i.to?[new $d(i.from,i.to)]:[]));p.length&&iK(p),(p.length||!o.overlay)&&this.inner.push(new rK(o.parser,p.length?o.parser.startParse(this.input,lK(d,p),p):o.parser.startParse(""),o.overlay?o.overlay.map(g=>new $d(g.from-i.from,g.to-i.from)):null,i.tree,p.length?p[0].from:i.from)),o.overlay?p.length&&(r={ranges:p,depth:0,prev:r}):a=!1}}else if(n&&(c=n.predicate(i))&&(c===!0&&(c=new $d(i.from,i.to)),c.from<c.to)){let d=n.ranges.length-1;d>=0&&n.ranges[d].to==c.from?n.ranges[d]={from:n.ranges[d].from,to:c.to}:n.ranges.push(c)}if(a&&i.firstChild())n&&n.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(n&&!--n.depth){let d=aK(this.ranges,n.ranges);d.length&&(iK(d),this.inner.splice(n.index,0,new rK(n.parser,n.parser.startParse(this.input,lK(n.mounts,d),d),n.ranges.map(p=>new $d(p.from-n.start,p.to-n.start)),n.target,d[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function L8e(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 oK(t,e,n,r,i,o){if(e<n){let s=t.buffer[e+1];r.push(t.slice(e,n,s)),i.push(s-o)}}function U8e(t){let{node:e}=t,n=[],r=e.context.buffer;do n.push(t.index),t.parent();while(!t.tree);let i=t.tree,o=i.children.indexOf(r),s=i.children[o],a=s.buffer,c=[o];function d(p,g,O,v,w,S){let C=n[S],T=[],E=[];oK(s,p,C,T,E,v);let $=a[C+1],_=a[C+2];c.push(T.length);let R=S?d(C+4,a[C+3],s.set.types[a[C]],$,_-$,S-1):e.toTree();return T.push(R),E.push($-v),oK(s,a[C+3],g,T,E,v),new Ti(O,T,E,w)}i.children[o]=d(0,a.length,dl.none,0,s.length,n.length-1);for(let p of c){let g=t.tree.children[p],O=t.tree.positions[p];t.yield(new Md(g,O+t.from,p,t._tree))}}class sK{constructor(e,n){this.offset=n,this.done=!1,this.cursor=e.cursor(wi.IncludeAnonymous|wi.IgnoreMounts)}moveTo(e){let{cursor:n}=this,r=e-this.offset;for(;!this.done&&n.from<r;)n.to>=e&&n.enter(r,1,wi.IgnoreOverlays|wi.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 Ti)n=n.children[0];else break}return!1}}let V8e=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(A9))!==null&&n!==void 0?n:r.to,this.inner=new sK(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(A9))!==null&&e!==void 0?e:n.to,this.inner=new sK(n.tree,-n.offset)}}findMounts(e,n){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let o=this.inner.cursor.node;o;o=o.parent){let s=(r=o.tree)===null||r===void 0?void 0:r.prop(Bn.mounted);if(s&&s.parser==n)for(let a=this.fragI;a<this.fragments.length;a++){let c=this.fragments[a];if(c.from>=o.to)break;c.tree==this.curFrag.tree&&i.push({frag:c,pos:o.from-c.offset,mount:s})}}}return i}};function aK(t,e){let n=null,r=e;for(let i=1,o=0;i<t.length;i++){let s=t[i-1].to,a=t[i].from;for(;o<r.length;o++){let c=r[o];if(c.from>=a)break;c.to<=s||(n||(r=n=e.slice()),c.from<s?(n[o]=new $d(c.from,s),c.to>a&&n.splice(o+1,0,new $d(a,c.to))):c.to>a?n[o--]=new $d(a,c.to):n.splice(o--,1))}}return r}function B8e(t,e,n,r){let i=0,o=0,s=!1,a=!1,c=-1e9,d=[];for(;;){let p=i==t.length?1e9:s?t[i].to:t[i].from,g=o==e.length?1e9:a?e[o].to:e[o].from;if(s!=a){let O=Math.max(c,n),v=Math.min(p,g,r);O<v&&d.push(new $d(O,v))}if(c=Math.min(p,g),c==1e9)break;p==c&&(s?(s=!1,i++):s=!0),g==c&&(a?(a=!1,o++):a=!0)}return d}function lK(t,e){let n=[];for(let{pos:r,mount:i,frag:o}of t){let s=r+(i.overlay?i.overlay[0].from:0),a=s+i.tree.length,c=Math.max(o.from,s),d=Math.min(o.to,a);if(i.overlay){let p=i.overlay.map(O=>new $d(O.from+r,O.to+r)),g=B8e(e,p,c,d);for(let O=0,v=c;;O++){let w=O==g.length,S=w?d:g[O].from;if(S>v&&n.push(new Gm(v,S,i.tree,-s,o.from>=v||o.openStart,o.to<=S||o.openEnd)),w)break;v=g[O].to}}else n.push(new Gm(c,d,i.tree,-s,o.from>=s||o.openStart,o.to<=a||o.openEnd))}return n}class KQ{constructor(e,n,r,i,o,s,a,c,d,p=0,g){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=o,this.score=s,this.buffer=a,this.bufferBase=c,this.curContext=d,this.lookAhead=p,this.parent=g}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 KQ(e,[],n,r,r,0,[],0,i?new cK(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:o}=this.p,s=this.reducePos<this.pos-25;s&&this.setLookAhead(this.pos);let a=o.dynamicPrecedence(i);if(a&&(this.score+=a),r==0){this.pushState(o.getGoto(this.state,i,!0),this.reducePos),i<o.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,s?8:4,!0),this.reduceContext(i,this.reducePos);return}let c=this.stack.length-(r-1)*3-(e&262144?6:0),d=c?this.stack[c-2]:this.p.ranges[0].from,p=this.reducePos-d;p>=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=p):this.p.lastBigReductionSize<p&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=p));let g=c?this.stack[c-1]:0,O=this.bufferBase+this.buffer.length-g;if(i<o.minRepeatTerm||e&131072){let v=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,d,v,O+4,!0)}if(e&262144)this.state=this.stack[c];else{let v=this.stack[c-3];this.state=o.getGoto(v,i,!0)}for(;this.stack.length>c;)this.stack.pop();this.reduceContext(i,d)}storeNode(e,n,r,i=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let s=this,a=this.buffer.length;if(a==0&&s.parent&&(a=s.bufferBase-s.parent.bufferBase,s=s.parent),a>0&&s.buffer[a-4]==0&&s.buffer[a-1]>-1){if(n==r)return;if(s.buffer[a-2]>=n){s.buffer[a-2]=r;return}}}if(!o||this.pos==r)this.buffer.push(e,n,r,i);else{let s=this.buffer.length;if(s>0&&this.buffer[s-4]!=0){let a=!1;for(let c=s;c>0&&this.buffer[c-2]>r;c-=4)if(this.buffer[c-1]>=0){a=!0;break}if(a)for(;s>0&&this.buffer[s-2]>r;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,i>4&&(i-=4)}this.buffer[s]=e,this.buffer[s+1]=n,this.buffer[s+2]=r,this.buffer[s+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let o=e,{parser:s}=this.p;(i>this.pos||n<=s.maxNode)&&(this.pos=i,s.stateFlag(o,1)||(this.reducePos=i)),this.pushState(o,r),this.shiftContext(n,r),n<=s.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 KQ(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 X8e(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 o=0,s;o<n.length;o+=2)(s=n[o+1])!=this.state&&this.p.parser.hasAction(s,e)&&i.push(n[o],s);if(this.stack.length<120)for(let o=0;i.length<8&&o<n.length;o+=2){let s=n[o+1];i.some((a,c)=>c&1&&a==s)||i.push(n[o],s)}n=i}let r=[];for(let i=0;i<n.length&&r.length<4;i+=2){let o=n[i+1];if(o==this.state)continue;let s=this.split();s.pushState(o,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(n[i],this.pos),s.reducePos=this.pos,s.score-=200,r.push(s)}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,o=this.stack.length-r*3;if(o<0||e.getGoto(this.stack[o],i,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;n=s}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,o)=>{if(!n.includes(i))return n.push(i),e.allActions(i,s=>{if(!(s&393216))if(s&65536){let a=(s>>19)-o;if(a>1){let c=s&65535,d=this.stack.length-a*3;if(d>=0&&e.getGoto(this.stack[d],c,!1)>=0)return a<<19|65536|c}}else{let a=r(s,o+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 cK(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 cK{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class X8e{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 eD{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 eD(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 eD(this.stack,this.pos,this.index)}}function AP(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r<t.length;){let o=0;for(;;){let s=t.charCodeAt(r++),a=!1;if(s==126){o=65535;break}s>=92&&s--,s>=34&&s--;let c=s-32;if(c>=46&&(c-=46,a=!0),o+=c,a)break;o*=46}n?n[i++]=o:n=new e(o)}return n}class hj{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const uK=new hj;class Z8e{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=uK,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,o=this.pos+e;for(;o<r.from;){if(!i)return null;let s=this.ranges[--i];o-=r.from-s.to,r=s}for(;n<0?o>r.to:o>=r.to;){if(i==this.ranges.length-1)return null;let s=this.ranges[++i];o+=s.from-r.to,r=s}return o}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 o=this.resolveOffset(e,1);if(o==null)return-1;if(r=o,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let s=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++s];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=uK,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 NS{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;che(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}NS.prototype.contextual=NS.prototype.fallback=NS.prototype.extend=!1;class tD{constructor(e,n,r){this.precTable=n,this.elseToken=r,this.data=typeof e=="string"?AP(e):e}token(e,n){let r=e.pos,i=0;for(;;){let o=e.next<0,s=e.resolveOffset(1,1);if(che(this.data,e,n,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(o||i++,s==null)break;e.reset(s,e.token)}i&&(e.reset(r,e.token),e.acceptToken(this.elseToken,i))}}tD.prototype.contextual=NS.prototype.fallback=NS.prototype.extend=!1;class qo{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function che(t,e,n,r,i,o){let s=0,a=1<<r,{dialect:c}=n.p.parser;e:for(;(a&t[s])!=0;){let d=t[s+1];for(let v=s+3;v<d;v+=2)if((t[v+1]&a)>0){let w=t[v];if(c.allows(w)&&(e.token.value==-1||e.token.value==w||Y8e(w,e.token.value,i,o))){e.acceptToken(w);break}}let p=e.next,g=0,O=t[s+2];if(e.next<0&&O>g&&t[d+O*3-3]==65535){s=t[d+O*3-1];continue e}for(;g<O;){let v=g+O>>1,w=d+v+(v<<1),S=t[w],C=t[w+1]||65536;if(p<S)O=v;else if(p>=C)g=v+1;else{s=t[w+2],e.advance();continue e}}break}}function dK(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function Y8e(t,e,n,r){let i=dK(n,r,e);return i<0||dK(n,r,t)<i}const du=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let Sz=null;function fK(t,e,n){let r=t.cursor(wi.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 G8e{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?fK(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?fK(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 o=r.children[i],s=this.start[n]+r.positions[i];if(s>e)return this.nextStart=s,null;if(o instanceof Ti){if(s==e){if(s<this.safeFrom)return null;let a=s+o.length;if(a<=this.safeTo){let c=o.prop(Bn.lookAhead);if(!c||a+c<this.fragment.to)return o}}this.index[n]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[n]++,this.nextStart=s+o.length}}}class W8e{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new hj)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:o}=i,s=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,c=0;for(let d=0;d<o.length;d++){if((1<<d&s)==0)continue;let p=o[d],g=this.tokens[d];if(!(r&&!p.fallback)&&((p.contextual||g.start!=e.pos||g.mask!=s||g.context!=a)&&(this.updateCachedToken(g,p,e),g.mask=s,g.context=a),g.lookAhead>g.end+25&&(c=Math.max(g.lookAhead,c)),g.value!=0)){let O=n;if(g.extended>-1&&(n=this.addActions(e,g.extended,g.end,n)),n=this.addActions(e,g.value,g.end,n),!p.extend&&(r=g,n>O))break}}for(;this.actions.length>n;)this.actions.pop();return c&&e.setLookAhead(c),!r&&e.pos==this.stream.end&&(r=new hj,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 hj,{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:o}=r.p;for(let s=0;s<o.specialized.length;s++)if(o.specialized[s]==e.value){let a=o.specializers[s](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 o=0;o<i;o+=3)if(this.actions[o]==e)return i;return this.actions[i++]=e,this.actions[i++]=n,this.actions[i++]=r,i}addActions(e,n,r,i){let{state:o}=e,{parser:s}=e.p,{data:a}=s;for(let c=0;c<2;c++)for(let d=s.stateSlot(o,c?2:1);;d+=3){if(a[d]==65535)if(a[d+1]==1)d=zm(a,d+2);else{i==0&&a[d+1]==2&&(i=this.putAction(zm(a,d+2),n,r,i));break}a[d]==n&&(i=this.putAction(zm(a,d+1),n,r,i))}return i}}let F8e=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 Z8e(n,i),this.tokens=new W8e(e,this.stream),this.topTerm=e.top[1];let{from:o}=i[0];this.stacks=[KQ.start(this,e.top[0],o)],this.fragments=r.length&&this.stream.end-o>e.bufferLength*4?new G8e(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],i,o;if(this.bigReductionCount>300&&e.length==1){let[s]=e;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<e.length;s++){let a=e[s];for(;;){if(this.tokens.mainToken=null,a.pos>n)r.push(a);else{if(this.advanceStack(a,r,e))continue;{i||(i=[],o=[]),i.push(a);let c=this.tokens.getMainToken(a);o.push(c.value,c.end)}}break}}if(!r.length){let s=i&&J8e(i);if(s)return du&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw du&&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 s=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,o,r);if(s)return du&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(r.length>s)for(r.sort((a,c)=>c.score-a.score);r.length>s;)r.pop();r.some(a=>a.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let s=0;s<r.length-1;s++){let a=r[s];for(let c=s+1;c<r.length;c++){let d=r[c];if(a.sameState(d)||a.buffer.length>500&&d.buffer.length>500)if((a.score-d.score||a.buffer.length-d.buffer.length)>0)r.splice(c--,1);else{r.splice(s--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let s=1;s<r.length;s++)r[s].pos<this.minStackPos&&(this.minStackPos=r[s].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:o}=this,s=du?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.curContext&&e.curContext.tracker.strict,p=d?e.curContext.hash:0;for(let g=this.fragments.nodeAt(i);g;){let O=this.parser.nodeSet.types[g.type.id]==g.type?o.getGoto(e.state,g.type.id):-1;if(O>-1&&g.length&&(!d||(g.prop(Bn.contextHash)||0)==p))return e.useNode(g,O),du&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(g.type.id)})`),!0;if(!(g instanceof Ti)||g.children.length==0||g.positions[0]>0)break;let v=g.children[0];if(v instanceof Ti&&g.positions[0]==0)g=v;else break}}let a=o.stateSlot(e.state,4);if(a>0)return e.reduce(a),du&&console.log(s+this.stackID(e)+` (via always-reduce ${o.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let c=this.tokens.getActions(e);for(let d=0;d<c.length;){let p=c[d++],g=c[d++],O=c[d++],v=d==c.length||!r,w=v?e:e.split(),S=this.tokens.mainToken;if(w.apply(p,g,S?S.start:w.pos,O),du&&console.log(s+this.stackID(w)+` (via ${(p&65536)==0?"shift":`reduce of ${o.getName(p&65535)}`} for ${o.getName(g)} @ ${i}${w==e?"":", split"})`),v)return!0;w.pos>i?n.push(w):r.push(w)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return pK(e,n),!0}}runRecovery(e,n,r){let i=null,o=!1;for(let s=0;s<e.length;s++){let a=e[s],c=n[s<<1],d=n[(s<<1)+1],p=du?this.stackID(a)+" -> ":"";if(a.deadEnd&&(o||(o=!0,a.restart(),du&&console.log(p+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let g=a.split(),O=p;for(let v=0;g.forceReduce()&&v<10&&(du&&console.log(O+this.stackID(g)+" (via force-reduce)"),!this.advanceFully(g,r));v++)du&&(O=this.stackID(g)+" -> ");for(let v of a.recoverByInsert(c))du&&console.log(p+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,r);this.stream.end>a.pos?(d==a.pos&&(d++,c=0),a.recoverByDelete(c,d),du&&console.log(p+this.stackID(a)+` (via recover-delete ${this.parser.getName(c)})`),pK(a,r)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),Ti.build({buffer:eD.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=(Sz||(Sz=new WeakMap)).get(e);return n||Sz.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}};function pK(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 H8e{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}const wz=t=>t;class D${constructor(e){this.start=e.start,this.shift=e.shift||wz,this.reduce=e.reduce||wz,this.reuse=e.reuse||wz,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rf extends IV{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 o(a,c,d){i[a].push([c,c.deserialize(String(d))])}if(e.nodeProps)for(let a of e.nodeProps){let c=a[0];typeof c=="string"&&(c=Bn[c]);for(let d=1;d<a.length;){let p=a[d++];if(p>=0)o(p,c,a[d++]);else{let g=a[d+-p];for(let O=-p;O>0;O--)o(a[d++],c,g);d++}}}this.nodeSet=new pM(n.map((a,c)=>dl.define({name:c>=this.minRepeatTerm?void 0:a,id:c,props:i[c],top:r.indexOf(c)>-1,error:c==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(c)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=ohe;let s=AP(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(hK),this.states=AP(e.states,Uint32Array),this.data=AP(e.stateData),this.goto=AP(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new NS(s,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 F8e(this,e,n,r);for(let o of this.wrappers)i=o(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let o=i[n+1];;){let s=i[o++],a=s&1,c=i[o++];if(a&&r)return c;for(let d=o+(s>>1);o<d;o++)if(i[o]==e)return c;if(a)return-1}}hasAction(e,n){let r=this.data;for(let i=0;i<2;i++)for(let o=this.stateSlot(e,i?2:1),s;;o+=3){if((s=r[o])==65535)if(r[o+1]==1)s=r[o=zm(r,o+2)];else{if(r[o+1]==2)return zm(r,o+2);break}if(s==n||s==0)return zm(r,o+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 o=this.stateSlot(e,1);i==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=zm(this.data,o+2);else break;i=n(zm(this.data,o+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=zm(this.data,r+2);else break;if((this.data[r+2]&1)==0){let i=this.data[r+1];n.some((o,s)=>s&1&&o==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(Rf.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(o=>o.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let o=e.specializers.find(a=>a.from==r.external);if(!o)return r;let s=Object.assign(Object.assign({},r),{external:o.to});return n.specializers[i]=hK(s),s})),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 o of e.split(" ")){let s=n.indexOf(o);s>=0&&(r[s]=!0)}let i=null;for(let o=0;o<n.length;o++)if(!r[o])for(let s=this.dialects[n[o]],a;(a=this.data[s++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new H8e(e,r,i)}static deserialize(e){return new Rf(e)}}function zm(t,e){return t[e]|t[e+1]<<16}function J8e(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 hK(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}let K8e=0,qm=class $9{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=K8e++}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 $9&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let i=new $9(r,[],null,[]);if(i.set.push(i),n)for(let o of n.set)i.set.push(o);return i}static defineModifier(e){let n=new nD(e);return r=>r.modified.indexOf(n)>-1?r:nD.get(r.base||r,r.modified.concat(n).sort((i,o)=>i.id-o.id))}},eBe=0;class nD{constructor(e){this.name=e,this.instances=[],this.id=eBe++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&tBe(n,a.modified));if(r)return r;let i=[],o=new qm(e.name,i,e,n);for(let a of n)a.instances.push(o);let s=nBe(n);for(let a of e.set)if(!a.modified.length)for(let c of s)i.push(nD.get(a,c));return o}}function tBe(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function nBe(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 dg(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 o=[],s=2,a=i;for(let g=0;;){if(a=="..."&&g>0&&g+3==i.length){s=1;break}let O=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!O)throw new RangeError("Invalid path: "+i);if(o.push(O[0]=="*"?"":O[0][0]=='"'?JSON.parse(O[0]):O[0]),g+=O[0].length,g==i.length)break;let v=i[g++];if(g==i.length&&v=="!"){s=0;break}if(v!="/")throw new RangeError("Invalid path: "+i);a=i.slice(g)}let c=o.length-1,d=o[c];if(!d)throw new RangeError("Invalid path: "+i);let p=new rD(r,s,c>0?o.slice(0,c):null);e[d]=p.sort(e[d])}}return uhe.add(e)}const uhe=new Bn;class rD{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}}rD.empty=new rD([],2,null);function dhe(t,e){let n=Object.create(null);for(let o of t)if(!Array.isArray(o.tag))n[o.tag.id]=o.class;else for(let s of o.tag)n[s.id]=o.class;let{scope:r,all:i=null}=e||{};return{style:o=>{let s=i;for(let a of o)for(let c of a.set){let d=n[c.id];if(d){s=s?s+" "+d:d;break}}return s},scope:r}}function rBe(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function iBe(t,e,n,r=0,i=t.length){let o=new oBe(r,Array.isArray(e)?e:[e],n);o.highlightRange(t.cursor(),r,i,"",o.highlighters),o.flush(i)}class oBe{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,o){let{type:s,from:a,to:c}=e;if(a>=r||c<=n)return;s.isTop&&(o=this.highlighters.filter(v=>!v.scope||v.scope(s)));let d=i,p=sBe(e)||rD.empty,g=rBe(o,p.tags);if(g&&(d&&(d+=" "),d+=g,p.mode==1&&(i+=(i?" ":"")+g)),this.startSpan(Math.max(n,a),d),p.opaque)return;let O=e.tree&&e.tree.prop(Bn.mounted);if(O&&O.overlay){let v=e.node.enter(O.overlay[0].from+a,1),w=this.highlighters.filter(C=>!C.scope||C.scope(O.tree.type)),S=e.firstChild();for(let C=0,T=a;;C++){let E=C<O.overlay.length?O.overlay[C]:null,$=E?E.from+a:c,_=Math.max(n,T),R=Math.min(r,$);if(_<R&&S)for(;e.from<R&&(this.highlightRange(e,_,R,i,o),this.startSpan(Math.min(R,e.to),d),!(e.to>=$||!e.nextSibling())););if(!E||$>r)break;T=E.to+a,T>n&&(this.highlightRange(v.cursor(),Math.max(n,E.from+a),Math.min(r,T),"",w),this.startSpan(Math.min(r,T),d))}S&&e.parent()}else if(e.firstChild()){O&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,o),this.startSpan(Math.min(r,e.to),d)}while(e.nextSibling());e.parent()}}}function sBe(t){let e=t.type.prop(uhe);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const kt=qm.define,tI=kt(),Hy=kt(),mK=kt(Hy),gK=kt(Hy),Jy=kt(),nI=kt(Jy),Cz=kt(Jy),zp=kt(),xb=kt(zp),Rp=kt(),_p=kt(),k9=kt(),sP=kt(k9),rI=kt(),ne={comment:tI,lineComment:kt(tI),blockComment:kt(tI),docComment:kt(tI),name:Hy,variableName:kt(Hy),typeName:mK,tagName:kt(mK),propertyName:gK,attributeName:kt(gK),className:kt(Hy),labelName:kt(Hy),namespace:kt(Hy),macroName:kt(Hy),literal:Jy,string:nI,docString:kt(nI),character:kt(nI),attributeValue:kt(nI),number:Cz,integer:kt(Cz),float:kt(Cz),bool:kt(Jy),regexp:kt(Jy),escape:kt(Jy),color:kt(Jy),url:kt(Jy),keyword:Rp,self:kt(Rp),null:kt(Rp),atom:kt(Rp),unit:kt(Rp),modifier:kt(Rp),operatorKeyword:kt(Rp),controlKeyword:kt(Rp),definitionKeyword:kt(Rp),moduleKeyword:kt(Rp),operator:_p,derefOperator:kt(_p),arithmeticOperator:kt(_p),logicOperator:kt(_p),bitwiseOperator:kt(_p),compareOperator:kt(_p),updateOperator:kt(_p),definitionOperator:kt(_p),typeOperator:kt(_p),controlOperator:kt(_p),punctuation:k9,separator:kt(k9),bracket:sP,angleBracket:kt(sP),squareBracket:kt(sP),paren:kt(sP),brace:kt(sP),content:zp,heading:xb,heading1:kt(xb),heading2:kt(xb),heading3:kt(xb),heading4:kt(xb),heading5:kt(xb),heading6:kt(xb),contentSeparator:kt(zp),list:kt(zp),quote:kt(zp),emphasis:kt(zp),strong:kt(zp),link:kt(zp),monospace:kt(zp),strikethrough:kt(zp),inserted:kt(),deleted:kt(),changed:kt(),invalid:kt(),meta:rI,documentMeta:kt(rI),annotation:kt(rI),processingInstruction:kt(rI),definition:qm.defineModifier("definition"),constant:qm.defineModifier("constant"),function:qm.defineModifier("function"),standard:qm.defineModifier("standard"),local:qm.defineModifier("local"),special:qm.defineModifier("special")};for(let t in ne){let e=ne[t];e instanceof qm&&(e.name=t)}dhe([{tag:ne.link,class:"tok-link"},{tag:ne.heading,class:"tok-heading"},{tag:ne.emphasis,class:"tok-emphasis"},{tag:ne.strong,class:"tok-strong"},{tag:ne.keyword,class:"tok-keyword"},{tag:ne.atom,class:"tok-atom"},{tag:ne.bool,class:"tok-bool"},{tag:ne.url,class:"tok-url"},{tag:ne.labelName,class:"tok-labelName"},{tag:ne.inserted,class:"tok-inserted"},{tag:ne.deleted,class:"tok-deleted"},{tag:ne.literal,class:"tok-literal"},{tag:ne.string,class:"tok-string"},{tag:ne.number,class:"tok-number"},{tag:[ne.regexp,ne.escape,ne.special(ne.string)],class:"tok-string2"},{tag:ne.variableName,class:"tok-variableName"},{tag:ne.local(ne.variableName),class:"tok-variableName tok-local"},{tag:ne.definition(ne.variableName),class:"tok-variableName tok-definition"},{tag:ne.special(ne.variableName),class:"tok-variableName2"},{tag:ne.definition(ne.propertyName),class:"tok-propertyName tok-definition"},{tag:ne.typeName,class:"tok-typeName"},{tag:ne.namespace,class:"tok-namespace"},{tag:ne.className,class:"tok-className"},{tag:ne.macroName,class:"tok-macroName"},{tag:ne.propertyName,class:"tok-propertyName"},{tag:ne.operator,class:"tok-operator"},{tag:ne.comment,class:"tok-comment"},{tag:ne.meta,class:"tok-meta"},{tag:ne.invalid,class:"tok-invalid"},{tag:ne.punctuation,class:"tok-punctuation"}]);const aBe=dg({String:ne.string,Number:ne.number,"True False":ne.bool,PropertyName:ne.propertyName,Null:ne.null,",":ne.separator,"[ ]":ne.squareBracket,"{ }":ne.brace}),lBe=Rf.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:[aBe],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 R9=[],fhe=[];(()=>{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?fhe:R9).push(n=n+t[e])})();function cBe(t){if(t<768)return!1;for(let e=0,n=R9.length;;){let r=e+n>>1;if(t<R9[r])n=r;else if(t>=fhe[r])e=r+1;else return!0;if(e==n)return!1}}function yK(t){return t>=127462&&t<=127487}const OK=8205;function uBe(t,e,n=!0,r=!0){return(n?phe:dBe)(t,e,r)}function phe(t,e,n){if(e==t.length)return e;e&&hhe(t.charCodeAt(e))&&mhe(t.charCodeAt(e-1))&&e--;let r=Tz(t,e);for(e+=vK(r);e<t.length;){let i=Tz(t,e);if(r==OK||i==OK||n&&cBe(i))e+=vK(i),r=i;else if(yK(i)){let o=0,s=e-2;for(;s>=0&&yK(Tz(t,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function dBe(t,e,n){for(;e>0;){let r=phe(t,e-2,n);if(r<e)return r;e--}return 0}function Tz(t,e){let n=t.charCodeAt(e);if(!mhe(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return hhe(r)?(n-55296<<10)+(r-56320)+65536:n}function hhe(t){return t>=56320&&t<57344}function mhe(t){return t>=55296&&t<56320}function vK(t){return t<65536?1:2}class br{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]=lw(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),Zp.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]=lw(this,e,n);let r=[];return this.decompose(e,n,r,0),Zp.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 HP(this),o=new HP(e);for(let s=n,a=n;;){if(i.next(s),o.next(s),s=0,i.lineBreak!=o.lineBreak||i.done!=o.done||i.value!=o.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new HP(this,e)}iterRange(e,n=this.length){return new ghe(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 yhe(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]?br.empty:e.length<=32?new Mo(e):Zp.from(Mo.split(e,[]))}}class Mo extends br{constructor(e,n=fBe(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 o=0;;o++){let s=this.text[o],a=i+s.length;if((n?r:a)>=e)return new pBe(i,a,r,s);i=a+1,r++}}decompose(e,n,r,i){let o=e<=0&&n>=this.length?this:new Mo(bK(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let s=r.pop(),a=mj(o.text,s.text.slice(),0,o.length);if(a.length<=32)r.push(new Mo(a,s.length+o.length));else{let c=a.length>>1;r.push(new Mo(a.slice(0,c)),new Mo(a.slice(c)))}}else r.push(o)}replace(e,n,r){if(!(r instanceof Mo))return super.replace(e,n,r);[e,n]=lw(this,e,n);let i=mj(this.text,mj(r.text,bK(this.text,0,e)),n),o=this.length+r.length-(n-e);return i.length<=32?new Mo(i,o):Zp.from(Mo.split(i,[]),o)}sliceString(e,n=this.length,r=`
348
+ `;function iM({input:t,onSave:e,onCancel:n,...r}){const[i,o]=M.useState(!!t.isSecret),s=({name:a,value:c})=>{e({...t,name:a,value:c,isSecret:i})};return y.jsx(ape,{variable:t,onSave:s,onCancel:n,maskValue:i,...r,children:y.jsx(RA,{children:y.jsx(vfe,{value:i,onChange:a=>o(a),title:"Make it secret"})})})}const XQ=()=>({name:"",value:"",isSecret:!1}),ro=t=>Cae+"$inputs."+t+l6,lpe=(t,e)=>e.inputs.find(n=>n.get().name===t.match(`^${S$}$`)?.[1]);function rUe({environments:t,activeEnvironmentId:e}){return t.get().find(r=>r.name===e.get())?.inputs||[]}function Vy(t){const e=new RegExp(S$,"g"),n=new Set;if(!t)return n;for(const[r,i,o]of t.matchAll(e)){const s=i||o;s&&n.add(s)}return n}function O0(t){const e=/^\{?\$inputs\.([^\}\s]+)\}?$/,n=t.match(e);return n?n[1]:null}function cj(t){const e=new Error(t);return e.source="ulid",e}const mV="0123456789ABCDEFGHJKMNPQRSTVWXYZ",GP=mV.length,EJ=Math.pow(2,48)-1,iUe=10,oUe=16;function sUe(t){let e=Math.floor(t()*GP);return e===GP&&(e=GP-1),mV.charAt(e)}function aUe(t,e){if(isNaN(t))throw new Error(t+" must be a number");if(t>EJ)throw cj("cannot encode time greater than "+EJ);if(t<0)throw cj("time must be positive");if(Number.isInteger(Number(t))===!1)throw cj("time must be an integer");let n,r="";for(;e>0;e--)n=t%GP,r=mV.charAt(n)+r,t=(t-n)/GP;return r}function lUe(t,e){let n="";for(;t>0;t--)n=sUe(e)+n;return n}function cUe(t=!1,e){e||(e=typeof window<"u"?window:null);const n=e&&(e.crypto||e.msCrypto);if(n)return()=>{const r=new Uint8Array(1);return n.getRandomValues(r),r[0]/255};try{const r=require("crypto");return()=>r.randomBytes(1).readUInt8()/255}catch{}if(t){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return()=>Math.random()}throw cj("secure crypto unusable, insecure Math.random not allowed")}function uUe(t){return t||(t=cUe()),function(n){return isNaN(n)&&(n=Date.now()),aUe(n,iUe)+lUe(oUe,t)}}const ZQ=uUe();function dUe(t){const{type:e,data:n,additionalData:r={},message:i,namespace:o,sourceDetails:s,actor:a,requestId:c,userIp:d,analyticsMetadata:p,origin:g,subjects:O,category:v="product",signal:w="log"}=t;let S,C;o&&n&&(Array.isArray(n)?C=n:typeof n=="object"&&"data"in n&&Array.isArray(n.data)&&(S=n)),!S&&!C&&(S=i);const T=s??S?.sourceDetails??null,E=a??S?.actor??T??null,$=!!(o&&(S||C)),_=`evt_${ZQ()}`.toLowerCase(),R=$?new Date:new Date().toISOString(),Q=o?`${o}.${e}`:e,q={specversion:"1.0",object:"event",datacontenttype:"application/json; charset=utf-8",origin:g??($||r.organizationId||r.projectId||r.origin==="api"?"api":"ui"),category:v,signal:w};if($){const Z=C??S?.data??[],Y=O||Z.map(K=>({id:K.id??"",object:K.object??"unknown",uri:K.uri??""})),G=Z[0]?.id??null;Object.assign(q,{...r,...S||{},id:_,type:Q,time:R,source:T?.uri??null,sourceDetails:T,actor:E,subject:G,subjects:Y,context:{ip:d},data:Z,requestId:c??"",analyticsMetadata:p})}else{const Z=r.request,Y=r.sourceDetails,G=Y?{id:Y.user??Y.id??`usr_${ZQ()}`,object:Y.object??"user",uri:Y.uri??""}:null,K=(Array.isArray(n)?n[0]:n)?.id??null;Object.assign(q,{...r,id:_,type:Q,time:R,source:Z?.source??r.source??null,sourceDetails:G,actor:G,subject:K,data:n})}return q}var fUe=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},jb="1.9.0",PJ=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function pUe(t){var e=new Set([t]),n=new Set,r=t.match(PJ);if(!r)return function(){return!1};var i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(c){return c===t};function o(a){return n.add(a),!1}function s(a){return e.add(a),!0}return function(c){if(e.has(c))return!0;if(n.has(c))return!1;var d=c.match(PJ);if(!d)return o(c);var p={major:+d[1],minor:+d[2],patch:+d[3],prerelease:d[4]};return p.prerelease!=null||i.major!==p.major?o(c):i.major===0?i.minor===p.minor&&i.patch<=p.patch?s(c):o(c):i.minor<=p.minor?s(c):o(c)}}var hUe=pUe(jb),mUe=jb.split(".")[0],MA=Symbol.for("opentelemetry.js.api."+mUe),NA=fUe;function I$(t,e,n,r){var i;r===void 0&&(r=!1);var o=NA[MA]=(i=NA[MA])!==null&&i!==void 0?i:{version:jb};if(!r&&o[t]){var s=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return n.error(s.stack||s.message),!1}if(o.version!==jb){var s=new Error("@opentelemetry/api: Registration of version v"+o.version+" for "+t+" does not match previously registered API v"+jb);return n.error(s.stack||s.message),!1}return o[t]=e,n.debug("@opentelemetry/api: Registered a global for "+t+" v"+jb+"."),!0}function Hb(t){var e,n,r=(e=NA[MA])===null||e===void 0?void 0:e.version;if(!(!r||!hUe(r)))return(n=NA[MA])===null||n===void 0?void 0:n[t]}function j$(t,e){e.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+jb+".");var n=NA[MA];n&&delete n[t]}var gUe=function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o},yUe=function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},OUe=(function(){function t(e){this._namespace=e.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return nP("debug",this._namespace,e)},t.prototype.error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return nP("error",this._namespace,e)},t.prototype.info=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return nP("info",this._namespace,e)},t.prototype.warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return nP("warn",this._namespace,e)},t.prototype.verbose=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return nP("verbose",this._namespace,e)},t})();function nP(t,e,n){var r=Hb("diag");if(r)return n.unshift(e),r[t].apply(r,yUe([],gUe(n),!1))}var yu;(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"})(yu||(yu={}));function vUe(t,e){t<yu.NONE?t=yu.NONE:t>yu.ALL&&(t=yu.ALL),e=e||{};function n(r,i){var o=e[r];return typeof o=="function"&&t>=i?o.bind(e):function(){}}return{error:n("error",yu.ERROR),warn:n("warn",yu.WARN),info:n("info",yu.INFO),debug:n("debug",yu.DEBUG),verbose:n("verbose",yu.VERBOSE)}}var bUe=function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o},xUe=function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},SUe="diag",ch=(function(){function t(){function e(i){return function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var a=Hb("diag");if(a)return a[i].apply(a,xUe([],bUe(o),!1))}}var n=this,r=function(i,o){var s,a,c;if(o===void 0&&(o={logLevel:yu.INFO}),i===n){var d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return n.error((s=d.stack)!==null&&s!==void 0?s:d.message),!1}typeof o=="number"&&(o={logLevel:o});var p=Hb("diag"),g=vUe((a=o.logLevel)!==null&&a!==void 0?a:yu.INFO,i);if(p&&!o.suppressOverrideMessage){var O=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";p.warn("Current logger will be overwritten from "+O),g.warn("Current logger will overwrite one already registered from "+O)}return I$("diag",g,n,!0)};n.setLogger=r,n.disable=function(){j$(SUe,n)},n.createComponentLogger=function(i){return new OUe(i)},n.verbose=e("verbose"),n.debug=e("debug"),n.info=e("info"),n.warn=e("warn"),n.error=e("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t})(),wUe=function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o},CUe=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},TUe=(function(){function t(e){this._entries=e?new Map(e):new Map}return t.prototype.getEntry=function(e){var n=this._entries.get(e);if(n)return Object.assign({},n)},t.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var n=wUe(e,2),r=n[0],i=n[1];return[r,i]})},t.prototype.setEntry=function(e,n){var r=new t(this._entries);return r._entries.set(e,n),r},t.prototype.removeEntry=function(e){var n=new t(this._entries);return n._entries.delete(e),n},t.prototype.removeEntries=function(){for(var e,n,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=new t(this._entries);try{for(var s=CUe(r),a=s.next();!a.done;a=s.next()){var c=a.value;o._entries.delete(c)}}catch(d){e={error:d}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return o},t.prototype.clear=function(){return new t},t})(),EUe=Symbol("BaggageEntryMetadata"),PUe=ch.instance();function AUe(t){return t===void 0&&(t={}),new TUe(new Map(Object.entries(t)))}function $Ue(t){return typeof t!="string"&&(PUe.error("Cannot create baggage metadata from unknown type: "+typeof t),t=""),{__TYPE__:EUe,toString:function(){return t}}}function gV(t){return Symbol.for(t)}var kUe=(function(){function t(e){var n=this;n._currentContext=e?new Map(e):new Map,n.getValue=function(r){return n._currentContext.get(r)},n.setValue=function(r,i){var o=new t(n._currentContext);return o._currentContext.set(r,i),o},n.deleteValue=function(r){var i=new t(n._currentContext);return i._currentContext.delete(r),i}}return t})(),uS=new kUe,v0=(function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),RUe=(function(){function t(){}return t.prototype.createGauge=function(e,n){return LUe},t.prototype.createHistogram=function(e,n){return UUe},t.prototype.createCounter=function(e,n){return qUe},t.prototype.createUpDownCounter=function(e,n){return VUe},t.prototype.createObservableGauge=function(e,n){return XUe},t.prototype.createObservableCounter=function(e,n){return BUe},t.prototype.createObservableUpDownCounter=function(e,n){return ZUe},t.prototype.addBatchObservableCallback=function(e,n){},t.prototype.removeBatchObservableCallback=function(e){},t})(),oM=(function(){function t(){}return t})(),_Ue=(function(t){v0(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.add=function(n,r){},e})(oM),IUe=(function(t){v0(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.add=function(n,r){},e})(oM),jUe=(function(t){v0(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.record=function(n,r){},e})(oM),QUe=(function(t){v0(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.record=function(n,r){},e})(oM),yV=(function(){function t(){}return t.prototype.addCallback=function(e){},t.prototype.removeCallback=function(e){},t})(),DUe=(function(t){v0(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(yV),MUe=(function(t){v0(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(yV),NUe=(function(t){v0(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(yV),zUe=new RUe,qUe=new _Ue,LUe=new jUe,UUe=new QUe,VUe=new IUe,BUe=new DUe,XUe=new MUe,ZUe=new NUe,YUe={get:function(t,e){if(t!=null)return t[e]},keys:function(t){return t==null?[]:Object.keys(t)}},GUe={set:function(t,e,n){t!=null&&(t[e]=n)}},WUe=function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o},FUe=function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},HUe=(function(){function t(){}return t.prototype.active=function(){return uS},t.prototype.with=function(e,n,r){for(var i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];return n.call.apply(n,FUe([r],WUe(i),!1))},t.prototype.bind=function(e,n){return n},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t})(),JUe=function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o},KUe=function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},cz="context",e7e=new HUe,sM=(function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(e){return I$(cz,e,ch.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(e,n,r){for(var i,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return(i=this._getContextManager()).with.apply(i,KUe([e,n,r],JUe(o),!1))},t.prototype.bind=function(e,n){return this._getContextManager().bind(e,n)},t.prototype._getContextManager=function(){return Hb(cz)||e7e},t.prototype.disable=function(){this._getContextManager().disable(),j$(cz,ch.instance())},t})(),ng;(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(ng||(ng={}));var cpe="0000000000000000",upe="00000000000000000000000000000000",dpe={traceId:upe,spanId:cpe,traceFlags:ng.NONE},WP=(function(){function t(e){e===void 0&&(e=dpe),this._spanContext=e}return t.prototype.spanContext=function(){return this._spanContext},t.prototype.setAttribute=function(e,n){return this},t.prototype.setAttributes=function(e){return this},t.prototype.addEvent=function(e,n){return this},t.prototype.addLink=function(e){return this},t.prototype.addLinks=function(e){return this},t.prototype.setStatus=function(e){return this},t.prototype.updateName=function(e){return this},t.prototype.end=function(e){},t.prototype.isRecording=function(){return!1},t.prototype.recordException=function(e,n){},t})(),OV=gV("OpenTelemetry Context Key SPAN");function vV(t){return t.getValue(OV)||void 0}function t7e(){return vV(sM.getInstance().active())}function bV(t,e){return t.setValue(OV,e)}function n7e(t){return t.deleteValue(OV)}function r7e(t,e){return bV(t,new WP(e))}function fpe(t){var e;return(e=vV(t))===null||e===void 0?void 0:e.spanContext()}var i7e=/^([0-9a-f]{32})$/i,o7e=/^[0-9a-f]{16}$/i;function ppe(t){return i7e.test(t)&&t!==upe}function s7e(t){return o7e.test(t)&&t!==cpe}function aM(t){return ppe(t.traceId)&&s7e(t.spanId)}function a7e(t){return new WP(t)}var uz=sM.getInstance(),hpe=(function(){function t(){}return t.prototype.startSpan=function(e,n,r){r===void 0&&(r=uz.active());var i=!!n?.root;if(i)return new WP;var o=r&&fpe(r);return l7e(o)&&aM(o)?new WP(o):new WP},t.prototype.startActiveSpan=function(e,n,r,i){var o,s,a;if(!(arguments.length<2)){arguments.length===2?a=n:arguments.length===3?(o=n,a=r):(o=n,s=r,a=i);var c=s??uz.active(),d=this.startSpan(e,o,c),p=bV(c,d);return uz.with(p,a,void 0,d)}},t})();function l7e(t){return typeof t=="object"&&typeof t.spanId=="string"&&typeof t.traceId=="string"&&typeof t.traceFlags=="number"}var c7e=new hpe,u7e=(function(){function t(e,n,r,i){this._provider=e,this.name=n,this.version=r,this.options=i}return t.prototype.startSpan=function(e,n,r){return this._getTracer().startSpan(e,n,r)},t.prototype.startActiveSpan=function(e,n,r,i){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},t.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):c7e},t})(),d7e=(function(){function t(){}return t.prototype.getTracer=function(e,n,r){return new hpe},t})(),f7e=new d7e,AJ=(function(){function t(){}return t.prototype.getTracer=function(e,n,r){var i;return(i=this.getDelegateTracer(e,n,r))!==null&&i!==void 0?i:new u7e(this,e,n,r)},t.prototype.getDelegate=function(){var e;return(e=this._delegate)!==null&&e!==void 0?e:f7e},t.prototype.setDelegate=function(e){this._delegate=e},t.prototype.getDelegateTracer=function(e,n,r){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(e,n,r)},t})(),YQ;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(YQ||(YQ={}));var p9;(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"})(p9||(p9={}));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={}));var Zm=sM.getInstance(),jr=ch.instance(),p7e=(function(){function t(){}return t.prototype.getMeter=function(e,n,r){return zUe},t})(),h7e=new p7e,dz="metrics",m7e=(function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalMeterProvider=function(e){return I$(dz,e,ch.instance())},t.prototype.getMeterProvider=function(){return Hb(dz)||h7e},t.prototype.getMeter=function(e,n,r){return this.getMeterProvider().getMeter(e,n,r)},t.prototype.disable=function(){j$(dz,ch.instance())},t})(),mpe=m7e.getInstance(),g7e=(function(){function t(){}return t.prototype.inject=function(e,n){},t.prototype.extract=function(e,n){return e},t.prototype.fields=function(){return[]},t})(),xV=gV("OpenTelemetry Baggage Key");function gpe(t){return t.getValue(xV)||void 0}function y7e(){return gpe(sM.getInstance().active())}function O7e(t,e){return t.setValue(xV,e)}function v7e(t){return t.deleteValue(xV)}var fz="propagation",b7e=new g7e,x7e=(function(){function t(){this.createBaggage=AUe,this.getBaggage=gpe,this.getActiveBaggage=y7e,this.setBaggage=O7e,this.deleteBaggage=v7e}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(e){return I$(fz,e,ch.instance())},t.prototype.inject=function(e,n,r){return r===void 0&&(r=GUe),this._getGlobalPropagator().inject(e,n,r)},t.prototype.extract=function(e,n,r){return r===void 0&&(r=YUe),this._getGlobalPropagator().extract(e,n,r)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){j$(fz,ch.instance())},t.prototype._getGlobalPropagator=function(){return Hb(fz)||b7e},t})(),FP=x7e.getInstance(),pz="trace",S7e=(function(){function t(){this._proxyTracerProvider=new AJ,this.wrapSpanContext=a7e,this.isSpanContextValid=aM,this.deleteSpan=n7e,this.getSpan=vV,this.getActiveSpan=t7e,this.getSpanContext=fpe,this.setSpan=bV,this.setSpanContext=r7e}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(e){var n=I$(pz,this._proxyTracerProvider,ch.instance());return n&&this._proxyTracerProvider.setDelegate(e),n},t.prototype.getTracerProvider=function(){return Hb(pz)||this._proxyTracerProvider},t.prototype.getTracer=function(e,n){return this.getTracerProvider().getTracer(e,n)},t.prototype.disable=function(){j$(pz,ch.instance()),this._proxyTracerProvider=new AJ},t})(),vc=S7e.getInstance();const ype=gV("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function w7e(t){return t.setValue(ype,!0)}function SV(t){return t.getValue(ype)===!0}const C7e="=",h9=";",m9=",",hz="baggage",T7e=180,E7e=4096,P7e=8192;function A7e(t){return t.reduce((e,n)=>{const r=`${e}${e!==""?m9:""}${n}`;return r.length>P7e?e:r},"")}function $7e(t){return t.getAllEntries().map(([e,n])=>{let r=`${encodeURIComponent(e)}=${encodeURIComponent(n.value)}`;return n.metadata!==void 0&&(r+=h9+n.metadata.toString()),r})}function k7e(t){const e=t.split(h9);if(e.length<=0)return;const n=e.shift();if(!n)return;const r=n.indexOf(C7e);if(r<=0)return;const i=decodeURIComponent(n.substring(0,r).trim()),o=decodeURIComponent(n.substring(r+1).trim());let s;return e.length>0&&(s=$Ue(e.join(h9))),{key:i,value:o,metadata:s}}class R7e{inject(e,n,r){const i=FP.getBaggage(e);if(!i||SV(e))return;const o=$7e(i).filter(a=>a.length<=E7e).slice(0,T7e),s=A7e(o);s.length>0&&r.set(n,hz,s)}extract(e,n,r){const i=r.get(n,hz),o=Array.isArray(i)?i.join(m9):i;if(!o)return e;const s={};return o.length===0||(o.split(m9).forEach(c=>{const d=k7e(c);if(d){const p={value:d.value};d.metadata&&(p.metadata=d.metadata),s[d.key]=p}}),Object.entries(s).length===0)?e:FP.setBaggage(e,FP.createBaggage(s))}fields(){return[hz]}}function uj(t){const e={};if(typeof t!="object"||t==null)return e;for(const[n,r]of Object.entries(t)){if(!_7e(n)){jr.warn(`Invalid attribute key: ${n}`);continue}if(!Ope(r)){jr.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?e[n]=r.slice():e[n]=r}return e}function _7e(t){return typeof t=="string"&&t.length>0}function Ope(t){return t==null?!0:Array.isArray(t)?I7e(t):vpe(t)}function I7e(t){let e;for(const n of t)if(n!=null){if(!e){if(vpe(n)){e=typeof n;continue}return!1}if(typeof n!==e)return!1}return!0}function vpe(t){switch(typeof t){case"number":case"boolean":case"string":return!0}return!1}function j7e(){return t=>{jr.error(Q7e(t))}}function Q7e(t){return typeof t=="string"?t:JSON.stringify(D7e(t))}function D7e(t){const e={};let n=t;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(r=>{if(e[r])return;const i=n[r];i&&(e[r]=String(i))}),n=Object.getPrototypeOf(n);return e}let M7e=j7e();function sw(t){try{M7e(t)}catch{}}const QS=performance,N7e="2.0.1",mz="exception.message",z7e="exception.stacktrace",gz="exception.type",q7e="service.name",g9="telemetry.sdk.language",L7e="webjs",y9="telemetry.sdk.name",O9="telemetry.sdk.version",U7e="process.runtime.name",yz={[y9]:"opentelemetry",[U7e]:"browser",[g9]:L7e,[O9]:N7e};const V7e=9,B7e=6,X7e=Math.pow(10,B7e),GQ=Math.pow(10,V7e);function SS(t){const e=t/1e3,n=Math.trunc(e),r=Math.round(t%1e3*X7e);return[n,r]}function bpe(){let t=QS.timeOrigin;if(typeof t!="number"){const e=QS;t=e.timing&&e.timing.fetchStart}return t}function Z7e(t){const e=SS(bpe()),n=SS(typeof t=="number"?t:QS.now());return Spe(e,n)}function Y7e(t,e){let n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=GQ),[n,r]}function G7e(t){return t[0]*GQ+t[1]}function xpe(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}function $J(t){return xpe(t)||typeof t=="number"||t instanceof Date}function Spe(t,e){const n=[t[0]+e[0],t[1]+e[1]];return n[1]>=GQ&&(n[1]-=GQ,n[0]+=1),n}var Vp;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(Vp||(Vp={}));class W7e{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields=="function"?n.fields():[]).reduce((n,r)=>n.concat(r),[])))}inject(e,n,r){for(const i of this._propagators)try{i.inject(e,n,r)}catch(o){jr.warn(`Failed to inject with ${i.constructor.name}. Err: ${o.message}`)}}extract(e,n,r){return this._propagators.reduce((i,o)=>{try{return o.extract(i,n,r)}catch(s){jr.warn(`Failed to extract with ${o.constructor.name}. Err: ${s.message}`)}return i},e)}fields(){return this._fields.slice()}}const v9="[_0-9a-z-*/]",F7e=`[a-z]${v9}{0,255}`,H7e=`[a-z0-9]${v9}{0,240}@[a-z]${v9}{0,13}`,J7e=new RegExp(`^(?:${F7e}|${H7e})$`),K7e=/^[ -~]{0,255}[!-~]$/,e6e=/,|=/;function t6e(t){return J7e.test(t)}function n6e(t){return K7e.test(t)&&!e6e.test(t)}const kJ=32,r6e=512,RJ=",",_J="=";class wV{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,n){const r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,n),r}unset(e){const n=this._clone();return n._internalState.delete(e),n}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,n)=>(e.push(n+_J+this.get(n)),e),[]).join(RJ)}_parse(e){e.length>r6e||(this._internalState=e.split(RJ).reverse().reduce((n,r)=>{const i=r.trim(),o=i.indexOf(_J);if(o!==-1){const s=i.slice(0,o),a=i.slice(o+1,r.length);t6e(s)&&n6e(a)&&n.set(s,a)}return n},new Map),this._internalState.size>kJ&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,kJ))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){const e=new wV;return e._internalState=new Map(this._internalState),e}}const Oz="traceparent",vz="tracestate",i6e="00",o6e="(?!ff)[\\da-f]{2}",s6e="(?![0]{32})[\\da-f]{32}",a6e="(?![0]{16})[\\da-f]{16}",l6e="[\\da-f]{2}",c6e=new RegExp(`^\\s?(${o6e})-(${s6e})-(${a6e})-(${l6e})(-.*)?\\s?$`);function u6e(t){const e=c6e.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}class d6e{inject(e,n,r){const i=vc.getSpanContext(e);if(!i||SV(e)||!aM(i))return;const o=`${i6e}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||ng.NONE).toString(16)}`;r.set(n,Oz,o),i.traceState&&r.set(n,vz,i.traceState.serialize())}extract(e,n,r){const i=r.get(n,Oz);if(!i)return e;const o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;const s=u6e(o);if(!s)return e;s.isRemote=!0;const a=r.get(n,vz);if(a){const c=Array.isArray(a)?a.join(","):a;s.traceState=new wV(typeof c=="string"?c:void 0)}return vc.setSpanContext(e,s)}fields(){return[Oz,vz]}}const f6e="[object Object]",p6e="[object Null]",h6e="[object Undefined]",m6e=Function.prototype,wpe=m6e.toString,g6e=wpe.call(Object),y6e=Object.getPrototypeOf,Cpe=Object.prototype,Tpe=Cpe.hasOwnProperty,Pb=Symbol?Symbol.toStringTag:void 0,Epe=Cpe.toString;function IJ(t){if(!O6e(t)||v6e(t)!==f6e)return!1;const e=y6e(t);if(e===null)return!0;const n=Tpe.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&wpe.call(n)===g6e}function O6e(t){return t!=null&&typeof t=="object"}function v6e(t){return t==null?t===void 0?h6e:p6e:Pb&&Pb in Object(t)?b6e(t):x6e(t)}function b6e(t){const e=Tpe.call(t,Pb),n=t[Pb];let r=!1;try{t[Pb]=void 0,r=!0}catch{}const i=Epe.call(t);return r&&(e?t[Pb]=n:delete t[Pb]),i}function x6e(t){return Epe.call(t)}const S6e=20;function w6e(...t){let e=t.shift();const n=new WeakMap;for(;t.length>0;)e=Ppe(e,t.shift(),0,n);return e}function bz(t){return WQ(t)?t.slice():t}function Ppe(t,e,n=0,r){let i;if(!(n>S6e)){if(n++,dj(t)||dj(e)||Ape(e))i=bz(e);else if(WQ(t)){if(i=t.slice(),WQ(e))for(let o=0,s=e.length;o<s;o++)i.push(bz(e[o]));else if(rP(e)){const o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){const c=o[s];i[c]=bz(e[c])}}}else if(rP(t))if(rP(e)){if(!C6e(t,e))return e;i=Object.assign({},t);const o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){const c=o[s],d=e[c];if(dj(d))typeof d>"u"?delete i[c]:i[c]=d;else{const p=i[c],g=d;if(jJ(t,c,r)||jJ(e,c,r))delete i[c];else{if(rP(p)&&rP(g)){const O=r.get(p)||[],v=r.get(g)||[];O.push({obj:t,key:c}),v.push({obj:e,key:c}),r.set(p,O),r.set(g,v)}i[c]=Ppe(i[c],d,n,r)}}}}else i=e;return i}}function jJ(t,e,n){const r=n.get(t[e])||[];for(let i=0,o=r.length;i<o;i++){const s=r[i];if(s.key===e&&s.obj===t)return!0}return!1}function WQ(t){return Array.isArray(t)}function Ape(t){return typeof t=="function"}function rP(t){return!dj(t)&&!WQ(t)&&!Ape(t)&&typeof t=="object"}function dj(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function C6e(t,e){return!(!IJ(t)||!IJ(e))}class T6e{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,n)=>{this._resolve=e,this._reject=n})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}class E6e{_callback;_that;_isCalled=!1;_deferred=new T6e;constructor(e,n){this._callback=e,this._that=n}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}function P6e(){return"unknown_service"}const PP=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";class FQ{_rawAttributes;_asyncAttributesPending=!1;_memoizedAttributes;static FromAttributeList(e){const n=new FQ({});return n._rawAttributes=QJ(e),n._asyncAttributesPending=e.filter(([r,i])=>PP(i)).length>0,n}constructor(e){const n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([r,i])=>(PP(i)&&(this._asyncAttributesPending=!0),[r,i])),this._rawAttributes=QJ(this._rawAttributes)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){const[n,r]=this._rawAttributes[e];this._rawAttributes[e]=[n,PP(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&jr.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const e={};for(const[n,r]of this._rawAttributes){if(PP(r)){jr.debug(`Unsettled resource attribute ${n} skipped`);continue}r!=null&&(e[n]??=r)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}merge(e){return e==null?this:FQ.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()])}}function $pe(t){return FQ.FromAttributeList(Object.entries(t))}function A6e(){return $pe({[q7e]:P6e(),[g9]:yz[g9],[y9]:yz[y9],[O9]:yz[O9]})}function QJ(t){return t.map(([e,n])=>PP(n)?[e,n.catch(r=>{jr.debug("promise rejection for resource attribute: %s - %s",e,r)})]:[e,n])}const $6e="exception";class k6e{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;name;status={code:exports.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){const n=Date.now();this._spanContext=e.spanContext,this._performanceStartTime=QS.now(),this._performanceOffset=n-(this._performanceStartTime+bpe()),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit||0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,this.links=e.links||[],this.startTime=this._getTime(e.startTime??n),this.resource=e.resource,this.instrumentationScope=e.scope,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,n){if(n==null||this._isSpanEnded())return this;if(e.length===0)return jr.warn(`Invalid attribute key: ${e}`),this;if(!Ope(n))return jr.warn(`Invalid attribute value set for key: ${e}`),this;const{attributeCountLimit:r}=this._spanLimits;return r!==void 0&&Object.keys(this.attributes).length>=r&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(n),this)}setAttributes(e){for(const[n,r]of Object.entries(e))this.setAttribute(n,r);return this}addEvent(e,n,r){if(this._isSpanEnded())return this;const{eventCountLimit:i}=this._spanLimits;if(i===0)return jr.warn("No events allowed."),this._droppedEventsCount++,this;i!==void 0&&this.events.length>=i&&(this._droppedEventsCount===0&&jr.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),$J(n)&&($J(r)||(r=n),n=void 0);const o=uj(n);return this.events.push({name:e,attributes:o,time:this._getTime(r),droppedAttributesCount:0}),this}addLink(e){return this.links.push(e),this}addLinks(e){return this.links.push(...e),this}setStatus(e){return this._isSpanEnded()?this:(this.status={...e},this.status.message!=null&&typeof e.message!="string"&&(jr.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`),delete this.status.message),this)}updateName(e){return this._isSpanEnded()?this:(this.name=e,this)}end(e){if(this._isSpanEnded()){jr.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this._ended=!0,this.endTime=this._getTime(e),this._duration=Y7e(this.startTime,this.endTime),this._duration[0]<0&&(jr.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&jr.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e=="number"&&e<=QS.now())return Z7e(e+this._performanceOffset);if(typeof e=="number")return SS(e);if(e instanceof Date)return SS(e.getTime());if(xpe(e))return e;if(this._startTimeProvided)return SS(Date.now());const n=QS.now()-this._performanceStartTime;return Spe(this.startTime,SS(n))}isRecording(){return this._ended===!1}recordException(e,n){const r={};typeof e=="string"?r[mz]=e:e&&(e.code?r[gz]=e.code.toString():e.name&&(r[gz]=e.name),e.message&&(r[mz]=e.message),e.stack&&(r[z7e]=e.stack)),r[gz]||r[mz]?this.addEvent($6e,r,n):jr.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){const e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);jr.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,n){return e.length<=n?e:e.substring(0,n)}_truncateToSize(e){const n=this._attributeValueLengthLimit;return n<=0?(jr.warn(`Attribute value limit must be positive, got ${n}`),e):typeof e=="string"?this._truncateToLimitUtil(e,n):Array.isArray(e)?e.map(r=>typeof r=="string"?this._truncateToLimitUtil(r,n):r):e}}var aw;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(aw||(aw={}));class HQ{shouldSample(){return{decision:aw.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class DS{shouldSample(){return{decision:aw.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class F_{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||(sw(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new DS),this._remoteParentSampled=e.remoteParentSampled??new DS,this._remoteParentNotSampled=e.remoteParentNotSampled??new HQ,this._localParentSampled=e.localParentSampled??new DS,this._localParentNotSampled=e.localParentNotSampled??new HQ}shouldSample(e,n,r,i,o,s){const a=vc.getSpanContext(e);return!a||!aM(a)?this._root.shouldSample(e,n,r,i,o,s):a.isRemote?a.traceFlags&ng.SAMPLED?this._remoteParentSampled.shouldSample(e,n,r,i,o,s):this._remoteParentNotSampled.shouldSample(e,n,r,i,o,s):a.traceFlags&ng.SAMPLED?this._localParentSampled.shouldSample(e,n,r,i,o,s):this._localParentNotSampled.shouldSample(e,n,r,i,o,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}class DJ{_ratio;_upperBound;constructor(e=0){this._ratio=e,this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,n){return{decision:ppe(n)&&this._accumulate(n)<this._upperBound?aw.RECORD_AND_SAMPLED:aw.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!="number"||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let n=0;for(let r=0;r<e.length/8;r++){const i=r*8,o=parseInt(e.slice(i,i+8),16);n=(n^o)>>>0}return n}}const MJ=1;function kpe(){return{sampler:Rpe(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function Rpe(){const t="parentbased_always_on";switch(t){case"always_on":return new DS;case"always_off":return new HQ;case"parentbased_always_on":return new F_({root:new DS});case"parentbased_always_off":return new F_({root:new HQ});case"traceidratio":return new DJ(NJ());case"parentbased_traceidratio":return new F_({root:new DJ(NJ())});default:return jr.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "parentbased_always_on".`),new F_({root:new DS})}}function NJ(){return jr.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${MJ}.`),MJ}const R6e=128,_6e=1/0;function I6e(t){const e={sampler:Rpe()},n=kpe(),r=Object.assign({},n,e,t);return r.generalLimits=Object.assign({},n.generalLimits,t.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,t.spanLimits||{}),r}function j6e(t){const e=Object.assign({},t.spanLimits);return e.attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??void 0??void 0??R6e,e.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??void 0??void 0??_6e,Object.assign({},t,{spanLimits:e})}class Q6e{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,n){this._exporter=e,this._maxExportBatchSize=typeof n?.maxExportBatchSize=="number"?n.maxExportBatchSize:512,this._maxQueueSize=typeof n?.maxQueueSize=="number"?n.maxQueueSize:2048,this._scheduledDelayMillis=typeof n?.scheduledDelayMillis=="number"?n.scheduledDelayMillis:5e3,this._exportTimeoutMillis=typeof n?.exportTimeoutMillis=="number"?n.exportTimeoutMillis:3e4,this._shutdownOnce=new E6e(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(jr.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,n){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&ng.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&jr.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(jr.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,n)=>{const r=[],i=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let o=0,s=i;o<s;o++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(n)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,n)=>{const r=setTimeout(()=>{n(new Error("Timeout"))},this._exportTimeoutMillis);Zm.with(w7e(Zm.active()),()=>{let i;this._finishedSpans.length<=this._maxExportBatchSize?(i=this._finishedSpans,this._finishedSpans=[]):i=this._finishedSpans.splice(0,this._maxExportBatchSize);const o=()=>this._exporter.export(i,a=>{clearTimeout(r),a.code===Vp.SUCCESS?e():n(a.error??new Error("BatchSpanProcessor: span export failed"))});let s=null;for(let a=0,c=i.length;a<c;a++){const d=i[a];d.resource.asyncAttributesPending&&d.resource.waitForAsyncAttributes&&(s??=[],s.push(d.resource.waitForAsyncAttributes()))}s===null?o():Promise.all(s).then(o,a=>{sw(a),n(a)})})})}_maybeStartTimer(){if(this._isExporting)return;const e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(n=>{this._isExporting=!1,sw(n)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),this._timer,void 0)}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}class D6e extends Q6e{_visibilityChangeListener;_pageHideListener;constructor(e,n){super(e,n),this.onInit(n)}onInit(e){e?.disableAutoFlushOnDocumentHide!==!0&&typeof document<"u"&&(this._visibilityChangeListener=()=>{document.visibilityState==="hidden"&&this.forceFlush().catch(n=>{sw(n)})},this._pageHideListener=()=>{this.forceFlush().catch(n=>{sw(n)})},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){typeof document<"u"&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}}const M6e=8,N6e=16;class z6e{generateTraceId=zJ(N6e);generateSpanId=zJ(M6e)}const H_=Array(32);function zJ(t){return function(){for(let n=0;n<t*2;n++)H_[n]=Math.floor(Math.random()*16)+48,H_[n]>=58&&(H_[n]+=39);return String.fromCharCode.apply(null,H_.slice(0,t*2))}}class q6e{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;constructor(e,n,r,i){const o=I6e(n);this._sampler=o.sampler,this._generalLimits=o.generalLimits,this._spanLimits=o.spanLimits,this._idGenerator=n.idGenerator||new z6e,this._resource=r,this._spanProcessor=i,this.instrumentationScope=e}startSpan(e,n={},r=Zm.active()){n.root&&(r=vc.deleteSpan(r));const i=vc.getSpan(r);if(SV(r))return jr.debug("Instrumentation suppressed, returning Noop Span"),vc.wrapSpanContext(dpe);const o=i?.spanContext(),s=this._idGenerator.generateSpanId();let a,c,d;!o||!vc.isSpanContextValid(o)?c=this._idGenerator.generateTraceId():(c=o.traceId,d=o.traceState,a=o);const p=n.kind??p9.INTERNAL,g=(n.links??[]).map(E=>({context:E.context,attributes:uj(E.attributes)})),O=uj(n.attributes),v=this._sampler.shouldSample(r,c,e,p,O,g);d=v.traceState??d;const w=v.decision===YQ.RECORD_AND_SAMPLED?ng.SAMPLED:ng.NONE,S={traceId:c,spanId:s,traceFlags:w,traceState:d};if(v.decision===YQ.NOT_RECORD)return jr.debug("Recording is off, propagating context in a non-recording span"),vc.wrapSpanContext(S);const C=uj(Object.assign(O,v.attributes));return new k6e({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:S,name:e,kind:p,links:g,parentSpanContext:a,attributes:C,startTime:n.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits})}startActiveSpan(e,n,r,i){let o,s,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(o=n,a=r):(o=n,s=r,a=i);const c=s??Zm.active(),d=this.startSpan(e,o,c),p=vc.setSpan(c,d);return Zm.with(p,a,void 0,d)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}class L6e{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){const e=[];for(const n of this._spanProcessors)e.push(n.forceFlush());return new Promise(n=>{Promise.all(e).then(()=>{n()}).catch(r=>{sw(r||new Error("MultiSpanProcessor: forceFlush failed")),n()})})}onStart(e,n){for(const r of this._spanProcessors)r.onStart(e,n)}onEnd(e){for(const n of this._spanProcessors)n.onEnd(e)}shutdown(){const e=[];for(const n of this._spanProcessors)e.push(n.shutdown());return new Promise((n,r)=>{Promise.all(e).then(()=>{n()},r)})}}var Ab;(function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"})(Ab||(Ab={}));class U6e{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){const n=w6e({},kpe(),j6e(e));this._resource=n.resource??A6e(),this._config=Object.assign({},n,{resource:this._resource});const r=[];e.spanProcessors?.length&&r.push(...e.spanProcessors),this._activeSpanProcessor=new L6e(r)}getTracer(e,n,r){const i=`${e}@${n||""}:${r?.schemaUrl||""}`;return this._tracers.has(i)||this._tracers.set(i,new q6e({name:e,version:n,schemaUrl:r?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(i)}forceFlush(){const e=this._config.forceFlushTimeoutMillis,n=this._activeSpanProcessor._spanProcessors.map(r=>new Promise(i=>{let o;const s=setTimeout(()=>{i(new Error(`Span processor did not completed within timeout period of ${e} ms`)),o=Ab.timeout},e);r.forceFlush().then(()=>{clearTimeout(s),o!==Ab.timeout&&(o=Ab.resolved,i(o))}).catch(a=>{clearTimeout(s),o=Ab.error,i(a)})}));return new Promise((r,i)=>{Promise.all(n).then(o=>{const s=o.filter(a=>a!==Ab.resolved);s.length>0?i(s):r()}).catch(o=>i([o]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}class V6e{_enabled=!1;_currentContext=uS;_bindFunction(e=uS,n){const r=this,i=function(...o){return r.with(e,()=>n.apply(this,o))};return Object.defineProperty(i,"length",{enumerable:!1,configurable:!0,writable:!1,value:n.length}),i}active(){return this._currentContext}bind(e,n){return e===void 0&&(e=this.active()),typeof n=="function"?this._bindFunction(e,n):n}disable(){return this._currentContext=uS,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=uS,this)}with(e,n,r,...i){const o=this._currentContext;this._currentContext=e||uS;try{return n.call(r,...i)}finally{this._currentContext=o}}}function B6e(t){if(t!==null){if(t===void 0){const e=new V6e;e.enable(),Zm.setGlobalContextManager(e);return}t.enable(),Zm.setGlobalContextManager(t)}}function X6e(t){if(t!==null){if(t===void 0){FP.setGlobalPropagator(new W7e({propagators:[new d6e,new R7e]}));return}FP.setGlobalPropagator(t)}}class Z6e extends U6e{constructor(e={}){super(e)}register(e={}){vc.setGlobalTracerProvider(this),X6e(e.propagator),B6e(e.contextManager)}}class Y6e{_delegate;constructor(e){this._delegate=e}export(e,n){this._delegate.export(e,n)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}class qJ extends Error{code;name="OTLPExporterError";data;constructor(e,n,r){super(e),this.data=r,this.code=n}}function G6e(t){if(Number.isFinite(t)&&t>0)return t;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${t}')`)}function W6e(t){if(t!=null)return()=>t}function F6e(t,e,n){return{timeoutMillis:G6e(t.timeoutMillis??e.timeoutMillis??n.timeoutMillis),concurrencyLimit:t.concurrencyLimit??e.concurrencyLimit??n.concurrencyLimit,compression:t.compression??e.compression??n.compression}}function H6e(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}class J6e{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(e);const n=()=>{const r=this._sendingPromises.indexOf(e);this._sendingPromises.splice(r,1)};e.then(n,n)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}function K6e(t){return new J6e(t.concurrencyLimit)}function eVe(t){return Object.prototype.hasOwnProperty.call(t,"partialSuccess")}function tVe(){return{handleResponse(t){t==null||!eVe(t)||t.partialSuccess==null||Object.keys(t.partialSuccess).length===0||jr.warn("Received Partial Success response:",JSON.stringify(t.partialSuccess))}}}class nVe{_transport;_serializer;_responseHandler;_promiseQueue;_timeout;_diagLogger;constructor(e,n,r,i,o){this._transport=e,this._serializer=n,this._responseHandler=r,this._promiseQueue=i,this._timeout=o,this._diagLogger=jr.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,n){if(this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit()){n({code:Vp.FAILED,error:new Error("Concurrent export limit reached")});return}const r=this._serializer.serializeRequest(e);if(r==null){n({code:Vp.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(r,this._timeout).then(i=>{if(i.status==="success"){if(i.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(i.data))}catch(o){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",o,i.data)}n({code:Vp.SUCCESS});return}else if(i.status==="failure"&&i.error){n({code:Vp.FAILED,error:i.error});return}else i.status==="retryable"?n({code:Vp.FAILED,error:new qJ("Export failed with retryable status")}):n({code:Vp.FAILED,error:new qJ("Export failed with unknown error")})},i=>n({code:Vp.FAILED,error:i})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function rVe(t,e){return new nVe(t.transport,t.serializer,tVe(),t.promiseHandler,e.timeout)}function _pe(t,e,n){return rVe({transport:n,serializer:e,promiseHandler:K6e(t)},{timeout:t.timeoutMillis})}function LJ(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:t-55}function Ipe(t){const e=new Uint8Array(t.length/2);let n=0;for(let r=0;r<t.length;r+=2){const i=LJ(t.charCodeAt(r)),o=LJ(t.charCodeAt(r+1));e[n++]=i<<4|o}return e}function jpe(t){const e=BigInt(1e9);return BigInt(t[0])*e+BigInt(t[1])}function iVe(t){const e=Number(BigInt.asUintN(32,t)),n=Number(BigInt.asUintN(32,t>>BigInt(32)));return{low:e,high:n}}function oVe(t){const e=jpe(t);return iVe(e)}function sVe(t){return jpe(t).toString()}const aVe=typeof BigInt<"u"?sVe:G7e;function UJ(t){return t}function lVe(t){if(t!==void 0)return Ipe(t)}const cVe={encodeHrTime:oVe,encodeSpanContext:Ipe,encodeOptionalSpanContext:lVe};function uVe(t){return t===void 0?cVe:{encodeHrTime:aVe,encodeSpanContext:UJ,encodeOptionalSpanContext:UJ}}function dVe(t){return{attributes:lM(t.attributes),droppedAttributesCount:0}}function fVe(t){return{name:t.name,version:t.version}}function lM(t){return Object.keys(t).map(e=>Qpe(e,t[e]))}function Qpe(t,e){return{key:t,value:Dpe(e)}}function Dpe(t){const e=typeof t;return e==="string"?{stringValue:t}:e==="number"?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:e==="boolean"?{boolValue:t}:t instanceof Uint8Array?{bytesValue:t}:Array.isArray(t)?{arrayValue:{values:t.map(Dpe)}}:e==="object"&&t!=null?{kvlistValue:{values:Object.entries(t).map(([n,r])=>Qpe(n,r))}}:{}}function pVe(t,e){const n=t.spanContext(),r=t.status,i=t.parentSpanContext?.spanId?e.encodeSpanContext(t.parentSpanContext?.spanId):void 0;return{traceId:e.encodeSpanContext(n.traceId),spanId:e.encodeSpanContext(n.spanId),parentSpanId:i,traceState:n.traceState?.serialize(),name:t.name,kind:t.kind==null?0:t.kind+1,startTimeUnixNano:e.encodeHrTime(t.startTime),endTimeUnixNano:e.encodeHrTime(t.endTime),attributes:lM(t.attributes),droppedAttributesCount:t.droppedAttributesCount,events:t.events.map(o=>mVe(o,e)),droppedEventsCount:t.droppedEventsCount,status:{code:r.code,message:r.message},links:t.links.map(o=>hVe(o,e)),droppedLinksCount:t.droppedLinksCount}}function hVe(t,e){return{attributes:t.attributes?lM(t.attributes):[],spanId:e.encodeSpanContext(t.context.spanId),traceId:e.encodeSpanContext(t.context.traceId),traceState:t.context.traceState?.serialize(),droppedAttributesCount:t.droppedAttributesCount||0}}function mVe(t,e){return{attributes:t.attributes?lM(t.attributes):[],name:t.name,timeUnixNano:e.encodeHrTime(t.time),droppedAttributesCount:t.droppedAttributesCount||0}}function gVe(t,e){const n=uVe(e);return{resourceSpans:OVe(t,n)}}function yVe(t){const e=new Map;for(const n of t){let r=e.get(n.resource);r||(r=new Map,e.set(n.resource,r));const i=`${n.instrumentationScope.name}@${n.instrumentationScope.version||""}:${n.instrumentationScope.schemaUrl||""}`;let o=r.get(i);o||(o=[],r.set(i,o)),o.push(n)}return e}function OVe(t,e){const n=yVe(t),r=[],i=n.entries();let o=i.next();for(;!o.done;){const[s,a]=o.value,c=[],d=a.values();let p=d.next();for(;!p.done;){const O=p.value;if(O.length>0){const v=O.map(w=>pVe(w,e));c.push({scope:fVe(O[0].instrumentationScope),spans:v,schemaUrl:O[0].instrumentationScope.schemaUrl})}p=d.next()}const g={resource:dVe(s),scopeSpans:c,schemaUrl:void 0};r.push(g),o=i.next()}return r}const vVe={serializeRequest:t=>{const e=gVe(t,{});return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};const e=new TextDecoder;return JSON.parse(e.decode(t))}},bVe=5,xVe=1e3,SVe=5e3,wVe=1.5,VJ=.2;function CVe(){return Math.random()*(2*VJ)-VJ}class TVe{_transport;constructor(e){this._transport=e}retry(e,n,r){return new Promise((i,o)=>{setTimeout(()=>{this._transport.send(e,n).then(i,o)},r)})}async send(e,n){const r=Date.now()+n;let i=await this._transport.send(e,n),o=bVe,s=xVe;for(;i.status==="retryable"&&o>0;){o--;const a=Math.max(Math.min(s,SVe)+CVe(),0);s=s*wVe;const c=i.retryInMillis??a,d=r-Date.now();if(c>d)return i;i=await this.retry(e,d,c)}return i}shutdown(){return this._transport.shutdown()}}function Mpe(t){return new TVe(t.transport)}function EVe(t){return[429,502,503,504].includes(t)}function PVe(t){if(t==null)return;const e=Number.parseInt(t,10);if(Number.isInteger(e))return e>0?e*1e3:-1;const n=new Date(t).getTime()-Date.now();return n>=0?n:0}class AVe{_parameters;constructor(e){this._parameters=e}send(e,n){return new Promise(r=>{const i=new XMLHttpRequest;i.timeout=n,i.open("POST",this._parameters.url);const o=this._parameters.headers();Object.entries(o).forEach(([s,a])=>{i.setRequestHeader(s,a)}),i.ontimeout=s=>{r({status:"failure",error:new Error("XHR request timed out")})},i.onreadystatechange=()=>{i.status>=200&&i.status<=299?(jr.debug("XHR success"),r({status:"success"})):i.status&&EVe(i.status)?r({status:"retryable",retryInMillis:PVe(i.getResponseHeader("Retry-After"))}):i.status!==0&&r({status:"failure",error:new Error("XHR request failed with non-retryable status")})},i.onabort=()=>{r({status:"failure",error:new Error("XHR request aborted")})},i.onerror=()=>{r({status:"failure",error:new Error("XHR request errored")})},i.send(e)})}shutdown(){}}function $Ve(t){return new AVe(t)}class kVe{_params;constructor(e){this._params=e}send(e){return new Promise(n=>{navigator.sendBeacon(this._params.url,new Blob([e],{type:this._params.blobType}))?(jr.debug("SendBeacon success"),n({status:"success"})):n({status:"failure",error:new Error("SendBeacon failed")})})}shutdown(){}}function RVe(t){return new kVe(t)}function _Ve(t,e){return _pe(t,e,Mpe({transport:$Ve(t)}))}function IVe(t,e){return _pe(t,e,Mpe({transport:RVe({url:t.url,blobType:t.headers()["Content-Type"]})}))}function jVe(t){return()=>{const e={};return Object.entries(t?.()??{}).forEach(([n,r])=>{typeof r<"u"?e[n]=String(r):jr.warn(`Header "${n}" has invalid value (${r}) and will be ignored`)}),e}}function QVe(t,e,n){const r={...n()},i={};return()=>(e!=null&&Object.assign(i,e()),t!=null&&Object.assign(i,t()),Object.assign(i,r))}function DVe(t){if(t!=null)try{return new URL(t),t}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${t}'`)}}function MVe(t,e,n){return{...F6e(t,e,n),headers:QVe(jVe(t.headers),e.headers,n.headers),url:DVe(t.url)??e.url??n.url,agentOptions:t.agentOptions??e.agentOptions??n.agentOptions}}function NVe(t,e){return{...H6e(),headers:()=>t,url:"http://localhost:4318/"+e,agentOptions:{keepAlive:!0}}}function zVe(t,e,n){return MVe({url:t.url,timeoutMillis:t.timeoutMillis,headers:W6e(t.headers),concurrencyLimit:t.concurrencyLimit},{},NVe(n,e))}function qVe(t,e,n,r){const i=!!t.headers||typeof navigator.sendBeacon!="function",o=zVe(t,n,r);return i?_Ve(o,e):IVe(o,e)}class LVe extends Y6e{constructor(e={}){super(qVe(e,vVe,"v1/traces",{"Content-Type":"application/json"}))}}const UVe="service.name",VVe="service.version";let Npe=class{emit(e){}};const BVe=new Npe;class XVe{getLogger(e,n,r){return new Npe}}const zpe=new XVe;class ZVe{constructor(e,n,r,i){this._provider=e,this.name=n,this.version=r,this.options=i}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;const e=this._provider.getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):BVe}}class BJ{getLogger(e,n,r){var i;return(i=this.getDelegateLogger(e,n,r))!==null&&i!==void 0?i:new ZVe(this,e,n,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:zpe}setDelegate(e){this._delegate=e}getDelegateLogger(e,n,r){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,n,r)}}const YVe=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},J_=Symbol.for("io.opentelemetry.js.api.logs"),iP=YVe;function GVe(t,e,n){return r=>r===t?e:n}const XJ=1;class CV{constructor(){this._proxyLoggerProvider=new BJ}static getInstance(){return this._instance||(this._instance=new CV),this._instance}setGlobalLoggerProvider(e){return iP[J_]?this.getLoggerProvider():(iP[J_]=GVe(XJ,e,zpe),this._proxyLoggerProvider.setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=iP[J_])===null||e===void 0?void 0:e.call(iP,XJ))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete iP[J_],this._proxyLoggerProvider=new BJ}}const qpe=CV.getInstance();function WVe(t,e,n,r){for(let i=0,o=t.length;i<o;i++){const s=t[i];e&&s.setTracerProvider(e),n&&s.setMeterProvider(n),r&&s.setLoggerProvider&&s.setLoggerProvider(r),s.getConfig().enabled||s.enable()}}function FVe(t){t.forEach(e=>e.disable())}function HVe(t){const e=t.tracerProvider||vc.getTracerProvider(),n=t.meterProvider||mpe.getMeterProvider(),r=t.loggerProvider||qpe.getLoggerProvider(),i=t.instrumentations?.flat()??[];return WVe(i,e,n,r),()=>{FVe(i)}}let Tu=console.error.bind(console);function oP(t,e,n){const r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}const Lpe=(t,e,n)=>{if(!t||!t[e]){Tu("no original function "+String(e)+" to wrap");return}if(!n){Tu("no wrapper function"),Tu(new Error().stack);return}const r=t[e];if(typeof r!="function"||typeof n!="function"){Tu("original object and wrapper must be functions");return}const i=n(r,e);return oP(i,"__original",r),oP(i,"__unwrap",()=>{t[e]===i&&oP(t,e,r)}),oP(i,"__wrapped",!0),oP(t,e,i),i},JVe=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{Tu("must provide one or more modules to patch"),Tu(new Error().stack);return}if(!(e&&Array.isArray(e))){Tu("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(i=>{Lpe(r,i,n)})})},Upe=(t,e)=>{if(!t||!t[e]){Tu("no function to unwrap."),Tu(new Error().stack);return}const n=t[e];if(!n.__unwrap)Tu("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}},KVe=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{Tu("must provide one or more modules to patch"),Tu(new Error().stack);return}if(!(e&&Array.isArray(e))){Tu("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{Upe(n,r)})})};class e8e{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=jr.createComponentLogger({namespace:e}),this._tracer=vc.getTracer(e,n),this._meter=mpe.getMeter(e,n),this._logger=qpe.getLogger(e,n),this._updateMetricInstruments()}_wrap=Lpe;_unwrap=Upe;_massWrap=JVe;_massUnwrap=KVe;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){const e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,n,r,i){if(e)try{e(r,i)}catch(o){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},o)}}}class t8e extends e8e{constructor(e,n,r){super(e,n,r),this._config.enabled&&this.enable()}}class n8e{span=void 0;constructor(e){this.span=e}get context(){return this.span?.context}error(e){this.span&&(this.span.setStatus(exports.SpanStatusCode.ERROR,e.message),this.span.recordException(e),this.span.end())}setAttribute(e,n){this.span&&this.span.setAttribute(e,n)}setStatus(e,n){this.span&&this.span.setStatus(e,n)}end(){this.span&&(this.span.setStatus(exports.SpanStatusCode.OK),this.span.end())}}const wS=t=>t.replace(/([A-Z])/g,"_$1").toLowerCase(),ZJ=t=>t.reduce((e,n)=>{if(!n||typeof n!="object")return e;const r=n.object;if(!r||typeof r!="string")return e;const i=e.notUpdated.find(({object:o})=>o===r);return i?(e.updated=[i,n],e.notUpdated=e.notUpdated.filter(({object:o})=>o!==r)):e.updated.some(({object:o})=>o===r)||e.notUpdated.push(n),e},{updated:[],notUpdated:[]}),K_=(t,e,n,r=!0)=>{for(const[i,o]of Object.entries(t))if(o!==void 0){const s=r?wS(i):i;n[`${e}${s}`]=o}},r8e=(t,e,n)=>{for(const[r,i]of Object.entries(t))i==null||typeof i=="object"||(n[`${e}.${wS(r)}`]=i)};class i8e{config=null;tracer=null;tracerProvider=null;initialized=!1;initTracer(e){throw new Error("initTracer must be implemented by the environment-specific client")}init(e){this.config=e,this.initTracer(e)}send(e){try{if(!this.tracer||!this.config)return;const n=e,r="time"in n&&n.time?new Date(n.time):new Date;this.tracer.startSpan(`event.${n.type}`,{attributes:this.processAttributes(n,r),startTime:r}).end(r)}catch(n){this.config?.isProd||console.error("Event reporting failed:",n)}}processAttributes(e,n){const r=e.data,i={...this.buildBaseAttributes(e,n),...this.extractFieldAttributes("project",e),...this.extractFieldAttributes("organization",e)};return this.processEventData(r,i),this.processSubjects(e,i),this.processExtensionAttributes(e,i),i}buildBaseAttributes(e,n){return{"cloudevents.event_id":ZQ(),"cloudevents.event_type":e.type,"cloudevents.event_source":e.source||void 0,"cloudevents.event_spec_version":e.specversion,"cloudevents.event_data_content_type":e.datacontenttype||"application/json; charset=utf-8","cloudevents.event_time":n.toISOString(),"cloudevents.event_subject":("subject"in e?e.subject:void 0)||"","cloudevents.page.uri":typeof location<"u"?location.href:void 0,"cloudevents.event_version":this.config?.version,"cloudevents.event_origin":this.config?.serviceName,"cloudevents.event_source_details.id":e.sourceDetails?.id||"anonymous","cloudevents.event_source_details.object":e.sourceDetails?.object||"anonymous","cloudevents.event_source_details.uri":e.sourceDetails?.uri||void 0,"cloudevents.metadata.user_id":("analyticsMetadata"in e?e.analyticsMetadata?.userId:void 0)||void 0,"cloudevents.metadata.user_ip_address":("analyticsMetadata"in e?e.analyticsMetadata?.userIpAddress:void 0)||void 0}}processEventData(e,n){!e||typeof e!="object"||(Array.isArray(e)?this.processArrayData(e,n):this.processObjectData(e,n))}processArrayData(e,n){e.some(i=>i&&typeof i=="object"&&typeof i.object=="string")?this.processEventBusStyleData(e,n):this.processSimpleArrayData(e,n)}processEventBusStyleData(e,n){const r=ZJ(e);r.updated.forEach((i,o)=>{const s=`cloudevents.event_data.${o===0?"after.":"before."}${i.object}.`;K_(i,s,n)}),r.notUpdated.forEach(i=>{const o=`cloudevents.event_data.${i.object}.`;K_(i,o,n)})}processSimpleArrayData(e,n){for(const r of e)if(!(!r||typeof r!="object"))for(const[i,o]of Object.entries(r)){if(o===void 0)continue;const s=wS(i);o!==null&&typeof o=="object"&&!Array.isArray(o)?r8e(o,`cloudevents.event_data.${s}`,n):n[`cloudevents.event_data.${s}`]=o}}processObjectData(e,n){for(const[r,i]of Object.entries(e)){if(i===void 0)continue;const o=wS(r);if(typeof i=="object"&&i!==null&&!Array.isArray(i))for(const[s,a]of Object.entries(i))a!==void 0&&(n[`cloudevents.event_data.${o}.${s}`]=a);else n[`cloudevents.event_data.${o}`]=i}}processSubjects(e,n){if(!("subjects"in e)||!Array.isArray(e.subjects))return;const r=ZJ(e.subjects);r.updated.forEach((i,o)=>{const s=`cloudevents.subjects.${o===0?"after.":"before."}${i.object}.`;K_(i,s,n,!1)}),r.notUpdated.forEach(i=>{const o=`cloudevents.subjects.${i.object}.`;K_(i,o,n,!1)})}processExtensionAttributes(e,n){const r=["id","source","type","specversion","time","datacontenttype","data","subject","sourceDetails","analyticsMetadata","context"];for(const[i,o]of Object.entries(e))if(!(r.includes(i)||o===void 0))if(o instanceof Object)for(const[s,a]of Object.entries(o))a!==void 0&&(n[`cloudevents.${i}.${s}`]=a);else n[`cloudevents.${i}`]=o}extractFieldAttributes(e,n){const r=n,i=`${e}Id`,o=`${e}Slug`;if(i in r&&o in r)return{[`cloudevents.${e}.id`]:r[i],[`cloudevents.${e}.slug`]:r[o]};const s=r.data;if(Array.isArray(s)&&s.length){const a=s.find(c=>c?.object===e);if(a)return{[`cloudevents.${e}.id`]:a.id,[`cloudevents.${e}.slug`]:a.slug}}return{}}startSpan(e,n){try{if(!this.tracer)return;let r;const i=e.time?new Date(e.time):new Date,o=this.tracer.startSpan(`event.${e.type}`,{attributes:this.processAttributes(e,i),root:!n},n);return n||(r=vc.setSpan(Zm.active(),o)),{end:()=>o.end(),setAttribute:(s,a)=>{o.setAttribute(`cloudevents.event_data.${wS(s)}`,a)},setStatus:(s,a)=>o.setStatus({code:s,message:a}),parentCtx:r}}catch(r){this.config?.isProd||console.error("Event reporting failed:",r);return}}startStepSpan(e){try{if(!this.tracer)return;const n=Zm.active(),r=e,i=r.time?new Date(r.time):new Date,o=this.tracer.startSpan(`event.${r.type}`,{attributes:this.processAttributes(r,i)},n),s=vc.setSpan(n,o);return{end:()=>o.end(),setAttribute:(a,c)=>{o.setAttribute(`cloudevents.event_data.${wS(a)}`,c)},setStatus:(a,c)=>o.setStatus({code:a,message:c}),recordException:a=>o.recordException(a),context:s}}catch(n){this.config?.isProd||console.error("Event reporting failed:",n);return}}traceStep(e){const n=this.startStepSpan(e);if(n)return new n8e(n)}async forceFlush(){return this.tracerProvider?.forceFlush()}async shutdown(){return this.tracerProvider?.shutdown()}}class o8e extends i8e{tracer=null;initialized=!1;constructor(){super()}initTracer(e){if(!e.collectorUrl&&!e.collectorTraceUrl)return;const n=`ses_${ZQ()}`,r=$pe({[UVe]:e.serviceName,[VVe]:e.serviceVersion,session_id:n}),i=e.collectorTraceUrl||`${e.collectorUrl}/v1/traces`;this.tracerProvider=new Z6e({resource:r,spanProcessors:[new D6e(new LVe({url:i,headers:{}}))]}),this.tracer=this.tracerProvider.getTracer(e.tracerName),this.tracerProvider.register(),HVe({instrumentations:e.instrumentations??[]}),this.initialized=!0}}class rO extends t8e{sendErrorEvent;originalConsoleError;constructor(e,n){super("errors","1.0",e||{}),this.sendErrorEvent=n}static toErrorEvent(e,n){return{type:"error",payload:[{handler:n,errorType:rO.getErrorType(e),message:rO.getErrorMessage(e),stack:rO.getErrorStack(e)}]}}enable(){window.addEventListener("error",this.onError),window.addEventListener("unhandledrejection",this.onUnhandledRejection),this.wrapConsoleError()}disable(){window.removeEventListener("error",this.onError),window.removeEventListener("unhandledrejection",this.onUnhandledRejection),this.unwrapConsoleError()}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>4096?n.substring(0,4096):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,o)=>o!==n).map(i=>String(i)).join(" ");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")};wrapConsoleError(){this.originalConsoleError=console.error,console.error=(...e)=>{try{const n=rO.combineConsoleErrorArgs(e);this.sendError(n,"console.error")}catch(n){process.env.NODE_ENV!=="production"&&this.originalConsoleError?.call(console,"Error reporting failed:",n)}this.originalConsoleError?.apply(console,e)}}unwrapConsoleError(){this.originalConsoleError&&(console.error=this.originalConsoleError,this.originalConsoleError=void 0)}sendError(e,n){this.sendErrorEvent(rO.toErrorEvent(e,n))}}class s8e{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>{},this.otelClient=new o8e,this.tracer={traceStep:(e,n)=>{const r=this.constructCloudEvent(e,n);return this.otelClient.traceStep(r)}}}updateCloudEventData=e=>{this.config?.disabled||(this.useCloudEventData=e)};send(e,n){try{if(!this.config?.otel.isProd)return;const i=e&&typeof e=="object"&&"type"in e&&"data"in e?e:this.constructCloudEvent(e,n);this.sendToOtelService(i)}catch(r){this.config?.otel.isProd||console.error("Event reporting failed:",r)}}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,instrumentations:[...e.otel.enableErrorInstrumentation===!0?[new rO(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);return this.otelClient.startSpan(i,r)}constructCloudEvent(e,n){const r=this.useCloudEventData();return dUe({type:e,additionalData:r,data:n})}sendToOtelService(e){this.config?.otel.isProd||console.log("CloudEvent to be sent to OTEL service:",e),this.otelClient.send(e)}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=rO.toErrorEvent(e,n);this.sendToOtelService({type:r.type,data:r.payload})}sendTabChangeMessage(e){this.send("tab.change",e)}sendButtonClickMessage(e){this.send("button.click",e)}sendTabOpenFailedMessage(e){this.send("tab.open_failed",e)}sendChangeMessage(e){this.send("change",e)}sendContentCopyMessage(e){this.send("content.copy",e)}sendRequestSendMessage(e){this.send("request.send",e)}sendTokenGenerateMessage(e){this.send("token.generate",e)}sendAppLifecycleMessage(e){this.send("app.lifecycle",e)}sendEnvironmentManagementMessage(e){this.send("environment.management",e)}sendServerManagementMessage(e){this.send("server.management",e)}sendInputManagementMessage(e){this.send("input.management",e)}sendNodeManagementMessage(e){this.send("node.management",e)}sendHistoryManagementMessage(e){this.send("history.management",e)}sendHistoryMigrationMessage(e){this.send("history.migration",e)}sendCredentialManagementMessage(e){this.send("credential.management",e)}sendPanelToggleMessage(e){this.send("panel.toggle",e)}sendWorkflowRunClickMessage(e){this.send("workflow.run.click",e)}sendWorkflowRunResultMessage(e){this.send("workflow.run.result",e)}sendStorageReadMessage(){this.send("storage.read")}sendStorageLoadUserStateMessage(){this.send("storage.loadUserState")}sendStorageDetectFilesMessage(){this.send("storage.detectFiles")}sendStorageLoadApisMessage(){this.send("storage.loadApis")}sendStorageParseApisMessage(){this.send("storage.parseApis")}sendStorageParseCollectionsMessage(){this.send("storage.parseCollections")}sendUpdaterCheckMessage(){this.send("updater.check")}sendUpdaterDownloadMessage(){this.send("updater.download")}sendUpdaterInstallMessage(){this.send("updater.install")}sendUpdaterProcessMessage(){this.send("updater.process")}sendErrorMessage(e){this.send("error",e)}sendCodeEditorSearchMessage(e){this.send("code_editor.search",e)}}const cM=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],a8e="https://cors.redocly.com/";function l8e(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function YJ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function GJ(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?YJ(Object(n),!0).forEach(function(r){l8e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):YJ(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function xa(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var WJ=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),xz=function(){return Math.random().toString(36).substring(7).split("").join(".")},yO={INIT:"@@redux/INIT"+xz(),REPLACE:"@@redux/REPLACE"+xz(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+xz()}};function Vpe(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function c8e(t){if(t===void 0)return"undefined";if(t===null)return"null";var e=typeof t;switch(e){case"boolean":case"string":case"number":case"symbol":case"function":return e}if(Array.isArray(t))return"array";if(f8e(t))return"date";if(d8e(t))return"error";var n=u8e(t);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return e.slice(8,-1).toLowerCase().replace(/\s/g,"")}function u8e(t){return typeof t.constructor=="function"?t.constructor.name:null}function d8e(t){return t instanceof Error||typeof t.message=="string"&&t.constructor&&typeof t.constructor.stackTraceLimit=="number"}function f8e(t){return t instanceof Date?!0:typeof t.toDateString=="function"&&typeof t.getDate=="function"&&typeof t.setDate=="function"}function Fy(t){var e=typeof t;return process.env.NODE_ENV!=="production"&&(e=c8e(t)),e}function uM(t,e,n){var r;if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?xa(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(process.env.NODE_ENV==="production"?xa(1):"Expected the enhancer to be a function. Instead, received: '"+Fy(n)+"'");return n(uM)(t,e)}if(typeof t!="function")throw new Error(process.env.NODE_ENV==="production"?xa(2):"Expected the root reducer to be a function. Instead, received: '"+Fy(t)+"'");var i=t,o=e,s=[],a=s,c=!1;function d(){a===s&&(a=s.slice())}function p(){if(c)throw new Error(process.env.NODE_ENV==="production"?xa(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return o}function g(S){if(typeof S!="function")throw new Error(process.env.NODE_ENV==="production"?xa(4):"Expected the listener to be a function. Instead, received: '"+Fy(S)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?xa(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var C=!0;return d(),a.push(S),function(){if(C){if(c)throw new Error(process.env.NODE_ENV==="production"?xa(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");C=!1,d();var E=a.indexOf(S);a.splice(E,1),s=null}}}function O(S){if(!Vpe(S))throw new Error(process.env.NODE_ENV==="production"?xa(7):"Actions must be plain objects. Instead, the actual type was: '"+Fy(S)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof S.type>"u")throw new Error(process.env.NODE_ENV==="production"?xa(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error(process.env.NODE_ENV==="production"?xa(9):"Reducers may not dispatch actions.");try{c=!0,o=i(o,S)}finally{c=!1}for(var C=s=a,T=0;T<C.length;T++){var E=C[T];E()}return S}function v(S){if(typeof S!="function")throw new Error(process.env.NODE_ENV==="production"?xa(10):"Expected the nextReducer to be a function. Instead, received: '"+Fy(S));i=S,O({type:yO.REPLACE})}function w(){var S,C=g;return S={subscribe:function(E){if(typeof E!="object"||E===null)throw new Error(process.env.NODE_ENV==="production"?xa(11):"Expected the observer to be an object. Instead, received: '"+Fy(E)+"'");function $(){E.next&&E.next(p())}$();var _=C($);return{unsubscribe:_}}},S[WJ]=function(){return this},S}return O({type:yO.INIT}),r={dispatch:O,subscribe:g,getState:p,replaceReducer:v},r[WJ]=w,r}var p8e=uM;function b9(t){typeof console<"u"&&typeof console.error=="function"&&console.error(t);try{throw new Error(t)}catch{}}function h8e(t,e,n,r){var i=Object.keys(e),o=n&&n.type===yO.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(i.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!Vpe(t))return"The "+o+' has unexpected type of "'+Fy(t)+'". Expected argument to be an object with the following '+('keys: "'+i.join('", "')+'"');var s=Object.keys(t).filter(function(a){return!e.hasOwnProperty(a)&&!r[a]});if(s.forEach(function(a){r[a]=!0}),!(n&&n.type===yO.REPLACE)&&s.length>0)return"Unexpected "+(s.length>1?"keys":"key")+" "+('"'+s.join('", "')+'" found in '+o+". ")+"Expected to find one of the known reducer keys instead: "+('"'+i.join('", "')+'". Unexpected keys will be ignored.')}function m8e(t){Object.keys(t).forEach(function(e){var n=t[e],r=n(void 0,{type:yO.INIT});if(typeof r>"u")throw new Error(process.env.NODE_ENV==="production"?xa(12):'The slice reducer for key "'+e+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof n(void 0,{type:yO.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?xa(13):'The slice reducer for key "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle '"+yO.INIT+`' or other actions in "redux/*" `)+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}function g8e(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++){var i=e[r];process.env.NODE_ENV!=="production"&&typeof t[i]>"u"&&b9('No reducer provided for key "'+i+'"'),typeof t[i]=="function"&&(n[i]=t[i])}var o=Object.keys(n),s;process.env.NODE_ENV!=="production"&&(s={});var a;try{m8e(n)}catch(c){a=c}return function(d,p){if(d===void 0&&(d={}),a)throw a;if(process.env.NODE_ENV!=="production"){var g=h8e(d,n,p,s);g&&b9(g)}for(var O=!1,v={},w=0;w<o.length;w++){var S=o[w],C=n[S],T=d[S],E=C(T,p);if(typeof E>"u"){var $=p&&p.type;throw new Error(process.env.NODE_ENV==="production"?xa(14):"When called with an action of type "+($?'"'+String($)+'"':"(unknown type)")+', the slice reducer for key "'+S+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.')}v[S]=E,O=O||E!==T}return O=O||o.length!==Object.keys(d).length,O?v:d}}function FJ(t,e){return function(){return e(t.apply(this,arguments))}}function y8e(t,e){if(typeof t=="function")return FJ(t,e);if(typeof t!="object"||t===null)throw new Error(process.env.NODE_ENV==="production"?xa(16):"bindActionCreators expected an object or a function, but instead received: '"+Fy(t)+`'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?`);var n={};for(var r in t){var i=t[r];typeof i=="function"&&(n[r]=FJ(i,e))}return n}function Bpe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.length===0?function(r){return r}:e.length===1?e[0]:e.reduce(function(r,i){return function(){return r(i.apply(void 0,arguments))}})}function O8e(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(r){return function(){var i=r.apply(void 0,arguments),o=function(){throw new Error(process.env.NODE_ENV==="production"?xa(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},s={getState:i.getState,dispatch:function(){return o.apply(void 0,arguments)}},a=e.map(function(c){return c(s)});return o=Bpe.apply(void 0,a)(i.dispatch),GJ(GJ({},i),{},{dispatch:o})}}}function HJ(){}process.env.NODE_ENV!=="production"&&typeof HJ.name=="string"&&HJ.name!=="isCrushed"&&b9('You are currently using minified code outside of NODE_ENV === "production". This means that you are running a slower development build of Redux. You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) to ensure you have the correct code for your production build.');var v8e=Object.freeze({__proto__:null,__DO_NOT_USE__ActionTypes:yO,applyMiddleware:O8e,bindActionCreators:y8e,combineReducers:g8e,compose:Bpe,createStore:uM,legacy_createStore:p8e});function b8e(t){var e=t.default;if(typeof e=="function"){var n=function(){return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var x8e=b8e(v8e);x8e.compose;var S8e=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(t){return t}};function w8e(t,e,n){var r=!1,i=!1,o=uM(function(a,c){if(!i){var d=function(C){return Array.isArray(C)&&C.findIndex(function(T){return typeof T!="string"&&typeof T!="number"})===-1};if(c.type.startsWith("SET")){var p=function(C){try{r=!0,"value"in c?C.set(c.value):C.set(An)}finally{r=!1}};if(c.path){if(d(c.path)){c.path.length===0&&p(t);for(var g=t,O=!0,v=0,w=c.path;v<w.length;v++){var S=w[v];g[S]?g=g[S]:O=!1}O&&p(g)}}else p(t)}else c.type==="BREAKPOINT"&&n()}return t.promised||t.error?An:t.get({noproxy:!0})},S8e({name:"".concat(window.location.hostname,": ").concat(e),trace:!0,traceLimit:16,autoPause:!0,shouldHotReload:!1,features:{persist:!0,pause:!0,lock:!1,export:"custom",import:"custom",jump:!1,skip:!1,reorder:!1,dispatch:!0,test:!1}})),s=function(a,c){if(r)c&&c();else try{i=!0,o.dispatch(a)}finally{i=!1}};return s}function C8e(t){return function(){var e,n,r=!1;return{onInit:function(i,o){if(!(typeof window>"u"||!("__REDUX_DEVTOOLS_EXTENSION__"in window))){if(t?.key===void 0){if(o.identifier===void 0)throw Error("State is missing Identifiable extension or Devtools key option");e=o.identifier(i)}else e=t.key;n=w8e(i,e,function(){r=!r}),i.promise||n?.({type:"CREATE",state:i.get({noproxy:!0,stealth:!0})})}},onSet:function(i,o){if(n?.({type:"SET [".concat(i.path.join("/"),"]"),state:i.get({noproxy:!0,stealth:!0}),descriptor:o}),r)debugger},onDestroy:function(){n?.({type:"DESTROY"})}}}}var Er=(t=>(t.Normal="Normal",t.Edit="Edit",t.Draft="Draft",t))(Er||{});const Q$="default",Xpe=[{name:Q$,inputs:[],servers:[],state:Er.Normal}],Zpe={activeTabIdx:0,tabs:[]};var Lp=(t=>(t.Idle="idle",t.Loading="loading",t.Success="success",t.Error="error",t))(Lp||{});function Ym(t){const e=new WeakMap;function n(r){if(typeof r!="object"||r===null)return r;if(e.has(r))return e.get(r);const i=Array.isArray(r)?[]:{};e.set(r,i);for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&(i[o]=n(r[o]));return i}return n(t)}function x9(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!x9(t[i],e[i]))return!1;return!0}const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++){const o=n[i];if(!Object.prototype.hasOwnProperty.call(e,o)||!x9(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function JJ(t){return Object.keys(t).forEach(e=>{t[e]===void 0&&delete t[e]}),t}function T8e(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function ul(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}function Xs(){return!!window?.__TAURI__}async function KJ(t,e,n){const r=[],i=[];for(const o of t){const s=Promise.resolve().then(()=>n(o,t));if(r.push(s),e<=t.length){const a=s.then(()=>i.splice(i.indexOf(a),1));i.push(a),i.length>=e&&await Promise.race(i)}}return Promise.all(r)}const Zl={FS:"fs",WEB:"web"};async function hh(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}var S9;(function(t){t[t.Audio=1]="Audio",t[t.Cache=2]="Cache",t[t.Config=3]="Config",t[t.Data=4]="Data",t[t.LocalData=5]="LocalData",t[t.Document=6]="Document",t[t.Download=7]="Download",t[t.Picture=8]="Picture",t[t.Public=9]="Public",t[t.Video=10]="Video",t[t.Resource=11]="Resource",t[t.Temp=12]="Temp",t[t.AppConfig=13]="AppConfig",t[t.AppData=14]="AppData",t[t.AppLocalData=15]="AppLocalData",t[t.AppCache=16]="AppCache",t[t.AppLog=17]="AppLog",t[t.Desktop=18]="Desktop",t[t.Executable=19]="Executable",t[t.Font=20]="Font",t[t.Home=21]="Home",t[t.Runtime=22]="Runtime",t[t.Template=23]="Template"})(S9||(S9={}));var w9;(function(t){t[t.Start=0]="Start",t[t.Current=1]="Current",t[t.End=2]="End"})(w9||(w9={}));async function C9(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await hh("plugin:fs|mkdir",{path:t instanceof URL?t.toString():t,options:e})}async function TV(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await hh("plugin:fs|read_dir",{path:t instanceof URL?t.toString():t,options:e})}async function Ype(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await hh("plugin:fs|read_file",{path:t instanceof URL?t.toString():t,options:e});return n instanceof ArrayBuffer?new Uint8Array(n):Uint8Array.from(n)}async function dM(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await hh("plugin:fs|read_text_file",{path:t instanceof URL?t.toString():t,options:e})}async function Gpe(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await hh("plugin:fs|remove",{path:t instanceof URL?t.toString():t,options:e})}async function Wpe(t,e,n){if(t instanceof URL&&t.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await hh("plugin:fs|rename",{oldPath:t instanceof URL?t.toString():t,newPath:e instanceof URL?e.toString():e,options:n})}async function E8e(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await hh("plugin:fs|write_file",e,{headers:{path:t instanceof URL?t.toString():t,options:JSON.stringify(n)}})}async function Fpe(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await hh("plugin:fs|write_text_file",{path:t instanceof URL?t.toString():t,data:e,options:n})}async function fM(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await hh("plugin:fs|exists",{path:t instanceof URL?t.toString():t,options:e})}const EV=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return S9},get SeekMode(){return w9},exists:fM,mkdir:C9,readDir:TV,readFile:Ype,readTextFile:dM,remove:Gpe,rename:Wpe,writeFile:E8e,writeTextFile:Fpe},Symbol.toStringTag,{value:"Module"}));var zA;(function(t){t[t.Audio=1]="Audio",t[t.Cache=2]="Cache",t[t.Config=3]="Config",t[t.Data=4]="Data",t[t.LocalData=5]="LocalData",t[t.Document=6]="Document",t[t.Download=7]="Download",t[t.Picture=8]="Picture",t[t.Public=9]="Public",t[t.Video=10]="Video",t[t.Resource=11]="Resource",t[t.Temp=12]="Temp",t[t.AppConfig=13]="AppConfig",t[t.AppData=14]="AppData",t[t.AppLocalData=15]="AppLocalData",t[t.AppCache=16]="AppCache",t[t.AppLog=17]="AppLog",t[t.Desktop=18]="Desktop",t[t.Executable=19]="Executable",t[t.Font=20]="Font",t[t.Home=21]="Home",t[t.Runtime=22]="Runtime",t[t.Template=23]="Template"})(zA||(zA={}));async function Hpe(){return ul("plugin:path|resolve_directory",{directory:zA.AppData})}async function Jpe(){return ul("plugin:path|resolve_directory",{directory:zA.Desktop})}function PV(){return window.__TAURI_INTERNALS__.plugins.path.sep}async function Kpe(...t){return ul("plugin:path|resolve",{paths:t})}async function MS(...t){return ul("plugin:path|join",{paths:t})}async function ehe(t){return ul("plugin:path|dirname",{path:t})}async function the(t){return ul("plugin:path|extname",{path:t})}async function AV(t,e){return ul("plugin:path|basename",{path:t,ext:e})}async function nhe(t){return ul("plugin:path|is_absolute",{path:t})}const rhe=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return zA},appDataDir:Hpe,basename:AV,desktopDir:Jpe,dirname:ehe,extname:the,isAbsolute:nhe,join:MS,resolve:Kpe,sep:PV},Symbol.toStringTag,{value:"Module"}));class Fr{static utils=null;static async getUtils(){return Fr.utils||(Fr.utils=Xs()?await Promise.resolve().then(()=>require("./replay-tauri-path-ajRwPy6A.js")):await Promise.resolve().then(()=>jTe)),Fr.utils}static async dirname(e){return(await Fr.getUtils()).dirname(e)}static async join(...e){return(await Fr.getUtils()).join(...e)}static async resolve(e){return(await Fr.getUtils()).resolve(e)}static async isAbsolute(e){return(await Fr.getUtils()).isAbsolute(e)}static async relative(e,n){return(await Fr.getUtils()).relative(e,n)}static async extname(e){return(await Fr.getUtils()).extname(e)}}const P8e=new Set(["node_modules"]);class T9{constructor(e){this.baseDir=e,this.initializeDirectory(e)}writeExcludedKeys=new Set;listeners=new Map;writeEndTimers=new Map;on(e,n){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e)?.add(n)}off(e,n){this.listeners.get(e)?.delete(n)}emit(e,n){this.listeners.get(e)?.forEach(r=>r(n))}async initializeDirectory(e){await C9(e,{recursive:!0})}setWriteExcludedKeys(e){this.writeExcludedKeys=e}async ls(e){const n=await this.getFullPath(e);return this.getDirEntryFilesRecursively(n)}async getDirEntryFilesRecursively(e){try{const n=[],r=await TV(e);for(const i of r)if(i.isDirectory){if(P8e.has(i.name))continue;const o=await MS(e,i.name),s=await this.getDirEntryFilesRecursively(o);n.push(...s)}else{const o=await MS(e,i.name),s=await Fr.relative(this.baseDir,o);n.push(s)}return n}catch(n){return n.includes("forbidden path")||console.error(n),[]}}async get(e){const n=await this.getFullPath(e);try{return await dM(n)}catch(r){return!r.includes("No such file or directory")&&!r.includes("forbidden path")&&console.error(r),null}}async has(e){const n=await this.getFullPath(e);return await fM(n)}async set(e,n){if(!this.writeExcludedKeys.has(e)){this.emit("write-start",e);try{const r=await this.getFullPath(e),i=PV(),o=r.split(i).slice(0,-1).join(i);await C9(o,{recursive:!0}),await Fpe(r,n)}finally{const r=this.writeEndTimers.get(e);r&&clearTimeout(r);const i=setTimeout(()=>{this.emit("write-end",e),this.writeEndTimers.delete(e)},1e3);this.writeEndTimers.set(e,i)}}}async remove(e){if(!this.writeExcludedKeys.has(e)){this.emit("write-start",e);try{const n=await this.getFullPath(e);await Gpe(n)}catch(n){!n.includes("No such file or directory")&&!n.includes("forbidden path")&&console.error(n)}finally{const n=this.writeEndTimers.get(e);n&&clearTimeout(n);const r=setTimeout(()=>{this.emit("write-end",e),this.writeEndTimers.delete(e)},1e3);this.writeEndTimers.set(e,r)}}}async rename(e,n){const r=await this.getFullPath(e),i=await this.getFullPath(n);await Wpe(r,i)}async getFullPath(e){return await MS(this.baseDir,e??"")}}class A8e{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 $8e{constructor(e){this.projectId=e}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 ihe{constructor(e){this.storage=e}itemIds=[];async getAbsolutePath(e){return await Fr.resolve(await Fr.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(o){return console.error(`Error parsing from ${i.type} ${i.uri}:`,o),null}}))).filter(i=>i!==null)}setItemIds(e){this.itemIds=e}async write(e){e.state===Er.Draft||e.srcType!==Zl.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 o in r){const s=parseInt(o);switch(r[o]){case"D":await this.remove(this.itemIds[s]);break;case"I":case"U":await this.write(n[s]);break}}return}const i=this.itemIds.filter(o=>!n.some(s=>s.id===o));await Promise.all([...n.map(o=>this.write(o)),...i.map(o=>this.remove(o))])}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 o=i.path[0];i.path.length===1&&i.actions&&i.actions.id==="U"&&await this.remove(this.itemIds[o]),i.path[1]&&i.path[1]==="id"&&await this.remove(this.itemIds[o]),await this.write(n[o])}this.itemIds=n.map(o=>o.id)}}class k8e extends ihe{parse(e){return{...e.content,id:e.uri,srcType:e.type,fileDependencies:e.fileDependencies}}async stringify(e){const{id:n,srcType:r,fileDependencies:i,...o}=e;return await Fr.extname(n)===".json"?JSON.stringify(o,null,2):eg.dump(o)}async write(e){await this.storage.has(e.id)||await super.write(e)}}var ol=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(ol||{});const ohe=1024;let R8e=0,$d=class{constructor(e,n){this.from=e,this.to=n}};class Bn{constructor(e={}){this.id=R8e++,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=dl.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Bn.closedBy=new Bn({deserialize:t=>t.split(" ")});Bn.openedBy=new Bn({deserialize:t=>t.split(" ")});Bn.group=new Bn({deserialize:t=>t.split(" ")});Bn.isolate=new Bn({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Bn.contextHash=new Bn({perNode:!0});Bn.lookAhead=new Bn({perNode:!0});Bn.mounted=new Bn({perNode:!0});class qA{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[Bn.mounted.id]}}const _8e=Object.create(null);class dl{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):_8e,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new dl(e.name||"",n,e.id,r);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(i)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[o[0].id]=o[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(Bn.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(Bn.group),o=-1;o<(i?i.length:0);o++){let s=n[o<0?r.name:i[o]];if(s)return s}}}}dl.none=new dl("",Object.create(null),0,8);class pM{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 o of e){let s=o(r);s&&(i||(i=Object.assign({},r.props)),i[s[0].id]=s[1])}n.push(i?new dl(r.name,i,r.id,r.flags):r)}return new pM(n)}}const eI=new WeakMap,eK=new WeakMap;var wi;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(wi||(wi={}));let Ti=class E9{constructor(e,n,r,i,o){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,o&&o.length){this.props=Object.create(null);for(let[s,a]of o)this.props[typeof s=="number"?s:s.id]=a}}toString(){let e=qA.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 JQ(this.topNode,e)}cursorAt(e,n=0,r=0){let i=eI.get(this)||this.topNode,o=new JQ(i);return o.moveTo(e,n),eI.set(this,o._tree),o}get topNode(){return new Md(this,0,0,null)}resolve(e,n=0){let r=LA(eI.get(this)||this.topNode,e,n,!1);return eI.set(this,r),r}resolveInner(e,n=0){let r=LA(eK.get(this)||this.topNode,e,n,!0);return eK.set(this,r),r}resolveStack(e,n=0){return Q8e(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:o=this.length}=e,s=e.mode||0,a=(s&wi.IncludeAnonymous)>0;for(let c=this.cursor(s|wi.IncludeAnonymous);;){let d=!1;if(c.from<=o&&c.to>=i&&(!a&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;d=!0}for(;d&&r&&(a||!c.type.isAnonymous)&&r(c),!c.nextSibling();){if(!c.parent())return;d=!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:RV(dl.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new E9(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new E9(dl.none,n,r,i)))}static build(e){return D8e(e)}};Ti.empty=new Ti(dl.none,[],[],0);class $V{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 $V(this.buffer,this.index)}}class EO{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return dl.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],o=i.name;if(/\W/.test(o)&&!i.isError&&(o=JSON.stringify(o)),e+=4,r==e)return o;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return o+"("+s.join(",")+")"}findChild(e,n,r,i,o){let{buffer:s}=this,a=-1;for(let c=e;c!=n&&!(she(o,i,s[c+1],s[c+2])&&(a=c,r>0));c=s[c+3]);return a}slice(e,n,r){let i=this.buffer,o=new Uint16Array(n-e),s=0;for(let a=e,c=0;a<n;){o[c++]=i[a++],o[c++]=i[a++]-r;let d=o[c++]=i[a++]-r;o[c++]=i[a++]-e,s=Math.max(s,d)}return new EO(o,s,this.set)}}function she(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 LA(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 s=!r&&t instanceof Md&&t.index<0?null:t.parent;if(!s)return t;t=s}let o=r?0:wi.IgnoreOverlays;if(r)for(let s=t,a=s.parent;a;s=a,a=s.parent)s instanceof Md&&s.index<0&&((i=a.enter(e,n,o))===null||i===void 0?void 0:i.from)!=s.from&&(t=a);for(;;){let s=t.enter(e,n,o);if(!s)return t;t=s}}class ahe{cursor(e=0){return new JQ(this,e)}getChild(e,n=null,r=null){let i=tK(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return tK(this,e,n,r)}resolve(e,n=0){return LA(this,e,n,!1)}resolveInner(e,n=0){return LA(this,e,n,!0)}matchContext(e){return P9(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 Md=class fj extends ahe{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,o=0){for(let s=this;;){for(let{children:a,positions:c}=s._tree,d=n>0?a.length:-1;e!=d;e+=n){let p=a[e],g=c[e]+s.from;if(she(i,r,g,g+p.length)){if(p instanceof EO){if(o&wi.ExcludeBuffers)continue;let O=p.findChild(0,p.buffer.length,n,r-g,i);if(O>-1)return new Wp(new I8e(s,p,e,g),null,O)}else if(o&wi.IncludeAnonymous||!p.type.isAnonymous||kV(p)){let O;if(!(o&wi.IgnoreMounts)&&(O=qA.get(p))&&!O.overlay)return new fj(O.tree,g,e,s);let v=new fj(p,g,e,s);return o&wi.IncludeAnonymous||!v.type.isAnonymous?v:v.nextChild(n<0?p.children.length-1:0,n,r,i)}}}if(o&wi.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+n:e=n<0?-1:s._parent._tree.children.length,s=s._parent,!s))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&wi.IgnoreOverlays)&&(i=qA.get(this._tree))&&i.overlay){let o=e-this.from;for(let{from:s,to:a}of i.overlay)if((n>0?s<=o:s<o)&&(n<0?a>=o:a>o))return new fj(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 tK(t,e,n,r){let i=t.cursor(),o=[];if(!i.firstChild())return o;if(n!=null){for(let s=!1;!s;)if(s=i.type.is(n),!i.nextSibling())return o}for(;;){if(r!=null&&i.type.is(r))return o;if(i.type.is(e)&&o.push(i.node),!i.nextSibling())return r==null?o:[]}}function P9(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 I8e{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class Wp extends ahe{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,o=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return o<0?null:new Wp(this.context,this,o)}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&wi.ExcludeBuffers)return null;let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return o<0?null:new Wp(this.context,this,o)}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 Wp(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 Wp(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,o=r.buffer[this.index+3];if(o>i){let s=r.buffer[this.index+1];e.push(r.slice(i,o,s)),n.push(0)}return new Ti(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function lhe(t){if(!t.length)return null;let e=0,n=t[0];for(let o=1;o<t.length;o++){let s=t[o];(s.from>n.from||s.to<n.to)&&(n=s,e=o)}let r=n instanceof Md&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new j8e(i,n)}class j8e{constructor(e,n){this.heads=e,this.node=n}get next(){return lhe(this.heads)}}function Q8e(t,e,n){let r=t.resolveInner(e,n),i=null;for(let o=r instanceof Md?r:r.context.parent;o;o=o.parent)if(o.index<0){let s=o.parent;(i||(i=[r])).push(s.resolve(e,n)),o=s}else{let s=qA.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let a=new Md(s.tree,s.overlay[0].from+o.from,-1,o);(i||(i=[r])).push(LA(a,e,n,!1))}}return i?lhe(i):r}class JQ{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 Md)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 Md?(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,o=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}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&wi.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&wi.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&wi.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 o=0;o<this.index;o++)if(i.buffer.buffer[o+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 o=n+e,s=e<0?-1:r._tree.children.length;o!=s;o+=e){let a=r._tree.children[o];if(this.mode&wi.IncludeAnonymous||a instanceof EO||!a.type.isAnonymous||kV(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,o=this.stack.length;o>=0;){for(let s=e;s;s=s._parent)if(s.index==i){if(i==this.index)return s;n=s,r=o+1;break e}i=this.stack[--o]}for(let i=r;i<this.stack.length;i++)n=new Wp(this.buffer,n,this.stack[i]);return this.bufferNode=new Wp(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 P9(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,o=this.stack.length-1;i>=0;o--){if(o<0)return P9(this._tree,e,i);let s=r[n.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[i]&&e[i]!=s.name)return!1;i--}}return!0}}function kV(t){return t.children.some(e=>e instanceof EO||!e.type.isAnonymous||kV(e))}function D8e(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=ohe,reused:o=[],minRepeatType:s=r.types.length}=t,a=Array.isArray(n)?new $V(n,n.length):n,c=r.types,d=0,p=0;function g(R,Q,D,q,Z,Y){let{id:G,start:K,end:re,size:fe}=a,de=p,H=d;for(;fe<0;)if(a.next(),fe==-1){let ee=o[G];D.push(ee),q.push(K-R);return}else if(fe==-3){d=G;return}else if(fe==-4){p=G;return}else throw new RangeError(`Unrecognized record size: ${fe}`);let pe=c[G],se,ve,te=K-R;if(re-K<=i&&(ve=C(a.pos-Q,Z))){let ee=new Uint16Array(ve.size-ve.skip),ae=a.pos-ve.size,ie=ee.length;for(;a.pos>ae;)ie=T(ve.start,ee,ie);se=new EO(ee,re-ve.start,r),te=ve.start-R}else{let ee=a.pos-fe;a.next();let ae=[],ie=[],B=G>=s?G:-1,W=0,le=re;for(;a.pos>ee;)B>=0&&a.id==B&&a.size>=0?(a.end<=le-i&&(w(ae,ie,K,W,a.end,le,B,de,H),W=ae.length,le=a.end),a.next()):Y>2500?O(K,ee,ae,ie):g(K,ee,ae,ie,B,Y+1);if(B>=0&&W>0&&W<ae.length&&w(ae,ie,K,W,K,le,B,de,H),ae.reverse(),ie.reverse(),B>-1&&W>0){let Oe=v(pe,H);se=RV(pe,ae,ie,0,ae.length,0,re-K,Oe,Oe)}else se=S(pe,ae,ie,re-K,de-re,H)}D.push(se),q.push(te)}function O(R,Q,D,q){let Z=[],Y=0,G=-1;for(;a.pos>Q;){let{id:K,start:re,end:fe,size:de}=a;if(de>4)a.next();else{if(G>-1&&re<G)break;G<0&&(G=fe-i),Z.push(K,re,fe),Y++,a.next()}}if(Y){let K=new Uint16Array(Y*4),re=Z[Z.length-2];for(let fe=Z.length-3,de=0;fe>=0;fe-=3)K[de++]=Z[fe],K[de++]=Z[fe+1]-re,K[de++]=Z[fe+2]-re,K[de++]=de;D.push(new EO(K,Z[2]-re,r)),q.push(re-R)}}function v(R,Q){return(D,q,Z)=>{let Y=0,G=D.length-1,K,re;if(G>=0&&(K=D[G])instanceof Ti){if(!G&&K.type==R&&K.length==Z)return K;(re=K.prop(Bn.lookAhead))&&(Y=q[G]+K.length+re)}return S(R,D,q,Z,Y,Q)}}function w(R,Q,D,q,Z,Y,G,K,re){let fe=[],de=[];for(;R.length>q;)fe.push(R.pop()),de.push(Q.pop()+D-Z);R.push(S(r.types[G],fe,de,Y-Z,K-Y,re)),Q.push(Z-D)}function S(R,Q,D,q,Z,Y,G){if(Y){let K=[Bn.contextHash,Y];G=G?[K].concat(G):[K]}if(Z>25){let K=[Bn.lookAhead,Z];G=G?[K].concat(G):[K]}return new Ti(R,Q,D,q,G)}function C(R,Q){let D=a.fork(),q=0,Z=0,Y=0,G=D.end-i,K={size:0,start:0,skip:0};e:for(let re=D.pos-R;D.pos>re;){let fe=D.size;if(D.id==Q&&fe>=0){K.size=q,K.start=Z,K.skip=Y,Y+=4,q+=4,D.next();continue}let de=D.pos-fe;if(fe<0||de<re||D.start<G)break;let H=D.id>=s?4:0,pe=D.start;for(D.next();D.pos>de;){if(D.size<0)if(D.size==-3)H+=4;else break e;else D.id>=s&&(H+=4);D.next()}Z=pe,q+=fe,Y+=H}return(Q<0||q==R)&&(K.size=q,K.start=Z,K.skip=Y),K.size>4?K:void 0}function T(R,Q,D){let{id:q,start:Z,end:Y,size:G}=a;if(a.next(),G>=0&&q<s){let K=D;if(G>4){let re=a.pos-(G-4);for(;a.pos>re;)D=T(R,Q,D)}Q[--D]=K,Q[--D]=Y-R,Q[--D]=Z-R,Q[--D]=q}else G==-3?d=q:G==-4&&(p=q);return D}let E=[],$=[];for(;a.pos>0;)g(t.start||0,t.bufferStart||0,E,$,-1,0);let _=(e=t.length)!==null&&e!==void 0?e:E.length?$[0]+E[0].length:0;return new Ti(c[t.topID],E.reverse(),$.reverse(),_)}const nK=new WeakMap;function pj(t,e){if(!t.isAnonymous||e instanceof EO||e.type!=t)return 1;let n=nK.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Ti)){n=1;break}n+=pj(t,r)}nK.set(e,n)}return n}function RV(t,e,n,r,i,o,s,a,c){let d=0;for(let w=r;w<i;w++)d+=pj(t,e[w]);let p=Math.ceil(d*1.5/8),g=[],O=[];function v(w,S,C,T,E){for(let $=C;$<T;){let _=$,R=S[$],Q=pj(t,w[$]);for($++;$<T;$++){let D=pj(t,w[$]);if(Q+D>=p)break;Q+=D}if($==_+1){if(Q>p){let D=w[_];v(D.children,D.positions,0,D.children.length,S[_]+E);continue}g.push(w[_])}else{let D=S[$-1]+w[$-1].length-R;g.push(RV(t,w,S,_,$,R,D,null,c))}O.push(R+E-o)}}return v(e,n,r,i,0),(a||c)(g,O,s)}class _V{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 Wp?this.setBuffer(e.context.buffer,e.index,n):e instanceof Md&&this.map.set(e.tree,n)}get(e){return e instanceof Wp?this.getBuffer(e.context.buffer,e.index):e instanceof Md?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 Gm{constructor(e,n,r,i,o=!1,s=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(o?1:0)|(s?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 Gm(0,e.length,e,0,!1,r)];for(let o of n)o.to>e.length&&i.push(o);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],o=1,s=e.length?e[0]:null;for(let a=0,c=0,d=0;;a++){let p=a<n.length?n[a]:null,g=p?p.fromA:1e9;if(g-c>=r)for(;s&&s.from<g;){let O=s;if(c>=O.from||g<=O.to||d){let v=Math.max(O.from,c)-d,w=Math.min(O.to,g)-d;O=v>=w?null:new Gm(v,w,O.tree,O.offset+d,a>0,!!p)}if(O&&i.push(O),s.to>g)break;s=o<e.length?e[o++]:null}if(!p)break;c=p.toA,d=p.toA-p.toB}return i}}let IV=class{startParse(e,n,r){return typeof e=="string"&&(e=new M8e(e)),r=r?r.length?r.map(i=>new $d(i.from,i.to)):[new $d(0,0)]:[new $d(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let o=i.advance();if(o)return o}}};class M8e{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 N8e(t){return(e,n,r,i)=>new q8e(e,t,n,r,i)}class rK{constructor(e,n,r,i,o){this.parser=e,this.parse=n,this.overlay=r,this.target=i,this.from=o}}function iK(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class z8e{constructor(e,n,r,i,o,s,a){this.parser=e,this.predicate=n,this.mounts=r,this.index=i,this.start=o,this.target=s,this.prev=a,this.depth=0,this.ranges=[]}}const A9=new Bn({perNode:!0});class q8e{constructor(e,n,r,i,o){this.nest=n,this.input=r,this.fragments=i,this.ranges=o,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 Ti(r.type,r.children,r.positions,r.length,r.propValues.concat([[A9,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[Bn.mounted.id]=new qA(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 V8e(this.fragments),n=null,r=null,i=new JQ(new Md(this.baseTree,this.ranges[0].from,0,null),wi.IncludeAnonymous|wi.IgnoreMounts);e:for(let o,s;;){let a=!0,c;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)a=!1;else if(e.hasNode(i)){if(n){let d=n.mounts.find(p=>p.frag.from<=i.from&&p.frag.to>=i.to&&p.mount.overlay);if(d)for(let p of d.mount.overlay){let g=p.from+d.pos,O=p.to+d.pos;g>=i.from&&O<=i.to&&!n.ranges.some(v=>v.from<O&&v.to>g)&&n.ranges.push({from:g,to:O})}}a=!1}else if(r&&(s=L8e(r.ranges,i.from,i.to)))a=s!=2;else if(!i.type.isAnonymous&&(o=this.nest(i,this.input))&&(i.from<i.to||!o.overlay)){i.tree||U8e(i);let d=e.findMounts(i.from,o.parser);if(typeof o.overlay=="function")n=new z8e(o.parser,o.overlay,d,this.inner.length,i.from,i.tree,n);else{let p=aK(this.ranges,o.overlay||(i.from<i.to?[new $d(i.from,i.to)]:[]));p.length&&iK(p),(p.length||!o.overlay)&&this.inner.push(new rK(o.parser,p.length?o.parser.startParse(this.input,lK(d,p),p):o.parser.startParse(""),o.overlay?o.overlay.map(g=>new $d(g.from-i.from,g.to-i.from)):null,i.tree,p.length?p[0].from:i.from)),o.overlay?p.length&&(r={ranges:p,depth:0,prev:r}):a=!1}}else if(n&&(c=n.predicate(i))&&(c===!0&&(c=new $d(i.from,i.to)),c.from<c.to)){let d=n.ranges.length-1;d>=0&&n.ranges[d].to==c.from?n.ranges[d]={from:n.ranges[d].from,to:c.to}:n.ranges.push(c)}if(a&&i.firstChild())n&&n.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(n&&!--n.depth){let d=aK(this.ranges,n.ranges);d.length&&(iK(d),this.inner.splice(n.index,0,new rK(n.parser,n.parser.startParse(this.input,lK(n.mounts,d),d),n.ranges.map(p=>new $d(p.from-n.start,p.to-n.start)),n.target,d[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function L8e(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 oK(t,e,n,r,i,o){if(e<n){let s=t.buffer[e+1];r.push(t.slice(e,n,s)),i.push(s-o)}}function U8e(t){let{node:e}=t,n=[],r=e.context.buffer;do n.push(t.index),t.parent();while(!t.tree);let i=t.tree,o=i.children.indexOf(r),s=i.children[o],a=s.buffer,c=[o];function d(p,g,O,v,w,S){let C=n[S],T=[],E=[];oK(s,p,C,T,E,v);let $=a[C+1],_=a[C+2];c.push(T.length);let R=S?d(C+4,a[C+3],s.set.types[a[C]],$,_-$,S-1):e.toTree();return T.push(R),E.push($-v),oK(s,a[C+3],g,T,E,v),new Ti(O,T,E,w)}i.children[o]=d(0,a.length,dl.none,0,s.length,n.length-1);for(let p of c){let g=t.tree.children[p],O=t.tree.positions[p];t.yield(new Md(g,O+t.from,p,t._tree))}}class sK{constructor(e,n){this.offset=n,this.done=!1,this.cursor=e.cursor(wi.IncludeAnonymous|wi.IgnoreMounts)}moveTo(e){let{cursor:n}=this,r=e-this.offset;for(;!this.done&&n.from<r;)n.to>=e&&n.enter(r,1,wi.IgnoreOverlays|wi.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 Ti)n=n.children[0];else break}return!1}}let V8e=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(A9))!==null&&n!==void 0?n:r.to,this.inner=new sK(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(A9))!==null&&e!==void 0?e:n.to,this.inner=new sK(n.tree,-n.offset)}}findMounts(e,n){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let o=this.inner.cursor.node;o;o=o.parent){let s=(r=o.tree)===null||r===void 0?void 0:r.prop(Bn.mounted);if(s&&s.parser==n)for(let a=this.fragI;a<this.fragments.length;a++){let c=this.fragments[a];if(c.from>=o.to)break;c.tree==this.curFrag.tree&&i.push({frag:c,pos:o.from-c.offset,mount:s})}}}return i}};function aK(t,e){let n=null,r=e;for(let i=1,o=0;i<t.length;i++){let s=t[i-1].to,a=t[i].from;for(;o<r.length;o++){let c=r[o];if(c.from>=a)break;c.to<=s||(n||(r=n=e.slice()),c.from<s?(n[o]=new $d(c.from,s),c.to>a&&n.splice(o+1,0,new $d(a,c.to))):c.to>a?n[o--]=new $d(a,c.to):n.splice(o--,1))}}return r}function B8e(t,e,n,r){let i=0,o=0,s=!1,a=!1,c=-1e9,d=[];for(;;){let p=i==t.length?1e9:s?t[i].to:t[i].from,g=o==e.length?1e9:a?e[o].to:e[o].from;if(s!=a){let O=Math.max(c,n),v=Math.min(p,g,r);O<v&&d.push(new $d(O,v))}if(c=Math.min(p,g),c==1e9)break;p==c&&(s?(s=!1,i++):s=!0),g==c&&(a?(a=!1,o++):a=!0)}return d}function lK(t,e){let n=[];for(let{pos:r,mount:i,frag:o}of t){let s=r+(i.overlay?i.overlay[0].from:0),a=s+i.tree.length,c=Math.max(o.from,s),d=Math.min(o.to,a);if(i.overlay){let p=i.overlay.map(O=>new $d(O.from+r,O.to+r)),g=B8e(e,p,c,d);for(let O=0,v=c;;O++){let w=O==g.length,S=w?d:g[O].from;if(S>v&&n.push(new Gm(v,S,i.tree,-s,o.from>=v||o.openStart,o.to<=S||o.openEnd)),w)break;v=g[O].to}}else n.push(new Gm(c,d,i.tree,-s,o.from>=s||o.openStart,o.to<=a||o.openEnd))}return n}class KQ{constructor(e,n,r,i,o,s,a,c,d,p=0,g){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=o,this.score=s,this.buffer=a,this.bufferBase=c,this.curContext=d,this.lookAhead=p,this.parent=g}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 KQ(e,[],n,r,r,0,[],0,i?new cK(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:o}=this.p,s=this.reducePos<this.pos-25;s&&this.setLookAhead(this.pos);let a=o.dynamicPrecedence(i);if(a&&(this.score+=a),r==0){this.pushState(o.getGoto(this.state,i,!0),this.reducePos),i<o.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,s?8:4,!0),this.reduceContext(i,this.reducePos);return}let c=this.stack.length-(r-1)*3-(e&262144?6:0),d=c?this.stack[c-2]:this.p.ranges[0].from,p=this.reducePos-d;p>=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=p):this.p.lastBigReductionSize<p&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=p));let g=c?this.stack[c-1]:0,O=this.bufferBase+this.buffer.length-g;if(i<o.minRepeatTerm||e&131072){let v=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,d,v,O+4,!0)}if(e&262144)this.state=this.stack[c];else{let v=this.stack[c-3];this.state=o.getGoto(v,i,!0)}for(;this.stack.length>c;)this.stack.pop();this.reduceContext(i,d)}storeNode(e,n,r,i=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let s=this,a=this.buffer.length;if(a==0&&s.parent&&(a=s.bufferBase-s.parent.bufferBase,s=s.parent),a>0&&s.buffer[a-4]==0&&s.buffer[a-1]>-1){if(n==r)return;if(s.buffer[a-2]>=n){s.buffer[a-2]=r;return}}}if(!o||this.pos==r)this.buffer.push(e,n,r,i);else{let s=this.buffer.length;if(s>0&&this.buffer[s-4]!=0){let a=!1;for(let c=s;c>0&&this.buffer[c-2]>r;c-=4)if(this.buffer[c-1]>=0){a=!0;break}if(a)for(;s>0&&this.buffer[s-2]>r;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,i>4&&(i-=4)}this.buffer[s]=e,this.buffer[s+1]=n,this.buffer[s+2]=r,this.buffer[s+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let o=e,{parser:s}=this.p;(i>this.pos||n<=s.maxNode)&&(this.pos=i,s.stateFlag(o,1)||(this.reducePos=i)),this.pushState(o,r),this.shiftContext(n,r),n<=s.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 KQ(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 X8e(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 o=0,s;o<n.length;o+=2)(s=n[o+1])!=this.state&&this.p.parser.hasAction(s,e)&&i.push(n[o],s);if(this.stack.length<120)for(let o=0;i.length<8&&o<n.length;o+=2){let s=n[o+1];i.some((a,c)=>c&1&&a==s)||i.push(n[o],s)}n=i}let r=[];for(let i=0;i<n.length&&r.length<4;i+=2){let o=n[i+1];if(o==this.state)continue;let s=this.split();s.pushState(o,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(n[i],this.pos),s.reducePos=this.pos,s.score-=200,r.push(s)}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,o=this.stack.length-r*3;if(o<0||e.getGoto(this.stack[o],i,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;n=s}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,o)=>{if(!n.includes(i))return n.push(i),e.allActions(i,s=>{if(!(s&393216))if(s&65536){let a=(s>>19)-o;if(a>1){let c=s&65535,d=this.stack.length-a*3;if(d>=0&&e.getGoto(this.stack[d],c,!1)>=0)return a<<19|65536|c}}else{let a=r(s,o+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 cK(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 cK{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class X8e{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 eD{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 eD(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 eD(this.stack,this.pos,this.index)}}function AP(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r<t.length;){let o=0;for(;;){let s=t.charCodeAt(r++),a=!1;if(s==126){o=65535;break}s>=92&&s--,s>=34&&s--;let c=s-32;if(c>=46&&(c-=46,a=!0),o+=c,a)break;o*=46}n?n[i++]=o:n=new e(o)}return n}class hj{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const uK=new hj;class Z8e{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=uK,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,o=this.pos+e;for(;o<r.from;){if(!i)return null;let s=this.ranges[--i];o-=r.from-s.to,r=s}for(;n<0?o>r.to:o>=r.to;){if(i==this.ranges.length-1)return null;let s=this.ranges[++i];o+=s.from-r.to,r=s}return o}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 o=this.resolveOffset(e,1);if(o==null)return-1;if(r=o,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let s=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++s];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=uK,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 NS{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;che(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}NS.prototype.contextual=NS.prototype.fallback=NS.prototype.extend=!1;class tD{constructor(e,n,r){this.precTable=n,this.elseToken=r,this.data=typeof e=="string"?AP(e):e}token(e,n){let r=e.pos,i=0;for(;;){let o=e.next<0,s=e.resolveOffset(1,1);if(che(this.data,e,n,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(o||i++,s==null)break;e.reset(s,e.token)}i&&(e.reset(r,e.token),e.acceptToken(this.elseToken,i))}}tD.prototype.contextual=NS.prototype.fallback=NS.prototype.extend=!1;class qo{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function che(t,e,n,r,i,o){let s=0,a=1<<r,{dialect:c}=n.p.parser;e:for(;(a&t[s])!=0;){let d=t[s+1];for(let v=s+3;v<d;v+=2)if((t[v+1]&a)>0){let w=t[v];if(c.allows(w)&&(e.token.value==-1||e.token.value==w||Y8e(w,e.token.value,i,o))){e.acceptToken(w);break}}let p=e.next,g=0,O=t[s+2];if(e.next<0&&O>g&&t[d+O*3-3]==65535){s=t[d+O*3-1];continue e}for(;g<O;){let v=g+O>>1,w=d+v+(v<<1),S=t[w],C=t[w+1]||65536;if(p<S)O=v;else if(p>=C)g=v+1;else{s=t[w+2],e.advance();continue e}}break}}function dK(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function Y8e(t,e,n,r){let i=dK(n,r,e);return i<0||dK(n,r,t)<i}const du=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let Sz=null;function fK(t,e,n){let r=t.cursor(wi.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 G8e{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?fK(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?fK(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 o=r.children[i],s=this.start[n]+r.positions[i];if(s>e)return this.nextStart=s,null;if(o instanceof Ti){if(s==e){if(s<this.safeFrom)return null;let a=s+o.length;if(a<=this.safeTo){let c=o.prop(Bn.lookAhead);if(!c||a+c<this.fragment.to)return o}}this.index[n]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[n]++,this.nextStart=s+o.length}}}class W8e{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new hj)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:o}=i,s=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,c=0;for(let d=0;d<o.length;d++){if((1<<d&s)==0)continue;let p=o[d],g=this.tokens[d];if(!(r&&!p.fallback)&&((p.contextual||g.start!=e.pos||g.mask!=s||g.context!=a)&&(this.updateCachedToken(g,p,e),g.mask=s,g.context=a),g.lookAhead>g.end+25&&(c=Math.max(g.lookAhead,c)),g.value!=0)){let O=n;if(g.extended>-1&&(n=this.addActions(e,g.extended,g.end,n)),n=this.addActions(e,g.value,g.end,n),!p.extend&&(r=g,n>O))break}}for(;this.actions.length>n;)this.actions.pop();return c&&e.setLookAhead(c),!r&&e.pos==this.stream.end&&(r=new hj,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 hj,{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:o}=r.p;for(let s=0;s<o.specialized.length;s++)if(o.specialized[s]==e.value){let a=o.specializers[s](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 o=0;o<i;o+=3)if(this.actions[o]==e)return i;return this.actions[i++]=e,this.actions[i++]=n,this.actions[i++]=r,i}addActions(e,n,r,i){let{state:o}=e,{parser:s}=e.p,{data:a}=s;for(let c=0;c<2;c++)for(let d=s.stateSlot(o,c?2:1);;d+=3){if(a[d]==65535)if(a[d+1]==1)d=zm(a,d+2);else{i==0&&a[d+1]==2&&(i=this.putAction(zm(a,d+2),n,r,i));break}a[d]==n&&(i=this.putAction(zm(a,d+1),n,r,i))}return i}}let F8e=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 Z8e(n,i),this.tokens=new W8e(e,this.stream),this.topTerm=e.top[1];let{from:o}=i[0];this.stacks=[KQ.start(this,e.top[0],o)],this.fragments=r.length&&this.stream.end-o>e.bufferLength*4?new G8e(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],i,o;if(this.bigReductionCount>300&&e.length==1){let[s]=e;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<e.length;s++){let a=e[s];for(;;){if(this.tokens.mainToken=null,a.pos>n)r.push(a);else{if(this.advanceStack(a,r,e))continue;{i||(i=[],o=[]),i.push(a);let c=this.tokens.getMainToken(a);o.push(c.value,c.end)}}break}}if(!r.length){let s=i&&J8e(i);if(s)return du&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw du&&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 s=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,o,r);if(s)return du&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(r.length>s)for(r.sort((a,c)=>c.score-a.score);r.length>s;)r.pop();r.some(a=>a.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let s=0;s<r.length-1;s++){let a=r[s];for(let c=s+1;c<r.length;c++){let d=r[c];if(a.sameState(d)||a.buffer.length>500&&d.buffer.length>500)if((a.score-d.score||a.buffer.length-d.buffer.length)>0)r.splice(c--,1);else{r.splice(s--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let s=1;s<r.length;s++)r[s].pos<this.minStackPos&&(this.minStackPos=r[s].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:o}=this,s=du?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.curContext&&e.curContext.tracker.strict,p=d?e.curContext.hash:0;for(let g=this.fragments.nodeAt(i);g;){let O=this.parser.nodeSet.types[g.type.id]==g.type?o.getGoto(e.state,g.type.id):-1;if(O>-1&&g.length&&(!d||(g.prop(Bn.contextHash)||0)==p))return e.useNode(g,O),du&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(g.type.id)})`),!0;if(!(g instanceof Ti)||g.children.length==0||g.positions[0]>0)break;let v=g.children[0];if(v instanceof Ti&&g.positions[0]==0)g=v;else break}}let a=o.stateSlot(e.state,4);if(a>0)return e.reduce(a),du&&console.log(s+this.stackID(e)+` (via always-reduce ${o.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let c=this.tokens.getActions(e);for(let d=0;d<c.length;){let p=c[d++],g=c[d++],O=c[d++],v=d==c.length||!r,w=v?e:e.split(),S=this.tokens.mainToken;if(w.apply(p,g,S?S.start:w.pos,O),du&&console.log(s+this.stackID(w)+` (via ${(p&65536)==0?"shift":`reduce of ${o.getName(p&65535)}`} for ${o.getName(g)} @ ${i}${w==e?"":", split"})`),v)return!0;w.pos>i?n.push(w):r.push(w)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return pK(e,n),!0}}runRecovery(e,n,r){let i=null,o=!1;for(let s=0;s<e.length;s++){let a=e[s],c=n[s<<1],d=n[(s<<1)+1],p=du?this.stackID(a)+" -> ":"";if(a.deadEnd&&(o||(o=!0,a.restart(),du&&console.log(p+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let g=a.split(),O=p;for(let v=0;g.forceReduce()&&v<10&&(du&&console.log(O+this.stackID(g)+" (via force-reduce)"),!this.advanceFully(g,r));v++)du&&(O=this.stackID(g)+" -> ");for(let v of a.recoverByInsert(c))du&&console.log(p+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,r);this.stream.end>a.pos?(d==a.pos&&(d++,c=0),a.recoverByDelete(c,d),du&&console.log(p+this.stackID(a)+` (via recover-delete ${this.parser.getName(c)})`),pK(a,r)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),Ti.build({buffer:eD.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=(Sz||(Sz=new WeakMap)).get(e);return n||Sz.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}};function pK(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 H8e{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}const wz=t=>t;class D${constructor(e){this.start=e.start,this.shift=e.shift||wz,this.reduce=e.reduce||wz,this.reuse=e.reuse||wz,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rf extends IV{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 o(a,c,d){i[a].push([c,c.deserialize(String(d))])}if(e.nodeProps)for(let a of e.nodeProps){let c=a[0];typeof c=="string"&&(c=Bn[c]);for(let d=1;d<a.length;){let p=a[d++];if(p>=0)o(p,c,a[d++]);else{let g=a[d+-p];for(let O=-p;O>0;O--)o(a[d++],c,g);d++}}}this.nodeSet=new pM(n.map((a,c)=>dl.define({name:c>=this.minRepeatTerm?void 0:a,id:c,props:i[c],top:r.indexOf(c)>-1,error:c==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(c)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=ohe;let s=AP(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(hK),this.states=AP(e.states,Uint32Array),this.data=AP(e.stateData),this.goto=AP(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new NS(s,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 F8e(this,e,n,r);for(let o of this.wrappers)i=o(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let o=i[n+1];;){let s=i[o++],a=s&1,c=i[o++];if(a&&r)return c;for(let d=o+(s>>1);o<d;o++)if(i[o]==e)return c;if(a)return-1}}hasAction(e,n){let r=this.data;for(let i=0;i<2;i++)for(let o=this.stateSlot(e,i?2:1),s;;o+=3){if((s=r[o])==65535)if(r[o+1]==1)s=r[o=zm(r,o+2)];else{if(r[o+1]==2)return zm(r,o+2);break}if(s==n||s==0)return zm(r,o+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 o=this.stateSlot(e,1);i==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=zm(this.data,o+2);else break;i=n(zm(this.data,o+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=zm(this.data,r+2);else break;if((this.data[r+2]&1)==0){let i=this.data[r+1];n.some((o,s)=>s&1&&o==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(Rf.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(o=>o.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let o=e.specializers.find(a=>a.from==r.external);if(!o)return r;let s=Object.assign(Object.assign({},r),{external:o.to});return n.specializers[i]=hK(s),s})),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 o of e.split(" ")){let s=n.indexOf(o);s>=0&&(r[s]=!0)}let i=null;for(let o=0;o<n.length;o++)if(!r[o])for(let s=this.dialects[n[o]],a;(a=this.data[s++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new H8e(e,r,i)}static deserialize(e){return new Rf(e)}}function zm(t,e){return t[e]|t[e+1]<<16}function J8e(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 hK(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}let K8e=0,qm=class $9{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=K8e++}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 $9&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let i=new $9(r,[],null,[]);if(i.set.push(i),n)for(let o of n.set)i.set.push(o);return i}static defineModifier(e){let n=new nD(e);return r=>r.modified.indexOf(n)>-1?r:nD.get(r.base||r,r.modified.concat(n).sort((i,o)=>i.id-o.id))}},eBe=0;class nD{constructor(e){this.name=e,this.instances=[],this.id=eBe++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&tBe(n,a.modified));if(r)return r;let i=[],o=new qm(e.name,i,e,n);for(let a of n)a.instances.push(o);let s=nBe(n);for(let a of e.set)if(!a.modified.length)for(let c of s)i.push(nD.get(a,c));return o}}function tBe(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function nBe(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 dg(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 o=[],s=2,a=i;for(let g=0;;){if(a=="..."&&g>0&&g+3==i.length){s=1;break}let O=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!O)throw new RangeError("Invalid path: "+i);if(o.push(O[0]=="*"?"":O[0][0]=='"'?JSON.parse(O[0]):O[0]),g+=O[0].length,g==i.length)break;let v=i[g++];if(g==i.length&&v=="!"){s=0;break}if(v!="/")throw new RangeError("Invalid path: "+i);a=i.slice(g)}let c=o.length-1,d=o[c];if(!d)throw new RangeError("Invalid path: "+i);let p=new rD(r,s,c>0?o.slice(0,c):null);e[d]=p.sort(e[d])}}return uhe.add(e)}const uhe=new Bn;class rD{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}}rD.empty=new rD([],2,null);function dhe(t,e){let n=Object.create(null);for(let o of t)if(!Array.isArray(o.tag))n[o.tag.id]=o.class;else for(let s of o.tag)n[s.id]=o.class;let{scope:r,all:i=null}=e||{};return{style:o=>{let s=i;for(let a of o)for(let c of a.set){let d=n[c.id];if(d){s=s?s+" "+d:d;break}}return s},scope:r}}function rBe(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function iBe(t,e,n,r=0,i=t.length){let o=new oBe(r,Array.isArray(e)?e:[e],n);o.highlightRange(t.cursor(),r,i,"",o.highlighters),o.flush(i)}class oBe{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,o){let{type:s,from:a,to:c}=e;if(a>=r||c<=n)return;s.isTop&&(o=this.highlighters.filter(v=>!v.scope||v.scope(s)));let d=i,p=sBe(e)||rD.empty,g=rBe(o,p.tags);if(g&&(d&&(d+=" "),d+=g,p.mode==1&&(i+=(i?" ":"")+g)),this.startSpan(Math.max(n,a),d),p.opaque)return;let O=e.tree&&e.tree.prop(Bn.mounted);if(O&&O.overlay){let v=e.node.enter(O.overlay[0].from+a,1),w=this.highlighters.filter(C=>!C.scope||C.scope(O.tree.type)),S=e.firstChild();for(let C=0,T=a;;C++){let E=C<O.overlay.length?O.overlay[C]:null,$=E?E.from+a:c,_=Math.max(n,T),R=Math.min(r,$);if(_<R&&S)for(;e.from<R&&(this.highlightRange(e,_,R,i,o),this.startSpan(Math.min(R,e.to),d),!(e.to>=$||!e.nextSibling())););if(!E||$>r)break;T=E.to+a,T>n&&(this.highlightRange(v.cursor(),Math.max(n,E.from+a),Math.min(r,T),"",w),this.startSpan(Math.min(r,T),d))}S&&e.parent()}else if(e.firstChild()){O&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,o),this.startSpan(Math.min(r,e.to),d)}while(e.nextSibling());e.parent()}}}function sBe(t){let e=t.type.prop(uhe);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const kt=qm.define,tI=kt(),Hy=kt(),mK=kt(Hy),gK=kt(Hy),Jy=kt(),nI=kt(Jy),Cz=kt(Jy),zp=kt(),xb=kt(zp),Rp=kt(),_p=kt(),k9=kt(),sP=kt(k9),rI=kt(),ne={comment:tI,lineComment:kt(tI),blockComment:kt(tI),docComment:kt(tI),name:Hy,variableName:kt(Hy),typeName:mK,tagName:kt(mK),propertyName:gK,attributeName:kt(gK),className:kt(Hy),labelName:kt(Hy),namespace:kt(Hy),macroName:kt(Hy),literal:Jy,string:nI,docString:kt(nI),character:kt(nI),attributeValue:kt(nI),number:Cz,integer:kt(Cz),float:kt(Cz),bool:kt(Jy),regexp:kt(Jy),escape:kt(Jy),color:kt(Jy),url:kt(Jy),keyword:Rp,self:kt(Rp),null:kt(Rp),atom:kt(Rp),unit:kt(Rp),modifier:kt(Rp),operatorKeyword:kt(Rp),controlKeyword:kt(Rp),definitionKeyword:kt(Rp),moduleKeyword:kt(Rp),operator:_p,derefOperator:kt(_p),arithmeticOperator:kt(_p),logicOperator:kt(_p),bitwiseOperator:kt(_p),compareOperator:kt(_p),updateOperator:kt(_p),definitionOperator:kt(_p),typeOperator:kt(_p),controlOperator:kt(_p),punctuation:k9,separator:kt(k9),bracket:sP,angleBracket:kt(sP),squareBracket:kt(sP),paren:kt(sP),brace:kt(sP),content:zp,heading:xb,heading1:kt(xb),heading2:kt(xb),heading3:kt(xb),heading4:kt(xb),heading5:kt(xb),heading6:kt(xb),contentSeparator:kt(zp),list:kt(zp),quote:kt(zp),emphasis:kt(zp),strong:kt(zp),link:kt(zp),monospace:kt(zp),strikethrough:kt(zp),inserted:kt(),deleted:kt(),changed:kt(),invalid:kt(),meta:rI,documentMeta:kt(rI),annotation:kt(rI),processingInstruction:kt(rI),definition:qm.defineModifier("definition"),constant:qm.defineModifier("constant"),function:qm.defineModifier("function"),standard:qm.defineModifier("standard"),local:qm.defineModifier("local"),special:qm.defineModifier("special")};for(let t in ne){let e=ne[t];e instanceof qm&&(e.name=t)}dhe([{tag:ne.link,class:"tok-link"},{tag:ne.heading,class:"tok-heading"},{tag:ne.emphasis,class:"tok-emphasis"},{tag:ne.strong,class:"tok-strong"},{tag:ne.keyword,class:"tok-keyword"},{tag:ne.atom,class:"tok-atom"},{tag:ne.bool,class:"tok-bool"},{tag:ne.url,class:"tok-url"},{tag:ne.labelName,class:"tok-labelName"},{tag:ne.inserted,class:"tok-inserted"},{tag:ne.deleted,class:"tok-deleted"},{tag:ne.literal,class:"tok-literal"},{tag:ne.string,class:"tok-string"},{tag:ne.number,class:"tok-number"},{tag:[ne.regexp,ne.escape,ne.special(ne.string)],class:"tok-string2"},{tag:ne.variableName,class:"tok-variableName"},{tag:ne.local(ne.variableName),class:"tok-variableName tok-local"},{tag:ne.definition(ne.variableName),class:"tok-variableName tok-definition"},{tag:ne.special(ne.variableName),class:"tok-variableName2"},{tag:ne.definition(ne.propertyName),class:"tok-propertyName tok-definition"},{tag:ne.typeName,class:"tok-typeName"},{tag:ne.namespace,class:"tok-namespace"},{tag:ne.className,class:"tok-className"},{tag:ne.macroName,class:"tok-macroName"},{tag:ne.propertyName,class:"tok-propertyName"},{tag:ne.operator,class:"tok-operator"},{tag:ne.comment,class:"tok-comment"},{tag:ne.meta,class:"tok-meta"},{tag:ne.invalid,class:"tok-invalid"},{tag:ne.punctuation,class:"tok-punctuation"}]);const aBe=dg({String:ne.string,Number:ne.number,"True False":ne.bool,PropertyName:ne.propertyName,Null:ne.null,",":ne.separator,"[ ]":ne.squareBracket,"{ }":ne.brace}),lBe=Rf.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:[aBe],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 R9=[],fhe=[];(()=>{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?fhe:R9).push(n=n+t[e])})();function cBe(t){if(t<768)return!1;for(let e=0,n=R9.length;;){let r=e+n>>1;if(t<R9[r])n=r;else if(t>=fhe[r])e=r+1;else return!0;if(e==n)return!1}}function yK(t){return t>=127462&&t<=127487}const OK=8205;function uBe(t,e,n=!0,r=!0){return(n?phe:dBe)(t,e,r)}function phe(t,e,n){if(e==t.length)return e;e&&hhe(t.charCodeAt(e))&&mhe(t.charCodeAt(e-1))&&e--;let r=Tz(t,e);for(e+=vK(r);e<t.length;){let i=Tz(t,e);if(r==OK||i==OK||n&&cBe(i))e+=vK(i),r=i;else if(yK(i)){let o=0,s=e-2;for(;s>=0&&yK(Tz(t,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function dBe(t,e,n){for(;e>0;){let r=phe(t,e-2,n);if(r<e)return r;e--}return 0}function Tz(t,e){let n=t.charCodeAt(e);if(!mhe(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return hhe(r)?(n-55296<<10)+(r-56320)+65536:n}function hhe(t){return t>=56320&&t<57344}function mhe(t){return t>=55296&&t<56320}function vK(t){return t<65536?1:2}class br{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]=lw(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),Zp.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]=lw(this,e,n);let r=[];return this.decompose(e,n,r,0),Zp.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 HP(this),o=new HP(e);for(let s=n,a=n;;){if(i.next(s),o.next(s),s=0,i.lineBreak!=o.lineBreak||i.done!=o.done||i.value!=o.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new HP(this,e)}iterRange(e,n=this.length){return new ghe(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 yhe(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]?br.empty:e.length<=32?new Mo(e):Zp.from(Mo.split(e,[]))}}class Mo extends br{constructor(e,n=fBe(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 o=0;;o++){let s=this.text[o],a=i+s.length;if((n?r:a)>=e)return new pBe(i,a,r,s);i=a+1,r++}}decompose(e,n,r,i){let o=e<=0&&n>=this.length?this:new Mo(bK(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let s=r.pop(),a=mj(o.text,s.text.slice(),0,o.length);if(a.length<=32)r.push(new Mo(a,s.length+o.length));else{let c=a.length>>1;r.push(new Mo(a.slice(0,c)),new Mo(a.slice(c)))}}else r.push(o)}replace(e,n,r){if(!(r instanceof Mo))return super.replace(e,n,r);[e,n]=lw(this,e,n);let i=mj(this.text,mj(r.text,bK(this.text,0,e)),n),o=this.length+r.length-(n-e);return i.length<=32?new Mo(i,o):Zp.from(Mo.split(i,[]),o)}sliceString(e,n=this.length,r=`
349
349
  `){[e,n]=lw(this,e,n);let i="";for(let o=0,s=0;o<=n&&s<this.text.length;s++){let a=this.text[s],c=o+a.length;o>e&&s&&(i+=r),e<c&&n>o&&(i+=a.slice(Math.max(0,e-o),n-o)),o=c+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let o of e)r.push(o),i+=o.length+1,r.length==32&&(n.push(new Mo(r,i)),r=[],i=-1);return i>-1&&n.push(new Mo(r,i)),n}}class Zp extends br{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let o=0;;o++){let s=this.children[o],a=i+s.length,c=r+s.lines-1;if((n?c:a)>=e)return s.lineInner(e,n,r,i);i=a+1,r=c+1}}decompose(e,n,r,i){for(let o=0,s=0;s<=n&&o<this.children.length;o++){let a=this.children[o],c=s+a.length;if(e<=c&&n>=s){let d=i&((s<=e?1:0)|(c>=n?2:0));s>=e&&c<=n&&!d?r.push(a):a.decompose(e-s,n-s,r,d)}s=c+1}}replace(e,n,r){if([e,n]=lw(this,e,n),r.lines<this.lines)for(let i=0,o=0;i<this.children.length;i++){let s=this.children[i],a=o+s.length;if(e>=o&&n<=a){let c=s.replace(e-o,n-o,r),d=this.lines-s.lines+c.lines;if(c.lines<d>>4&&c.lines>d>>6){let p=this.children.slice();return p[i]=c,new Zp(p,this.length-(n-e)+r.length)}return super.replace(o,a,c)}o=a+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
350
350
  `){[e,n]=lw(this,e,n);let i="";for(let o=0,s=0;o<this.children.length&&s<=n;o++){let a=this.children[o],c=s+a.length;s>e&&o&&(i+=r),e<c&&n>s&&(i+=a.sliceString(e-s,n-s,r)),s=c+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Zp))return 0;let r=0,[i,o,s,a]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,o+=n){if(i==s||o==a)return r;let c=this.children[i],d=e.children[o];if(c!=d)return r+c.scanIdentical(d,n);r+=c.length+1}}static from(e,n=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let v of e)r+=v.lines;if(r<32){let v=[];for(let w of e)w.flatten(v);return new Mo(v,n)}let i=Math.max(32,r>>5),o=i<<1,s=i>>1,a=[],c=0,d=-1,p=[];function g(v){let w;if(v.lines>o&&v instanceof Zp)for(let S of v.children)g(S);else v.lines>s&&(c>s||!c)?(O(),a.push(v)):v instanceof Mo&&c&&(w=p[p.length-1])instanceof Mo&&v.lines+w.lines<=32?(c+=v.lines,d+=v.length+1,p[p.length-1]=new Mo(w.text.concat(v.text),w.length+1+v.length)):(c+v.lines>i&&O(),c+=v.lines,d+=v.length+1,p.push(v))}function O(){c!=0&&(a.push(p.length==1?p[0]:Zp.from(p,d)),d=-1,c=p.length=0)}for(let v of e)g(v);return O(),a.length==1?a[0]:new Zp(a,n)}}br.empty=new Mo([""],0);function fBe(t){let e=-1;for(let n of t)e+=n.length+1;return e}function mj(t,e,n=0,r=1e9){for(let i=0,o=0,s=!0;o<t.length&&i<=r;o++){let a=t[o],c=i+a.length;c>=n&&(c>r&&(a=a.slice(0,r-i)),i<n&&(a=a.slice(n-i)),s?(e[e.length-1]+=a,s=!1):e.push(a)),i=c+1}return e}function bK(t,e,n){return mj(t,[""],e,n)}class HP{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof Mo?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],o=this.offsets[r],s=o>>1,a=i instanceof Mo?i.text.length:i.children.length;if(s==(n>0?a:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=`
351
351
  `,this;e--}else if(i instanceof Mo){let c=i.text[s+(n<0?-1:0)];if(this.offsets[r]+=n,c.length>Math.max(0,e))return this.value=e==0?c:n>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=i.children[s+(n<0?-1:0)];e>c.length?(e-=c.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof Mo?c.text.length:c.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class ghe{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new HP(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class yhe{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(br.prototype[Symbol.iterator]=function(){return this.iter()},HP.prototype[Symbol.iterator]=ghe.prototype[Symbol.iterator]=yhe.prototype[Symbol.iterator]=function(){return this});let pBe=class{constructor(e,n,r,i){this.from=e,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}};function lw(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function $a(t,e,n=!0,r=!0){return uBe(t,e,n,r)}function hBe(t){return t>=56320&&t<57344}function mBe(t){return t>=55296&&t<56320}function bc(t,e){let n=t.charCodeAt(e);if(!mBe(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return hBe(r)?(n-55296<<10)+(r-56320)+65536:n}function jV(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Yp(t){return t<65536?1:2}const _9=/\r\n?|\n/;var Aa=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(Aa||(Aa={}));class ih{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,i=0;n<this.sections.length;){let o=this.sections[n++],s=this.sections[n++];s<0?(e(r,i,o),i+=o):i+=s,r+=o}}iterChangedRanges(e,n=!1){I9(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];i<0?e.push(r,i):e.push(i,r)}return new ih(e)}composeDesc(e){return this.empty?e:e.empty?this:Ohe(this,e)}mapDesc(e,n=!1){return e.empty?this:j9(this,e,n)}mapPos(e,n=-1,r=Aa.Simple){let i=0,o=0;for(let s=0;s<this.sections.length;){let a=this.sections[s++],c=this.sections[s++],d=i+a;if(c<0){if(d>e)return o+(e-i);o+=a}else{if(r!=Aa.Simple&&d>=e&&(r==Aa.TrackDel&&i<e&&d>e||r==Aa.TrackBefore&&i<e||r==Aa.TrackAfter&&d>e))return null;if(d>e||d==e&&n<0&&!a)return e==i||n<0?o:o+c;o+=c}i=d}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return o}touchesRange(e,n=e){for(let r=0,i=0;r<this.sections.length&&i<=n;){let o=this.sections[r++],s=this.sections[r++],a=i+o;if(s>=0&&i<=n&&a>=e)return i<e&&a>n?"cover":!0;i=a}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ih(e)}static create(e){return new ih(e)}}class Ts extends ih{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return I9(this,(n,r,i,o,s)=>e=e.replace(i,i+(r-n),s),!1),e}mapDesc(e,n=!1){return j9(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,o=0;i<n.length;i+=2){let s=n[i],a=n[i+1];if(a>=0){n[i]=a,n[i+1]=s;let c=i>>1;for(;r.length<c;)r.push(br.empty);r.push(s?e.slice(o,o+s):br.empty)}o+=s}return new Ts(n,r)}compose(e){return this.empty?e:e.empty?this:Ohe(this,e,!0)}map(e,n=!1){return e.empty?this:j9(this,e,n,!0)}iterChanges(e,n=!1){I9(this,e,n)}get desc(){return ih.create(this.sections)}filter(e){let n=[],r=[],i=[],o=new UA(this);e:for(let s=0,a=0;;){let c=s==e.length?1e9:e[s++];for(;a<c||a==c&&o.len==0;){if(o.done)break e;let p=Math.min(o.len,c-a);sl(i,p,-1);let g=o.ins==-1?-1:o.off==0?o.ins:0;sl(n,p,g),g>0&&cO(r,n,o.text),o.forward(p),a+=p}let d=e[s++];for(;a<d;){if(o.done)break e;let p=Math.min(o.len,d-a);sl(n,p,-1),sl(i,p,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(p),a+=p}}return{changes:new Ts(n,r),filtered:ih.create(i)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],i=this.sections[n+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let i=[],o=[],s=0,a=null;function c(p=!1){if(!p&&!i.length)return;s<n&&sl(i,n-s,-1);let g=new Ts(i,o);a=a?a.compose(g.map(a)):g,i=[],o=[],s=0}function d(p){if(Array.isArray(p))for(let g of p)d(g);else if(p instanceof Ts){if(p.length!=n)throw new RangeError(`Mismatched change set length (got ${p.length}, expected ${n})`);c(),a=a?a.compose(p.map(a)):p}else{let{from:g,to:O=g,insert:v}=p;if(g>O||g<0||O>n)throw new RangeError(`Invalid change range ${g} to ${O} (in doc of length ${n})`);let w=v?typeof v=="string"?br.of(v.split(r||_9)):v:br.empty,S=w.length;if(g==O&&S==0)return;g<s&&c(),g>s&&sl(i,g-s,-1),sl(i,O-g,S),cO(o,i,w),s=O}}return d(e),c(!a),a}static empty(e){return new Ts(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;i<e.length;i++){let o=e[i];if(typeof o=="number")n.push(o,-1);else{if(!Array.isArray(o)||typeof o[0]!="number"||o.some((s,a)=>a&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)n.push(o[0],0);else{for(;r.length<i;)r.push(br.empty);r[i]=br.of(o.slice(1)),n.push(o[0],r[i].length)}}}return new Ts(n,r)}static createSet(e,n){return new Ts(e,n)}}function sl(t,e,n,r=!1){if(e==0&&n<=0)return;let i=t.length-2;i>=0&&n<=0&&n==t[i+1]?t[i]+=e:i>=0&&e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function cO(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(br.empty);t.push(n)}}function I9(t,e,n){let r=t.inserted;for(let i=0,o=0,s=0;s<t.sections.length;){let a=t.sections[s++],c=t.sections[s++];if(c<0)i+=a,o+=a;else{let d=i,p=o,g=br.empty;for(;d+=a,p+=c,c&&r&&(g=g.append(r[s-2>>1])),!(n||s==t.sections.length||t.sections[s+1]<0);)a=t.sections[s++],c=t.sections[s++];e(i,d,o,p,g),i=d,o=p}}}function j9(t,e,n,r=!1){let i=[],o=r?[]:null,s=new UA(t),a=new UA(e);for(let c=-1;;){if(s.done&&a.len||a.done&&s.len)throw new Error("Mismatched change set lengths");if(s.ins==-1&&a.ins==-1){let d=Math.min(s.len,a.len);sl(i,d,-1),s.forward(d),a.forward(d)}else if(a.ins>=0&&(s.ins<0||c==s.i||s.off==0&&(a.len<s.len||a.len==s.len&&!n))){let d=a.len;for(sl(i,a.ins,-1);d;){let p=Math.min(s.len,d);s.ins>=0&&c<s.i&&s.len<=p&&(sl(i,0,s.ins),o&&cO(o,i,s.text),c=s.i),s.forward(p),d-=p}a.next()}else if(s.ins>=0){let d=0,p=s.len;for(;p;)if(a.ins==-1){let g=Math.min(p,a.len);d+=g,p-=g,a.forward(g)}else if(a.ins==0&&a.len<p)p-=a.len,a.next();else break;sl(i,d,c<s.i?s.ins:0),o&&c<s.i&&cO(o,i,s.text),c=s.i,s.forward(s.len-p)}else{if(s.done&&a.done)return o?Ts.createSet(i,o):ih.create(i);throw new Error("Mismatched change set lengths")}}}function Ohe(t,e,n=!1){let r=[],i=n?[]:null,o=new UA(t),s=new UA(e);for(let a=!1;;){if(o.done&&s.done)return i?Ts.createSet(r,i):ih.create(r);if(o.ins==0)sl(r,o.len,0,a),o.next();else if(s.len==0&&!s.done)sl(r,0,s.ins,a),i&&cO(i,r,s.text),s.next();else{if(o.done||s.done)throw new Error("Mismatched change set lengths");{let c=Math.min(o.len2,s.len),d=r.length;if(o.ins==-1){let p=s.ins==-1?-1:s.off?0:s.ins;sl(r,c,p,a),i&&p&&cO(i,r,s.text)}else s.ins==-1?(sl(r,o.off?0:o.len,c,a),i&&cO(i,r,o.textBit(c))):(sl(r,o.off?0:o.len,s.off?0:s.ins,a),i&&!s.off&&cO(i,r,s.text));a=(o.ins>c||s.ins>=0&&s.len>c)&&(a||r.length>d),o.forward2(c),s.forward(c)}}}}class UA{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?br.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?br.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}let iI=class Q9{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new Q9(r,i,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return gt.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return gt.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return gt.range(e.anchor,e.head)}static create(e,n,r){return new Q9(e,n,r)}};class gt{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:gt.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new gt([this.main],0)}addRange(e,n=!0){return gt.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,gt.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new gt(e.ranges.map(n=>iI.fromJSON(n)),e.main)}static single(e,n=e){return new gt([gt.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let o=e[i];if(o.empty?o.from<=r:o.from<r)return gt.normalized(e.slice(),n);r=o.to}return new gt(e,n)}static cursor(e,n=0,r,i){return iI.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,n,r,i){let o=(r??16777215)<<6|(i==null?7:Math.min(6,i));return n<e?iI.create(n,e,48|o):iI.create(e,n,(n>e?8:0)|o)}static normalized(e,n=0){let r=e[n];e.sort((i,o)=>i.from-o.from),n=e.indexOf(r);for(let i=1;i<e.length;i++){let o=e[i],s=e[i-1];if(o.empty?o.from<=s.to:o.from<s.to){let a=s.from,c=Math.max(o.to,s.to);i<=n&&n--,e.splice(--i,2,o.anchor>o.head?gt.range(c,a):gt.range(a,c))}}return new gt(e,n)}}function vhe(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let QV=0;class Qt{constructor(e,n,r,i,o){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=QV++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new Qt(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:DV),!!e.static,e.enables)}of(e){return new gj([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new gj(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new gj(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function DV(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class gj{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=QV++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,o=this.id,s=e[o]>>1,a=this.type==2,c=!1,d=!1,p=[];for(let g of this.dependencies)g=="doc"?c=!0:g=="selection"?d=!0:(((n=e[g.id])!==null&&n!==void 0?n:1)&1)==0&&p.push(e[g.id]);return{create(g){return g.values[s]=r(g),1},update(g,O){if(c&&O.docChanged||d&&(O.docChanged||O.selection)||D9(g,p)){let v=r(g);if(a?!xK(v,g.values[s],i):!i(v,g.values[s]))return g.values[s]=v,1}return 0},reconfigure:(g,O)=>{let v,w=O.config.address[o];if(w!=null){let S=oD(O,w);if(this.dependencies.every(C=>C instanceof Qt?O.facet(C)===g.facet(C):C instanceof _s?O.field(C,!1)==g.field(C,!1):!0)||(a?xK(v=r(g),S,i):i(v=r(g),S)))return g.values[s]=S,0}else v=r(g);return g.values[s]=v,1}}}}function xK(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function D9(t,e){let n=!1;for(let r of e)JP(t,r)&1&&(n=!0);return n}function gBe(t,e,n){let r=n.map(c=>t[c.id]),i=n.map(c=>c.type),o=r.filter(c=>!(c&1)),s=t[e.id]>>1;function a(c){let d=[];for(let p=0;p<r.length;p++){let g=oD(c,r[p]);if(i[p]==2)for(let O of g)d.push(O);else d.push(g)}return e.combine(d)}return{create(c){for(let d of r)JP(c,d);return c.values[s]=a(c),1},update(c,d){if(!D9(c,o))return 0;let p=a(c);return e.compare(p,c.values[s])?0:(c.values[s]=p,1)},reconfigure(c,d){let p=D9(c,r),g=d.config.facets[e.id],O=d.facet(e);if(g&&!p&&DV(n,g))return c.values[s]=O,0;let v=a(c);return e.compare(v,O)?(c.values[s]=O,0):(c.values[s]=v,1)}}}const oI=Qt.define({static:!0});class _s{constructor(e,n,r,i,o){this.id=e,this.createF=n,this.updateF=r,this.compareF=i,this.spec=o,this.provides=void 0}static define(e){let n=new _s(QV++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(oI).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let o=r.values[n],s=this.updateF(o,i);return this.compareF(o,s)?0:(r.values[n]=s,1)},reconfigure:(r,i)=>{let o=r.facet(oI),s=i.facet(oI),a;return(a=o.find(c=>c.field==this))&&a!=s.find(c=>c.field==this)?(r.values[n]=a.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,oI.of({field:this,create:e})]}get extension(){return this}}const $b={lowest:4,low:3,default:2,high:1,highest:0};function aP(t){return e=>new bhe(e,t)}const ku={highest:aP($b.highest),high:aP($b.high),default:aP($b.default),low:aP($b.low),lowest:aP($b.lowest)};class bhe{constructor(e,n){this.inner=e,this.prec=n}}class hM{of(e){return new M9(this,e)}reconfigure(e){return hM.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class M9{constructor(e,n){this.compartment=e,this.inner=n}}class iD{constructor(e,n,r,i,o,s){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let i=[],o=Object.create(null),s=new Map;for(let O of yBe(e,n,s))O instanceof _s?i.push(O):(o[O.facet.id]||(o[O.facet.id]=[])).push(O);let a=Object.create(null),c=[],d=[];for(let O of i)a[O.id]=d.length<<1,d.push(v=>O.slot(v));let p=r?.config.facets;for(let O in o){let v=o[O],w=v[0].facet,S=p&&p[O]||[];if(v.every(C=>C.type==0))if(a[w.id]=c.length<<1|1,DV(S,v))c.push(r.facet(w));else{let C=w.combine(v.map(T=>T.value));c.push(r&&w.compare(C,r.facet(w))?r.facet(w):C)}else{for(let C of v)C.type==0?(a[C.id]=c.length<<1|1,c.push(C.value)):(a[C.id]=d.length<<1,d.push(T=>C.dynamicSlot(T)));a[w.id]=d.length<<1,d.push(C=>gBe(C,w,v))}}let g=d.map(O=>O(a));return new iD(e,s,g,a,c,o)}}function yBe(t,e,n){let r=[[],[],[],[],[]],i=new Map;function o(s,a){let c=i.get(s);if(c!=null){if(c<=a)return;let d=r[c].indexOf(s);d>-1&&r[c].splice(d,1),s instanceof M9&&n.delete(s.compartment)}if(i.set(s,a),Array.isArray(s))for(let d of s)o(d,a);else if(s instanceof M9){if(n.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(s.compartment)||s.inner;n.set(s.compartment,d),o(d,a)}else if(s instanceof bhe)o(s.inner,s.prec);else if(s instanceof _s)r[a].push(s),s.provides&&o(s.provides,a);else if(s instanceof gj)r[a].push(s),s.facet.extensions&&o(s.facet.extensions,$b.default);else{let d=s.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(d,a)}}return o(t,$b.default),r.reduce((s,a)=>s.concat(a))}function JP(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function oD(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const xhe=Qt.define(),N9=Qt.define({combine:t=>t.some(e=>e),static:!0}),She=Qt.define({combine:t=>t.length?t[0]:void 0,static:!0}),whe=Qt.define(),Che=Qt.define(),The=Qt.define(),Ehe=Qt.define({combine:t=>t.length?t[0]:!1});class mh{constructor(e,n){this.type=e,this.value=n}static define(){return new OBe}}class OBe{of(e){return new mh(this,e)}}class vBe{constructor(e){this.map=e}of(e){return new wn(this,e)}}class wn{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new wn(this.type,n)}is(e){return this.type==e}static define(e={}){return new vBe(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let o=i.map(n);o&&r.push(o)}return r}}wn.reconfigure=wn.define();wn.appendConfig=wn.define();class as{constructor(e,n,r,i,o,s){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,r&&vhe(r,n.newLength),o.some(a=>a.type==as.time)||(this.annotations=o.concat(as.time.of(Date.now())))}static create(e,n,r,i,o,s){return new as(e,n,r,i,o,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(as.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}as.time=mh.define();as.userEvent=mh.define();as.addToHistory=mh.define();as.remote=mh.define();function bBe(t,e){let n=[];for(let r=0,i=0;;){let o,s;if(r<t.length&&(i==e.length||e[i]>=t[r]))o=t[r++],s=t[r++];else if(i<e.length)o=e[i++],s=e[i++];else return n;!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function Phe(t,e,n){var r;let i,o,s;return n?(i=e.changes,o=Ts.empty(e.changes.length),s=t.changes.compose(e.changes)):(i=e.changes.map(t.changes),o=t.changes.mapDesc(e.changes,!0),s=t.changes.compose(i)),{changes:s,selection:e.selection?e.selection.map(o):(r=t.selection)===null||r===void 0?void 0:r.map(i),effects:wn.mapEffects(t.effects,i).concat(wn.mapEffects(e.effects,o)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function z9(t,e,n){let r=e.selection,i=zS(e.annotations);return e.userEvent&&(i=i.concat(as.userEvent.of(e.userEvent))),{changes:e.changes instanceof Ts?e.changes:Ts.of(e.changes||[],n,t.facet(She)),selection:r&&(r instanceof gt?r:gt.single(r.anchor,r.head)),effects:zS(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function Ahe(t,e,n){let r=z9(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(n=!1);let s=!!e[o].sequential;r=Phe(r,z9(t,e[o],s?r.changes.newLength:t.doc.length),s)}let i=as.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return SBe(n?xBe(i):i)}function xBe(t){let e=t.startState,n=!0;for(let i of e.facet(whe)){let o=i(t);if(o===!1){n=!1;break}Array.isArray(o)&&(n=n===!0?o:bBe(n,o))}if(n!==!0){let i,o;if(n===!1)o=t.changes.invertedDesc,i=Ts.empty(e.doc.length);else{let s=t.changes.filter(n);i=s.changes,o=s.filtered.mapDesc(s.changes).invertedDesc}t=as.create(e,i,t.selection&&t.selection.map(o),wn.mapEffects(t.effects,o),t.annotations,t.scrollIntoView)}let r=e.facet(Che);for(let i=r.length-1;i>=0;i--){let o=r[i](t);o instanceof as?t=o:Array.isArray(o)&&o.length==1&&o[0]instanceof as?t=o[0]:t=Ahe(e,zS(o),!1)}return t}function SBe(t){let e=t.startState,n=e.facet(The),r=t;for(let i=n.length-1;i>=0;i--){let o=n[i](t);o&&Object.keys(o).length&&(r=Phe(r,z9(e,o,t.changes.newLength),!0))}return r==t?t:as.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const wBe=[];function zS(t){return t==null?wBe:Array.isArray(t)?t:[t]}var io=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(io||(io={}));const CBe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let q9;try{q9=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function TBe(t){if(q9)return q9.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||CBe.test(n)))return!0}return!1}function EBe(t){return e=>{if(!/\S/.test(e))return io.Space;if(TBe(e))return io.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return io.Word;return io.Other}}class fr{constructor(e,n,r,i,o,s){this.config=e,this.doc=n,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)JP(this,a<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return JP(this,r),oD(this,r)}update(...e){return Ahe(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:i}=n;for(let a of e.effects)a.is(hM.reconfigure)?(n&&(i=new Map,n.compartments.forEach((c,d)=>i.set(d,c)),n=null),i.set(a.value.compartment,a.value.extension)):a.is(wn.reconfigure)?(n=null,r=a.value):a.is(wn.appendConfig)&&(n=null,r=zS(r).concat(a.value));let o;n?o=e.startState.values.slice():(n=iD.resolve(r,i,this),o=new fr(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,d)=>d.reconfigure(c,this),null).values);let s=e.startState.facet(N9)?e.newSelection:e.newSelection.asSingle();new fr(n,e.newDoc,s,o,(a,c)=>c.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:gt.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),o=[r.range],s=zS(r.effects);for(let a=1;a<n.ranges.length;a++){let c=e(n.ranges[a]),d=this.changes(c.changes),p=d.map(i);for(let O=0;O<a;O++)o[O]=o[O].map(p);let g=i.mapDesc(d,!0);o.push(c.range.map(g)),i=i.compose(p),s=wn.mapEffects(s,p).concat(wn.mapEffects(zS(c.effects),g))}return{changes:i,selection:gt.create(o,n.mainIndex),effects:s}}changes(e=[]){return e instanceof Ts?e:Ts.of(e,this.doc.length,this.facet(fr.lineSeparator))}toText(e){return br.of(e.split(this.facet(fr.lineSeparator)||_9))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(JP(this,n),oD(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof _s&&this.config.address[i.id]!=null&&(n[r]=i.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let o in r)if(Object.prototype.hasOwnProperty.call(e,o)){let s=r[o],a=e[o];i.push(s.init(c=>s.spec.fromJSON(a,c)))}}return fr.create({doc:e.doc,selection:gt.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=iD.resolve(e.extensions||[],new Map),r=e.doc instanceof br?e.doc:br.of((e.doc||"").split(n.staticFacet(fr.lineSeparator)||_9)),i=e.selection?e.selection instanceof gt?e.selection:gt.single(e.selection.anchor,e.selection.head):gt.single(0);return vhe(i,r.length),n.staticFacet(N9)||(i=i.asSingle()),new fr(n,r,i,n.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(fr.tabSize)}get lineBreak(){return this.facet(fr.lineSeparator)||`
@@ -407,7 +407,7 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function pet(t){return t.
407
407
  `];let T=-1,E=0;for(const $ of C){const _=t.indexOf($,p);if(_!==-1&&_<c.start){T=_,E=$.length;break}}if(T!==-1)g=T+E;else{const $=[`
408
408
  `,`\r
409
409
  `];for(const _ of $){const R=t.indexOf(_,p);if(R!==-1&&R<c.start){g=R+_.length;break}}}}const S=c.start;e.push({boundaryStart:a.start,boundaryEnd:a.end,headersStart:d,headersEnd:p,bodyStart:g,bodyEnd:S,contentType:O})}return e}const Jet=()=>Ar.fromClass(class{decorations;constructor(t){this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.viewportChanged)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){const e=t.state.doc.toString(),n=[],r=Et.mark({attributes:{style:"color: var(--color-carrot-8); font-weight: var(--font-weight-semibold);"}}),i=Et.mark({attributes:{style:"color: var(--color-blue-8);"}}),o=Et.mark({attributes:{style:"color: var(--color-purple-8);"}}),s=Het(e),a=/^--[a-zA-Z0-9_\-\.]+(?:--)?(?:\r?\n|$)/gm,c=[];let d;for(;(d=a.exec(e))!==null;)c.push({start:d.index,end:d.index+d[0].length});for(const w of c)t.visibleRanges.some(C=>Math.max(C.from,w.start)<Math.min(C.to,w.end))&&n.push({from:w.start,to:w.end,value:r});const p=/^([a-zA-Z0-9\-]+):\s*(.+?)(?:\r?\n|$)/gm;for(const w of s){p.lastIndex=w.headersStart;let S;for(;(S=p.exec(e))!==null&&S.index<w.headersEnd;){const T=S.index+S[1].length+1+(S[2].match(/^\s*/)?.[0]?.length||0),E=S.index+S[0].length-(S[0].match(/\r?\n$/)?.[0]?.length||0);t.visibleRanges.some(_=>Math.max(_.from,T)<Math.min(_.to,E))&&E>T&&n.push({from:T,to:E,value:i})}}const g=/\[Binary\s+Data\]/gi;let O;for(;(O=g.exec(e))!==null;){const w=O.index,S=O[0].length;t.visibleRanges.some(T=>Math.max(T.from,w)<Math.min(T.to,w+S))&&n.push({from:w,to:w+S,value:o})}const v=Et.mark({attributes:{style:"color: var(--color-blue-8);"}});for(const w of s)if(w.contentType?.includes("json")){const S=e.slice(w.bodyStart,w.bodyEnd),C=S.trim();if(!C)continue;const T=S.length-S.trimStart().length,E=w.bodyStart+T;let $;try{const R=ww.create("inmemory://model.json","json",0,C),D=Get.parseJSONDocument(R)?.root;$=Wet(D)?D:void 0}catch{$=void 0}if(!$)continue;const _=Fet($);for(const R of _){const Q=E+R.from,D=E+R.to;if(!t.visibleRanges.some(G=>Math.max(G.from,Q)<Math.min(G.to,D))||!(e[Q]==='"'&&e[D-1]==='"'))continue;const Z=Q+1,Y=D-1;Y<=Z||n.push({from:Z,to:Y,value:v})}}return Et.set(n,!0)}},{decorations:t=>t.decorations}),Ket=()=>Ar.fromClass(class{decorations;constructor(t){this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.viewportChanged)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){const e=t.state.doc.toString(),n=[],r=Et.mark({attributes:{style:"color: var(--color-blue-8);"}}),i=/^([a-zA-Z0-9\-]+):\s*(.+?)(?:\r?\n|$)/gm;let o;for(;(o=i.exec(e))!==null;){let c=o.index+o[1].length+1;for(;c<e.length&&/\s/.test(e[c]);)c++;const p=o.index+o[0].length-(o[0].match(/\r?\n$/)?.[0]?.length||0);p<=c||!t.visibleRanges.some(O=>Math.max(O.from,c)<Math.min(O.to,p))||n.push({from:c,to:p,value:r})}return Et.set(n,!0)}},{decorations:t=>t.decorations}),ett=AM({});function ttt(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.type=="string"&&typeof e.offset=="number"&&typeof e.length=="number"}function ntt(t){const e=[];if(!t)return e;const n=[t];for(;n.length>0;){const r=n.pop();if(r.type==="property"){r.valueNode&&n.push(r.valueNode);continue}if(r.type==="string"){const i=r.offset,o=r.offset+r.length;o>i&&e.push({from:i,to:o})}if(r.children&&r.children.length)for(const i of r.children)n.push(i)}return e}const cq=()=>Ar.fromClass(class{decorations;constructor(t){this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.viewportChanged)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){const e=t.state.doc.toString(),n=[],r=Et.mark({attributes:{style:"color: var(--color-blue-8);"}}),i=Et.mark({attributes:{style:"color: var(--code-block-tokens-keyword-color); font-weight: var(--font-weight-bold);"}}),o=e.split(/\r?\n/);let s=0;for(let a=0;a<o.length;a++){const c=o[a],d=s,p=s+c.length;if(!c.trim()){s=p+(e[s+c.length]==="\r"?2:1);continue}let g=d,O=c;c.startsWith("0x1E")?(g=d+4,O=c.substring(4),n.push({from:d,to:d+4,value:i})):c.charCodeAt(0)===30&&(g=d+1,O=c.substring(1),n.push({from:d,to:d+1,value:i})),c.endsWith("0x0A")?(O=O.substring(0,O.length-4),n.push({from:p-4,to:p,value:i})):c.charCodeAt(c.length-1)===10&&(O=O.substring(0,O.length-1),n.push({from:p-1,to:p,value:i}));let v;try{const S=ww.create("inmemory://model.json","json",0,O),T=ett.parseJSONDocument(S)?.root;v=ttt(T)?T:void 0}catch{v=void 0}if(!v){s=p+(e[s+c.length]==="\r"?2:1);continue}const w=ntt(v);for(const S of w){const C=g+S.from,T=g+S.to;if(!t.visibleRanges.some(R=>Math.max(R.from,C)<Math.min(R.to,T))||!(e[C]==='"'&&e[T-1]==='"'))continue;const $=C+1,_=T-1;_<=$||n.push({from:$,to:_,value:r})}s=p+(e[s+c.length]==="\r"?2:1)}return Et.set(n,!0)}},{decorations:t=>t.decorations}),Xw={[zo.Text]:{name:"Text",extensions:[wt.lineWrapping],stateExtensions:[t7]},[zo.JSON]:{name:"JSON",extensions:[lge(),EHe(zet(),{delay:0,needsRefresh:t=>t.transactions.some(e=>e.effects.some(n=>n.is(cOe)))}),age.data.of({autocomplete:Let()}),qet],stateExtensions:[Net,Yet]},[zo.XML]:{name:"XML",extensions:[hHe()],stateExtensions:[t7]}},uOe={[zo.MultipartMixed]:{name:"Multipart Mixed",extensions:[wt.lineWrapping],stateExtensions:[Jet]},[zo.JSONL]:{name:"JSON Lines",extensions:[wt.lineWrapping],stateExtensions:[cq]},[zo.NDJSON]:{name:"NDJSON",extensions:[lge(),wt.lineWrapping],stateExtensions:[cq]},[zo.JSONSeq]:{name:"JSON Sequence",extensions:[wt.lineWrapping],stateExtensions:[cq]},[zo.TextStream]:{name:"SSE",extensions:[wt.lineWrapping],stateExtensions:[Ket]}},dOe={[zo.Image]:{name:"Image",extensions:[],stateExtensions:[]}},fOe={[zo.HTML]:{name:"HTML",extensions:[BFe()],stateExtensions:[t7]}},IP={...Xw,...dOe,...fOe,...uOe},P8={...Xw,...dOe,...fOe},Mb={...Xw,...uOe},pOe={[zo.FormData]:{name:"form-data",extensions:void 0},[zo["application/x-www-form-urlencoded"]]:{name:"x-www-form-urlencoded",extensions:void 0}},hOe={[zo.Binary]:{name:"Binary",extensions:void 0}},o0={...Xw,...pOe,...hOe},rtt=Object.keys(Xw),RD=Object.keys(pOe),mOe=Object.keys(hOe);function gOe(t=[],e){const n={};return t.forEach(r=>{const i=String(r[e]);n[i]||(n[i]=[]),n[i].push(r)}),n}const Z$={active:!0,key:"",value:""};function Bb(t,e){return[...t.map(r=>({id:crypto.randomUUID(),key:r.name,value:e.initializeWithInputs?`$inputs.${r.name}`:r.example?String(r.example):"",active:e.initializeWithInputs?!0:!!r.example,in:r.in})),xi(e.in)]}function Y$(t,e){const[n]=t.split("?"),r=e.slice(0,-1).filter(i=>i.active).map(i=>`${i.key}=${i.value}`).join("&");return`${n}${r?`?${r}`:""}`}function Id(){return{id:crypto.randomUUID(),...Z$}}function Sc(){return{id:crypto.randomUUID(),...Z$,description:""}}function xi(t){return{...Z$,id:crypto.randomUUID(),in:t}}function Jm(){return{id:crypto.randomUUID(),...Z$,type:"text",files:null}}function A8(){return{id:crypto.randomUUID(),...Z$,sendIn:ll.URL}}function uq(t){return t.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function kM(t,e){return t.filter(n=>n.active&&n.value).map(({value:n})=>(e?Hr(n,e):n).trim())}function bO(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 itt(t,e){return t.map(({value:n,...r})=>({...r,value:Hr(n,e)}))}function ott(t,e){if(!t.startsWith("$components.parameters."))return null;const n=t.replace("$components.parameters.","");return n&&e[n]||null}function go(t=[],e={}){const n=[];for(const r of t)if(hO(r)){const i=ott(r.reference,e);i&&n.push({...i,active:r.active,value:r.value||i.value})}else n.push(r);return n}function Ky(t){return Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:n}))}function stt(t,e){return[...t.flatMap(r=>{const i=r.schema,o=i?.fields||[];return o.length>0?o.flatMap(s=>Nne(s.name,s.example)):Nne(r.name,i?.example??r.example)}),xi("query")]}function Nne(t,e){if(e===void 0)return[dq(t,"",!1)];const n=n7(e,t);return n.length===0?[dq(t,"",!1)]:n.map(r=>dq(r.key,r.value,!0))}function n7(t,e){return t===void 0?[]:t===null?[{key:e,value:""}]:Array.isArray(t)?t.flatMap((n,r)=>n!==null&&typeof n=="object"?n7(n,`${e}[${r}]`):[{key:e,value:String(n)}]):att(t)?Object.entries(t).flatMap(([n,r])=>n7(r,`${e}[${n}]`)):[{key:e,value:String(t)}]}function att(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function dq(t,e,n){return{id:crypto.randomUUID(),key:t,value:e,active:n,in:"query"}}function ltt(t){return t.replace(/{/g,"{{").replace(/}/g,"}}")}const zne={documentedOAuth2Types:[],grantType:Je.ClientCredentials,authRequestExtraParams:[Id()],tokenRequestExtraParams:[A8()],[Je.ClientCredentials]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[Sc()],accessToken:""},[Je.ClientCredentialsWithJwtAssertion]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[Sc()],accessToken:""},[Je.AuthorizationCode]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[Sc()],codeVerifier:"",codeChallenge:"",accessToken:""},[Je.AuthorizationCodeWithPkce]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[Sc()],codeVerifier:"",codeChallenge:"",accessToken:""},[Je.Implicit]:{clientId:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[Sc()],accessToken:""},[Je.Password]:{username:"",password:"",clientId:"",clientSecret:"",tokenUrl:"",accessToken:"",scopes:[Sc()]}},ctt={securityType:Ge.NoAuth,securitySchemeId:null,[Ge.BasicAuth]:{username:"",password:""},[Ge.JWT]:{token:""},[Ge.DigestAuth]:{username:"",password:"",nc:"00000001",realm:"",nonce:"",opaque:"",qop:"",algorithm:"",cnonce:""},[Ge.APIKey]:{location:Cu.Header,name:"",key:""},[Ge.OAuth2]:zne,[Ge.OpenIDConnect]:{...zne,openIdConnectUrl:"",userInfoUrl:""}},r7="urn:ietf:params:oauth:client-assertion-type:jwt-bearer",utt={[ol.SIMPLE]:{condition:"",type:ol.SIMPLE},[ol.REGEX]:{condition:"",type:ol.REGEX,context:""},[ol.JSONPATH]:{condition:"",type:ol.JSONPATH,context:""},[ol.XPATH]:{condition:"",type:ol.XPATH,context:""}};function _D(){return structuredClone({type:ks.Text,content:"",activeExampleName:"",formData:{"multipart/form-data":[Jm()],"application/x-www-form-urlencoded":[Jm()]},binary:null})}const dtt={method:"GET",url:"",security:[Lf()],body:_D(),queryParameters:[Id()],headers:[Id()],cookies:[Id()],pathParameters:[Id()]};function yOe(){return structuredClone(dtt)}function Lf(){return Ym(ctt)}function ftt(t){return Ym({id:crypto.randomUUID(),...utt[t]})}function OOe(t,e,n){for(const r of n){const i=qne(t,r),o=qne(e,r);if(typeof i=="object"&&typeof o=="object"){if(!OOe(i,o,n))return!1}else if(i!==o)return!1}return!0}function qne(t,e){const n=e.split("/");let r=t;for(const i of n)if(r&&typeof r=="object"&&i in r)r=r[i];else return;return r}function ptt(t,e){return t.length===e.length&&t.sort().join()===e.sort().join()}function htt(t,e){return t.every(n=>e.includes(n))}function mtt(t){switch(t){case"query":return Cu.Query;case"cookie":return Cu.Cookie;case"header":return Cu.Header;default:return}}function gtt(t,e,n){const{security:r}=e,i=rUe(t);if(!n)return!1;const o=$8(n),s=o.map(p=>p.securityType),a=r.map(p=>p.securityType);if(!ptt(s,a))return!0;let d=[];return r.forEach(p=>{const g=p.securityType,O=p[Ge.OAuth2]?.grantType,v=s.includes(g),w=o.find(E=>E.securityType===g),S=!w||OOe(p,w,Ott(g,O)),C=ytt(p,g,p[Ge.OAuth2]?.grantType,i),T=!!(v&&w&&S&&C);d.push(!n.security?.length||T)}),d.includes(!1)}function ytt(t,e,n,r){if(e===Ge.OAuth2&&(n===Je.AuthorizationCode||n===Je.AuthorizationCodeWithPkce||n===Je.Implicit)){const i=t[Ge.OAuth2][n]?.availableScopes,o=kM(t[Ge.OAuth2][n]?.scopes,r);return htt(o,i)}return!0}function Ott(t,e){return t===Ge.APIKey?[`${Ge.APIKey}/name`,`${Ge.APIKey}/location`]:t===Ge.OAuth2?[`${Ge.OAuth2}/grantType`,...vtt(e)]:t===Ge.OpenIDConnect?[`${Ge.OpenIDConnect}/openIdConnectUrl`]:[]}function vtt(t){return t===Je.ClientCredentials?[`${Ge.OAuth2}/${Je.ClientCredentials}/tokenUrl`]:t===Je.Password?[`${Ge.OAuth2}/${Je.Password}/tokenUrl`]:t===Je.Implicit?[`${Ge.OAuth2}/${Je.Implicit}/authorizationUrl`]:t===Je.AuthorizationCode?[`${Ge.OAuth2}/${Je.AuthorizationCode}/tokenUrl`,`${Ge.OAuth2}/${Je.AuthorizationCode}/authorizationUrl`]:t===Je.AuthorizationCodeWithPkce?[`${Ge.OAuth2}/${Je.AuthorizationCodeWithPkce}/tokenUrl`,`${Ge.OAuth2}/${Je.AuthorizationCodeWithPkce}/authorizationUrl`]:[]}function btt(t){return t.map(e=>{const n=e.map(r=>r.id).join("_");return e.map(r=>({...r,schemeId:n}))})}function xtt(t){const e=t.security||[],n=e.map(r=>{let i="";const o=[];return r.forEach((s,a)=>{i=a===0?`${s.id}`:`${i}_${s.id}`,o.push(k8(s))}),{id:i,security:o}});return e.length?n:[]}function Stt(t,e){const n=t.security||[];return n?.length?wOe(n).map((r,i)=>k8(r)):[]}function $8(t){const n=(t.security||[])[0];return n?n.map(r=>k8(r)):[Lf()]}function k8(t,e){const n={...Lf(),securitySchemeId:t.id},r=RM(t);n.securityType=r;const i=t.id;if(t.id&&r!==Ge.NoAuth&&(n[r].schemeName=t.id),r===Ge.BasicAuth&&(n[Ge.BasicAuth].username||(n[Ge.BasicAuth].username=ro(i+F.SecurityVariablesEnvSuffix.Username)),n[Ge.BasicAuth].password||(n[Ge.BasicAuth].password=ro(i+F.SecurityVariablesEnvSuffix.Password))),r===Ge.DigestAuth&&(n[Ge.DigestAuth].username||(n[Ge.DigestAuth].username=ro(i+F.SecurityVariablesEnvSuffix.Username)),n[Ge.DigestAuth].password||(n[Ge.DigestAuth].password=ro(i+F.SecurityVariablesEnvSuffix.Password))),r===Ge.JWT&&!n[Ge.JWT].token&&(n[Ge.JWT].token=ro(i+F.SecurityVariablesEnvSuffix.JWTToken)),r===Ge.APIKey&&!n[Ge.APIKey].key){n[Ge.APIKey].name=t.name||"",n[Ge.APIKey].key=ro(i+F.SecurityVariablesEnvSuffix.APIKey);const o=mtt(t.in);o&&(n[Ge.APIKey].location=o)}if(r===Ge.OAuth2){const o=_8(t),s=ro(i+F.SecurityVariablesEnvSuffix.Token),a=n[Ge.OAuth2];a.grantType=o[0],o.forEach(c=>{c===Je.AuthorizationCode&&!a[Je.AuthorizationCode].accessToken&&(a[Je.AuthorizationCode].accessToken=s,a[Je.AuthorizationCode].clientId=ro(i+F.SecurityVariablesEnvSuffix.ClientId),a[Je.AuthorizationCode].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[Je.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[Je.AuthorizationCode].clientSecret=ro(i+F.SecurityVariablesEnvSuffix.ClientSecret),a[Je.AuthorizationCode].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[Je.AuthorizationCode].scopes=[...Ky(t.flows?.authorizationCode?.scopes||{})||[],Sc()]),c===Je.AuthorizationCodeWithPkce&&!a[Je.AuthorizationCodeWithPkce].accessToken&&(a[Je.AuthorizationCodeWithPkce].accessToken=s,a[Je.AuthorizationCodeWithPkce].clientId=ro(i+F.SecurityVariablesEnvSuffix.ClientId),a[Je.AuthorizationCodeWithPkce].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[Je.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[Je.AuthorizationCodeWithPkce].clientSecret=ro(i+F.SecurityVariablesEnvSuffix.ClientSecret),a[Je.AuthorizationCodeWithPkce].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[Je.AuthorizationCodeWithPkce].scopes=[...Ky(t.flows?.authorizationCode?.scopes||{}),Sc()]),c===Je.ClientCredentials&&!a[Je.ClientCredentials].accessToken&&(a[Je.ClientCredentials].accessToken=s,a[Je.ClientCredentials].clientId=ro(i+F.SecurityVariablesEnvSuffix.ClientId),a[Je.ClientCredentials].clientSecret=ro(i+F.SecurityVariablesEnvSuffix.ClientSecret),a[Je.ClientCredentials].tokenUrl=t.flows?.clientCredentials?.tokenUrl||"",a[Je.ClientCredentials].scopes=[...Ky(t.flows?.clientCredentials?.scopes||{}),Sc()]),c===Je.ClientCredentialsWithJwtAssertion&&!a[Je.ClientCredentialsWithJwtAssertion].accessToken&&(a[Je.ClientCredentialsWithJwtAssertion].accessToken=s,a[Je.ClientCredentialsWithJwtAssertion].clientId=ro(i+F.SecurityVariablesEnvSuffix.ClientId),a[Je.ClientCredentialsWithJwtAssertion].clientAssertion=ro(i+F.SecurityVariablesEnvSuffix.ClientAssertion),a[Je.ClientCredentialsWithJwtAssertion].scopes=[...Ky(t.flows?.clientCredentials?.scopes||{}),Sc()]),c===Je.Implicit&&!a[Je.Implicit].accessToken&&(a[Je.Implicit].accessToken=s,a[Je.Implicit].clientId=ro(i+F.SecurityVariablesEnvSuffix.ClientId),a[Je.Implicit].authorizationUrl=t.flows?.implicit?.authorizationUrl||"",a[Je.Implicit].availableScopes=Object.keys(t.flows?.implicit?.scopes||{})||[],a[Je.Implicit].scopes=[...Ky(t.flows?.implicit?.scopes||{}),Sc()]),c===Je.Password&&!a[Je.Password].accessToken&&(a[Je.Password].accessToken=s,a[Je.Password].clientId=ro(i+F.SecurityVariablesEnvSuffix.ClientId),a[Je.Password].clientSecret=ro(i+F.SecurityVariablesEnvSuffix.ClientSecret),a[Je.Password].tokenUrl=t.flows?.password?.tokenUrl||"",a[Je.Password].scopes=[...Ky(t.flows?.password?.scopes||{}),Sc()])})}if(r===Ge.OpenIDConnect){const o=ro(i+F.SecurityVariablesEnvSuffix.Token),s=n[Ge.OpenIDConnect];s[Je.AuthorizationCode].accessToken||(s[Je.AuthorizationCode].accessToken=o,s[Je.AuthorizationCode].clientId=ro(i+F.SecurityVariablesEnvSuffix.ClientId),s[Je.AuthorizationCode].clientSecret=ro(i+F.SecurityVariablesEnvSuffix.ClientSecret),s[Je.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),s[Je.AuthorizationCodeWithPkce].accessToken||(s[Je.AuthorizationCodeWithPkce].accessToken=o,s[Je.AuthorizationCodeWithPkce].clientId=ro(i+F.SecurityVariablesEnvSuffix.ClientId),s[Je.AuthorizationCodeWithPkce].clientSecret=ro(i+F.SecurityVariablesEnvSuffix.ClientSecret),s[Je.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),s[Je.Implicit].accessToken||(s[Je.Implicit].accessToken=o,s[Je.Implicit].clientId=ro(i+F.SecurityVariablesEnvSuffix.ClientId))}return n}function vOe(t){try{const e=JSON.parse(t);return JSON.stringify(e,null,2)}catch(e){return console.error({error:e}),t}}function bOe(t,e){return e&&e.length>0?stt(e):Bb(t||[],{in:"query"})}function wtt(t,e=!1,n="",r){const i=gOe(t.parameters,"in"),o=xOe(t),s=$8(t),a=bOe(i.query,i.querystring);return{id:crypto.randomUUID(),name:t.name,operationId:t.operationId,collectionPath:r,apiPath:{path:t.path,method:t.method},apiId:n,isAdditionalOperation:e,request:{pathParameters:Bb(i.path||[],{in:"path"}),method:t.method.toLowerCase()==="x-query"?"QUERY":t.method.toLocaleUpperCase(),url:Y$(ltt(t.path),a),headers:Bb(i.header||[],{in:"header"}),queryParameters:a,cookies:Bb(i.cookie||[],{in:"cookie"}),body:o,security:s},response:null}}function R8(t){const e=gOe(t.parameters,"in"),n=xOe(t),r=$8(t);return{parameters:{queryParameters:bOe(e.query,e.querystring),headers:Bb(e.header||[],{in:"header"}),cookies:Bb(e.cookie||[],{in:"cookie"}),pathParameters:Bb(e.path||[],{initializeWithInputs:!0,in:"path"})},requestBody:n,security:r}}function Ctt(t,e){const n=new cg({format:!0});if(typeof t=="string")return e?.includes("json")?vOe(t):t;if(typeof t=="object"&&t!==null&&e?.includes("xml")){const i=Array.isArray(t)?t:{root:t};return n.build(i)}return JSON.stringify(t,null,2)}function xOe(t){const e=t.body?.mediaTypes;if(!e||!Object.keys(e).length)return _D();const n=Ttt(e,t),r=n?.name||"",i=!RD.includes(r)&&!mOe.includes(r),o=i7(n),a=o.find(({key:d})=>d===t.body?.activeExampleName)?.value??o[0]?.value,c=i&&a?Ctt(a,r):"";return{..._D(),activeExampleName:t.body?.activeExampleName||o[0]?.key||"",...n&&{type:n.name},content:c,formData:{"multipart/form-data":Lne(e[zo.FormData]),"application/x-www-form-urlencoded":Lne(e[zo["application/x-www-form-urlencoded"]])}}}function SOe(t){return t?{...(Object.keys(t?.body?.mediaTypes||{})||[]).reduce((n,r)=>(n[r]={name:r,extensions:void 0},n),{}),...o0}:o0}function Lne(t){if(!t)return[Jm()];if(!t.parameters)return[Jm()];const e=t.parameters.map(n=>({id:crypto.randomUUID(),key:n.name,value:String(n.example)||"",active:!0,type:n.inputType,files:null}));return e.push(Jm()),e}function i7(t){const e=t?.examples;return Object.keys(e||{}).map(n=>{const r=e?.[n];return{name:F.isString(r?.summary)?r?.summary:r?.summary?.raw||n,key:n,value:e?.[n].value}})}function Ttt(t,e){const n=SOe(e),r=Object.keys(t).find(i=>!!n[i]);return r?t[r]:null}function Ett(t){return!t?.security?.length||!t?[]:Stt(t)}function wOe(t){const e=new Set;return t.flat().filter(n=>e.has(n.id)?!1:(e.add(n.id),!0))}function RM(t){if(t.type==="http"){if(t.scheme==="bearer")return Ge.JWT;if(t.scheme==="basic")return Ge.BasicAuth;if(t.scheme==="digest")return Ge.DigestAuth}else{if(t.type==="apiKey")return Ge.APIKey;if(t.type==="oauth2")return Ge.OAuth2;if(t.type==="openIdConnect")return Ge.OpenIDConnect}return Ge.NoAuth}function Ptt(t,e){if(t==="clientCredentials"&&e&&"x-assertionType"in e&&e["x-assertionType"]===r7)return Je.ClientCredentialsWithJwtAssertion;if(t==="authorizationCode"&&e&&"x-usePkce"in e&&e["x-usePkce"])return Je.AuthorizationCodeWithPkce;switch(t){case"implicit":return Je.Implicit;case"password":return Je.Password;case"clientCredentials":return Je.ClientCredentials;case"authorizationCode":return Je.AuthorizationCode;default:return Je.AuthorizationCode}}function Att(t,e){const n=t?.security;if(!n?.length)return[];const o=btt(n).flat().filter(s=>s.schemeId===e).find(s=>RM(s)===Ge.OAuth2);return _8(o)}function _8(t){return Object.entries(t?.flows||{}).map(([e,n])=>Ptt(e,n)).filter(Boolean)}async function G$(t){try{const e=await Ype(t),n=await AV(t);return{absolutePath:t,file:new File([e],n)}}catch(e){return console.error("Failed to init replay file",e),null}}async function COe(t){return(await Promise.allSettled(t.map(n=>G$(n)))).map(n=>n.status==="fulfilled"?n.value:null).filter(n=>n!==null)}function Aj(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function o7(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function $tt(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function _M(t){return/^https?:\/\//i.test(t)}function ktt(t,e){let n;if(e.startsWith("//")){const{protocol:r}=new URL(t);n=`${r||"https:"}${e}`}else if(Aj(e))n=e;else if(!e.startsWith("/"))n=o7(t)+"/"+e;else{const r=new URL(t);r.pathname=e,n=r.toString()}return o7(n)}function Une(t,e){let n=t;return e.forEach(({key:r,value:i,active:o})=>{i&&o&&(n=n.replaceAll(`{${r}}`,i))}),n}function TOe(t,e){let n=t;return e.forEach(({name:r,value:i})=>{i&&(n=n.replaceAll(`{${r}}`,i))}),n}function Rtt(t){return t.startsWith("http://")||t.startsWith("https://")}function EI({url:t,serverUrl:e,corsProxyUrl:n}){let r;if(Rtt(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}async function _tt(t,e,n,r,i,o){const s=await Promise.all(t.sourceDescriptions?.map(async c=>({...c,apiId:await EOe({projectPath:r,apiUrl:c.url,collectionId:e})}))),a={inputs:t.components?.inputs||{},parameters:Object.fromEntries(Object.entries(t.components?.parameters||{}).map(([c,d])=>[c,{...d,key:d.name,value:d.value,id:crypto.randomUUID(),active:!0}]))};return{...t,id:e,srcType:n,state:Er.Normal,sourceDescriptions:s,components:a,workflows:await Promise.all(t.workflows.map(async c=>({...c,state:Er.Normal,parameters:Hne(c.parameters,c["x-replay-disabled-parameters"],t.components?.parameters),outputs:Wne(c.outputs),security:Zne(c["x-security"]),steps:await Promise.all(c.steps.map(async d=>{const p=Hne(d.parameters,d["x-replay-disabled-parameters"],t.components?.parameters),g=d["x-operation"]??null;g&&(g.url=Y$(g.url,p.queryParameters.filter(vae)));const O=Itt(d,s,i);let v;if(O&&o){const S=i?.find(C=>C.id===O.apiId);try{v=o(O.path,O.method,S)}catch(C){console.error("Failed to convert operation to replay value",C),v=void 0}}delete d.operationId,delete d["x-operation"];const w=await ztt(d.requestBody,r);return{...d,state:Er.Normal,parameters:p,outputs:Wne(d.outputs),successCriteria:d.successCriteria?.map(S=>({...S,type:S.type??ol.SIMPLE}))||[],requestBody:w,xOperation:g,security:Zne(d["x-security"],v),operation:O}}))})))}}async function EOe({projectPath:t,apiUrl:e,collectionId:n}){if(_M(e))return e;if(await Fr.isAbsolute(e))return await Fr.relative(t,e);const r=await Fr.resolve(await Fr.join(t,n,"..",e));return await Fr.relative(t,r)}function Itt(t,e,n){if(t["x-operation"])return null;const{path:r,method:i,apiId:o,isAdditionalOperation:s}=POe({operationPath:t.operationPath,parsedSourceDescriptions:e}),{operationId:a,apiId:c}=jtt({operationId:t.operationId,parsedSourceDescriptions:e}),d=c||o||e[0]?.apiId||"",p=n?.find(g=>g.id===d);if(a&&p&&!r&&!i){const g=Ltt(a,p);return{apiId:d,path:g?.path??"",method:g?.method??"",operationId:a,isAdditionalOperation:g?.isAdditionalOperation??!1}}return{apiId:d,path:r??"",method:i??"",operationId:a,isAdditionalOperation:s}}function jtt({operationId:t,parsedSourceDescriptions:e}){if(!t)return{operationId:"",apiId:null};const n=t.split(".");if(n.length===1)return{operationId:t,apiId:e[0]?.apiId??""};const[,r,i=""]=n,o=e.find(({name:s})=>s===r);return{operationId:i,apiId:o?.apiId??""}}function Vne(t){return"reference"in t&&typeof t.reference=="string"}function POe({operationPath:t,parsedSourceDescriptions:e}){if(!t)return{apiId:null,path:"",method:"",isAdditionalOperation:!1};try{const n=t.split("#"),r=n.length>1?n[1]:n[0],i=n.length>1?n[0]:"";if(!r)return{path:"",method:"",apiId:null,isAdditionalOperation:!1};let o=null,s=null;const a=/\$sourceDescriptions\.(.+)\.url/,c=i.match(a);if(c&&(o=c[1]),o){const v=e.find(({name:w})=>w===o);v&&(s=v.apiId)}const d=r.split("/"),p=d.pop()||"",g=d[d.length-1]==="additionalOperations";return g&&d.pop(),{path:kQ.unescape(d.pop()||""),method:p.toLowerCase(),apiId:s,isAdditionalOperation:g}}catch{return{path:"",method:"",apiId:null,isAdditionalOperation:!1}}}function Qtt(t){switch(t.type){case"apiKey":return Ge.APIKey;case"oauth2":return Ge.OAuth2;case"openIdConnect":return Ge.OpenIDConnect;case"http":return t.scheme==="basic"?Ge.BasicAuth:t.scheme==="digest"?Ge.DigestAuth:t.scheme==="bearer"?Ge.JWT:Ge.NoAuth;default:return Ge.NoAuth}}function AOe(t,e){const n={clientCredentials:Je.ClientCredentials,authorizationCode:Je.AuthorizationCode,implicit:Je.Implicit,password:Je.Password,clientCredentialsWithJwtAssertion:Je.ClientCredentialsWithJwtAssertion,authorizationCodeWithPkce:Je.AuthorizationCodeWithPkce};return t==="clientCredentials"&&e["x-assertionType"]==="urn:ietf:params:oauth:client-assertion-type:jwt-bearer"?Je.ClientCredentialsWithJwtAssertion:t==="authorizationCode"&&e["x-usePkce"]?Je.AuthorizationCodeWithPkce:n[t]??null}function Dtt(t){return{query:Cu.Query,header:Cu.Header,cookie:Cu.Cookie}[t.toLowerCase()]||Cu.Header}function Mtt(t){return{body:ll.Body,header:ll.Header,url:ll.URL}[t.toLowerCase()]||ll.URL}function Bne(t,e,n){return Object.keys(t).reduce((r,i)=>{const o=AOe(i,t[i]);if(!o)return r;switch(o){case Je.ClientCredentials:r[o]={...n[o],clientId:e.clientId??"",clientSecret:e.clientSecret??"",clientAssertion:e.clientAssertion??"",tokenUrl:t[i].tokenUrl??"",scopes:Sb(t[i].scopes,t[i]["x-replay-disabled-scopes"]),accessToken:e.accessToken??""};break;case Je.AuthorizationCode:r[o]={...n[o],clientId:e.clientId??"",clientSecret:e.clientSecret??"",tokenUrl:t[i].tokenUrl??"",authorizationUrl:t[i].authorizationUrl??"",callbackUrl:e.callbackUrl??"",availableScopes:t[i].availableScopes??[],scopes:Sb(t[i].scopes,t[i]["x-replay-disabled-scopes"]),accessToken:e.accessToken??""};break;case Je.Implicit:r[o]={...n[o],clientId:e.clientId??"",authorizationUrl:t[i].authorizationUrl??"",callbackUrl:e.callbackUrl??"",availableScopes:Sb(t[i].availableScopes),scopes:Sb(t[i].scopes,t[i]["x-replay-disabled-scopes"]),accessToken:e.accessToken??""};break;case Je.Password:r[o]={...n[o],tokenUrl:t[i].tokenUrl??"",username:e.username??"",password:e.password??"",clientId:e.clientId??"",clientSecret:e.clientSecret??"",accessToken:e.accessToken??""};break;case Je.ClientCredentialsWithJwtAssertion:r[o]={...n[o],clientAssertion:e.clientAssertion??"",tokenUrl:t[i].tokenUrl??"",scopes:Sb(t[i].scopes,t[i]["x-replay-disabled-scopes"]),clientId:e.clientId??"",clientSecret:e.clientSecret??"",accessToken:e.accessToken??""};break;case Je.AuthorizationCodeWithPkce:r[o]={...n[o],tokenUrl:t[i].tokenUrl??"",authorizationUrl:t[i].authorizationUrl??"",callbackUrl:e.callbackUrl??"",availableScopes:Sb(t[i].availableScopes),scopes:Sb(t[i].scopes,t[i]["x-replay-disabled-scopes"]),codeVerifier:e.codeVerifier??"",codeChallenge:e.codeChallenge??"",clientId:e.clientId??"",clientSecret:e.clientSecret??"",accessToken:e.accessToken??""};break}return r},n)}function Xne(t,e,n){const i={...Lf(),securityType:t},o=Object.keys(e.flows||{})[0],s=AOe(o,e.flows?.[o])??Je.ClientCredentials;switch(t){case Ge.BasicAuth:return{...i,[Ge.BasicAuth]:{username:n.username,password:n.password,schemeName:e.id}};case Ge.JWT:return{...i,[Ge.JWT]:{token:n.token,schemeName:e.id}};case Ge.DigestAuth:return{...i,[Ge.DigestAuth]:{...i[Ge.DigestAuth],username:n.username,password:n.password,schemeName:e.id}};case Ge.APIKey:return{...i,[Ge.APIKey]:{location:Dtt(e.in),name:e.name,key:n.apiKey,schemeName:e.id}};case Ge.OAuth2:return{...i,[Ge.OAuth2]:{...i[Ge.OAuth2],...Bne(e.flows||{},n||{},i[Ge.OAuth2]),authRequestExtraParams:Yne(n.authRequestExtraParams),tokenRequestExtraParams:Gne(n.tokenRequestExtraParams),grantType:s,schemeName:e.id}};case Ge.OpenIDConnect:return{...i,[Ge.OpenIDConnect]:{...i[Ge.OpenIDConnect],...Bne(n.flows||{},n||{},i[Ge.OpenIDConnect]),openIdConnectUrl:n.openIdConnectUrl,userInfoUrl:n.userInfoUrl,authRequestExtraParams:Yne(n.authRequestExtraParams),tokenRequestExtraParams:Gne(n.tokenRequestExtraParams),grantType:s,schemeName:e.id}};default:return i}}function Ntt(t,e){return[...t.map(r=>{if("scheme"in r){const o=Qtt(r.scheme);return Xne(o,r.scheme,r.values)}const i=e.find(o=>o.id===r.schemeName);if(i){const o=RM(i),s=Xne(o,i,r.values);return s.securitySchemeId=i.id,s}return Lf()})]}function Zne(t=[],e){const n=wOe(e?.security||[]);return t.length?Ntt(t,n):[Lf()]}function Sb(t,e){const n=Ky(t||{}),r=Ky(e||{});return[...n,...r,Sc()]}function Yne(t){return(t||[]).map(e=>({id:crypto.randomUUID(),key:e.key??"",value:e.value??"",active:e.active??!0})).concat(Id())}function Gne(t){return(t||[]).map(e=>({id:crypto.randomUUID(),key:e.key??"",value:e.value??"",active:e.active??!0,sendIn:Mtt(e.in)})).concat(A8())}function Wne(t){if(!t)return[Id()];const e=[];for(const n in t)e.push({id:crypto.randomUUID(),key:n,value:t[n],active:!0});return e.push(Id()),e}const W1={query:"queryParameters",path:"pathParameters",header:"headers",cookie:"cookies"};function Fne(t,e){const n="$components.parameters.";if(t.reference.startsWith(n)){const r=t.reference.replace(n,"");return e?.[r]}}function Hne(t,e,n){if(!t&&!e)return{pathParameters:[xi("path")],queryParameters:[xi("query")],headers:[xi("header")],cookies:[xi("cookie")]};const r={pathParameters:[],queryParameters:[],headers:[],cookies:[]};if(t)for(const i of t)if(Vne(i)){const o=Fne(i,n),s=W1[o?.in];s&&r[s].push({reference:i.reference,active:!0,value:i.value})}else W1[i.in]&&r[W1[i.in]].push({id:crypto.randomUUID(),key:i.name,value:i.value,active:!0,in:i.in});if(e)for(const i of e)if(Vne(i)){const o=Fne(i,n),s=W1[o?.in];s&&r[s].push({reference:i.reference,active:!1,value:i.value})}else W1[i.in]&&r[W1[i.in]].push({id:crypto.randomUUID(),key:i.name,value:i.value,active:!1,in:i.in});return r.pathParameters.push(xi("path")),r.queryParameters.push(xi("query")),r.headers.push(xi("header")),r.cookies.push(xi("cookie")),r}async function ztt(t,e){const n=yOe().body;if(!t)return n;switch(t.contentType){case"application/x-www-form-urlencoded":case"multipart/form-data":return{...n,type:t.contentType,formData:await qtt(t,e)};case"application/octet-stream":const r=t.payload?await $Oe(t.payload,e):[],i=r.length>0?await G$(r[0]):null;return{...n,type:t.contentType,binary:i};case"application/json":case"application/ld+json":return{...n,type:t.contentType,content:Kne(t.payload)};default:{const o=typeof t.payload=="string",s=t.contentType||(o?"text/plain":"application/json");return{...n,type:s,content:o?t.payload:Kne(t.payload)}}}}async function Jne(t,e,n,r){const i=await $Oe(e,r),o=i.length>0||Array.isArray(e),s=o?await COe(i):void 0;return{id:crypto.randomUUID(),key:t,value:o?"":e,type:o?"file":"text",active:n,files:s}}async function qtt(t,e){const n=yOe().body.formData,r=t.contentType,i=t.payload?await Promise.all(Object.entries(t.payload).map(([a,c])=>Jne(a,c,!0,e))):[],o=t["x-replay-disabled-payload"]?await Promise.all(Object.entries(t["x-replay-disabled-payload"]||{}).map(([a,c])=>Jne(a,c,!1,e))):[];return{...n,[r]:[...i,...o,Jm()]}}function Kne(t){return t?JSON.stringify(t,null,2):""}function Ltt(t,e){for(const n of Object.keys(e.paths)){const r=e.paths[n];for(const i of Object.keys(r)){const o=i.toLowerCase();if(["get","put","post","delete","options","head","patch","trace"].includes(o)&&r[o]?.operationId===t)return{method:o,path:n,isAdditionalOperation:!1}}if(r.additionalOperations){for(const[i,o]of Object.entries(r.additionalOperations))if(o?.operationId===t)return{method:i.toLowerCase(),path:n,isAdditionalOperation:!0}}}return null}async function $Oe(t,e){return Array.isArray(t)?(await Promise.all(t.map(n=>ere(n,e)))).flat():typeof t=="string"?await ere(t,e):[]}async function ere(t,e){const n=/\$file\(['"](.+?)['"]\)/g,r=Array.from(t.matchAll(n));return Promise.all(r.map(i=>Utt(i[1],e)))}async function Utt(t,e){return await Fr.isAbsolute(t)?t:await Fr.resolve(await Fr.join(e,t))}const Wl=t=>!t||typeof t=="boolean"?{type:"object",properties:{}}:t.type?t:{...t,type:"object"},tre=(t,e,n)=>{if(!t.properties)return t;const r=t.properties[e],i=Wl(r);return{...t,properties:{...t.properties,[e]:{...i,...n}}}},Vtt=(t,e,n)=>{if(!t.properties||e===n||!n.trim())return null;const r={...t.properties};return r[n]?null:(r[n]=r[e],delete r[e],{...t,properties:r})},Btt=(t,e)=>{if(!t.properties)return t;const n={...t.properties};return delete n[e],{...t,properties:n}},Xtt=(t,e,n={type:"string"})=>{const r=t.properties||{};return{...t,type:"object",properties:{...r,[e]:n}}};function nre(t){const e=Object.assign({},...(t||[]).filter(({key:n,active:r})=>n&&r).map(n=>({[n.key]:n.value})));if(Object.keys(e).length!==0)return e}function rre(t){if(!t)return{};const e={queryParameters:"query",headers:"header",cookies:"cookie",pathParameters:"path"},n=[],r=[];return Object.keys(e).forEach(i=>{const o=i;t[o].forEach(s=>{if(hO(s)){const a={reference:s.reference,value:s.value||void 0};s.active?n.push(a):r.push(a)}else{if(!s.key)return;const a={name:s.key,in:e[o],value:s.value};s.active?n.push(a):r.push(a)}})}),{parameters:n.length>0?n:void 0,"x-replay-disabled-parameters":r.length>0?r:void 0}}function Ztt(t){const e=t?.map(n=>({condition:n.condition,context:n.context,type:n.type==ol.SIMPLE?void 0:n.type}));if(e?.length!==0)return e}function Ytt(t){if(!(!t||t.length===0))return[...t]}async function kOe(t,e){return t.absolutePath?`$file('${await Fr.relative(e,t.absolutePath)}')`:null}async function Gtt(t,e){const{type:n,value:r,files:i}=t;switch(n){case"text":return r;case"file":let o=[];return i&&(o=(await Promise.all(Object.values(i).map(s=>kOe(s,e)))).filter(s=>s!==null)),o.length===0?"":o.length===1?o[0]:o}}async function Wtt(t,e){const n=t.type,r=t.formData[n],i={},o={};return await Promise.all(r.map(async s=>{const{key:a,active:c}=s;if(!a)return;const d=await Gtt(s,e);c?i[a]=d:o[a]=d})),{payload:Object.keys(i).length>0?i:void 0,"x-replay-disabled-payload":Object.keys(o).length>0?o:void 0}}function Ftt(t){if(!t)return t;try{const e=JSON.parse(t);return typeof e=="object"?e:t}catch{return t}}async function Htt(t,e){if(t)switch(t.type){case"application/x-www-form-urlencoded":case"multipart/form-data":return{contentType:t.type,...await Wtt(t,e)};case"application/octet-stream":return{contentType:t.type,payload:t.binary?await kOe(t.binary,e):null};case"application/json":case"application/ld+json":return t.content?{contentType:t.type,payload:Ftt(t.content)}:void 0;default:return t.content?{contentType:t.type,payload:t.content}:void 0}}function Jtt(t){return{...t.schemeName?{schemeName:t.schemeName}:{scheme:{type:"http",scheme:"basic"}},values:{username:t.username,password:t.password}}}function Ktt(t){return{...t.schemeName?{schemeName:t.schemeName}:{scheme:{type:"apiKey",name:t.name,in:t.location.toLowerCase()}},values:{apiKey:t.key}}}function ent(t){return{...t.schemeName?{schemeName:t.schemeName}:{scheme:{type:"http",scheme:"bearer"}},values:{token:t.token}}}function tnt(t){return{...t.schemeName?{schemeName:t.schemeName}:{scheme:{type:"http",scheme:"digest"}},values:{username:t.username,password:t.password}}}function nnt(t){const{flows:e,values:n}=IOe(t);return{...t.schemeName?{schemeName:t.schemeName}:{scheme:{type:"openIdConnect",flows:e}},values:{...n,openIdConnectUrl:t.openIdConnectUrl,userInfoUrl:t.userInfoUrl,authRequestExtraParams:ROe(t.authRequestExtraParams),tokenRequestExtraParams:_Oe(t.tokenRequestExtraParams)}}}function rnt(t){const{flows:e,values:n}=IOe(t);return{...t.schemeName?{schemeName:t.schemeName}:{scheme:{type:"oauth2",flows:e}},values:{...n,authRequestExtraParams:ROe(t.authRequestExtraParams),tokenRequestExtraParams:_Oe(t.tokenRequestExtraParams)}}}function F1(t){const e={},n={};return t.forEach(r=>{r.value&&(r.active?e[r.value]=r.description:n[r.value]=r.description)}),{scopes:e,"x-replay-disabled-scopes":Object.keys(n).length>0?n:void 0}}function ROe(t){return t.filter(e=>e.value||e.key).map(e=>({key:e.key,value:e.value,active:e.active}))}function _Oe(t){return t.filter(e=>e.value||e.key).map(e=>({key:e.key,value:e.value,active:e.active,in:e.sendIn.toLowerCase()}))}function IOe(t){let e;switch(t.grantType){case Je.ClientCredentials:return e=t[Je.ClientCredentials],{flows:{clientCredentials:{tokenUrl:e.tokenUrl,...F1(e.scopes)}},values:{clientId:e.clientId,clientSecret:e.clientSecret,accessToken:e.accessToken}};case Je.Implicit:return e=t[Je.Implicit],{flows:{implicit:{authorizationUrl:e.authorizationUrl,...F1(e.scopes)}},values:{clientId:e.clientId,accessToken:e.accessToken,callbackUrl:e.callbackUrl}};case Je.Password:return e=t[Je.Password],{flows:{password:{tokenUrl:e.tokenUrl,...F1(e.scopes)}},values:{clientId:e.clientId,clientSecret:e.clientSecret,username:e.username,password:e.password,accessToken:e.accessToken}};case Je.AuthorizationCode:return e=t[Je.AuthorizationCode],{flows:{authorizationCode:{tokenUrl:e.tokenUrl,authorizationUrl:e.authorizationUrl,...F1(e.scopes)}},values:{accessToken:e.accessToken,clientId:e.clientId,callbackUrl:e.callbackUrl}};case Je.ClientCredentialsWithJwtAssertion:return e=t[Je.ClientCredentialsWithJwtAssertion],{flows:{clientCredentials:{tokenUrl:e.tokenUrl,...F1(e.scopes),"x-assertionType":"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}},values:{clientId:e.clientId,clientAssertion:e.clientAssertion,accessToken:e.accessToken}};case Je.AuthorizationCodeWithPkce:return e=t[Je.AuthorizationCodeWithPkce],{flows:{authorizationCode:{tokenUrl:e.tokenUrl,authorizationUrl:e.authorizationUrl,...F1(e.scopes),"x-usePkce":!0}},values:{clientId:e.clientId,clientSecret:e.clientSecret,accessToken:e.accessToken,codeVerifier:e.codeVerifier,codeChallenge:e.codeChallenge,callbackUrl:e.callbackUrl}}}}function ire(t){const e=t.map(n=>{switch(n.securityType){case Ge.OpenIDConnect:{const i=n[Ge.OpenIDConnect];return nnt(i)}case Ge.OAuth2:{const i=n[Ge.OAuth2];return rnt(i)}case Ge.APIKey:{const i=n[Ge.APIKey];return Ktt(i)}case Ge.BasicAuth:{const i=n[Ge.BasicAuth];return Jtt(i)}case Ge.DigestAuth:{const i=n[Ge.DigestAuth];return tnt(i)}case Ge.JWT:{const i=n[Ge.JWT];return ent(i)}default:return null}}).filter(n=>n!==null);return{"x-security":e.length?e:void 0}}function int(t){const{inputs:e,parameters:n,...r}=t;let i=r;return Object.keys(e).length&&(i.inputs=e),Object.keys(n).length&&(i.parameters=Object.fromEntries(Object.entries(n).map(([o,{id:s,active:a,key:c,...d}])=>[o,{...d,name:c}]))),Object.keys(i).length||(i=void 0),i}async function ont(t,e){const{id:n,state:r,srcType:i,fileDependencies:o,sourceDescriptions:s,workflows:a,components:c,...d}=t;return{arazzoObject:{...d,sourceDescriptions:s.map(p=>({...p,name:p.name,url:p.url,type:p.type||"openapi",apiId:void 0})),components:int(c),workflows:await Promise.all(a.map(async({parameters:p,security:g,dependsOn:O,outputs:v,state:w,steps:S,inputs:C,...T})=>({...T,dependsOn:Ytt(O),outputs:nre(v),inputs:C?Wl(C):void 0,...ire(g),...rre(p),steps:await Promise.all(S.map(async({parameters:E,security:$,operation:_,requestBody:R,successCriteria:Q,outputs:D,state:q,xOperation:Z,...Y})=>{const G={operationId:void 0,operationPath:void 0,"x-operation":void 0};if(_){const K=t.sourceDescriptions.find(({apiId:re})=>re===_.apiId)||t.sourceDescriptions[0];if(_.operationId){const re=t.sourceDescriptions.length<=1;G.operationId=re?_.operationId:`$sourceDescriptions.${K.name}.${_.operationId}`}else G.operationPath=_.isAdditionalOperation?`{$sourceDescriptions.${K.name}.url}#/paths/${kQ.escape(_.path)}/additionalOperations/${_.method}`:`{$sourceDescriptions.${K.name}.url}#/paths/${kQ.escape(_.path)}/${_.method}`}else Z&&(G["x-operation"]={...Z,url:Z.url.split("?")[0]});return{...Y,...G,...ire($),...rre(E),requestBody:await Htt(R,e),successCriteria:Ztt(Q),outputs:nre(D)}}))})))}}}class snt extends ihe{constructor(e,n){super(e),this.convertOperationToReplayValue=n}async parse(e,n){return{...await _tt(e.content,e.uri,e.type,this.storage.baseDir,n,this.convertOperationToReplayValue),fileDependencies:e.fileDependencies}}async stringify(e){const{arazzoObject:n}=await ont(e,this.storage.baseDir);return await Fr.extname(e.id)===".json"?JSON.stringify(n,null,2):eg.dump(n)}}class ant{constructor(e,n){this.storage=e,this.localStorageSecretsProvider=n}default=[];async read(){const e=await this.storage.get("replay-environments.yaml"),n=await this.localStorageSecretsProvider.get();let r=null,i=null;if(!e)return this.default;try{r=eg.load(e),i=n?JSON.parse(n):null}catch(a){return console.error("Failed to parse environments file",a),this.default}return r?Object.keys(r).filter(a=>a!=="version").map(a=>({name:a,inputs:Object.entries(r[a].inputs).map(([c,d])=>{if(typeof d=="string")return{name:c,value:d,isSecret:!1};const p=i?.[a]?.[c]??"";return{name:c,value:p,isSecret:!0}}),servers:Object.entries(r[a].servers).map(([c,d])=>({apiId:c,value:d.value,variables:Object.entries(d.variables||{}).map(([p,g])=>({name:p,value:g}))})),state:Er.Normal})):this.default}async write(e){const n=await this.localStorageSecretsProvider.get(),r=n?JSON.parse(n):{},i=e.reduce((o,s)=>(s.name&&(o[s.name]={inputs:s.inputs.reduce((a,c)=>(c.isSecret&&r?(r[s.name]||(r[s.name]={}),r[s.name][c.name]=c.value,a[c.name]={provider:"local"}):a[c.name]=c.value,a),{}),servers:s.servers.reduce((a,c)=>(a[c.apiId]={value:c.value,variables:Object.fromEntries(c.variables.map(d=>[d.name,d.value]))},a),{})}),o),{});this.localStorageSecretsProvider.set(JSON.stringify(r)),i&&this.storage.set("replay-environments.yaml",eg.dump(i))}}class lnt{constructor(e,n,r){this.storage=e,this.filePath=n,this.defaultValue=r}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 cnt=(t,e)=>({data:t,version:e});class jOe extends lnt{constructor(e,n,r,i){super(e,n,r),this.version=i}migrationMap={};migrate(e){if(!this.migrationMap[e.version])return this.defaultValue;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(cnt(e,this.version))}}function unt(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===Yt.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 ore=2,dnt="tabs.json";class fnt extends jOe{migrationMap={1:unt};constructor(e){super(e,dnt,Ym(Zpe),ore)}async parse(e){let n=JSON.parse(e);n.version!==ore&&(n=this.migrate(n));const r=await Promise.all(n.data.tabs.map(async i=>{if(i.data.type===Yt.Step&&i.data.draftStep){const o=i.data.draftStep.requestBody.formData;o["multipart/form-data"]=await sre(o["multipart/form-data"]),o["application/x-www-form-urlencoded"]=await sre(o["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await G$(i.data.draftStep.requestBody.binary.absolutePath))}return i}));return{...n.data,tabs:r}}stringify(e){return super.stringify({...e,tabs:e.tabs.map(n=>n.data.type===Yt.Step?{...n,data:{...n.data,response:null}}:n.data.type===Yt.WorkflowRun?{...n,data:{...n.data,result:null}}:n)})}}async function sre(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 COe(r)}return n}))}const pnt=1;class QOe{constructor(e,n,r,i,o,s){this.systemFilesStorage=e,this.userFilesStorage=n,this.project=r,this.isApiPersisted=i,this.convertOperationToReplayValue=o,this.telemetry=s,this.localStorageSecretsProvider=new $8e(this.project.id);const a=new A8e;this.activeEnvironmentIdStorage=new jOe(this.systemFilesStorage,"active_environment_id.json",Q$,pnt),this.tabsStateStorage=new fnt(this.systemFilesStorage),this.environmentsStorage=new ant(this.userFilesStorage,this.localStorageSecretsProvider),this.collectionsStorage=new snt(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new k8e(this.isApiPersisted?this.userFilesStorage:a)}activeEnvironmentIdStorage;tabsStateStorage;environmentsStorage;collectionsStorage;apisStorage;localStorageSecretsProvider;persistExcludedIds=new Set;watchExcludedIds=new Set;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":this.environmentsStorage.write(n.environments.get());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}}}var fq={exports:{}},are;function hnt(){return are||(are=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,d,p){this.fn=c,this.context=d,this.once=p||!1}function o(c,d,p,g,O){if(typeof p!="function")throw new TypeError("The listener must be a function");var v=new i(p,g||c,O),w=n?n+d:d;return c._events[w]?c._events[w].fn?c._events[w]=[c._events[w],v]:c._events[w].push(v):(c._events[w]=v,c._eventsCount++),c}function s(c,d){--c._eventsCount===0?c._events=new r:delete c._events[d]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var d=[],p,g;if(this._eventsCount===0)return d;for(g in p=this._events)e.call(p,g)&&d.push(n?g.slice(1):g);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(p)):d},a.prototype.listeners=function(d){var p=n?n+d:d,g=this._events[p];if(!g)return[];if(g.fn)return[g.fn];for(var O=0,v=g.length,w=new Array(v);O<v;O++)w[O]=g[O].fn;return w},a.prototype.listenerCount=function(d){var p=n?n+d:d,g=this._events[p];return g?g.fn?1:g.length:0},a.prototype.emit=function(d,p,g,O,v,w){var S=n?n+d:d;if(!this._events[S])return!1;var C=this._events[S],T=arguments.length,E,$;if(C.fn){switch(C.once&&this.removeListener(d,C.fn,void 0,!0),T){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,p),!0;case 3:return C.fn.call(C.context,p,g),!0;case 4:return C.fn.call(C.context,p,g,O),!0;case 5:return C.fn.call(C.context,p,g,O,v),!0;case 6:return C.fn.call(C.context,p,g,O,v,w),!0}for($=1,E=new Array(T-1);$<T;$++)E[$-1]=arguments[$];C.fn.apply(C.context,E)}else{var _=C.length,R;for($=0;$<_;$++)switch(C[$].once&&this.removeListener(d,C[$].fn,void 0,!0),T){case 1:C[$].fn.call(C[$].context);break;case 2:C[$].fn.call(C[$].context,p);break;case 3:C[$].fn.call(C[$].context,p,g);break;case 4:C[$].fn.call(C[$].context,p,g,O);break;default:if(!E)for(R=1,E=new Array(T-1);R<T;R++)E[R-1]=arguments[R];C[$].fn.apply(C[$].context,E)}}return!0},a.prototype.on=function(d,p,g){return o(this,d,p,g,!1)},a.prototype.once=function(d,p,g){return o(this,d,p,g,!0)},a.prototype.removeListener=function(d,p,g,O){var v=n?n+d:d;if(!this._events[v])return this;if(!p)return s(this,v),this;var w=this._events[v];if(w.fn)w.fn===p&&(!O||w.once)&&(!g||w.context===g)&&s(this,v);else{for(var S=0,C=[],T=w.length;S<T;S++)(w[S].fn!==p||O&&!w[S].once||g&&w[S].context!==g)&&C.push(w[S]);C.length?this._events[v]=C.length===1?C[0]:C:s(this,v)}return this},a.prototype.removeAllListeners=function(d){var p;return d?(p=n?n+d:d,this._events[p]&&s(this,p)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a})(fq)),fq.exports}var mnt=hnt();const gnt=fl(mnt);class DOe extends Error{constructor(e){super(e),this.name="TimeoutError"}}let ynt=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}};const lre=t=>globalThis.DOMException===void 0?new ynt(t):new DOMException(t),cre=t=>{const e=t.reason===void 0?lre("This operation was aborted."):t.reason;return e instanceof Error?e:lre(e)};function Ont(t,e,n,r){let i;const o=new Promise((s,a)=>{if(typeof e!="number"||Math.sign(e)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${e}\``);if(e===Number.POSITIVE_INFINITY){s(t);return}if(r={customTimers:{setTimeout,clearTimeout},...r},r.signal){const{signal:c}=r;c.aborted&&a(cre(c)),c.addEventListener("abort",()=>{a(cre(c))})}i=r.customTimers.setTimeout.call(void 0,()=>{const c=`Promise timed out after ${e} milliseconds`,d=n instanceof Error?n:new DOe(c);typeof t.cancel=="function"&&t.cancel(),a(d)},e),(async()=>{try{s(await t)}catch(c){a(c)}finally{r.customTimers.clearTimeout.call(void 0,i)}})()});return o.clear=()=>{clearTimeout(i),i=void 0},o}function vnt(t,e,n){let r=0,i=t.length;for(;i>0;){const o=Math.trunc(i/2);let s=r+o;n(t[s],e)<=0?(r=++s,i-=o+1):i=o}return r}var wb=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},Rm;class bnt{constructor(){Rm.set(this,[])}enqueue(e,n){n={priority:0,...n};const r={priority:n.priority,run:e};if(this.size&&wb(this,Rm,"f")[this.size-1].priority>=n.priority){wb(this,Rm,"f").push(r);return}const i=vnt(wb(this,Rm,"f"),r,(o,s)=>s.priority-o.priority);wb(this,Rm,"f").splice(i,0,r)}dequeue(){const e=wb(this,Rm,"f").shift();return e?.run}filter(e){return wb(this,Rm,"f").filter(n=>n.priority===e.priority).map(n=>n.run)}get size(){return wb(this,Rm,"f").length}}Rm=new WeakMap;var ho=function(t,e,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(t,n):i?i.value=n:e.set(t,n),n},Bt=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},Do,oA,sA,oO,ID,aA,$j,Cf,jP,gu,kj,bu,lA,eO,Rj,ure,dre,MOe,fre,pre,_j,pq,hq,jD,NOe,Ij;class zOe extends Error{}class xnt extends gnt{constructor(e){var n,r,i,o;if(super(),Do.add(this),oA.set(this,void 0),sA.set(this,void 0),oO.set(this,0),ID.set(this,void 0),aA.set(this,void 0),$j.set(this,0),Cf.set(this,void 0),jP.set(this,void 0),gu.set(this,void 0),kj.set(this,void 0),bu.set(this,0),lA.set(this,void 0),eO.set(this,void 0),Rj.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:bnt,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(r=(n=e.intervalCap)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(o=(i=e.interval)===null||i===void 0?void 0:i.toString())!==null&&o!==void 0?o:""}\` (${typeof e.interval})`);ho(this,oA,e.carryoverConcurrencyCount,"f"),ho(this,sA,e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,"f"),ho(this,ID,e.intervalCap,"f"),ho(this,aA,e.interval,"f"),ho(this,gu,new e.queueClass,"f"),ho(this,kj,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,ho(this,Rj,e.throwOnTimeout===!0,"f"),ho(this,eO,e.autoStart===!1,"f")}get concurrency(){return Bt(this,lA,"f")}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);ho(this,lA,e,"f"),Bt(this,Do,"m",jD).call(this)}async add(e,n={}){return n={timeout:this.timeout,throwOnTimeout:Bt(this,Rj,"f"),...n},new Promise((r,i)=>{Bt(this,gu,"f").enqueue(async()=>{var o,s,a;ho(this,bu,(s=Bt(this,bu,"f"),s++,s),"f"),ho(this,oO,(a=Bt(this,oO,"f"),a++,a),"f");try{if(!((o=n.signal)===null||o===void 0)&&o.aborted)throw new zOe("The task was aborted.");let c=e({signal:n.signal});n.timeout&&(c=Ont(Promise.resolve(c),n.timeout)),n.signal&&(c=Promise.race([c,Bt(this,Do,"m",NOe).call(this,n.signal)]));const d=await c;r(d),this.emit("completed",d)}catch(c){if(c instanceof DOe&&!n.throwOnTimeout){r();return}i(c),this.emit("error",c)}finally{Bt(this,Do,"m",MOe).call(this)}},n),this.emit("add"),Bt(this,Do,"m",_j).call(this)})}async addAll(e,n){return Promise.all(e.map(async r=>this.add(r,n)))}start(){return Bt(this,eO,"f")?(ho(this,eO,!1,"f"),Bt(this,Do,"m",jD).call(this),this):this}pause(){ho(this,eO,!0,"f")}clear(){ho(this,gu,new(Bt(this,kj,"f")),"f")}async onEmpty(){Bt(this,gu,"f").size!==0&&await Bt(this,Do,"m",Ij).call(this,"empty")}async onSizeLessThan(e){Bt(this,gu,"f").size<e||await Bt(this,Do,"m",Ij).call(this,"next",()=>Bt(this,gu,"f").size<e)}async onIdle(){Bt(this,bu,"f")===0&&Bt(this,gu,"f").size===0||await Bt(this,Do,"m",Ij).call(this,"idle")}get size(){return Bt(this,gu,"f").size}sizeBy(e){return Bt(this,gu,"f").filter(e).length}get pending(){return Bt(this,bu,"f")}get isPaused(){return Bt(this,eO,"f")}}oA=new WeakMap,sA=new WeakMap,oO=new WeakMap,ID=new WeakMap,aA=new WeakMap,$j=new WeakMap,Cf=new WeakMap,jP=new WeakMap,gu=new WeakMap,kj=new WeakMap,bu=new WeakMap,lA=new WeakMap,eO=new WeakMap,Rj=new WeakMap,Do=new WeakSet,ure=function(){return Bt(this,sA,"f")||Bt(this,oO,"f")<Bt(this,ID,"f")},dre=function(){return Bt(this,bu,"f")<Bt(this,lA,"f")},MOe=function(){var e;ho(this,bu,(e=Bt(this,bu,"f"),e--,e),"f"),Bt(this,Do,"m",_j).call(this),this.emit("next")},fre=function(){Bt(this,Do,"m",hq).call(this),Bt(this,Do,"m",pq).call(this),ho(this,jP,void 0,"f")},pre=function(){const e=Date.now();if(Bt(this,Cf,"f")===void 0){const n=Bt(this,$j,"f")-e;if(n<0)ho(this,oO,Bt(this,oA,"f")?Bt(this,bu,"f"):0,"f");else return Bt(this,jP,"f")===void 0&&ho(this,jP,setTimeout(()=>{Bt(this,Do,"m",fre).call(this)},n),"f"),!0}return!1},_j=function(){if(Bt(this,gu,"f").size===0)return Bt(this,Cf,"f")&&clearInterval(Bt(this,Cf,"f")),ho(this,Cf,void 0,"f"),this.emit("empty"),Bt(this,bu,"f")===0&&this.emit("idle"),!1;if(!Bt(this,eO,"f")){const e=!Bt(this,Do,"a",pre);if(Bt(this,Do,"a",ure)&&Bt(this,Do,"a",dre)){const n=Bt(this,gu,"f").dequeue();return n?(this.emit("active"),n(),e&&Bt(this,Do,"m",pq).call(this),!0):!1}}return!1},pq=function(){Bt(this,sA,"f")||Bt(this,Cf,"f")!==void 0||(ho(this,Cf,setInterval(()=>{Bt(this,Do,"m",hq).call(this)},Bt(this,aA,"f")),"f"),ho(this,$j,Date.now()+Bt(this,aA,"f"),"f"))},hq=function(){Bt(this,oO,"f")===0&&Bt(this,bu,"f")===0&&Bt(this,Cf,"f")&&(clearInterval(Bt(this,Cf,"f")),ho(this,Cf,void 0,"f")),ho(this,oO,Bt(this,oA,"f")?Bt(this,bu,"f"):0,"f"),Bt(this,Do,"m",jD).call(this)},jD=function(){for(;Bt(this,Do,"m",_j).call(this););},NOe=async function(e){return new Promise((n,r)=>{e.addEventListener("abort",()=>{r(new zOe("The task was aborted."))},{once:!0})})},Ij=async function(e,n){return new Promise(r=>{const i=()=>{n&&!n()||(this.off(e,i),r())};this.on(e,i)})};const sh=window.__TAURI__?.http.fetch??globalThis.fetch;class qOe extends L5{constructor(){super()}resolveExternalRef(e,n){return Aj(n)?n:e&&Aj(e)?new URL(n,e).href:e?Wb.resolve(Wb.dirname(e),n):n}async loadExternalRef(e){if(Aj(e)){const{body:n,mimeType:r}=await $ae(e,{...this.config.http,customFetch:sh});return new ew(e,n,r)}else{if(!await fM(e))throw new Error(`File not found at ${e}.`);try{throw await TV(e),new Error(`Expected a file but received a folder at ${e}.`)}catch(i){if(i instanceof Error&&i.message.includes("Expected a file but received a folder"))throw i}const r=await dM(e);return new ew(e,r.replace(/\r\n/g,`
410
- `))}}}async function s7(t,e){const n=new Q5({});n.getRulesForSpecVersion=()=>[];const r=await Fr.dirname(t),i={config:n,base:r,externalRefResolver:new qOe,dereference:!0};e?i.doc={source:{absoluteRef:t},parsed:e}:i.ref=t;const{bundle:{parsed:o},fileDependencies:s}=await Ede(i);return{definition:o,fileDependencies:s}}class Snt{constructor(e){this.apisStorage=e}data=new Map;loading=new Set;pQueue=new xnt({concurrency:20});async get(e){return this.data.has(e)?this.data.get(e)??null:(await this.loadAndParse(e),this.data.get(e)??null)}async load(e,n=!1){this.data.has(e)&&!n||await this.loadAndParse(e,n)}async loadAndParse(e,n=!1){if(this.loading.has(e)){await this.pQueue.add(()=>this.get(e));return}n&&this.data.delete(e),this.loading.add(e),await this.pQueue.add(async()=>{const r=_M(e)?Zl.WEB:Zl.FS,i=r===Zl.WEB?e:await this.apisStorage.getAbsolutePath(e);try{const{definition:o,fileDependencies:s}=await s7(i);if(!o){this.data.set(e,null);return}const a=this.apisStorage.parse({uri:e,type:r,content:o});this.data.set(e,{...a,fileDependencies:s})}catch(o){this.data.set(e,null),console.error("Error loading api "+e,o);return}}),this.loading.delete(e)}get size(){return this.data.size}delete(e){this.data.delete(e)}getAll(){return Array.from(this.data.values()).filter(e=>e!==null)}clear(){this.data.clear(),this.loading.clear()}}class wnt extends QOe{apiLoader;constructor(e,n,r){const i=new T9(e.systemFilesDir),o=new T9(e.userFilesDir);super(i,o,e,!0,n,r),this.apiLoader=new Snt(this.apisStorage),this.setupWriteListeners(o)}setupWriteListeners(e){e.on("write-start",n=>{this.addWatchExcludedId(n)}),e.on("write-end",n=>{this.removeWatchExcludedId(n)})}async read(){const e=this.telemetry?.startSpan("storage.read",void 0,void 0),n=this.telemetry?.startSpan("storage.loadUserState",{},e?.parentCtx),[r,i,o]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);n?.setAttribute("status","completed"),n?.setAttribute("environmentCount",o.length),n?.setStatus(exports.SpanStatusCode.OK),n?.end();const{apiFiles:s,collectionFiles:a}=await this.detectProjectFiles(e);await this.loadAndParseApis(s,e);const d=(await this.loadAndParseCollections(a,e)).filter(g=>g!==null);this.collectionsStorage.setItemIds(d.map(g=>g.id));const p=this.apiLoader.getAll();return this.apisStorage.setItemIds(p.map(g=>g.id)),e?.setAttribute("status","completed"),e?.setStatus(exports.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:i,environments:o,apis:p,collections:d}}async detectProjectFiles(e){const n=this.telemetry?.startSpan("storage.detectFiles",{},e?.parentCtx),{api_files:r,collection_files:i}=await ul("fs_scan",{dir:this.project.userFilesDir});return n?.setAttribute("status","completed"),n?.setAttribute("filesCount",r.length+i.length),n?.setAttribute("apiFilesCount",r.length),n?.setAttribute("collectionFilesCount",i.length),n?.setStatus(exports.SpanStatusCode.OK),n?.end(),{apiFiles:r,collectionFiles:i}}readEnviroments(){return this.environmentsStorage.read()}deleteApiFromCache(e){this.apiLoader.delete(e)}async loadAndParseApis(e,n,r=!1){const i=this.telemetry?.startSpan("storage.parseApis",{apisCount:e.length},n?.parentCtx),o=await KJ(e,20,async s=>{try{return await this.apiLoader.load(s.relative_path,r),this.apiLoader.get(s.relative_path)}catch(a){return console.error(`Error parsing YAML/JSON file ${s.absolute_path}:`,a),null}});return i?.setAttribute("status","completed"),i?.setAttribute("parsedApisCount",this.apiLoader.size),i?.setStatus(exports.SpanStatusCode.OK),i?.end(),o}async loadAndParseCollections(e,n){const r=this.telemetry?.startSpan("storage.parseCollections",{collectionsCount:e.length},n?.parentCtx),i=await KJ(e,20,async o=>{try{const s=await this.userFilesStorage.get(o.relative_path);if(!s)return null;const a=eg.load(s);if(typeof a!="object"||a===null||typeof a.arazzo!="string")return null;const c=[];await Promise.all(a.sourceDescriptions?.map(async p=>{const g=p.type,O=p.url,v=!g||g==="openapi",w=await EOe({projectPath:this.project.userFilesDir,apiUrl:O,collectionId:o.relative_path});if(v){const S=await this.apiLoader.get(w);S&&c.push(S)}}));const d=await Fr.join(this.project.userFilesDir,o.relative_path);return await this.collectionsStorage.parse({uri:o.relative_path,type:Zl.FS,content:a,fileDependencies:new Set([d])},c)}catch(s){return console.error(`Error parsing Arazzo file ${o.relative_path}:`,s),null}});return r?.setAttribute("status","completed"),r?.setAttribute("parsedCollectionsCount",i.length),r?.setStatus(exports.SpanStatusCode.OK),r?.end(),i}}class a7{constructor(e){this.baseDir=e}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),o=localStorage.getItem(r);o!==null&&(localStorage.setItem(i,o),localStorage.removeItem(r))}makeKey(e){return`replay:fs:${this.baseDir}/${e}`}on(e,n){}off(e,n){}}class Cnt extends QOe{constructor(e,n,r){const i=new a7(e.systemFilesDir),o=new a7(e.userFilesDir);super(i,o,e,!1,n,r)}async detectProjectFiles(e){const n=this.telemetry?.startSpan("storage.detectFiles",{},e?.parentCtx),i=(await this.userFilesStorage.ls()).filter(c=>/\.(ya?ml|json)$/.test(c)),o=[],s=[],a=new Set;return await Promise.all(i.map(async c=>{const d=await this.userFilesStorage.get(c);if(d)try{const p=eg.load(d);if(typeof p=="object"&&p!==null)if(typeof p.openapi=="string"){const g=await Fr.resolve(await Fr.join(this.userFilesStorage.baseDir,c)),{definition:O}=await s7(g,p);o.push({uri:c,type:Zl.FS,content:O})}else typeof p.arazzo=="string"&&(s.push({uri:c,type:Zl.FS,content:p}),p.sourceDescriptions?.forEach(g=>{const O=g.type,v=g.url,w=!O||O==="openapi",S=typeof v=="string"&&_M(v);w&&S&&a.add(v)}))}catch(p){console.error(`Error parsing YAML/JSON file ${c}:`,p)}})),n?.setAttribute("status","completed"),n?.setAttribute("filesCount",i.length),n?.setAttribute("apiFilesCount",o.length),n?.setAttribute("collectionFilesCount",s.length),n?.setAttribute("apiUrlsCount",a.size),n?.setStatus(exports.SpanStatusCode.OK),n?.end(),{apiFiles:o,collectionFiles:s,apiUrls:a}}async loadApis(e,n){const r=this.telemetry?.startSpan("storage.loadApis",{apiUrlsCount:e.size},n?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async o=>{try{const{definition:s}=await s7(o);i.push({uri:o,type:Zl.WEB,content:s})}catch(s){console.error(`Error parsing YAML from ${o}:`,s)}})),r?.setAttribute("status","completed"),r?.setStatus(exports.SpanStatusCode.OK),r?.end(),i}async parseApis(e,n){const r=this.telemetry?.startSpan("storage.parseApis",{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("storage.parseCollections",{collectionsCount:e.length},r?.parentCtx),o=await this.collectionsStorage.parseMany(e,n);return i?.setAttribute("status","completed"),i?.setAttribute("parsedCollectionsCount",o.length),i?.setStatus(exports.SpanStatusCode.OK),i?.end(),o}async read(){const e=this.telemetry?.startSpan("storage.read",void 0,void 0),n=this.telemetry?.startSpan("storage.loadUserState",{},e?.parentCtx),[r,i,o]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);n?.setAttribute("status","completed"),n?.setAttribute("environmentCount",o.length),n?.setStatus(exports.SpanStatusCode.OK),n?.end();const{apiFiles:s,collectionFiles:a,apiUrls:c}=await this.detectProjectFiles(e),d=await this.loadApis(c,e),p=await this.parseApis([...s,...d],e);this.apisStorage.setItemIds(p.map(O=>O.id));const g=await this.parseCollections(a,p,e);return this.collectionsStorage.setItemIds(g.map(O=>O.id)),e?.setAttribute("status","completed"),e?.setStatus(exports.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:i,environments:o,apis:p,collections:g}}}var hre;(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"})(hre||(hre={}));async function Tnt(t,e){await ul("plugin:event|unlisten",{event:t,eventId:e})}async function Ent(t,e,n){var r;const i=(r=void 0)!==null&&r!==void 0?r:{kind:"Any"};return ul("plugin:event|listen",{event:t,target:i,handler:T8e(e)}).then(o=>async()=>Tnt(t,o))}class Pnt{constructor(e,n,r){this.storage=e,this.state=n,this.projectDir=r}watchPath=null;unlistenEvent=null;get tauriStorage(){return this.storage}async start(){if(this.watchPath){console.warn("Watcher already started for:",this.watchPath);return}try{this.unlistenEvent=await Ent("fs-watch-event",async e=>{const n=e.payload;try{await this.handleEvent(n)}catch(r){console.error("Error handling file change:",r)}}),await ul("fs_watch",{path:this.projectDir,options:{recursive:!0,delayMs:500}}),this.watchPath=this.projectDir}catch(e){throw console.error("Failed to start file watcher:",e),this.unlistenEvent&&(this.unlistenEvent(),this.unlistenEvent=null),e}}async stop(){if(this.watchPath)try{await ul("fs_unwatch",{path:this.watchPath})}catch(e){console.error("Error stopping file watcher:",e)}finally{this.unlistenEvent&&(this.unlistenEvent(),this.unlistenEvent=null),this.watchPath=null}}async handleEvent(e){const{changeType:n,paths:r,pathTypes:i,type:o}=e;if(await this.isProjectFolderRemoved(r,n)){await this.handleProjectFolderRemoval();return}const s=this.filterSpecFiles(r,i);if(s.paths.length===0)return;const a=await this.toFileEntries(s.paths,s.pathTypes);switch(n){case"changed":(o.includes("Data")||o.includes("Name"))&&await this.handleModify(a);break;case"added":await this.handleCreate(a);break;case"deleted":await this.handleDelete(a);break;case"renamed":await this.handleRename(a);break;default:console.log("Unhandled change type:",n)}}filterSpecFiles(e,n){const r=[],i=[];for(let o=0;o<e.length;o++){const s=e[o],a=s.split(".").pop()?.toLowerCase();a&&["yaml","yml","json"].includes(a)&&(r.push(s),i.push(n[o]||"unknown"))}return{paths:r,pathTypes:i}}async toFileEntries(e,n){return Promise.all(e.map(async(r,i)=>({relative_path:await Fr.relative(this.projectDir,r),absolute_path:r,type:n[i]||"unknown"})))}consolidateFileEntries(e){const n=[],r=new Set;for(const i of e)r.has(i.relative_path)||(r.add(i.relative_path),this.storage.isWatchExcluded(i.relative_path)||n.push(i));return n}async handleModify(e){const n=!this.storage.isWatchExcluded("replay-environments.yaml")&&e.some(v=>v.relative_path==="replay-environments.yaml"),r=e.filter(v=>v.relative_path!=="replay-environments.yaml"),{newApiFiles:i,existingApiFiles:o}=this.categorizeApisFromFiles(r),{newCollectionFiles:s,existingCollectionFiles:a}=this.categorizeCollectionsFromFiles(r),c=this.findApisToReload(e),d=this.findCollectionsToReload(e),p=[...i,...s];p.length>0&&await this.handleCreate(p),n&&await this.reloadEnvironments();const g=this.consolidateFileEntries([...o,...c]),O=this.consolidateFileEntries([...a,...d]);await this.reloadApis(g),await this.reloadCollections(O)}async handleCreate(e){const n=e.filter(c=>c.type==="api"),r=e.filter(c=>c.type==="collection"),{newApiFiles:i,existingApiFiles:o}=this.categorizeApisFromFiles(n),{newCollectionFiles:s,existingCollectionFiles:a}=this.categorizeCollectionsFromFiles(r);if(i.length>0||s.length>0){i.forEach(p=>this.storage.addPersistExcludedId(p.relative_path)),s.forEach(p=>this.storage.addPersistExcludedId(p.relative_path));const c=i.length>0?await this.tauriStorage.loadAndParseApis(i,void 0,!0):[],d=s.length>0?await this.tauriStorage.loadAndParseCollections(s,void 0):[];this.state.apis.merge(c.filter(p=>p!==null)),this.state.collections.merge(d.filter(p=>p!==null)),setTimeout(()=>{i.forEach(p=>this.storage.removePersistExcludedId(p.relative_path)),s.forEach(p=>this.storage.removePersistExcludedId(p.relative_path))},500)}o.length>0&&await this.reloadApis(o),a.length>0&&await this.reloadCollections(a)}categorizeApisFromFiles(e){const n=new Set,r=[],i=[];for(const o of e){if(n.has(o.relative_path))continue;n.add(o.relative_path),this.state.apis.get({noproxy:!0}).some(a=>a.id===o.relative_path)?i.push(o):o.type==="api"&&r.push(o)}return{newApiFiles:r,existingApiFiles:i}}categorizeCollectionsFromFiles(e){const n=new Set,r=[],i=[];for(const o of e){if(n.has(o.relative_path))continue;n.add(o.relative_path),this.state.collections.get({noproxy:!0}).some(a=>a.id===o.relative_path)?i.push(o):o.type==="collection"&&r.push(o)}return{newCollectionFiles:r,existingCollectionFiles:i}}async handleDelete(e){for(const n of e){this.storage.addPersistExcludedId(n.relative_path);const r=this.state.apis.get({noproxy:!0}).findIndex(o=>o.id===n.relative_path);r>=0&&(this.state.apis[r].set(An),this.tauriStorage.deleteApiFromCache(n.relative_path));const i=this.state.collections.get({noproxy:!0}).findIndex(o=>o.id===n.relative_path);i>=0&&this.state.collections[i].set(An),setTimeout(()=>{this.storage.removePersistExcludedId(n.relative_path)},500)}}async handleRename(e){if(e.length>=2){const[n,r]=e;await this.handleDelete([n]),await this.handleCreate([r])}else await this.handleCreate(e)}async isProjectFolderRemoved(e,n){if(e.length===0)return!1;if(n==="deleted"||n==="renamed"){for(const i of e)if(i===this.projectDir)return!0}return e.filter(i=>!i.startsWith(this.projectDir+"/")&&i!==this.projectDir).length>0&&n==="renamed"}async handleProjectFolderRemoval(){const e=this.state.apis.get({noproxy:!0});e.forEach(r=>{this.storage.addPersistExcludedId(r.id),this.tauriStorage.deleteApiFromCache(r.id)}),this.state.apis.set([]);const n=this.state.collections.get({noproxy:!0});n.forEach(r=>{this.storage.addPersistExcludedId(r.id)}),this.state.collections.set([]),setTimeout(()=>{e.forEach(r=>this.storage.removePersistExcludedId(r.id)),n.forEach(r=>this.storage.removePersistExcludedId(r.id))},500),await this.stop()}findApisToReload(e){const n=[];return this.state.apis.forEach(r=>{const i=r.fileDependencies?.get({noproxy:!0})??new Set,o=r.get({noproxy:!0}).id,s=e.find(a=>i.has(a.absolute_path));!this.storage.isWatchExcluded(o)&&s&&n.push(s)}),n}findCollectionsToReload(e){const n=[];return this.state.collections.forEach(r=>{const i=r.fileDependencies?.get({noproxy:!0})??new Set,o=r.get({noproxy:!0}).id,s=e.find(a=>i.has(a.absolute_path));!this.storage.isWatchExcluded(o)&&s&&n.push(s)}),n}async reloadEnvironments(){const e=await this.tauriStorage.readEnviroments();this.storage.addPersistExcludedId("replay-environments.yaml"),this.state.environments.set(e),setTimeout(()=>{this.storage.removePersistExcludedId("replay-environments.yaml")},500)}async reloadApis(e){if(e.length===0)return;const n=await this.tauriStorage.loadAndParseApis(e,void 0,!0);await Promise.all(n.map(async(r,i)=>{if(!r){await this.handleDelete([e[i]]);return}const o=this.state.apis.get({noproxy:!0}).findIndex(s=>s.id===r.id);o>=0?(this.storage.addPersistExcludedId(r.id),this.state.apis[o].set(r),setTimeout(()=>this.storage.removePersistExcludedId(r.id),500)):console.warn("API not found in state after reload:",r.id)}))}async reloadCollections(e){if(e.length===0)return;const n=await this.tauriStorage.loadAndParseCollections(e,void 0);await Promise.all(n.map(async(r,i)=>{if(!r){await this.handleDelete([e[i]]);return}const o=this.state.collections.get({noproxy:!0}).findIndex(s=>s.id===r.id);o>=0?(this.storage.addPersistExcludedId(r.id),this.state.collections[o].set(r),setTimeout(()=>this.storage.removePersistExcludedId(r.id),500)):console.warn("Collection not found in state after reload:",r.id)}))}}function LOe(t=!1){let e,n=!1,r=null,i=null;async function o(){if(!(!Xs()||!e||!i)){await s();try{const c=i.project.userFilesDir.get();r=new Pnt(e,i,c),await r.start()}catch(c){console.error("Failed to start file watcher:",c),r=null}}}async function s(){r&&(await r.stop(),r=null)}async function a(){Xs()&&(await s(),await ul("cleanup_all_managed_watchers"))}return()=>({id:"RootStoragePlugin",onCreate:()=>({cleanup:()=>async()=>{await a()},init:c=>async(d,p,g)=>{if(n||c.path.length>0)return{isInitialized:!1};if(n=!0,i=c,!t){e=Xs()?new wnt(d,p,g):new Cnt(d,p,g);const O=await e.read();c.merge(O)}return n=!1,Xs()&&!t&&await o(),{isInitialized:!0}}}),onSet(c,d,p){n||t||e.update(d,p)},onDestroy:async()=>{await a()}})}function UOe({defaultEnvironments:t}={}){return structuredClone({project:{id:"default",userFilesDir:"default",systemFilesDir:"default"},tabsState:Ym(Zpe),activeEnvironmentId:Q$,environments:t||Xpe,collections:[],apis:[],requestController:null,apps:{apps:[],appsLoadingState:Lp.Idle},predefinedApiId:null,predefinedEnvironmentNames:new Set,predefinedInputNames:new Set})}const Ant=mae(UOe(),gae(C8e({key:"replay-root-store"}),LOe())),I8=M.createContext(Ant),$nt=I8.Provider;function Mn(){const t=M.useContext(I8);return yae(t)}function knt(){return{theme:"light",disableCollectionsTab:!1,oAuth2RedirectURI:null,corsProxyUrl:void 0,mockServer:void 0,certificates:[],isApiBased:!1,generatedEnvironments:[],generatedInputs:[],hideOtherSecuritySchemes:!1}}const Rnt=knt(),_nt=M.createContext(Rnt);function Ud(){const t=M.useContext(_nt);return yae(t)}function Int(t,e){const{apps:{apiId:n}}=Mn(),{corsProxyUrl:r,disableCollectionsTab:i,mockServer:o,oAuth2RedirectURI:s,certificates:a,storageKey:c,isApiBased:d}=Ud();r.set(t?.corsProxyUrl??a8e),o.set(t?.mockServer),n.set(t?.apiId),s.set(t?.oAuth2RedirectURI),i.set(!!t?.disableCollectionsTab),c.set(t?.storageKey),d.set(!!e),M.useEffect(()=>{a.set(t?.certificates||[])},[t?.certificates])}const IM=M.createContext({});function C0(){return M.useContext(IM)||{}}const VOe=process.env.NODE_ENV==="development",jnt=process.env.NODE_ENV==="production",Qnt="0.22.0-next.2",Dnt={version:Qnt};class BOe{_client;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new s8e}get isInitialized(){return this._isInitialized}get client(){return this._client}awaitInit(){return this._initPromise}updateCloudEventData(e){this._client.updateCloudEventData(e)}enrichGlobalAttributes(e){this._globalAttributes={...this._globalAttributes,...e}}getGlobalAttributes(){return{...this._globalAttributes}}clearGlobalAttributes(){this._globalAttributes={platform:"",deviceId:""}}init(e){if(this.isInitialized)return;const n=e?.tracerName||"desktop",r=e?.enableErrorInstrumentation??n==="desktop",i={serviceName:"replay",serviceVersion:Dnt.version,version:"1.0.0",tracerName:n,collectorUrl:"",isProd:jnt,enableErrorInstrumentation:r};this._client.init({otel:{...i,...e}}),this._initResolve?.(this),this._isInitialized=!0}sendEvent(e,n){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}const r=Array.isArray(n)?n.map(i=>({...this._globalAttributes,...i})):{...this._globalAttributes,...n};VOe&&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{return this._client.startSpan(e,{...this._globalAttributes,...n},r)}catch(i){console.error("Failed to start telemetry span:",i);return}}}const AS=new BOe;function an(){const{telemetry:t}=C0();return AS.isInitialized||AS.init(t),{sendEvent:(e,n)=>{AS.sendEvent(e,n)},startSpan:(e,n,r)=>AS.startSpan(e,n,r)}}const Mnt=({awaitInit:t=!0}={})=>{const[e,n]=M.useState(void 0);return M.useEffect(()=>{(async()=>{const i=t?await AS.awaitInit():AS;n(i)})()},[t]),e},cl=800,$c=U(F.Button).attrs({variant:"text",size:"small",tone:"danger"})`
410
+ `))}}}async function s7(t,e){const n=new Q5({});n.getRulesForSpecVersion=()=>[];const r=await Fr.dirname(t),i={config:n,base:r,externalRefResolver:new qOe,dereference:!0};e?i.doc={source:{absoluteRef:t},parsed:e}:i.ref=t;const{bundle:{parsed:o},fileDependencies:s}=await Ede(i);return{definition:o,fileDependencies:s}}class Snt{constructor(e){this.apisStorage=e}data=new Map;loading=new Set;pQueue=new xnt({concurrency:20});async get(e){return this.data.has(e)?this.data.get(e)??null:(await this.loadAndParse(e),this.data.get(e)??null)}async load(e,n=!1){this.data.has(e)&&!n||await this.loadAndParse(e,n)}async loadAndParse(e,n=!1){if(this.loading.has(e)){await this.pQueue.add(()=>this.get(e));return}n&&this.data.delete(e),this.loading.add(e),await this.pQueue.add(async()=>{const r=_M(e)?Zl.WEB:Zl.FS,i=r===Zl.WEB?e:await this.apisStorage.getAbsolutePath(e);try{const{definition:o,fileDependencies:s}=await s7(i);if(!o){this.data.set(e,null);return}const a=this.apisStorage.parse({uri:e,type:r,content:o});this.data.set(e,{...a,fileDependencies:s})}catch(o){this.data.set(e,null),console.error("Error loading api "+e,o);return}}),this.loading.delete(e)}get size(){return this.data.size}delete(e){this.data.delete(e)}getAll(){return Array.from(this.data.values()).filter(e=>e!==null)}clear(){this.data.clear(),this.loading.clear()}}class wnt extends QOe{apiLoader;constructor(e,n,r){const i=new T9(e.systemFilesDir),o=new T9(e.userFilesDir);super(i,o,e,!0,n,r),this.apiLoader=new Snt(this.apisStorage),this.setupWriteListeners(o)}setupWriteListeners(e){e.on("write-start",n=>{this.addWatchExcludedId(n)}),e.on("write-end",n=>{this.removeWatchExcludedId(n)})}async read(){const e=this.telemetry?.startSpan("storage.read",void 0,void 0),n=this.telemetry?.startSpan("storage.loadUserState",{},e?.parentCtx),[r,i,o]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);n?.setAttribute("status","completed"),n?.setAttribute("environmentCount",o.length),n?.setStatus(exports.SpanStatusCode.OK),n?.end();const{apiFiles:s,collectionFiles:a}=await this.detectProjectFiles(e);await this.loadAndParseApis(s,e);const d=(await this.loadAndParseCollections(a,e)).filter(g=>g!==null);this.collectionsStorage.setItemIds(d.map(g=>g.id));const p=this.apiLoader.getAll();return this.apisStorage.setItemIds(p.map(g=>g.id)),e?.setAttribute("status","completed"),e?.setStatus(exports.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:i,environments:o,apis:p,collections:d}}async detectProjectFiles(e){const n=this.telemetry?.startSpan("storage.detectFiles",{},e?.parentCtx),{api_files:r,collection_files:i}=await ul("fs_scan",{dir:this.project.userFilesDir});return n?.setAttribute("status","completed"),n?.setAttribute("filesCount",r.length+i.length),n?.setAttribute("apiFilesCount",r.length),n?.setAttribute("collectionFilesCount",i.length),n?.setStatus(exports.SpanStatusCode.OK),n?.end(),{apiFiles:r,collectionFiles:i}}readEnviroments(){return this.environmentsStorage.read()}deleteApiFromCache(e){this.apiLoader.delete(e)}async loadAndParseApis(e,n,r=!1){const i=this.telemetry?.startSpan("storage.parseApis",{apisCount:e.length},n?.parentCtx),o=await KJ(e,20,async s=>{try{return await this.apiLoader.load(s.relative_path,r),this.apiLoader.get(s.relative_path)}catch(a){return console.error(`Error parsing YAML/JSON file ${s.absolute_path}:`,a),null}});return i?.setAttribute("status","completed"),i?.setAttribute("parsedApisCount",this.apiLoader.size),i?.setStatus(exports.SpanStatusCode.OK),i?.end(),o}async loadAndParseCollections(e,n){const r=this.telemetry?.startSpan("storage.parseCollections",{collectionsCount:e.length},n?.parentCtx),i=await KJ(e,20,async o=>{try{const s=await this.userFilesStorage.get(o.relative_path);if(!s)return null;const a=eg.load(s);if(typeof a!="object"||a===null||typeof a.arazzo!="string")return null;const c=[];await Promise.all(a.sourceDescriptions?.map(async p=>{const g=p.type,O=p.url,v=!g||g==="openapi",w=await EOe({projectPath:this.project.userFilesDir,apiUrl:O,collectionId:o.relative_path});if(v){const S=await this.apiLoader.get(w);S&&c.push(S)}}));const d=await Fr.join(this.project.userFilesDir,o.relative_path);return await this.collectionsStorage.parse({uri:o.relative_path,type:Zl.FS,content:a,fileDependencies:new Set([d])},c)}catch(s){return console.error(`Error parsing Arazzo file ${o.relative_path}:`,s),null}});return r?.setAttribute("status","completed"),r?.setAttribute("parsedCollectionsCount",i.length),r?.setStatus(exports.SpanStatusCode.OK),r?.end(),i}}class a7{constructor(e){this.baseDir=e}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),o=localStorage.getItem(r);o!==null&&(localStorage.setItem(i,o),localStorage.removeItem(r))}makeKey(e){return`replay:fs:${this.baseDir}/${e}`}on(e,n){}off(e,n){}}class Cnt extends QOe{constructor(e,n,r){const i=new a7(e.systemFilesDir),o=new a7(e.userFilesDir);super(i,o,e,!1,n,r)}async detectProjectFiles(e){const n=this.telemetry?.startSpan("storage.detectFiles",{},e?.parentCtx),i=(await this.userFilesStorage.ls()).filter(c=>/\.(ya?ml|json)$/.test(c)),o=[],s=[],a=new Set;return await Promise.all(i.map(async c=>{const d=await this.userFilesStorage.get(c);if(d)try{const p=eg.load(d);if(typeof p=="object"&&p!==null)if(typeof p.openapi=="string"){const g=await Fr.resolve(await Fr.join(this.userFilesStorage.baseDir,c)),{definition:O}=await s7(g,p);o.push({uri:c,type:Zl.FS,content:O})}else typeof p.arazzo=="string"&&(s.push({uri:c,type:Zl.FS,content:p}),p.sourceDescriptions?.forEach(g=>{const O=g.type,v=g.url,w=!O||O==="openapi",S=typeof v=="string"&&_M(v);w&&S&&a.add(v)}))}catch(p){console.error(`Error parsing YAML/JSON file ${c}:`,p)}})),n?.setAttribute("status","completed"),n?.setAttribute("filesCount",i.length),n?.setAttribute("apiFilesCount",o.length),n?.setAttribute("collectionFilesCount",s.length),n?.setAttribute("apiUrlsCount",a.size),n?.setStatus(exports.SpanStatusCode.OK),n?.end(),{apiFiles:o,collectionFiles:s,apiUrls:a}}async loadApis(e,n){const r=this.telemetry?.startSpan("storage.loadApis",{apiUrlsCount:e.size},n?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async o=>{try{const{definition:s}=await s7(o);i.push({uri:o,type:Zl.WEB,content:s})}catch(s){console.error(`Error parsing YAML from ${o}:`,s)}})),r?.setAttribute("status","completed"),r?.setStatus(exports.SpanStatusCode.OK),r?.end(),i}async parseApis(e,n){const r=this.telemetry?.startSpan("storage.parseApis",{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("storage.parseCollections",{collectionsCount:e.length},r?.parentCtx),o=await this.collectionsStorage.parseMany(e,n);return i?.setAttribute("status","completed"),i?.setAttribute("parsedCollectionsCount",o.length),i?.setStatus(exports.SpanStatusCode.OK),i?.end(),o}async read(){const e=this.telemetry?.startSpan("storage.read",void 0,void 0),n=this.telemetry?.startSpan("storage.loadUserState",{},e?.parentCtx),[r,i,o]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);n?.setAttribute("status","completed"),n?.setAttribute("environmentCount",o.length),n?.setStatus(exports.SpanStatusCode.OK),n?.end();const{apiFiles:s,collectionFiles:a,apiUrls:c}=await this.detectProjectFiles(e),d=await this.loadApis(c,e),p=await this.parseApis([...s,...d],e);this.apisStorage.setItemIds(p.map(O=>O.id));const g=await this.parseCollections(a,p,e);return this.collectionsStorage.setItemIds(g.map(O=>O.id)),e?.setAttribute("status","completed"),e?.setStatus(exports.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:i,environments:o,apis:p,collections:g}}}var hre;(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"})(hre||(hre={}));async function Tnt(t,e){await ul("plugin:event|unlisten",{event:t,eventId:e})}async function Ent(t,e,n){var r;const i=(r=void 0)!==null&&r!==void 0?r:{kind:"Any"};return ul("plugin:event|listen",{event:t,target:i,handler:T8e(e)}).then(o=>async()=>Tnt(t,o))}class Pnt{constructor(e,n,r){this.storage=e,this.state=n,this.projectDir=r}watchPath=null;unlistenEvent=null;get tauriStorage(){return this.storage}async start(){if(this.watchPath){console.warn("Watcher already started for:",this.watchPath);return}try{this.unlistenEvent=await Ent("fs-watch-event",async e=>{const n=e.payload;try{await this.handleEvent(n)}catch(r){console.error("Error handling file change:",r)}}),await ul("fs_watch",{path:this.projectDir,options:{recursive:!0,delayMs:500}}),this.watchPath=this.projectDir}catch(e){throw console.error("Failed to start file watcher:",e),this.unlistenEvent&&(this.unlistenEvent(),this.unlistenEvent=null),e}}async stop(){if(this.watchPath)try{await ul("fs_unwatch",{path:this.watchPath})}catch(e){console.error("Error stopping file watcher:",e)}finally{this.unlistenEvent&&(this.unlistenEvent(),this.unlistenEvent=null),this.watchPath=null}}async handleEvent(e){const{changeType:n,paths:r,pathTypes:i,type:o}=e;if(await this.isProjectFolderRemoved(r,n)){await this.handleProjectFolderRemoval();return}const s=this.filterSpecFiles(r,i);if(s.paths.length===0)return;const a=await this.toFileEntries(s.paths,s.pathTypes);switch(n){case"changed":(o.includes("Data")||o.includes("Name"))&&await this.handleModify(a);break;case"added":await this.handleCreate(a);break;case"deleted":await this.handleDelete(a);break;case"renamed":await this.handleRename(a);break;default:console.log("Unhandled change type:",n)}}filterSpecFiles(e,n){const r=[],i=[];for(let o=0;o<e.length;o++){const s=e[o],a=s.split(".").pop()?.toLowerCase();a&&["yaml","yml","json"].includes(a)&&(r.push(s),i.push(n[o]||"unknown"))}return{paths:r,pathTypes:i}}async toFileEntries(e,n){return Promise.all(e.map(async(r,i)=>({relative_path:await Fr.relative(this.projectDir,r),absolute_path:r,type:n[i]||"unknown"})))}consolidateFileEntries(e){const n=[],r=new Set;for(const i of e)r.has(i.relative_path)||(r.add(i.relative_path),this.storage.isWatchExcluded(i.relative_path)||n.push(i));return n}async handleModify(e){const n=!this.storage.isWatchExcluded("replay-environments.yaml")&&e.some(v=>v.relative_path==="replay-environments.yaml"),r=e.filter(v=>v.relative_path!=="replay-environments.yaml"),{newApiFiles:i,existingApiFiles:o}=this.categorizeApisFromFiles(r),{newCollectionFiles:s,existingCollectionFiles:a}=this.categorizeCollectionsFromFiles(r),c=this.findApisToReload(e),d=this.findCollectionsToReload(e),p=[...i,...s];p.length>0&&await this.handleCreate(p),n&&await this.reloadEnvironments();const g=this.consolidateFileEntries([...o,...c]),O=this.consolidateFileEntries([...a,...d]);await this.reloadApis(g),await this.reloadCollections(O)}async handleCreate(e){const n=e.filter(c=>c.type==="api"),r=e.filter(c=>c.type==="collection"),{newApiFiles:i,existingApiFiles:o}=this.categorizeApisFromFiles(n),{newCollectionFiles:s,existingCollectionFiles:a}=this.categorizeCollectionsFromFiles(r);if(i.length>0||s.length>0){i.forEach(p=>this.storage.addPersistExcludedId(p.relative_path)),s.forEach(p=>this.storage.addPersistExcludedId(p.relative_path));const c=i.length>0?await this.tauriStorage.loadAndParseApis(i,void 0,!0):[],d=s.length>0?await this.tauriStorage.loadAndParseCollections(s,void 0):[];this.state.apis.merge(c.filter(p=>p!==null)),this.state.collections.merge(d.filter(p=>p!==null)),setTimeout(()=>{i.forEach(p=>this.storage.removePersistExcludedId(p.relative_path)),s.forEach(p=>this.storage.removePersistExcludedId(p.relative_path))},500)}o.length>0&&await this.reloadApis(o),a.length>0&&await this.reloadCollections(a)}categorizeApisFromFiles(e){const n=new Set,r=[],i=[];for(const o of e){if(n.has(o.relative_path))continue;n.add(o.relative_path),this.state.apis.get({noproxy:!0}).some(a=>a.id===o.relative_path)?i.push(o):o.type==="api"&&r.push(o)}return{newApiFiles:r,existingApiFiles:i}}categorizeCollectionsFromFiles(e){const n=new Set,r=[],i=[];for(const o of e){if(n.has(o.relative_path))continue;n.add(o.relative_path),this.state.collections.get({noproxy:!0}).some(a=>a.id===o.relative_path)?i.push(o):o.type==="collection"&&r.push(o)}return{newCollectionFiles:r,existingCollectionFiles:i}}async handleDelete(e){for(const n of e){this.storage.addPersistExcludedId(n.relative_path);const r=this.state.apis.get({noproxy:!0}).findIndex(o=>o.id===n.relative_path);r>=0&&(this.state.apis[r].set(An),this.tauriStorage.deleteApiFromCache(n.relative_path));const i=this.state.collections.get({noproxy:!0}).findIndex(o=>o.id===n.relative_path);i>=0&&this.state.collections[i].set(An),setTimeout(()=>{this.storage.removePersistExcludedId(n.relative_path)},500)}}async handleRename(e){if(e.length>=2){const[n,r]=e;await this.handleDelete([n]),await this.handleCreate([r])}else await this.handleCreate(e)}async isProjectFolderRemoved(e,n){if(e.length===0)return!1;if(n==="deleted"||n==="renamed"){for(const i of e)if(i===this.projectDir)return!0}return e.filter(i=>!i.startsWith(this.projectDir+"/")&&i!==this.projectDir).length>0&&n==="renamed"}async handleProjectFolderRemoval(){const e=this.state.apis.get({noproxy:!0});e.forEach(r=>{this.storage.addPersistExcludedId(r.id),this.tauriStorage.deleteApiFromCache(r.id)}),this.state.apis.set([]);const n=this.state.collections.get({noproxy:!0});n.forEach(r=>{this.storage.addPersistExcludedId(r.id)}),this.state.collections.set([]),setTimeout(()=>{e.forEach(r=>this.storage.removePersistExcludedId(r.id)),n.forEach(r=>this.storage.removePersistExcludedId(r.id))},500),await this.stop()}findApisToReload(e){const n=[];return this.state.apis.forEach(r=>{const i=r.fileDependencies?.get({noproxy:!0})??new Set,o=r.get({noproxy:!0}).id,s=e.find(a=>i.has(a.absolute_path));!this.storage.isWatchExcluded(o)&&s&&n.push(s)}),n}findCollectionsToReload(e){const n=[];return this.state.collections.forEach(r=>{const i=r.fileDependencies?.get({noproxy:!0})??new Set,o=r.get({noproxy:!0}).id,s=e.find(a=>i.has(a.absolute_path));!this.storage.isWatchExcluded(o)&&s&&n.push(s)}),n}async reloadEnvironments(){const e=await this.tauriStorage.readEnviroments();this.storage.addPersistExcludedId("replay-environments.yaml"),this.state.environments.set(e),setTimeout(()=>{this.storage.removePersistExcludedId("replay-environments.yaml")},500)}async reloadApis(e){if(e.length===0)return;const n=await this.tauriStorage.loadAndParseApis(e,void 0,!0);await Promise.all(n.map(async(r,i)=>{if(!r){await this.handleDelete([e[i]]);return}const o=this.state.apis.get({noproxy:!0}).findIndex(s=>s.id===r.id);o>=0?(this.storage.addPersistExcludedId(r.id),this.state.apis[o].set(r),setTimeout(()=>this.storage.removePersistExcludedId(r.id),500)):console.warn("API not found in state after reload:",r.id)}))}async reloadCollections(e){if(e.length===0)return;const n=await this.tauriStorage.loadAndParseCollections(e,void 0);await Promise.all(n.map(async(r,i)=>{if(!r){await this.handleDelete([e[i]]);return}const o=this.state.collections.get({noproxy:!0}).findIndex(s=>s.id===r.id);o>=0?(this.storage.addPersistExcludedId(r.id),this.state.collections[o].set(r),setTimeout(()=>this.storage.removePersistExcludedId(r.id),500)):console.warn("Collection not found in state after reload:",r.id)}))}}function LOe(t=!1){let e,n=!1,r=null,i=null;async function o(){if(!(!Xs()||!e||!i)){await s();try{const c=i.project.userFilesDir.get();r=new Pnt(e,i,c),await r.start()}catch(c){console.error("Failed to start file watcher:",c),r=null}}}async function s(){r&&(await r.stop(),r=null)}async function a(){Xs()&&(await s(),await ul("cleanup_all_managed_watchers"))}return()=>({id:"RootStoragePlugin",onCreate:()=>({cleanup:()=>async()=>{await a()},init:c=>async(d,p,g)=>{if(n||c.path.length>0)return{isInitialized:!1};if(n=!0,i=c,!t){e=Xs()?new wnt(d,p,g):new Cnt(d,p,g);const O=await e.read();c.merge(O)}return n=!1,Xs()&&!t&&await o(),{isInitialized:!0}}}),onSet(c,d,p){n||t||e.update(d,p)},onDestroy:async()=>{await a()}})}function UOe({defaultEnvironments:t}={}){return structuredClone({project:{id:"default",userFilesDir:"default",systemFilesDir:"default"},tabsState:Ym(Zpe),activeEnvironmentId:Q$,environments:t||Xpe,collections:[],apis:[],requestController:null,apps:{apps:[],appsLoadingState:Lp.Idle},predefinedApiId:null,predefinedEnvironmentNames:new Set,predefinedInputNames:new Set})}const Ant=mae(UOe(),gae(C8e({key:"replay-root-store"}),LOe())),I8=M.createContext(Ant),$nt=I8.Provider;function Mn(){const t=M.useContext(I8);return yae(t)}function knt(){return{theme:"light",disableCollectionsTab:!1,oAuth2RedirectURI:null,corsProxyUrl:void 0,mockServer:void 0,certificates:[],isApiBased:!1,generatedEnvironments:[],generatedInputs:[],hideOtherSecuritySchemes:!1}}const Rnt=knt(),_nt=M.createContext(Rnt);function Ud(){const t=M.useContext(_nt);return yae(t)}function Int(t,e){const{apps:{apiId:n}}=Mn(),{corsProxyUrl:r,disableCollectionsTab:i,mockServer:o,oAuth2RedirectURI:s,certificates:a,storageKey:c,isApiBased:d}=Ud();r.set(t?.corsProxyUrl??a8e),o.set(t?.mockServer),n.set(t?.apiId),s.set(t?.oAuth2RedirectURI),i.set(!!t?.disableCollectionsTab),c.set(t?.storageKey),d.set(!!e),M.useEffect(()=>{a.set(t?.certificates||[])},[t?.certificates])}const IM=M.createContext({});function C0(){return M.useContext(IM)||{}}const VOe=process.env.NODE_ENV==="development",jnt=process.env.NODE_ENV==="production",Qnt="0.22.0-next.3",Dnt={version:Qnt};class BOe{_client;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new s8e}get isInitialized(){return this._isInitialized}get client(){return this._client}awaitInit(){return this._initPromise}updateCloudEventData(e){this._client.updateCloudEventData(e)}enrichGlobalAttributes(e){this._globalAttributes={...this._globalAttributes,...e}}getGlobalAttributes(){return{...this._globalAttributes}}clearGlobalAttributes(){this._globalAttributes={platform:"",deviceId:""}}init(e){if(this.isInitialized)return;const n=e?.tracerName||"desktop",r=e?.enableErrorInstrumentation??n==="desktop",i={serviceName:"replay",serviceVersion:Dnt.version,version:"1.0.0",tracerName:n,collectorUrl:"",isProd:jnt,enableErrorInstrumentation:r};this._client.init({otel:{...i,...e}}),this._initResolve?.(this),this._isInitialized=!0}sendEvent(e,n){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}const r=Array.isArray(n)?n.map(i=>({...this._globalAttributes,...i})):{...this._globalAttributes,...n};VOe&&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{return this._client.startSpan(e,{...this._globalAttributes,...n},r)}catch(i){console.error("Failed to start telemetry span:",i);return}}}const AS=new BOe;function an(){const{telemetry:t}=C0();return AS.isInitialized||AS.init(t),{sendEvent:(e,n)=>{AS.sendEvent(e,n)},startSpan:(e,n,r)=>AS.startSpan(e,n,r)}}const Mnt=({awaitInit:t=!0}={})=>{const[e,n]=M.useState(void 0);return M.useEffect(()=>{(async()=>{const i=t?await AS.awaitInit():AS;n(i)})()},[t]),e},cl=800,$c=U(F.Button).attrs({variant:"text",size:"small",tone:"danger"})`
411
411
  border: none;
412
412
  margin: 0;
413
413
 
@@ -679,7 +679,7 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function pet(t){return t.
679
679
  border-radius: var(--border-radius);
680
680
  border: 1px solid var(--border-color-primary);
681
681
  padding: 0 calc(var(--spacing-xxs) / 2);
682
- `,Hr=(t,e,n=new Set)=>{const r=Pve(t);if(!r.length)return t;let i=0;const o=r.flatMap(({start:s,end:a,name:c})=>{if(n.has(c))return null;const d=e.findLast(g=>g.name===c),p=t.slice(i,d?s:a);if(i=a,d){n.add(c);const g=Hr(d.value,e,n);return n.delete(c),[p.length?p:null,g||t.slice(s,a)]}return[p.length?p:null]});return t.slice(i).length&&o.push(t.slice(i)),o.join("")};function wot(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function Cot(t,e){const n=Ave(t);if(!n.length)return y.jsx(Ire,{children:t});let r=0;const i=n.flatMap(({start:o,end:s})=>{const a=t.slice(r,o),c=wot(t.slice(o,s),e);return r=s,[a.length?a:null,c]});return t.slice(r).length&&i.push(t.slice(r)),y.jsx(Ire,{children:i.join("")})}const $ve="New Step";function d7({name:t=$ve,workflow:e}={}){let n=t.replaceAll(" ","-").toLowerCase();if(!e)return n;const r=Tot(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function Tot(t){return t.steps.filter(e=>e.state.get()!==Er.Draft).map(e=>e.stepId.get())}function s0({name:t=$ve,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:o}={}){if(!n){const a=o?R8(o):null,c=[Lf()];return{stepId:d7({name:t,workflow:r}),description:t,outputs:[Id()],successCriteria:[],state:e?Er.Draft:Er.Normal,parameters:{pathParameters:[xi("path")],queryParameters:[xi("query")],headers:[xi("header")],cookies:[xi("cookie")]},requestBody:_D(),xOperation:i?null:{method:"GET",url:""},security:c,operation:i??null,...a}}const s=n.get({noproxy:!0});return{stepId:d7({name:t,workflow:r}),description:s.description,outputs:s.outputs,successCriteria:s.successCriteria,state:e?Er.Draft:Er.Normal,parameters:s.parameters,requestBody:s.requestBody,xOperation:s.xOperation,security:s.security,operation:s.operation}}function a0(t){return{method:(t.xOperation?t.xOperation.method:t.operation?.method)??"",url:(t.xOperation?t.xOperation.url:t.operation?.path)??""}}function B8(t,e,n,r){const{inputs:i,servers:o}=r,s=itt(bO("path",[go(e?.parameters.pathParameters,n?.components.parameters),go(t.parameters.pathParameters,n?.components.parameters)]),r.inputs),a=t.xOperation??null,c=t.operation??null;let d="",p="";if(a)p=a.method,d=Une(a.url,s);else if(c){const v=o.find(S=>S.apiId===c.apiId);p=c.method==="x-query"?"query":c.method,d=(v?.value?TOe(v.value,v.variables):"")+Une(c.path,s)}const g=d.split("?")[0];return{url:Hr(g,i),method:p.toUpperCase()}}function Eot(t){const e=t.substring(7).split(", "),n={};for(const r of e){const[i,o]=r.split("=");n[i]=o.replace(/"/g,"")}return n}function Pot(t,e,n,r){const{inputs:i}=r,{requestBody:{content:o}}=t,{url:s,method:a}=B8(t,e,n,r),c=[...e?.security||[],...t.security].findLast(D=>D.securityType===Ge.DigestAuth);if(!c)return"";const{username:d,password:p,realm:g,nonce:O,cnonce:v,algorithm:w,qop:S,nc:C,opaque:T}=c[Ge.DigestAuth],E=Hr(d,i),{pathname:$,search:_}=new URL(s),R=_?`${$}${_}`:$,Q=Aot({username:E,password:Hr(p,i),uri:R,realm:g,nonce:O,cnonce:v,algorithm:w,qop:S,nc:C,method:a,bodyContent:o});return`Digest username="${E}", realm="${g}", nonce="${O}", uri="${R}", qop=${S}, nc=${C}, cnonce="${v}", response="${Q}", algorithm=${w}${T?`, opaque="${T}"`:""}`}function Aot(t){const{username:e,password:n,realm:r,nonce:i,cnonce:o,algorithm:s,qop:a,nc:c,uri:d,method:p,bodyContent:g}=t,O=$ot(s),v=s?.endsWith("-sess")?O(`${O(`${e}:${r}:${n}`)}:${i}:${o}`):O(`${e}:${r}:${n}`),w=a?.includes("auth-int")?O(`${p}:${d}:${O(g)}`):O(`${p}:${d}`);return O(`${v}:${i}:${c}:${o}:${a}:${w}`).toString()}function $ot(t){switch(t?.replace("-sess","")){case"SHA-256":return e=>yA(wae(e));default:return e=>yA(w5(e))}}function kot(t){try{const n=new URL(t).hostname;return n==="localhost"||n==="127.0.0.1"}catch{return!1}}function f7(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function Rot(t){return t?t.split(";").map(r=>r.trim()).map(r=>{const i=r.indexOf("="),o=r.slice(0,i).trim(),s=r.slice(i+1).trim();return[o,s]}):[]}const _ot=["json","xml","html","text"],Iot=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function gq(t,e){return t.get(e)??t.get(e.toLowerCase())}function jot(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function Qot(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 Dot(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function Mot(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return Iot.some(r=>n.includes(r))?!0:n.startsWith("application/")?!_ot.some(r=>n.includes(r)):!1}async function Not(t,e){const n=gq(t.headers,"content-type")?.split(";")[0].trim(),r=gq(t.headers,"content-disposition"),i=jot(gq(t.headers,"content-length")),o=Mot(n,r),s=Rot(document.cookie);if(o){const O={fileName:Qot(r)||Dot(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:s,size:i??0,download:O,bodyNotStored:!0,url:t.url}}const c=await t.clone().arrayBuffer(),d=new TextDecoder().decode(c),p=new Uint8Array(c).length;return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:c,body:d,duration:e,cookies:s,size:p,url:t.url}}function jre(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}function Qre(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 kve(t,e){let n=Qre(t);const r=e.find(({host:i,port:o})=>Qre(`https://${i}:${o}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}function zot(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function qot(t,e){const{exists:n}=await Promise.resolve().then(()=>EV),{join:r}=await Promise.resolve().then(()=>rhe),{baseName:i,extension:o}=zot(e);let s=0;for(;;){const a=s===0?"":` (${s})`,c=`${i}${a}${o}`,d=await r(t,c);if(!await n(d))return d;s+=1}}function Lot(t){return t.split(/(\{[^}]+\}|\/)/g).filter(e=>e!=="")}function Uot(t){if(t!=null)return t}async function Rve({store:t,step:e,settings:n,workflow:r,collection:i,signal:o}){const{mockServer:s,corsProxyUrl:a,certificates:c}=n.get(),d=Bw(t),{url:p,method:g}=B8(e.get(),r?.get(),i?.get(),d),O=s?.url,v=O?p.startsWith(location.origin+O):!1,w=a||"",S=jve(e,r,i,t),C=v||kot(p)||f7(p),T=ist({proxyUrl:w,resolvedUrl:p,ignoreProxy:C,queryParameters:S});await Xot(e,r??void 0,T,v,o);const E=Z8(e,r??void 0,i??void 0,t),$=Uot(X8(e.get({noproxy:!0}),t)),{clientCert:_,clientKey:R}=kve(p,c||[]),D=!!T.match(/^https?:\/\//)?T:`https://${T}`,q=g.toUpperCase(),Z=!cM.includes(q),Y=Z?"POST":q,G=Z?{...E,"X-HTTP-Method-Override":q}:E;return{urlWithProxyAndProtocol:D,fetchMethod:Y,fetchHeaders:G,body:$,mode:v||f7(D)?"same-origin":"cors",clientCert:_,clientKey:R,resolvedUrl:p,isMockServer:v}}async function Vot(t,e,n,r){const{requestController:i}=t,s=Y8(t).data;if(s.type.get()!==Yt.Step){console.warn("not an operation tab");return}const{collectionId:a,workflowId:c,response:d,requestError:p,isProcessingRequest:g}=s,O=t.collections.find(C=>C.id.get()===a.get()),v=O?.workflows.find(C=>C.workflowId.get()===c.get()),w=Ym(e.get({noproxy:!0}));g.set(!0),i.get()?.abort?.(),i.set(new AbortController);const S=i.get()?.signal;try{const C=await Rve({store:t,step:e,settings:n,workflow:v,collection:O,signal:S}),T=Date.now(),E={signal:S,method:C.fetchMethod,headers:C.fetchHeaders,body:C.body,mode:C.mode,clientCert:C.clientCert,clientKey:C.clientKey},$=await sh(C.urlWithProxyAndProtocol,E),_=Date.now()-T;p.set(null),d.set(await Not($,_));const R=Ym(d.value);r?.(w,R)}catch(C){if(d.set(null),C.name==="AbortError")return;p.set(C.message||String(C));const T=Ym(d.value);r?.(w,T)}finally{g.set(!1)}}async function Bot({store:t,step:e,settings:n,workflow:r,collection:i,fileName:o,onProgress:s}){const a=await Rve({store:t,step:e,settings:n,workflow:r,collection:i}),c={method:a.fetchMethod,headers:a.fetchHeaders,body:a.body,mode:a.mode,clientCert:a.clientCert,clientKey:a.clientKey},{clientCert:d,clientKey:p}=c,g=Xs(),O=o||"response";let v=null;if(g){const{open:Q}=await Promise.resolve().then(()=>require("./replay-index-DCj7gnE9.js")),D=await Q({directory:!0,multiple:!1});if(!D)return;const q=Array.isArray(D)?D[0]:D;v=await qot(q,O)}const w=await sh(a.urlWithProxyAndProtocol,c),S=w.headers.get("content-length"),C=S?Number.parseInt(S,10):void 0,T=Number.isFinite(C)?C:void 0,E=w.headers.get("content-type")??void 0;let $;if(w.body?.getReader){const Q=w.body.getReader(),D=[];let q=0;for(;;){const{done:Z,value:Y}=await Q.read();if(Z)break;if(Y){const G=new Uint8Array(Y.byteLength);G.set(Y),D.push(G.buffer),q+=Y.byteLength,s?.({receivedBytes:q,totalBytes:T,done:!1})}}$=new Blob(D,{type:E}),s?.({receivedBytes:q,totalBytes:T,done:!0})}else $=await w.blob(),s?.({receivedBytes:$.size,totalBytes:T,done:!0});if(g){const{writeFile:Q}=await Promise.resolve().then(()=>EV),D=new Uint8Array(await $.arrayBuffer());if(!v)return;await Q(v,D);return}const _=window.URL.createObjectURL($),R=document.createElement("a");R.href=_,R.download=O,R.rel="noopener",R.click(),window.URL.revokeObjectURL(_)}async function Xot(t,e,n,r,i){const{method:o}=a0(t.get()),a=[...Array.from(e?.security||[]),...Array.from(t.security)].findLast(c=>c.securityType.get()===Ge.DigestAuth);if(a){const c=await sh(n,{signal:i,method:o.toUpperCase(),mode:r||f7(n)?"same-origin":"cors"}),d=Eot(c.headers.get("WWW-Authenticate")||"");a[Ge.DigestAuth].merge({nonce:d.nonce,realm:d.realm,qop:d.qop,algorithm:d.algorithm,opaque:d.opaque,cnonce:crypto.randomUUID(),nc:"00000001"})}}function Zot(t,e,n,r){return[...e?.security.get()||[],...t.security.get()].map(i=>{switch(i.securityType){case Ge.BasicAuth:{const o=i[Ge.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+btoa(`${_a(o.username,r)}:${_a(o.password,r)}`),active:!0,in:"header"}}case Ge.DigestAuth:{const o=Bw(r);return{id:"",key:"Authorization",value:Pot(t.get(),e?.get(),n?.get(),o),active:!0,in:"header"}}case Ge.JWT:return{id:"",key:"Authorization",value:"Bearer "+i[Ge.JWT].token,active:!0,in:"header"};case Ge.OAuth2:{const{grantType:o}=i[Ge.OAuth2],{accessToken:s}=i[Ge.OAuth2][o];return{id:"",key:"Authorization",value:"Bearer "+s,active:!0,in:"header"}}case Ge.OpenIDConnect:{const{grantType:o}=i[Ge.OpenIDConnect],{accessToken:s}=i[Ge.OpenIDConnect][o];return{id:"",key:"Authorization",value:"Bearer "+s,active:!0,in:"header"}}case Ge.APIKey:{const o=i[Ge.APIKey];return o.location===Cu.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(i=>!!i)}function Yot(t,e,n){const{operation:r,requestBody:i,parameters:o}=e,{headers:s,cookies:a,queryParameters:c}=o;if(!n)return!0;const d=n.parameters?.filter($=>$.in==="query"),p=n.parameters?.filter($=>$.in==="header"),g=n.parameters?.filter($=>$.in==="cookie"),O=r?.path!==n.path,v=n.method.toLowerCase()!==r?.method.toLowerCase(),w=n.body?.mediaTypes&&n.body?.mediaTypes?.[i.type]===void 0,S=p&&!p.every($=>s.some(_=>!hO(_)&&_.key===$.name)),C=g&&!g.every($=>a.some(_=>!hO(_)&&_.key===$.name)),T=d&&!d.every($=>c.some(_=>!hO(_)&&_.key===$.name)),E=gtt(t,e,n);return!O&&!v&&!w&&!S&&!C&&!T&&!E}function _ve(t,e){const{requestBody:n}=t,{method:r}=a0(t),i=r.toUpperCase();if(i==="GET"||i==="HEAD"||i==="OPTIONS")return null;try{switch(n.type){case"JSON":return structuredClone(_a(n.content,e));case"multipart/form-data":return Fot(t,e);case"application/x-www-form-urlencoded":return Wot(t,e);case"application/octet-stream":return n.binary;default:return _a(n.content,e)}}catch(o){console.error(o)}}function X8(t,e){const{requestBody:n}=t,r=_ve(t,e);if(r===null)return null;switch(n.type){default:return r;case"multipart/form-data":return Hot(r);case"application/x-www-form-urlencoded":return Got(r);case"application/octet-stream":return n.binary?.file??null}}function Got(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function Wot(t,e){const{requestBody:n}=t,r=[];return Dve(n.formData["application/x-www-form-urlencoded"]).forEach(i=>{const o=_a(i.value,e);r.push({key:_a(i.key,e),value:o,type:"text"})}),r}function Fot(t,e){const{requestBody:n}=t,r=[];return Dve(n.formData["multipart/form-data"]).forEach(({type:i,files:o,value:s,key:a})=>{const c=_a(a,e);if(i==="file"&&o)for(const d of o)r.push({key:c,value:d,type:i});else if(s){const d=_a(s,e);r.push({key:c,value:d,type:i})}}),r}function Hot(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 Dre(t=[]){return t.filter(e=>{const{securityType:n,[Ge.APIKey]:r}=e;return n===Ge.APIKey&&r.location===Cu.Query&&!!r.name}).map(e=>{const{[Ge.APIKey]:n}=e;return{id:"",key:n.name,value:n.key,active:!0,in:"query"}})}function Ive(t,e,n){const r=n?.components.parameters.get();return bO("query",[Dre(e?.security.get()),Dre(t.security.get()),go(e?.parameters.queryParameters.get(),r),go(t.parameters.queryParameters.get(),r)])}function jve(t,e,n,r){return Ive(t,e,n).map(o=>{const s=_a(o.value,r),a=jre(s);return`${jre(o.key)}=${a}`}).join("&")}function Jot(t,e,n,r){return Ive(t,e,n).reduce((o,s)=>{const a=_a(s.value,r),c=_a(s.key,r);return o[c]=a,o},{})}function Kot(t){const e=t.indexOf("?");if(e===-1)return[];const n=new URLSearchParams(t.slice(e+1)),r=[];for(const[i,o]of n.entries())r.push({id:crypto.randomUUID(),active:!0,key:i,value:o,in:"query"});return r}function est(t){const e=t.split("?")[0],n=Lot(e),r=/^\{[^\s]+\}$/,i=n.filter(o=>r.test(o)).map(o=>o.slice(1,-1));return new Set(i)}function Z8(t,e,n,r){const i=rst(t.get(),r),o=Zot(t,e,n,r),s=tst(t,e,n,r),a=n?.components.parameters.get();return bO("header",[i,o,s,go(e?.parameters.headers.get(),a),go(t.parameters.headers.get(),a)]).reduce((p,{key:g,value:O})=>(p[g]=_a(O,r),p),{})}function tst(t,e,n,r){const o=Qve(t,e,n).map(s=>`${s.key}=${_a(s.value,r)}`).join("; ");return o?[{id:"",key:"Cookie",value:o,active:!0,in:"header"},{id:"",key:"X-Redocly-Cookie",value:o,active:!0,in:"header"}]:[]}function nst(t,e,n,r){return Qve(t,e,n).reduce((o,s)=>{const a=_a(s.value,r);return{...o,[_a(s.key,r)]:a}},{})}function Mre(t=[]){return t.filter(e=>{const{securityType:n,[Ge.APIKey]:r}=e;return n===Ge.APIKey&&r.location===Cu.Cookie&&!!r.name}).map(e=>{const{[Ge.APIKey]:n}=e;return{id:"",key:n.name,value:n.key,active:!0,in:"cookie"}})}function Qve(t,e,n){const r=n?.components.parameters.get();return bO("cookie",[Mre(e?.security.get()),Mre(t.security.get()),go(e?.parameters.cookies.get(),r),go(t.parameters.cookies.get(),r)])}function Dve(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}function rst(t,e){const{requestBody:n}=t;return!X8(t,e)||["binary","multipart/form-data"].includes(n.type)?[]:[{id:"",key:"Content-Type",value:n.type,active:!0,in:"header"}]}function _a(t,e){return e?Hr(t,Bw(e)?.inputs):t}function ist({proxyUrl:t,resolvedUrl:e,ignoreProxy:n,queryParameters:r=""}){const i=t!=="/"?o7(t):t;let o;return n||!i?o=e:o=`${i}/${e}`,r&&(o+=`?${r}`),o}function Mve(t){return t.flatMap(e=>{const n=e.id.get();return(e.paths?.keys??[]).flatMap(i=>{const o=e.paths.nested(i),a=(o.keys??[]).filter(p=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(p.toLowerCase())).map(p=>{const g=o.nested(p),O=g.operationId.get()||"",v=g.summary.get();return{apiId:n,path:i,method:p,operationId:O,summary:v,isAdditionalOperation:!1}}),c=o.additionalOperations?.get(),d=c?Object.entries(c).map(([p,g])=>({apiId:n,path:i,method:p,operationId:g.operationId||"",summary:g.summary,isAdditionalOperation:!0})):[];return[...a,...d]})})}function Y8({tabsState:{activeTabIdx:t,tabs:e}}){return e[t?.get()??0]}function ost(t){const{environments:e,apis:n,tabsState:{tabs:r}}=t,i=r.filter(c=>c.data.type.get()===Yt.Step),o=Mve(n),s=i.map(c=>{const{collectionId:d,workflowId:p,satisfiesScheme:g}=c.data.get(),O=c.data.draftStep.ornull;if(O===null)return null;const{operationId:v,apiId:w}=O.get().operation??{};if(!g||!v)return null;const S=t.collections.find(D=>D.id.get()===d),C=S?.workflows.find(D=>D.workflowId.get()===p),T=o.find(D=>D.operationId===v&&D.apiId===w);if(!T)return null;const E=Z8(O,C,S,t),$=X8(O.get(),t),_=nst(O,C,S,t),R=Jot(O,C,S,t),Q=O.requestBody.activeExampleName;return{apiPath:{path:T.path,method:T.method},requestValues:{cookie:_,header:E,query:R,body:$},activeExampleName:Q.get()}}).filter(c=>c!==null),a=Bw(t);return{operations:s,environment:a?.name,environments:Object.fromEntries(e.get().map(c=>[c.name,{...Object.fromEntries(c.inputs.map(({name:d,value:p})=>[d,p])),...Object.fromEntries(c.servers.map(({apiId:d,value:p})=>[d,p]))}]))}}function sst(t){const e=t.data.get();switch(e.type){case Yt.Workflow:return`${e.collectionId}/${e.workflowId}`;case Yt.Collection:return e.collectionId;case Yt.Step:return`${e.collectionId}/${e.workflowId}/${e.stepId}`;case Yt.WorkflowRun:return`${e.collectionId}/${e.workflowId}`}}function Gw(t){const e=Mn(),n=Y8(e);return!n.get()||t&&!ss(n.data.get(),t)?{tab:null,tabDataId:void 0}:{tab:n,tabDataId:sst(n)}}function ast(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return M.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const DM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ww(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function G8(t){return"nodeType"in t}function Jl(t){var e,n;return t?Ww(t)?t:G8(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function W8(t){const{Document:e}=Jl(t);return t instanceof e}function W$(t){return Ww(t)?!1:t instanceof Jl(t).HTMLElement}function Nve(t){return t instanceof Jl(t).SVGElement}function Fw(t){return t?Ww(t)?t.document:G8(t)?W8(t)?t:W$(t)||Nve(t)?t.ownerDocument:document:document:document}const zd=DM?M.useLayoutEffect:M.useEffect;function MM(t){const e=M.useRef(t);return zd(()=>{e.current=t}),M.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 lst(){const t=M.useRef(null),e=M.useCallback((r,i)=>{t.current=setInterval(r,i)},[]),n=M.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function l$(t,e){e===void 0&&(e=[t]);const n=M.useRef(t);return zd(()=>{n.current!==t&&(n.current=t)},e),n}function F$(t,e){const n=M.useRef();return M.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function BD(t){const e=MM(t),n=M.useRef(null),r=M.useCallback(i=>{i!==n.current&&e?.(i,n.current),n.current=i},[]);return[n,r]}function XD(t){const e=M.useRef();return M.useEffect(()=>{e.current=t},[t]),e.current}let yq={};function H$(t,e){return M.useMemo(()=>{if(e)return e;const n=yq[t]==null?0:yq[t]+1;return yq[t]=n,t+"-"+n},[t,e])}function zve(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((o,s)=>{const a=Object.entries(s);for(const[c,d]of a){const p=o[c];p!=null&&(o[c]=p+t*d)}return o},{...e})}}const ZS=zve(1),ZD=zve(-1);function cst(t){return"clientX"in t&&"clientY"in t}function NM(t){if(!t)return!1;const{KeyboardEvent:e}=Jl(t.target);return e&&t instanceof e}function ust(t){if(!t)return!1;const{TouchEvent:e}=Jl(t.target);return e&&t instanceof e}function YD(t){if(ust(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 cst(t)?{x:t.clientX,y:t.clientY}:null}const RO=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[RO.Translate.toString(t),RO.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),Nre="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function dst(t){return t.matches(Nre)?t:t.querySelector(Nre)}const fst={display:"none"};function pst(t){let{id:e,value:n}=t;return ke.default.createElement("div",{id:e,style:fst},n)}function hst(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 ke.default.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function mst(){const[t,e]=M.useState("");return{announce:M.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const qve=M.createContext(null);function gst(t){const e=M.useContext(qve);M.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function yst(){const[t]=M.useState(()=>new Set),e=M.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[M.useCallback(r=>{let{type:i,event:o}=r;t.forEach(s=>{var a;return(a=s[i])==null?void 0:a.call(s,o)})},[t]),e]}const Ost={draggable:`
682
+ `,Hr=(t,e,n=new Set)=>{const r=Pve(t);if(!r.length)return t;let i=0;const o=r.flatMap(({start:s,end:a,name:c})=>{if(n.has(c))return null;const d=e.findLast(g=>g.name===c),p=t.slice(i,d?s:a);if(i=a,d){n.add(c);const g=Hr(d.value,e,n);return n.delete(c),[p.length?p:null,g||t.slice(s,a)]}return[p.length?p:null]});return t.slice(i).length&&o.push(t.slice(i)),o.join("")};function wot(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function Cot(t,e){const n=Ave(t);if(!n.length)return y.jsx(Ire,{children:t});let r=0;const i=n.flatMap(({start:o,end:s})=>{const a=t.slice(r,o),c=wot(t.slice(o,s),e);return r=s,[a.length?a:null,c]});return t.slice(r).length&&i.push(t.slice(r)),y.jsx(Ire,{children:i.join("")})}const $ve="New Step";function d7({name:t=$ve,workflow:e}={}){let n=t.replaceAll(" ","-").toLowerCase();if(!e)return n;const r=Tot(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function Tot(t){return t.steps.filter(e=>e.state.get()!==Er.Draft).map(e=>e.stepId.get())}function s0({name:t=$ve,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:o}={}){if(!n){const a=o?R8(o):null,c=[Lf()];return{stepId:d7({name:t,workflow:r}),description:t,outputs:[Id()],successCriteria:[],state:e?Er.Draft:Er.Normal,parameters:{pathParameters:[xi("path")],queryParameters:[xi("query")],headers:[xi("header")],cookies:[xi("cookie")]},requestBody:_D(),xOperation:i?null:{method:"GET",url:""},security:c,operation:i??null,...a}}const s=n.get({noproxy:!0});return{stepId:d7({name:t,workflow:r}),description:s.description,outputs:s.outputs,successCriteria:s.successCriteria,state:e?Er.Draft:Er.Normal,parameters:s.parameters,requestBody:s.requestBody,xOperation:s.xOperation,security:s.security,operation:s.operation}}function a0(t){return{method:(t.xOperation?t.xOperation.method:t.operation?.method)??"",url:(t.xOperation?t.xOperation.url:t.operation?.path)??""}}function B8(t,e,n,r){const{inputs:i,servers:o}=r,s=itt(bO("path",[go(e?.parameters.pathParameters,n?.components.parameters),go(t.parameters.pathParameters,n?.components.parameters)]),r.inputs),a=t.xOperation??null,c=t.operation??null;let d="",p="";if(a)p=a.method,d=Une(a.url,s);else if(c){const v=o.find(S=>S.apiId===c.apiId);p=c.method==="x-query"?"query":c.method,d=(v?.value?TOe(v.value,v.variables):"")+Une(c.path,s)}const g=d.split("?")[0];return{url:Hr(g,i),method:p.toUpperCase()}}function Eot(t){const e=t.substring(7).split(", "),n={};for(const r of e){const[i,o]=r.split("=");n[i]=o.replace(/"/g,"")}return n}function Pot(t,e,n,r){const{inputs:i}=r,{requestBody:{content:o}}=t,{url:s,method:a}=B8(t,e,n,r),c=[...e?.security||[],...t.security].findLast(D=>D.securityType===Ge.DigestAuth);if(!c)return"";const{username:d,password:p,realm:g,nonce:O,cnonce:v,algorithm:w,qop:S,nc:C,opaque:T}=c[Ge.DigestAuth],E=Hr(d,i),{pathname:$,search:_}=new URL(s),R=_?`${$}${_}`:$,Q=Aot({username:E,password:Hr(p,i),uri:R,realm:g,nonce:O,cnonce:v,algorithm:w,qop:S,nc:C,method:a,bodyContent:o});return`Digest username="${E}", realm="${g}", nonce="${O}", uri="${R}", qop=${S}, nc=${C}, cnonce="${v}", response="${Q}", algorithm=${w}${T?`, opaque="${T}"`:""}`}function Aot(t){const{username:e,password:n,realm:r,nonce:i,cnonce:o,algorithm:s,qop:a,nc:c,uri:d,method:p,bodyContent:g}=t,O=$ot(s),v=s?.endsWith("-sess")?O(`${O(`${e}:${r}:${n}`)}:${i}:${o}`):O(`${e}:${r}:${n}`),w=a?.includes("auth-int")?O(`${p}:${d}:${O(g)}`):O(`${p}:${d}`);return O(`${v}:${i}:${c}:${o}:${a}:${w}`).toString()}function $ot(t){switch(t?.replace("-sess","")){case"SHA-256":return e=>yA(wae(e));default:return e=>yA(w5(e))}}function kot(t){try{const n=new URL(t).hostname;return n==="localhost"||n==="127.0.0.1"}catch{return!1}}function f7(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function Rot(t){return t?t.split(";").map(r=>r.trim()).map(r=>{const i=r.indexOf("="),o=r.slice(0,i).trim(),s=r.slice(i+1).trim();return[o,s]}):[]}const _ot=["json","xml","html","text"],Iot=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function gq(t,e){return t.get(e)??t.get(e.toLowerCase())}function jot(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function Qot(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 Dot(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function Mot(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return Iot.some(r=>n.includes(r))?!0:n.startsWith("application/")?!_ot.some(r=>n.includes(r)):!1}async function Not(t,e){const n=gq(t.headers,"content-type")?.split(";")[0].trim(),r=gq(t.headers,"content-disposition"),i=jot(gq(t.headers,"content-length")),o=Mot(n,r),s=Rot(document.cookie);if(o){const O={fileName:Qot(r)||Dot(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:s,size:i??0,download:O,bodyNotStored:!0,url:t.url}}const c=await t.clone().arrayBuffer(),d=new TextDecoder().decode(c),p=new Uint8Array(c).length;return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:c,body:d,duration:e,cookies:s,size:p,url:t.url}}function jre(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}function Qre(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 kve(t,e){let n=Qre(t);const r=e.find(({host:i,port:o})=>Qre(`https://${i}:${o}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}function zot(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function qot(t,e){const{exists:n}=await Promise.resolve().then(()=>EV),{join:r}=await Promise.resolve().then(()=>rhe),{baseName:i,extension:o}=zot(e);let s=0;for(;;){const a=s===0?"":` (${s})`,c=`${i}${a}${o}`,d=await r(t,c);if(!await n(d))return d;s+=1}}function Lot(t){return t.split(/(\{[^}]+\}|\/)/g).filter(e=>e!=="")}function Uot(t){if(t!=null)return t}async function Rve({store:t,step:e,settings:n,workflow:r,collection:i,signal:o}){const{mockServer:s,corsProxyUrl:a,certificates:c}=n.get(),d=Bw(t),{url:p,method:g}=B8(e.get(),r?.get(),i?.get(),d),O=s?.url,v=O?p.startsWith(location.origin+O):!1,w=a||"",S=jve(e,r,i,t),C=v||kot(p)||f7(p),T=ist({proxyUrl:w,resolvedUrl:p,ignoreProxy:C,queryParameters:S});await Xot(e,r??void 0,T,v,o);const E=Z8(e,r??void 0,i??void 0,t),$=Uot(X8(e.get({noproxy:!0}),t)),{clientCert:_,clientKey:R}=kve(p,c||[]),D=!!T.match(/^https?:\/\//)?T:`https://${T}`,q=g.toUpperCase(),Z=!cM.includes(q),Y=Z?"POST":q,G=Z?{...E,"X-HTTP-Method-Override":q}:E;return{urlWithProxyAndProtocol:D,fetchMethod:Y,fetchHeaders:G,body:$,mode:v||f7(D)?"same-origin":"cors",clientCert:_,clientKey:R,resolvedUrl:p,isMockServer:v}}async function Vot(t,e,n,r){const{requestController:i}=t,s=Y8(t).data;if(s.type.get()!==Yt.Step){console.warn("not an operation tab");return}const{collectionId:a,workflowId:c,response:d,requestError:p,isProcessingRequest:g}=s,O=t.collections.find(C=>C.id.get()===a.get()),v=O?.workflows.find(C=>C.workflowId.get()===c.get()),w=Ym(e.get({noproxy:!0}));g.set(!0),i.get()?.abort?.(),i.set(new AbortController);const S=i.get()?.signal;try{const C=await Rve({store:t,step:e,settings:n,workflow:v,collection:O,signal:S}),T=Date.now(),E={signal:S,method:C.fetchMethod,headers:C.fetchHeaders,body:C.body,mode:C.mode,clientCert:C.clientCert,clientKey:C.clientKey},$=await sh(C.urlWithProxyAndProtocol,E),_=Date.now()-T;p.set(null),d.set(await Not($,_));const R=Ym(d.value);r?.(w,R)}catch(C){if(d.set(null),C.name==="AbortError")return;p.set(C.message||String(C));const T=Ym(d.value);r?.(w,T)}finally{g.set(!1)}}async function Bot({store:t,step:e,settings:n,workflow:r,collection:i,fileName:o,onProgress:s}){const a=await Rve({store:t,step:e,settings:n,workflow:r,collection:i}),c={method:a.fetchMethod,headers:a.fetchHeaders,body:a.body,mode:a.mode,clientCert:a.clientCert,clientKey:a.clientKey},{clientCert:d,clientKey:p}=c,g=Xs(),O=o||"response";let v=null;if(g){const{open:Q}=await Promise.resolve().then(()=>require("./replay-index-BRty-oaf.js")),D=await Q({directory:!0,multiple:!1});if(!D)return;const q=Array.isArray(D)?D[0]:D;v=await qot(q,O)}const w=await sh(a.urlWithProxyAndProtocol,c),S=w.headers.get("content-length"),C=S?Number.parseInt(S,10):void 0,T=Number.isFinite(C)?C:void 0,E=w.headers.get("content-type")??void 0;let $;if(w.body?.getReader){const Q=w.body.getReader(),D=[];let q=0;for(;;){const{done:Z,value:Y}=await Q.read();if(Z)break;if(Y){const G=new Uint8Array(Y.byteLength);G.set(Y),D.push(G.buffer),q+=Y.byteLength,s?.({receivedBytes:q,totalBytes:T,done:!1})}}$=new Blob(D,{type:E}),s?.({receivedBytes:q,totalBytes:T,done:!0})}else $=await w.blob(),s?.({receivedBytes:$.size,totalBytes:T,done:!0});if(g){const{writeFile:Q}=await Promise.resolve().then(()=>EV),D=new Uint8Array(await $.arrayBuffer());if(!v)return;await Q(v,D);return}const _=window.URL.createObjectURL($),R=document.createElement("a");R.href=_,R.download=O,R.rel="noopener",R.click(),window.URL.revokeObjectURL(_)}async function Xot(t,e,n,r,i){const{method:o}=a0(t.get()),a=[...Array.from(e?.security||[]),...Array.from(t.security)].findLast(c=>c.securityType.get()===Ge.DigestAuth);if(a){const c=await sh(n,{signal:i,method:o.toUpperCase(),mode:r||f7(n)?"same-origin":"cors"}),d=Eot(c.headers.get("WWW-Authenticate")||"");a[Ge.DigestAuth].merge({nonce:d.nonce,realm:d.realm,qop:d.qop,algorithm:d.algorithm,opaque:d.opaque,cnonce:crypto.randomUUID(),nc:"00000001"})}}function Zot(t,e,n,r){return[...e?.security.get()||[],...t.security.get()].map(i=>{switch(i.securityType){case Ge.BasicAuth:{const o=i[Ge.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+btoa(`${_a(o.username,r)}:${_a(o.password,r)}`),active:!0,in:"header"}}case Ge.DigestAuth:{const o=Bw(r);return{id:"",key:"Authorization",value:Pot(t.get(),e?.get(),n?.get(),o),active:!0,in:"header"}}case Ge.JWT:return{id:"",key:"Authorization",value:"Bearer "+i[Ge.JWT].token,active:!0,in:"header"};case Ge.OAuth2:{const{grantType:o}=i[Ge.OAuth2],{accessToken:s}=i[Ge.OAuth2][o];return{id:"",key:"Authorization",value:"Bearer "+s,active:!0,in:"header"}}case Ge.OpenIDConnect:{const{grantType:o}=i[Ge.OpenIDConnect],{accessToken:s}=i[Ge.OpenIDConnect][o];return{id:"",key:"Authorization",value:"Bearer "+s,active:!0,in:"header"}}case Ge.APIKey:{const o=i[Ge.APIKey];return o.location===Cu.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(i=>!!i)}function Yot(t,e,n){const{operation:r,requestBody:i,parameters:o}=e,{headers:s,cookies:a,queryParameters:c}=o;if(!n)return!0;const d=n.parameters?.filter($=>$.in==="query"),p=n.parameters?.filter($=>$.in==="header"),g=n.parameters?.filter($=>$.in==="cookie"),O=r?.path!==n.path,v=n.method.toLowerCase()!==r?.method.toLowerCase(),w=n.body?.mediaTypes&&n.body?.mediaTypes?.[i.type]===void 0,S=p&&!p.every($=>s.some(_=>!hO(_)&&_.key===$.name)),C=g&&!g.every($=>a.some(_=>!hO(_)&&_.key===$.name)),T=d&&!d.every($=>c.some(_=>!hO(_)&&_.key===$.name)),E=gtt(t,e,n);return!O&&!v&&!w&&!S&&!C&&!T&&!E}function _ve(t,e){const{requestBody:n}=t,{method:r}=a0(t),i=r.toUpperCase();if(i==="GET"||i==="HEAD"||i==="OPTIONS")return null;try{switch(n.type){case"JSON":return structuredClone(_a(n.content,e));case"multipart/form-data":return Fot(t,e);case"application/x-www-form-urlencoded":return Wot(t,e);case"application/octet-stream":return n.binary;default:return _a(n.content,e)}}catch(o){console.error(o)}}function X8(t,e){const{requestBody:n}=t,r=_ve(t,e);if(r===null)return null;switch(n.type){default:return r;case"multipart/form-data":return Hot(r);case"application/x-www-form-urlencoded":return Got(r);case"application/octet-stream":return n.binary?.file??null}}function Got(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function Wot(t,e){const{requestBody:n}=t,r=[];return Dve(n.formData["application/x-www-form-urlencoded"]).forEach(i=>{const o=_a(i.value,e);r.push({key:_a(i.key,e),value:o,type:"text"})}),r}function Fot(t,e){const{requestBody:n}=t,r=[];return Dve(n.formData["multipart/form-data"]).forEach(({type:i,files:o,value:s,key:a})=>{const c=_a(a,e);if(i==="file"&&o)for(const d of o)r.push({key:c,value:d,type:i});else if(s){const d=_a(s,e);r.push({key:c,value:d,type:i})}}),r}function Hot(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 Dre(t=[]){return t.filter(e=>{const{securityType:n,[Ge.APIKey]:r}=e;return n===Ge.APIKey&&r.location===Cu.Query&&!!r.name}).map(e=>{const{[Ge.APIKey]:n}=e;return{id:"",key:n.name,value:n.key,active:!0,in:"query"}})}function Ive(t,e,n){const r=n?.components.parameters.get();return bO("query",[Dre(e?.security.get()),Dre(t.security.get()),go(e?.parameters.queryParameters.get(),r),go(t.parameters.queryParameters.get(),r)])}function jve(t,e,n,r){return Ive(t,e,n).map(o=>{const s=_a(o.value,r),a=jre(s);return`${jre(o.key)}=${a}`}).join("&")}function Jot(t,e,n,r){return Ive(t,e,n).reduce((o,s)=>{const a=_a(s.value,r),c=_a(s.key,r);return o[c]=a,o},{})}function Kot(t){const e=t.indexOf("?");if(e===-1)return[];const n=new URLSearchParams(t.slice(e+1)),r=[];for(const[i,o]of n.entries())r.push({id:crypto.randomUUID(),active:!0,key:i,value:o,in:"query"});return r}function est(t){const e=t.split("?")[0],n=Lot(e),r=/^\{[^\s]+\}$/,i=n.filter(o=>r.test(o)).map(o=>o.slice(1,-1));return new Set(i)}function Z8(t,e,n,r){const i=rst(t.get(),r),o=Zot(t,e,n,r),s=tst(t,e,n,r),a=n?.components.parameters.get();return bO("header",[i,o,s,go(e?.parameters.headers.get(),a),go(t.parameters.headers.get(),a)]).reduce((p,{key:g,value:O})=>(p[g]=_a(O,r),p),{})}function tst(t,e,n,r){const o=Qve(t,e,n).map(s=>`${s.key}=${_a(s.value,r)}`).join("; ");return o?[{id:"",key:"Cookie",value:o,active:!0,in:"header"},{id:"",key:"X-Redocly-Cookie",value:o,active:!0,in:"header"}]:[]}function nst(t,e,n,r){return Qve(t,e,n).reduce((o,s)=>{const a=_a(s.value,r);return{...o,[_a(s.key,r)]:a}},{})}function Mre(t=[]){return t.filter(e=>{const{securityType:n,[Ge.APIKey]:r}=e;return n===Ge.APIKey&&r.location===Cu.Cookie&&!!r.name}).map(e=>{const{[Ge.APIKey]:n}=e;return{id:"",key:n.name,value:n.key,active:!0,in:"cookie"}})}function Qve(t,e,n){const r=n?.components.parameters.get();return bO("cookie",[Mre(e?.security.get()),Mre(t.security.get()),go(e?.parameters.cookies.get(),r),go(t.parameters.cookies.get(),r)])}function Dve(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}function rst(t,e){const{requestBody:n}=t;return!X8(t,e)||["binary","multipart/form-data"].includes(n.type)?[]:[{id:"",key:"Content-Type",value:n.type,active:!0,in:"header"}]}function _a(t,e){return e?Hr(t,Bw(e)?.inputs):t}function ist({proxyUrl:t,resolvedUrl:e,ignoreProxy:n,queryParameters:r=""}){const i=t!=="/"?o7(t):t;let o;return n||!i?o=e:o=`${i}/${e}`,r&&(o+=`?${r}`),o}function Mve(t){return t.flatMap(e=>{const n=e.id.get();return(e.paths?.keys??[]).flatMap(i=>{const o=e.paths.nested(i),a=(o.keys??[]).filter(p=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(p.toLowerCase())).map(p=>{const g=o.nested(p),O=g.operationId.get()||"",v=g.summary.get();return{apiId:n,path:i,method:p,operationId:O,summary:v,isAdditionalOperation:!1}}),c=o.additionalOperations?.get(),d=c?Object.entries(c).map(([p,g])=>({apiId:n,path:i,method:p,operationId:g.operationId||"",summary:g.summary,isAdditionalOperation:!0})):[];return[...a,...d]})})}function Y8({tabsState:{activeTabIdx:t,tabs:e}}){return e[t?.get()??0]}function ost(t){const{environments:e,apis:n,tabsState:{tabs:r}}=t,i=r.filter(c=>c.data.type.get()===Yt.Step),o=Mve(n),s=i.map(c=>{const{collectionId:d,workflowId:p,satisfiesScheme:g}=c.data.get(),O=c.data.draftStep.ornull;if(O===null)return null;const{operationId:v,apiId:w}=O.get().operation??{};if(!g||!v)return null;const S=t.collections.find(D=>D.id.get()===d),C=S?.workflows.find(D=>D.workflowId.get()===p),T=o.find(D=>D.operationId===v&&D.apiId===w);if(!T)return null;const E=Z8(O,C,S,t),$=X8(O.get(),t),_=nst(O,C,S,t),R=Jot(O,C,S,t),Q=O.requestBody.activeExampleName;return{apiPath:{path:T.path,method:T.method},requestValues:{cookie:_,header:E,query:R,body:$},activeExampleName:Q.get()}}).filter(c=>c!==null),a=Bw(t);return{operations:s,environment:a?.name,environments:Object.fromEntries(e.get().map(c=>[c.name,{...Object.fromEntries(c.inputs.map(({name:d,value:p})=>[d,p])),...Object.fromEntries(c.servers.map(({apiId:d,value:p})=>[d,p]))}]))}}function sst(t){const e=t.data.get();switch(e.type){case Yt.Workflow:return`${e.collectionId}/${e.workflowId}`;case Yt.Collection:return e.collectionId;case Yt.Step:return`${e.collectionId}/${e.workflowId}/${e.stepId}`;case Yt.WorkflowRun:return`${e.collectionId}/${e.workflowId}`}}function Gw(t){const e=Mn(),n=Y8(e);return!n.get()||t&&!ss(n.data.get(),t)?{tab:null,tabDataId:void 0}:{tab:n,tabDataId:sst(n)}}function ast(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return M.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const DM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ww(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function G8(t){return"nodeType"in t}function Jl(t){var e,n;return t?Ww(t)?t:G8(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function W8(t){const{Document:e}=Jl(t);return t instanceof e}function W$(t){return Ww(t)?!1:t instanceof Jl(t).HTMLElement}function Nve(t){return t instanceof Jl(t).SVGElement}function Fw(t){return t?Ww(t)?t.document:G8(t)?W8(t)?t:W$(t)||Nve(t)?t.ownerDocument:document:document:document}const zd=DM?M.useLayoutEffect:M.useEffect;function MM(t){const e=M.useRef(t);return zd(()=>{e.current=t}),M.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 lst(){const t=M.useRef(null),e=M.useCallback((r,i)=>{t.current=setInterval(r,i)},[]),n=M.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function l$(t,e){e===void 0&&(e=[t]);const n=M.useRef(t);return zd(()=>{n.current!==t&&(n.current=t)},e),n}function F$(t,e){const n=M.useRef();return M.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function BD(t){const e=MM(t),n=M.useRef(null),r=M.useCallback(i=>{i!==n.current&&e?.(i,n.current),n.current=i},[]);return[n,r]}function XD(t){const e=M.useRef();return M.useEffect(()=>{e.current=t},[t]),e.current}let yq={};function H$(t,e){return M.useMemo(()=>{if(e)return e;const n=yq[t]==null?0:yq[t]+1;return yq[t]=n,t+"-"+n},[t,e])}function zve(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((o,s)=>{const a=Object.entries(s);for(const[c,d]of a){const p=o[c];p!=null&&(o[c]=p+t*d)}return o},{...e})}}const ZS=zve(1),ZD=zve(-1);function cst(t){return"clientX"in t&&"clientY"in t}function NM(t){if(!t)return!1;const{KeyboardEvent:e}=Jl(t.target);return e&&t instanceof e}function ust(t){if(!t)return!1;const{TouchEvent:e}=Jl(t.target);return e&&t instanceof e}function YD(t){if(ust(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 cst(t)?{x:t.clientX,y:t.clientY}:null}const RO=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[RO.Translate.toString(t),RO.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),Nre="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function dst(t){return t.matches(Nre)?t:t.querySelector(Nre)}const fst={display:"none"};function pst(t){let{id:e,value:n}=t;return ke.default.createElement("div",{id:e,style:fst},n)}function hst(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 ke.default.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function mst(){const[t,e]=M.useState("");return{announce:M.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const qve=M.createContext(null);function gst(t){const e=M.useContext(qve);M.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function yst(){const[t]=M.useState(()=>new Set),e=M.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[M.useCallback(r=>{let{type:i,event:o}=r;t.forEach(s=>{var a;return(a=s[i])==null?void 0:a.call(s,o)})},[t]),e]}const Ost={draggable:`
683
683
  To pick up a draggable item, press the space bar.
684
684
  While dragging, use the arrow keys to move the item.
685
685
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -3100,7 +3100,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
3100
3100
  gap: var(--spacing-xs);
3101
3101
  `,Jj={[ol.SIMPLE]:{label:"Simple",tooltipContent:"Success criteria conditions in the form of basic literals, operators, and loose comparisons"},[ol.REGEX]:{label:"Regex",tooltipContent:"Regex patterns used as success criteria conditions"},[ol.JSONPATH]:{label:"JSONPath",tooltipContent:"JSONPath expressions as success criteria conditions"},[ol.XPATH]:{label:"XPath",tooltipContent:"XPath expressions as success criteria conditions"}},pSt=Object.keys(Jj);function hSt({successCriteria:t}){const{sendEvent:e}=an(),n=o=>{e("button.click",[{source:"workflow",action:"add_success_criteria",success_criteria_type:o}]),t.set(s=>[...s||[],{...ftt(o)}])},r=M.useMemo(()=>t.filter(o=>o.get()!==void 0),[t]),i=o=>{e("button.click",[{source:"workflow",action:"remove_success_criteria",success_criteria_type:o.get().type,condition:o.get().condition}]),o.set(An)};return y.jsxs(y.Fragment,{children:[y.jsxs(ag,{children:["Success criteria",y.jsx(jd,{content:"List of conditions required to complete the step."})]}),r.map(o=>y.jsx(M.Fragment,{children:y.jsx(lSt,{successCriteria:o,label:Jj[o.get().type].label,tooltipContent:Jj[o.get().type].tooltipContent,additionalActions:y.jsx($c,{"data-testid":"remove-success-criteria-button",variant:"text",icon:y.jsx(F.TrashCanIcon,{}),onClick:()=>i(o)})})},o.get().id)),y.jsx(mSt,{renderInput:()=>y.jsx(F.Button,{variant:"outlined",icon:y.jsx(F.AddIcon,{}),iconPosition:"left",size:"small",children:"Add success criteria"}),dataTestId:"workflow-step-success-criteria-select",options:pSt.map(o=>({element:Jj[o].label,label:o,value:o})),onChange:o=>{n(o)},placement:"top",hideCheckmarkIcon:!0})]})}const mSt=U(F.Select)`
3102
3102
  border-radius: var(--border-radius-md);
3103
- `;function gSt({step:t,workflowId:e,collectionId:n}){const{handleIdChange:r}=w0(),i=t.stepId.get();return y.jsx(y.Fragment,{children:y.jsxs(s1e,{children:[y.jsx(ag,{children:"Info"}),y.jsxs(Ir,{children:[y.jsxs(Ir.Row,{children:[y.jsx(Ir.Cell,{children:y.jsxs(Zb,{children:["Step ID",y.jsx(jd,{content:"This step's unique identifier"})]})}),y.jsx(Ir.Cell,{$readonly:!0,children:y.jsx(Y7,{attribute:t.stepId,editorTitle:"Change step ID",placeholder:"Add step ID",onSave:o=>{n&&e&&r({collectionId:n,workflowId:e,stepId:i},{collectionId:n,workflowId:e,stepId:o})}})})]}),y.jsxs(Ir.Row,{children:[y.jsx(Ir.Cell,{children:y.jsxs(Zb,{children:["Description",y.jsx(jd,{content:"The step's purpose in the workflow."})]})}),y.jsx(Ir.Cell,{children:y.jsx(fB,{state:t.description,placeholder:"Add description"})})]})]}),y.jsxs(GS,{children:[y.jsx(ag,{children:"Operation"}),y.jsx(iSt,{step:t,collectionId:n})]}),y.jsx(GS,{children:y.jsx(o1e,{outputs:t.outputs,tooltipText:"Data generated in this step that can be used in the next steps."})}),y.jsx(GS,{children:y.jsx(hSt,{successCriteria:t.successCriteria})})]})})}function ySt({onParameterChange:t,files:e}){const n=M.useRef(null),r=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(c=>({absolutePath:null,file:c})))},i=async()=>{if(Xs())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-DCj7gnE9.js")),c=await a({multiple:!0});if(!c)return;const p=(Array.isArray(c)?c:[c]).map(G$),O=(await Promise.all(p)).filter(v=>v!==null);t(O)}catch(a){console.error("Failed to open file dialog or read file:",a)}else n.current?.click()},o=M.useCallback(()=>{t(null)},[t]),s=M.useMemo(()=>{if(!e)return null;if(e.length===1)return y.jsx(rse,{icon:y.jsx(F.CloseIcon,{}),variant:"secondary",onClick:o,iconPosition:"right",size:"small",children:y.jsx(ise,{children:e[0].file.name})});if(e.length>1)return y.jsx(rse,{icon:y.jsx(F.CloseIcon,{}),variant:"secondary",onClick:o,iconPosition:"right",size:"small",children:y.jsxs(ise,{children:[e.length," files"]})})},[e,o]);return y.jsx(OSt,{children:y.jsxs(vSt,{children:[y.jsx(bSt,{children:s||y.jsx(SSt,{children:"Add files here"})}),y.jsxs(xSt,{children:[y.jsx(Nnt,{onClick:i,variant:"text","data-testid":"add-button",icon:y.jsx(F.AddIcon,{color:"--text-color-secondary"})}),y.jsx("input",{"data-testid":"file-input",hidden:!0,ref:n,type:"file",multiple:!0,accept:"files/*",onChange:r})]})]})})}const OSt=U.div`
3103
+ `;function gSt({step:t,workflowId:e,collectionId:n}){const{handleIdChange:r}=w0(),i=t.stepId.get();return y.jsx(y.Fragment,{children:y.jsxs(s1e,{children:[y.jsx(ag,{children:"Info"}),y.jsxs(Ir,{children:[y.jsxs(Ir.Row,{children:[y.jsx(Ir.Cell,{children:y.jsxs(Zb,{children:["Step ID",y.jsx(jd,{content:"This step's unique identifier"})]})}),y.jsx(Ir.Cell,{$readonly:!0,children:y.jsx(Y7,{attribute:t.stepId,editorTitle:"Change step ID",placeholder:"Add step ID",onSave:o=>{n&&e&&r({collectionId:n,workflowId:e,stepId:i},{collectionId:n,workflowId:e,stepId:o})}})})]}),y.jsxs(Ir.Row,{children:[y.jsx(Ir.Cell,{children:y.jsxs(Zb,{children:["Description",y.jsx(jd,{content:"The step's purpose in the workflow."})]})}),y.jsx(Ir.Cell,{children:y.jsx(fB,{state:t.description,placeholder:"Add description"})})]})]}),y.jsxs(GS,{children:[y.jsx(ag,{children:"Operation"}),y.jsx(iSt,{step:t,collectionId:n})]}),y.jsx(GS,{children:y.jsx(o1e,{outputs:t.outputs,tooltipText:"Data generated in this step that can be used in the next steps."})}),y.jsx(GS,{children:y.jsx(hSt,{successCriteria:t.successCriteria})})]})})}function ySt({onParameterChange:t,files:e}){const n=M.useRef(null),r=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(c=>({absolutePath:null,file:c})))},i=async()=>{if(Xs())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-BRty-oaf.js")),c=await a({multiple:!0});if(!c)return;const p=(Array.isArray(c)?c:[c]).map(G$),O=(await Promise.all(p)).filter(v=>v!==null);t(O)}catch(a){console.error("Failed to open file dialog or read file:",a)}else n.current?.click()},o=M.useCallback(()=>{t(null)},[t]),s=M.useMemo(()=>{if(!e)return null;if(e.length===1)return y.jsx(rse,{icon:y.jsx(F.CloseIcon,{}),variant:"secondary",onClick:o,iconPosition:"right",size:"small",children:y.jsx(ise,{children:e[0].file.name})});if(e.length>1)return y.jsx(rse,{icon:y.jsx(F.CloseIcon,{}),variant:"secondary",onClick:o,iconPosition:"right",size:"small",children:y.jsxs(ise,{children:[e.length," files"]})})},[e,o]);return y.jsx(OSt,{children:y.jsxs(vSt,{children:[y.jsx(bSt,{children:s||y.jsx(SSt,{children:"Add files here"})}),y.jsxs(xSt,{children:[y.jsx(Nnt,{onClick:i,variant:"text","data-testid":"add-button",icon:y.jsx(F.AddIcon,{color:"--text-color-secondary"})}),y.jsx("input",{"data-testid":"file-input",hidden:!0,ref:n,type:"file",multiple:!0,accept:"files/*",onChange:r})]})]})})}const OSt=U.div`
3104
3104
  position: relative;
3105
3105
  display: flex;
3106
3106
  flex-grow: 1;
@@ -3227,7 +3227,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
3227
3227
  `,DSt=U.div`
3228
3228
  display: flex;
3229
3229
  justify-content: center;
3230
- `;function MSt({data:t,type:e}){const n=Qr(),r=t[e];function i(s,a){a&&r.merge([Jm()])}function o(s){r[s].set(An)}return y.jsx(CSt,{keyName:"Param",formElements:r,onParameterChange:i,environment:n,enableInputTypeSelection:e!==zo["application/x-www-form-urlencoded"],actions:s=>y.jsx($c,{onClick:()=>o(s),variant:"text",icon:y.jsx(F.TrashCanIcon,{})})})}const NSt=({data:t})=>{const e=t.get(),[n,r]=M.useState(!1),i=M.useRef(null),o=d=>{const p=d.target.files?.[0];if(p){r(!0);const g=new FileReader;g.onload=()=>{r(!1),t.set({absolutePath:null,file:p})},g.readAsDataURL(p)}},s=async d=>{if(d?.preventDefault(),Xs())try{const{open:p}=await Promise.resolve().then(()=>require("./replay-index-DCj7gnE9.js")),g=await p();if(!g)return;const O=await G$(g);t.set(O)}catch(p){console.error("Failed to open file dialog or read file:",p)}else i.current?.click()},a=d=>{d.key==="Enter"&&(d.preventDefault(),s())},c=()=>{t.set(null)};return n?y.jsxs(zSt,{children:[y.jsx(F.SpinnerIcon,{}),"Loading..."]}):e&&e.file?.name?y.jsxs(qSt,{children:[y.jsxs(LSt,{children:[y.jsx(F.DocumentBlankIcon,{size:"16px"}),y.jsx(USt,{children:e.file?.name})]}),y.jsx($c,{onClick:c,icon:y.jsx(F.TrashCanIcon,{})})]}):y.jsx(a1e,{children:!e&&y.jsxs(VSt,{tabIndex:0,role:"button",onKeyDown:a,onClick:s,children:[y.jsx("input",{type:"file",onChange:o,ref:i}),y.jsx(F.CloudUploadIcon,{}),"Upload file"]})})},a1e=U.div`
3230
+ `;function MSt({data:t,type:e}){const n=Qr(),r=t[e];function i(s,a){a&&r.merge([Jm()])}function o(s){r[s].set(An)}return y.jsx(CSt,{keyName:"Param",formElements:r,onParameterChange:i,environment:n,enableInputTypeSelection:e!==zo["application/x-www-form-urlencoded"],actions:s=>y.jsx($c,{onClick:()=>o(s),variant:"text",icon:y.jsx(F.TrashCanIcon,{})})})}const NSt=({data:t})=>{const e=t.get(),[n,r]=M.useState(!1),i=M.useRef(null),o=d=>{const p=d.target.files?.[0];if(p){r(!0);const g=new FileReader;g.onload=()=>{r(!1),t.set({absolutePath:null,file:p})},g.readAsDataURL(p)}},s=async d=>{if(d?.preventDefault(),Xs())try{const{open:p}=await Promise.resolve().then(()=>require("./replay-index-BRty-oaf.js")),g=await p();if(!g)return;const O=await G$(g);t.set(O)}catch(p){console.error("Failed to open file dialog or read file:",p)}else i.current?.click()},a=d=>{d.key==="Enter"&&(d.preventDefault(),s())},c=()=>{t.set(null)};return n?y.jsxs(zSt,{children:[y.jsx(F.SpinnerIcon,{}),"Loading..."]}):e&&e.file?.name?y.jsxs(qSt,{children:[y.jsxs(LSt,{children:[y.jsx(F.DocumentBlankIcon,{size:"16px"}),y.jsx(USt,{children:e.file?.name})]}),y.jsx($c,{onClick:c,icon:y.jsx(F.TrashCanIcon,{})})]}):y.jsx(a1e,{children:!e&&y.jsxs(VSt,{tabIndex:0,role:"button",onKeyDown:a,onClick:s,children:[y.jsx("input",{type:"file",onChange:o,ref:i}),y.jsx(F.CloudUploadIcon,{}),"Upload file"]})})},a1e=U.div`
3231
3231
  display: flex;
3232
3232
  align-items: center;
3233
3233
  justify-content: flex-start;
@@ -3391,7 +3391,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
3391
3391
  font-size: var(--font-size-base);
3392
3392
  font-weight: var(--font-weight-medium);
3393
3393
  padding: var(--spacing-xs);
3394
- `;function bwt(t=32){let e="";for(;e.length<t;)e+=Math.random().toString(32).substring(2);return e.substring(0,t)}async function xwt(t){const e=new TextEncoder().encode(t);return crypto?.subtle.digest("SHA-256",e)}function Swt(t){if(t)return btoa(String.fromCharCode.apply(null,new Uint8Array(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function G7(t,e,n){const r=typeof t=="string"?t:t.toString();if(Xs()){const{openUrl:i}=await Promise.resolve().then(()=>require("./replay-index-CK_CAbBV.js"));await i(r);return}window.open(r,e,n)}const sse="/_auth/oauth2-redirect.html";let dN=class LP{static async authorizeImplicit({authorizationUrl:e,clientId:n,scopes:r,extraAuthParams:i={},routingBasePath:o="/",redirectUri:s,successCallback:a,errorCallback:c}){const d=ase({date:new Date().toString()});try{const p=new URL(e),g=o==="/"?"":o,O=`${window.location.origin}${g}${sse}`;p.searchParams.set("client_id",n),p.searchParams.set("redirect_uri",s||O),p.searchParams.set("response_type","token"),p.searchParams.set("state",d),Array.isArray(r)&&p.searchParams.set("scope",r.join(" "));for(const v in i)p.searchParams.set(v,i[v]);window.redirectOAuth2={flow:"implicit",data:{authorizationUrl:e,clientId:n,scopes:r},state:d,successCallback:v=>{a(v),LP.clearRedirectData("implicit")},errorCallback:v=>{c(v),LP.clearRedirectData("implicit")}},await G7(p.toString())}catch(p){c(Nm.OAuth2Error.fromError(p))}}static async authorizeAuthorizationCode({authorizationUrl:e,tokenUrl:n,serverUrl:r,clientId:i,clientSecret:o,codeVerifier:s,codeChallenge:a,scopes:c,extraAuthParams:d={},extraTokenHeaders:p={},extraTokenBody:g={},extraTokenParams:O={},routingBasePath:v="/",redirectUri:w,withPkce:S,successCallback:C,errorCallback:T}){try{const E=EI({url:e,serverUrl:r}),$=new URL(E),_=EI({url:n,serverUrl:r}),R=new URL(_),Q=v==="/"?"":v,D=`${window.location.origin}${Q}${sse}`,q=ase({date:new Date().toString()});$.searchParams.set("client_id",i),$.searchParams.set("redirect_uri",w||D),$.searchParams.set("response_type","code"),$.searchParams.set("state",q),Array.isArray(c)&&$.searchParams.set("scope",c.join(" ")),S&&(!a&&!s&&(s=Twt(),a=await wwt(s)),a&&($.searchParams.set("code_challenge",a),$.searchParams.set("code_challenge_method","S256")));for(const Z in d)$.searchParams.set(Z,d[Z]);for(const Z in O)R.searchParams.set(Z,O[Z]);window.redirectOAuth2={flow:"authorizationCode",data:{authorizationUrl:e,clientId:i,scopes:c},state:q,successCallback:async({auth_code:Z})=>{const Y=Ym({client_id:i,client_secret:o,...s&&{code_verifier:s},code:Z,grant_type:"authorization_code",redirect_uri:w||D,...g});try{const G=await sh(R,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...p},body:new URLSearchParams(Y).toString()});await lL(G,C,T)}catch(G){T(Nm.OAuth2Error.fromError(G))}LP.clearRedirectData("authorizationCode")},errorCallback:Z=>{T(Nm.OAuth2Error.fromError(Z)),LP.clearRedirectData("authorizationCode")}},await G7($.toString())}catch(E){T(Nm.OAuth2Error.fromError(E))}}static clearRedirectData(e){window.redirectOAuth2={flow:e,data:{authorizationUrl:"",clientId:"",scopes:[]},state:"",successCallback:()=>{},errorCallback:()=>{}}}static async authorizeClientCredentials({tokenUrl:e,clientId:n,clientSecret:r,scopes:i=[],extraTokenParams:o={},extraTokenHeaders:s={},extraTokenBody:a={},corsProxyUrl:c,serverUrl:d,assertionType:p,clientAssertion:g,successCallback:O,errorCallback:v}){try{const w={client_id:n,client_secret:r,grant_type:"client_credentials",scope:Array.isArray(i)&&i.length?i.join(" "):void 0,client_assertion_type:p,client_assertion:g,...a},S=EI({url:e,serverUrl:d,corsProxyUrl:c}),C=new URL(S);for(const E in o)C.searchParams.set(E,o[E]);const T=await sh(S,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...s},body:new URLSearchParams(JJ(w)).toString()});await lL(T,O,v)}catch(w){v(Nm.OAuth2Error.fromError(w))}}static async authorizePasswordGrant({username:e,password:n,tokenUrl:r,clientId:i,clientSecret:o,scopes:s=[],extraTokenParams:a={},extraTokenHeaders:c={},extraTokenBody:d={},corsProxyUrl:p,serverUrl:g,successCallback:O,errorCallback:v}){try{const w={client_id:i,client_secret:o,grant_type:"password",username:e,password:n,scope:Array.isArray(s)&&s.length?s.join(" "):void 0,...d},S=EI({url:r,serverUrl:g,corsProxyUrl:p}),C=new URL(S);for(const E in a)C.searchParams.set(E,a[E]);const T=await sh(S,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...c},body:new URLSearchParams(JJ(w)).toString()});await lL(T,O,v)}catch(w){v(Nm.OAuth2Error.fromError(w))}}};function ase(t){const e={randomStr:bwt(),...t};return btoa(encodeURIComponent(JSON.stringify(e)))}async function lL(t,e,n){if(t.ok){const r=await t.json();if(r.error){n(Nm.OAuth2Error.fromJsonData(r));return}e(r)}else{if((t.headers.get("Content-Type")||"").indexOf("json")>-1){const o=await t.json();n(Nm.OAuth2Error.fromJsonData(o));return}n(Nm.OAuth2Error.fromTextData(await t.text()))}}async function wwt(t){return Swt(await xwt(t))}function Cwt(t){return("0"+t.toString(16)).substring(-2)}function Twt(){const t=new Uint32Array(28);return crypto.getRandomValues(t),Array.from(t,Cwt).join("")}function fN({scopes:t,environment:e}){const n=(i,o)=>{o&&t.merge([Sc()])},r=i=>{t[i].set(An)};return y.jsx(Ewt,{children:y.jsx(Pwt,{keyName:"Scopes",elements:t,onParameterChange:n,environment:e,actions:i=>y.jsx($c,{onClick:()=>r(i),variant:"text",icon:y.jsx(F.TrashCanIcon,{})}),singleValue:!0,hideOuterBorders:!0,valuePlaceholder:"New scope item"})})}const Ewt=U.div`
3394
+ `;function bwt(t=32){let e="";for(;e.length<t;)e+=Math.random().toString(32).substring(2);return e.substring(0,t)}async function xwt(t){const e=new TextEncoder().encode(t);return crypto?.subtle.digest("SHA-256",e)}function Swt(t){if(t)return btoa(String.fromCharCode.apply(null,new Uint8Array(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function G7(t,e,n){const r=typeof t=="string"?t:t.toString();if(Xs()){const{openUrl:i}=await Promise.resolve().then(()=>require("./replay-index-C0EVLo0w.js"));await i(r);return}window.open(r,e,n)}const sse="/_auth/oauth2-redirect.html";let dN=class LP{static async authorizeImplicit({authorizationUrl:e,clientId:n,scopes:r,extraAuthParams:i={},routingBasePath:o="/",redirectUri:s,successCallback:a,errorCallback:c}){const d=ase({date:new Date().toString()});try{const p=new URL(e),g=o==="/"?"":o,O=`${window.location.origin}${g}${sse}`;p.searchParams.set("client_id",n),p.searchParams.set("redirect_uri",s||O),p.searchParams.set("response_type","token"),p.searchParams.set("state",d),Array.isArray(r)&&p.searchParams.set("scope",r.join(" "));for(const v in i)p.searchParams.set(v,i[v]);window.redirectOAuth2={flow:"implicit",data:{authorizationUrl:e,clientId:n,scopes:r},state:d,successCallback:v=>{a(v),LP.clearRedirectData("implicit")},errorCallback:v=>{c(v),LP.clearRedirectData("implicit")}},await G7(p.toString())}catch(p){c(Nm.OAuth2Error.fromError(p))}}static async authorizeAuthorizationCode({authorizationUrl:e,tokenUrl:n,serverUrl:r,clientId:i,clientSecret:o,codeVerifier:s,codeChallenge:a,scopes:c,extraAuthParams:d={},extraTokenHeaders:p={},extraTokenBody:g={},extraTokenParams:O={},routingBasePath:v="/",redirectUri:w,withPkce:S,successCallback:C,errorCallback:T}){try{const E=EI({url:e,serverUrl:r}),$=new URL(E),_=EI({url:n,serverUrl:r}),R=new URL(_),Q=v==="/"?"":v,D=`${window.location.origin}${Q}${sse}`,q=ase({date:new Date().toString()});$.searchParams.set("client_id",i),$.searchParams.set("redirect_uri",w||D),$.searchParams.set("response_type","code"),$.searchParams.set("state",q),Array.isArray(c)&&$.searchParams.set("scope",c.join(" ")),S&&(!a&&!s&&(s=Twt(),a=await wwt(s)),a&&($.searchParams.set("code_challenge",a),$.searchParams.set("code_challenge_method","S256")));for(const Z in d)$.searchParams.set(Z,d[Z]);for(const Z in O)R.searchParams.set(Z,O[Z]);window.redirectOAuth2={flow:"authorizationCode",data:{authorizationUrl:e,clientId:i,scopes:c},state:q,successCallback:async({auth_code:Z})=>{const Y=Ym({client_id:i,client_secret:o,...s&&{code_verifier:s},code:Z,grant_type:"authorization_code",redirect_uri:w||D,...g});try{const G=await sh(R,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...p},body:new URLSearchParams(Y).toString()});await lL(G,C,T)}catch(G){T(Nm.OAuth2Error.fromError(G))}LP.clearRedirectData("authorizationCode")},errorCallback:Z=>{T(Nm.OAuth2Error.fromError(Z)),LP.clearRedirectData("authorizationCode")}},await G7($.toString())}catch(E){T(Nm.OAuth2Error.fromError(E))}}static clearRedirectData(e){window.redirectOAuth2={flow:e,data:{authorizationUrl:"",clientId:"",scopes:[]},state:"",successCallback:()=>{},errorCallback:()=>{}}}static async authorizeClientCredentials({tokenUrl:e,clientId:n,clientSecret:r,scopes:i=[],extraTokenParams:o={},extraTokenHeaders:s={},extraTokenBody:a={},corsProxyUrl:c,serverUrl:d,assertionType:p,clientAssertion:g,successCallback:O,errorCallback:v}){try{const w={client_id:n,client_secret:r,grant_type:"client_credentials",scope:Array.isArray(i)&&i.length?i.join(" "):void 0,client_assertion_type:p,client_assertion:g,...a},S=EI({url:e,serverUrl:d,corsProxyUrl:c}),C=new URL(S);for(const E in o)C.searchParams.set(E,o[E]);const T=await sh(S,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...s},body:new URLSearchParams(JJ(w)).toString()});await lL(T,O,v)}catch(w){v(Nm.OAuth2Error.fromError(w))}}static async authorizePasswordGrant({username:e,password:n,tokenUrl:r,clientId:i,clientSecret:o,scopes:s=[],extraTokenParams:a={},extraTokenHeaders:c={},extraTokenBody:d={},corsProxyUrl:p,serverUrl:g,successCallback:O,errorCallback:v}){try{const w={client_id:i,client_secret:o,grant_type:"password",username:e,password:n,scope:Array.isArray(s)&&s.length?s.join(" "):void 0,...d},S=EI({url:r,serverUrl:g,corsProxyUrl:p}),C=new URL(S);for(const E in a)C.searchParams.set(E,a[E]);const T=await sh(S,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...c},body:new URLSearchParams(JJ(w)).toString()});await lL(T,O,v)}catch(w){v(Nm.OAuth2Error.fromError(w))}}};function ase(t){const e={randomStr:bwt(),...t};return btoa(encodeURIComponent(JSON.stringify(e)))}async function lL(t,e,n){if(t.ok){const r=await t.json();if(r.error){n(Nm.OAuth2Error.fromJsonData(r));return}e(r)}else{if((t.headers.get("Content-Type")||"").indexOf("json")>-1){const o=await t.json();n(Nm.OAuth2Error.fromJsonData(o));return}n(Nm.OAuth2Error.fromTextData(await t.text()))}}async function wwt(t){return Swt(await xwt(t))}function Cwt(t){return("0"+t.toString(16)).substring(-2)}function Twt(){const t=new Uint32Array(28);return crypto.getRandomValues(t),Array.from(t,Cwt).join("")}function fN({scopes:t,environment:e}){const n=(i,o)=>{o&&t.merge([Sc()])},r=i=>{t[i].set(An)};return y.jsx(Ewt,{children:y.jsx(Pwt,{keyName:"Scopes",elements:t,onParameterChange:n,environment:e,actions:i=>y.jsx($c,{onClick:()=>r(i),variant:"text",icon:y.jsx(F.TrashCanIcon,{})}),singleValue:!0,hideOuterBorders:!0,valuePlaceholder:"New scope item"})})}const Ewt=U.div`
3395
3395
  width: 100%;
3396
3396
 
3397
3397
  > div {
@@ -4035,7 +4035,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
4035
4035
  @media (max-width: ${cl}px) {
4036
4036
  padding: var(--spacing-xs) var(--spacing-sm);
4037
4037
  }
4038
- `,WTt={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t},FTt=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function HTt({collectionId:t,workflowId:e}){const{project:{userFilesDir:n}}=Mn(),{certificates:r}=Ud(),i=Qr(),{getCollection:o}=eC(),s=o(t),a=n.get(),{inputs:c,servers:d}=i.get(),p=s?.sourceDescriptions.get()??[];return{execute:async O=>{const v=`${a}/${t}`,w=new qOe,S=c.map(E=>JSON.stringify({[E.name]:E.value})),C=JTt(d,p),{run:T}=await Promise.resolve().then(()=>require("./replay-index-CCdgmEj-.js"));return await T({files:[v],workflow:e?[e]:[],fetch:(E,$)=>{const _=FTt(E),{clientCert:R,clientKey:Q}=kve(_,r?r.get({noproxy:!0}):[]);return sh(_,{...$,clientCert:R,clientKey:Q})},logger:WTt,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async E=>{if(!await fM(E))throw new Error(`File ${E} doesn't exist or isn't readable.`);try{const _=await dM(E),R=new TextEncoder().encode(_);return new File([R],await AV(E))}catch(_){throw new Error(`Failed to read file ${E}: ${_}`)}}},envVariables:{},config:await Ade({}),externalRefResolver:w,input:S,server:C,severity:JSON.stringify(O),skipLint:!0,noSecretsMasking:!0})}}}function JTt(t,e){return e.map(n=>{const r=t.find(o=>o.apiId===n.apiId);if(!r)return null;let i=r.value;if(r.variables)for(const o of r.variables){const s=new RegExp(`\\{${o.name}\\}`,"g");i=i.replace(s,o.value)}return`${n.name}=${i}`}).filter(n=>n!==null)}function hN(t){return t==null?"N/A":t<1e3?`${t} ms`:t<1e4?`${(t/1e3).toFixed(1)} s`:`${Math.round(t/1e3)} s`}function E1e({checks:t}){const e=t.filter(v=>v.severity!=="off"),n=e.filter(v=>v.passed).length,r=e.filter(v=>v.severity==="warn"&&!v.passed).length,i=e.length,o=i-n-r,s=n===i,a=n===0,[c,d]=ke.default.useState(o>0||r>0),p=()=>s?"All checks passed":a?"All checks failed":`Some ${i>1?"checks were":"check was"} not successful`,g=()=>s?y.jsx(F.CheckmarkFilledIcon,{color:"var(--color-success-base)"}):o>0?y.jsx(F.ErrorFilledIcon,{color:"var(--color-error-base)"}):y.jsx(F.WarningFilledIcon,{color:"var(--color-warning-base)"}),O=v=>{v.stopPropagation(),d(!c)};return!e||e.length===0?null:y.jsxs(KTt,{children:[y.jsxs(eEt,{onClick:O,children:[y.jsxs(tEt,{children:[y.jsx(nEt,{children:y.jsx(rEt,{children:g()})}),y.jsxs(iEt,{children:[y.jsx(oEt,{children:p()}),y.jsxs(sEt,{children:[n," successful",r>0&&y.jsxs(y.Fragment,{children:[", ",r," ",r===1?"warning":"warnings"]}),o>0&&y.jsxs(y.Fragment,{children:[", ",o," failed"]})]})]})]}),y.jsx(aEt,{isExpanded:c,children:c?y.jsx(F.ChevronDownIcon,{}):y.jsx(F.ChevronRightIcon,{})})]}),y.jsx(lEt,{isExpanded:c,children:e.map((v,w)=>y.jsxs(cEt,{children:[y.jsx(uEt,{children:v.passed?y.jsx(F.CheckmarkIcon,{color:"var(--color-success-base)",size:"14px"}):!v.passed&&["warn"].includes(v.severity)?y.jsx(F.WarningFilledIcon,{color:"var(--color-warning-base)",size:"14px"}):y.jsx(F.CloseOutlineIcon,{color:"var(--color-error-base)",size:"14px"})}),y.jsxs(dEt,{children:[y.jsx(fEt,{children:v.name}),v.message&&y.jsx(pEt,{children:v.message})]})]},w))})]})}const KTt=U.div`
4038
+ `,WTt={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t},FTt=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function HTt({collectionId:t,workflowId:e}){const{project:{userFilesDir:n}}=Mn(),{certificates:r}=Ud(),i=Qr(),{getCollection:o}=eC(),s=o(t),a=n.get(),{inputs:c,servers:d}=i.get(),p=s?.sourceDescriptions.get()??[];return{execute:async O=>{const v=`${a}/${t}`,w=new qOe,S=c.map(E=>JSON.stringify({[E.name]:E.value})),C=JTt(d,p),{run:T}=await Promise.resolve().then(()=>require("./replay-index-DyjWpVsr.js"));return await T({files:[v],workflow:e?[e]:[],fetch:(E,$)=>{const _=FTt(E),{clientCert:R,clientKey:Q}=kve(_,r?r.get({noproxy:!0}):[]);return sh(_,{...$,clientCert:R,clientKey:Q})},logger:WTt,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async E=>{if(!await fM(E))throw new Error(`File ${E} doesn't exist or isn't readable.`);try{const _=await dM(E),R=new TextEncoder().encode(_);return new File([R],await AV(E))}catch(_){throw new Error(`Failed to read file ${E}: ${_}`)}}},envVariables:{},config:await Ade({}),externalRefResolver:w,input:S,server:C,severity:JSON.stringify(O),skipLint:!0,noSecretsMasking:!0})}}}function JTt(t,e){return e.map(n=>{const r=t.find(o=>o.apiId===n.apiId);if(!r)return null;let i=r.value;if(r.variables)for(const o of r.variables){const s=new RegExp(`\\{${o.name}\\}`,"g");i=i.replace(s,o.value)}return`${n.name}=${i}`}).filter(n=>n!==null)}function hN(t){return t==null?"N/A":t<1e3?`${t} ms`:t<1e4?`${(t/1e3).toFixed(1)} s`:`${Math.round(t/1e3)} s`}function E1e({checks:t}){const e=t.filter(v=>v.severity!=="off"),n=e.filter(v=>v.passed).length,r=e.filter(v=>v.severity==="warn"&&!v.passed).length,i=e.length,o=i-n-r,s=n===i,a=n===0,[c,d]=ke.default.useState(o>0||r>0),p=()=>s?"All checks passed":a?"All checks failed":`Some ${i>1?"checks were":"check was"} not successful`,g=()=>s?y.jsx(F.CheckmarkFilledIcon,{color:"var(--color-success-base)"}):o>0?y.jsx(F.ErrorFilledIcon,{color:"var(--color-error-base)"}):y.jsx(F.WarningFilledIcon,{color:"var(--color-warning-base)"}),O=v=>{v.stopPropagation(),d(!c)};return!e||e.length===0?null:y.jsxs(KTt,{children:[y.jsxs(eEt,{onClick:O,children:[y.jsxs(tEt,{children:[y.jsx(nEt,{children:y.jsx(rEt,{children:g()})}),y.jsxs(iEt,{children:[y.jsx(oEt,{children:p()}),y.jsxs(sEt,{children:[n," successful",r>0&&y.jsxs(y.Fragment,{children:[", ",r," ",r===1?"warning":"warnings"]}),o>0&&y.jsxs(y.Fragment,{children:[", ",o," failed"]})]})]})]}),y.jsx(aEt,{isExpanded:c,children:c?y.jsx(F.ChevronDownIcon,{}):y.jsx(F.ChevronRightIcon,{})})]}),y.jsx(lEt,{isExpanded:c,children:e.map((v,w)=>y.jsxs(cEt,{children:[y.jsx(uEt,{children:v.passed?y.jsx(F.CheckmarkIcon,{color:"var(--color-success-base)",size:"14px"}):!v.passed&&["warn"].includes(v.severity)?y.jsx(F.WarningFilledIcon,{color:"var(--color-warning-base)",size:"14px"}):y.jsx(F.CloseOutlineIcon,{color:"var(--color-error-base)",size:"14px"})}),y.jsxs(dEt,{children:[y.jsx(fEt,{children:v.name}),v.message&&y.jsx(pEt,{children:v.message})]})]},w))})]})}const KTt=U.div`
4039
4039
  margin-bottom: 0;
4040
4040
  margin-top: var(--spacing-xxs);
4041
4041
  `,eEt=U.div`
@@ -5920,7 +5920,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
5920
5920
  `,j2t=U.div`
5921
5921
  display: flex;
5922
5922
  gap: var(--spacing-xs);
5923
- `;async function mSe(t,e,n){try{const{join:r,dirname:i}=await Promise.resolve().then(()=>rhe),{exists:o}=await Promise.resolve().then(()=>EV),{revealItemInDir:s,openPath:a}=await Promise.resolve().then(()=>require("./replay-index-CK_CAbBV.js")),c=await r(t,e);if(n||!await o(c)){const d=await i(c);await a(d);return}await s(c)}catch(r){throw console.error("Failed to reveal item in folder:",r),r}}function Q2t({node:t}){const e=t.data.type==="api"&&t.data.api.srcType.get()===Zl.WEB,{project:n}=Mn(),r=M.useMemo(()=>Xs(),[]),{sendEvent:i}=an();if(e)return null;const o=()=>{t.tree.delete(t.id)},s=async a=>{a.stopPropagation();try{if(t.data.type==="api"){const c=t.data.api.id.get({noproxy:!0}),d=n.userFilesDir.get({noproxy:!0});await mSe(d,c),i("node.management",[{action:"reveal_in_folder",node_type:"api"}])}}catch(c){console.error("Failed to reveal API in folder:",c)}};return y.jsx(D2t,{children:y.jsx(Yi,{content:"More actions",placement:"topRight",children:y.jsx(F.Dropdown,{trigger:y.jsx(F.Button,{variant:"text",size:"small",icon:y.jsx(F.OverflowMenuVerticalIcon,{})}),alignment:"end",children:y.jsxs(F.DropdownMenu,{children:[r&&y.jsxs(Rs,{onClick:s,children:[y.jsx(F.FolderIcon,{size:"14px"}),"Reveal in folder"]}),y.jsxs(Rs,{onClick:o,children:[y.jsx(F.TrashCanIcon,{size:"14px"}),"Delete"]})]})})})})}const D2t=U.div`
5923
+ `;async function mSe(t,e,n){try{const{join:r,dirname:i}=await Promise.resolve().then(()=>rhe),{exists:o}=await Promise.resolve().then(()=>EV),{revealItemInDir:s,openPath:a}=await Promise.resolve().then(()=>require("./replay-index-C0EVLo0w.js")),c=await r(t,e);if(n||!await o(c)){const d=await i(c);await a(d);return}await s(c)}catch(r){throw console.error("Failed to reveal item in folder:",r),r}}function Q2t({node:t}){const e=t.data.type==="api"&&t.data.api.srcType.get()===Zl.WEB,{project:n}=Mn(),r=M.useMemo(()=>Xs(),[]),{sendEvent:i}=an();if(e)return null;const o=()=>{t.tree.delete(t.id)},s=async a=>{a.stopPropagation();try{if(t.data.type==="api"){const c=t.data.api.id.get({noproxy:!0}),d=n.userFilesDir.get({noproxy:!0});await mSe(d,c),i("node.management",[{action:"reveal_in_folder",node_type:"api"}])}}catch(c){console.error("Failed to reveal API in folder:",c)}};return y.jsx(D2t,{children:y.jsx(Yi,{content:"More actions",placement:"topRight",children:y.jsx(F.Dropdown,{trigger:y.jsx(F.Button,{variant:"text",size:"small",icon:y.jsx(F.OverflowMenuVerticalIcon,{})}),alignment:"end",children:y.jsxs(F.DropdownMenu,{children:[r&&y.jsxs(Rs,{onClick:s,children:[y.jsx(F.FolderIcon,{size:"14px"}),"Reveal in folder"]}),y.jsxs(Rs,{onClick:o,children:[y.jsx(F.TrashCanIcon,{size:"14px"}),"Delete"]})]})})})})}const D2t=U.div`
5924
5924
  display: flex;
5925
5925
  gap: var(--spacing-xxs);
5926
5926
  `;function M2t({onImport:t}){return y.jsxs(N2t,{children:[y.jsx(z2t,{children:"No OpenAPI files were imported yet"}),y.jsx(q2t,{children:y.jsx(F.Button,{icon:y.jsx(F.DownloadIcon,{}),onClick:t,children:"Import OpenAPI file"})})]})}const N2t=U.div`