@redocly/replay 0.18.0-next.12 → 0.18.0-next.13

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.
@@ -219,7 +219,7 @@ ${n.message}`})}}}}),MH=({filePath:u})=>({Info:{leave(e,{report:a,location:t,con
219
219
  ${n.message}`,location:t.child("description")})}}}}),TH=u=>({Info:{leave(e){if(typeof u!="object"||Array.isArray(u)||u===null)throw new Error('"info-override" decorator should be called with an object');const{severity:a,...t}=u;Object.assign(e,t)}}});function $H(u){return Array.isArray(u)&&u.length===0}const Rhe="x-internal",RH=({internalFlagProperty:u=Rhe})=>{function e(t,r,n){const{parent:i,key:o}=r;let s=!1;if(Array.isArray(t))for(let l=0;l<t.length;l++){if(Ra(t[l])&&r.resolve(t[l]).node?.[u]){if(Du(i.discriminator?.mapping))for(const d in i.discriminator.mapping)n?.[d]===t[l].$ref&&delete i.discriminator.mapping[d];t.splice(l,1),s=!0,l--}t[l]?.[u]&&(t.splice(l,1),s=!0,l--)}else if(Du(t))for(const l of Object.keys(t)){if(Ra(t[l])){const c=r.resolve(t[l]);Du(c.node)&&c.node?.[u]&&(delete t[l],s=!0)}Du(t[l])&&t[l]?.[u]&&(delete t[l],s=!0)}s&&(zd(t)||$H(t))&&delete i[o]}let a={};return{DiscriminatorMapping:{enter:t=>{a=JSON.parse(JSON.stringify(t))}},any:{enter:(t,r)=>{e(t,r,a)}}}};function NH(u,e,a){const{parent:t,key:r}=e;let n=!1;if(Array.isArray(u))for(let i=0;i<u.length;i++){if(Ra(u[i])){const o=e.resolve(u[i]);a(o.node)&&(u.splice(i,1),n=!0,i--)}a(u[i])&&(u.splice(i,1),n=!0,i--)}else if(Du(u))for(const i of Object.keys(u)){if(u=u,Ra(u[i])){const o=e.resolve(u[i]);a(o.node)&&(delete u[i],n=!0)}a(u[i])&&(delete u[i],n=!0)}n&&(zd(u)||$H(u))&&delete t[r]}function _H(u,e,a){return u===void 0||e===void 0?!1:!Array.isArray(e)&&!Array.isArray(u)?u===e:(e=Mz(e),u=Mz(u),a==="any"?e.some(t=>u.includes(t)):a==="all"?e.every(t=>u.includes(t)):!1)}function Mz(u){return Array.isArray(u)?u:[u]}const Nhe="any",LH=({property:u,value:e,matchStrategy:a})=>{const t=a||Nhe,r=n=>n?.[u]&&!_H(n?.[u],e,t);return{any:{enter:(n,i)=>{NH(n,i,r)}}}},_he="any",IH=({property:u,value:e,matchStrategy:a})=>{const t=a||_he,r=n=>_H(n?.[u],e,t);return{any:{enter:(n,i)=>{NH(n,i,r)}}}},Lhe=({operationIds:u})=>({Operation:{enter(e,a){const t=e.operationId;if(!t)return;const r=u[t];if(r){if(r.responses&&e.responses)for(const n of Object.keys(r.responses)){const i=Tz(e.responses[n],a.resolve);i&&(i.content=i.content?i.content:{},Object.keys(r.responses[n]).forEach(o=>{const s=r.responses[n][o];i.content[o]={...i.content[o],examples:jz($d(s,a.config?.configPath))}}),e.responses[n]=i)}if(r.request&&e.requestBody){const n=Tz(e.requestBody,a.resolve);if(!n)return;n.content=n.content?n.content:{},Object.keys(r.request).forEach(i=>{const o=r.request[i];n.content[i]={...n.content[i],examples:jz($d(o,a.config?.configPath))}}),e.requestBody=n}}}}});function Tz(u,e){if(!Ra(u))return u;const a=e(u);return a.error?void 0:JSON.parse(JSON.stringify(a.node))}const KH=()=>{const u=new Map;function e(t,r,n){u.set(t.absolutePointer,{usedIn:u.get(t.absolutePointer)?.usedIn??[],componentType:r,name:n})}function a(t,r){const n=r.length;for(const[i,{usedIn:o,name:s,componentType:l}]of u)if(!o.some(d=>!r.some(E=>d.absolutePointer.startsWith(E)&&(d.absolutePointer.length===E.length||d.absolutePointer[E.length]==="/")))&&l&&t.components){r.push(i);const d=t.components[l];delete d[s],u.delete(i),zd(d)&&delete t.components[l]}return r.length>n?a(t,r):r.length}return{ref:{leave(t,{location:r,type:n,resolve:i,key:o}){if(["Schema","Header","Parameter","Response","Example","RequestBody"].includes(n.name)){const s=i(t);if(!s.location)return;const[l,c]=s.location.absolutePointer.split("#",2);if(!c)return;const d=c.split("/").slice(0,4).join("/"),E=`${l}#${d}`,p=u.get(E);p?p.usedIn.push(r):u.set(E,{usedIn:[r],name:o.toString()})}}},Root:{leave(t,r){const n=r.getVisitorData();n.removedCount=a(t,[]),zd(t.components)&&delete t.components}},NamedSchemas:{Schema(t,{location:r,key:n}){t.allOf||e(r,"schemas",n.toString())}},NamedParameters:{Parameter(t,{location:r,key:n}){e(r,"parameters",n.toString())}},NamedResponses:{Response(t,{location:r,key:n}){e(r,"responses",n.toString())}},NamedExamples:{Example(t,{location:r,key:n}){e(r,"examples",n.toString())}},NamedRequestBodies:{RequestBody(t,{location:r,key:n}){e(r,"requestBodies",n.toString())}},NamedHeaders:{Header(t,{location:r,key:n}){e(r,"headers",n.toString())}}}},Ihe={"operation-description-override":PH,"tag-description-override":jH,"info-description-override":MH,"info-override":TH,"remove-x-internal":RH,"remove-unused-components":KH,"filter-in":LH,"filter-out":IH,"media-type-examples-override":Lhe},VH=()=>{const u=new Map;function e(t,r,n){u.set(t.absolutePointer,{usedIn:u.get(t.absolutePointer)?.usedIn??[],componentType:r,name:n})}function a(t,r){const n=r.length;for(const[i,{usedIn:o,name:s,componentType:l}]of u)!o.some(d=>!r.some(E=>d.absolutePointer.startsWith(E)&&(d.absolutePointer.length===E.length||d.absolutePointer[E.length]==="/")))&&l&&(r.push(i),delete t[l][s],u.delete(i),zd(t[l])&&delete t[l]);return r.length>n?a(t,r):r.length}return{ref:{leave(t,{location:r,type:n,resolve:i,key:o}){if(["Schema","Parameter","Response","SecurityScheme"].includes(n.name)){const s=i(t);if(!s.location)return;const[l,c]=s.location.absolutePointer.split("#",2);if(!c)return;const d=c.split("/").slice(0,3).join("/"),E=`${l}#${d}`,p=u.get(E);p?p.usedIn.push(r):u.set(E,{usedIn:[r],name:o.toString()})}}},Root:{leave(t,r){const n=r.getVisitorData();n.removedCount=a(t,[])}},NamedSchemas:{Schema(t,{location:r,key:n}){t.allOf||e(r,"definitions",n.toString())}},NamedParameters:{Parameter(t,{location:r,key:n}){e(r,"parameters",n.toString())}},NamedResponses:{Response(t,{location:r,key:n}){e(r,"responses",n.toString())}},NamedSecuritySchemes:{SecurityScheme(t,{location:r,key:n}){e(r,"securityDefinitions",n.toString())}}}},Khe={"operation-description-override":PH,"tag-description-override":jH,"info-description-override":MH,"info-override":TH,"remove-x-internal":RH,"remove-unused-components":VH,"filter-in":LH,"filter-out":IH},Vhe={},Ghe={},Hhe={},qhe={},Whe={recommended:V3e,"recommended-strict":G3e,minimal:q3e,all:H3e,spec:W3e},$z={id:"",rules:{oas3:Xme,oas2:nhe,async2:lhe,async3:phe,arazzo1:jhe,overlay1:The},preprocessors:{oas3:ehe,oas2:ihe,async2:che,async3:mhe,arazzo1:Mhe,overlay1:$he},decorators:{oas3:Ihe,oas2:Khe,async2:Vhe,async3:Ghe,arazzo1:Hhe,overlay1:qhe},configs:Whe};function Jhe(u){return!z0(u)}function Uhe(){return new Promise(u=>{setTimeout(u)})}function ld(u,e){return u+"::"+e}class V1{constructor(e,a,t){this.absoluteRef=e,this.body=a,this.mimeType=t}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 T2 extends Error{constructor(e){super(e.message),this.originalError=e,Object.setPrototypeOf(this,T2.prototype)}}function Zhe(u,e){const a=new V1(e,u);try{return{source:a,parsed:B2(u,{filename:e})}}catch(t){throw new vc(t,a)}}class If{constructor(e={http:{headers:[]}}){this.config=e,this.cache=new Map}getFiles(){return new Set(Array.from(this.cache.keys()))}resolveExternalRef(e,a){return Ja(a)?a:e&&Ja(e)?new URL(a,e).href:$u.resolve(e?$u.dirname(e):process.cwd(),a)}async loadExternalRef(e){try{if(Ja(e)){const{body:a,mimeType:t}=await QI(e,this.config.http);return new V1(e,a,t)}else{if((void 0)(e).isDirectory())throw new Error(`Expected a file but received a folder at ${e}.`);const a=await(void 0).readFile(e,"utf-8");return new V1(e,a.replace(/\r\n/g,`
220
220
  `))}}catch(a){throw a.message=a.message.replace(", lstat",""),new T2(a)}}parseDocument(e,a=!1){const t=e.absoluteRef.substr(e.absoluteRef.lastIndexOf("."));if(![".json",".json",".yml",".yaml"].includes(t)&&!e.mimeType?.match(/(json|yaml|openapi)/)&&!a)return{source:e,parsed:e.body};try{return{source:e,parsed:B2(e.body,{filename:e.absoluteRef})}}catch(r){throw new vc(r,e)}}async resolveDocument(e,a,t=!1){const r=this.resolveExternalRef(e,a),n=this.cache.get(r);if(n)return n;const i=this.loadExternalRef(r).then(o=>this.parseDocument(o,t));return this.cache.set(r,i),i}}function Rz(u,e){return{prev:u,node:e}}function Qhe(u,e){for(;u;){if(u.node===e)return!0;u=u.prev}return!1}const o4={name:"unknown",properties:{}},Yhe={name:"scalar",properties:{}};async function Rd(u){const{rootDocument:e,externalRefResolver:a,rootType:t}=u,r=new Map,n=new Set,i=[];s(e.parsed,e,"#/",t);let o;do o=await Promise.all(i);while(i.length!==o.length);return r;function s(l,c,d,E){const p=c.source.absoluteRef,x=new Map;m(l,E,p+d);function m(h,f,k){if(typeof h!="object"||h===null)return;const y=`${f.name}::${k}`;if(n.has(y))return;n.add(y);const[v,b]=Object.entries(h).find(([C])=>C==="$anchor")||[];if(b&&x.set(`#${b}`,h),Array.isArray(h)){const C=f.items;if(C===void 0&&f!==o4&&f!==ws)return;const B=typeof C=="function";for(let z=0;z<h.length;z++){let P=B?C(h[z],u1(k,z)):C;if(P===void 0&&f!==o4&&f!==ws)continue;const L=P?.directResolveAs?{$ref:h[z]}:h[z];P=P?.directResolveAs||P,m(L,Os(P)?P:o4,u1(k,z))}return}for(const C of Object.keys(h)){let B=h[C],z=Fo(f.properties,C);z===void 0&&(z=f.additionalProperties),typeof z=="function"&&(z=z(B,C)),z===void 0&&(z=o4),f.extensionsPrefix&&C.startsWith(f.extensionsPrefix)&&z===o4&&(z=ws),!Os(z)&&z?.directResolveAs&&(z=z.directResolveAs,B={$ref:B}),z&&z.name===void 0&&z.resolvable!==!1&&(z=Yhe),!(!Os(z)||typeof B!="object")&&m(B,z,u1(k,od(C)))}if(Ra(h)){const C=g(c,h,{prev:null,node:h}).then(B=>{B.resolved&&s(B.node,B.document,B.nodePointer,f)});i.push(C)}if(YI(h)){const C=g(c,{$ref:h.externalValue},{prev:null,node:h}).then(B=>{B.resolved&&s(B.node,B.document,B.nodePointer,f)});i.push(C)}}async function g(h,f,k){if(Qhe(k.prev,f))throw new Error("Self-referencing circular pointer");if(Une(f.$ref)){await Uhe();const I={resolved:!0,isRemote:!1,node:x.get(f.$ref),document:h,nodePointer:f.$ref},G=ld(h.source.absoluteRef,f.$ref);return r.set(G,I),I}const{uri:y,pointer:v}=qne(f.$ref),b=y!==null&&a.resolveExternalRef(h.source.absoluteRef,y)!==h.source.absoluteRef;let C;try{C=b?await a.resolveDocument(h.source.absoluteRef,y):h}catch(I){const G={resolved:!1,isRemote:b,document:void 0,error:I},X=ld(h.source.absoluteRef,f.$ref);return r.set(X,G),G}let B={resolved:!0,document:C,isRemote:b,node:h.parsed,nodePointer:"#/"},z=C.parsed;const P=v;for(const I of P)if(typeof z!="object"){z=void 0;break}else if(z[I]!==void 0)z=z[I],B.nodePointer=u1(B.nodePointer,od(I));else if(Ra(z)){if(B=await g(C,z,Rz(k,z)),C=B.document||C,typeof B.node!="object"){z=void 0;break}z=B.node[I],B.nodePointer=u1(B.nodePointer,od(I))}else{z=void 0;break}B.node=z,B.document=C;const L=ld(h.source.absoluteRef,f.$ref);return B.document&&Ra(z)&&(B=await g(B.document,z,Rz(k,z))),r.set(L,B),{...B}}}}const ta=(u,e)=>{if(e)for(const a of Object.keys(e))Du(u[a])&&typeof e[a]=="string"?u[a]={...u[a],severity:e[a]}:u[a]=e[a]};function ga(u,e){if(e)for(const a of Object.keys(e))u.hasOwnProperty(a)&&(Du(u[a])&&typeof e[a]=="string"?u[a]={...u[a],severity:e[a]}:u[a]=e[a])}function Xhe(u){if(u.indexOf("/")>-1){const[e,a]=u.split("/");return{pluginId:e,configName:a}}else return{pluginId:"",configName:u}}function Ya(u,e){if(!e)return u;const a={};for(const t of Object.keys(u))a[`${e}/${t}`]=u[t];return a}function GH(u){const e={rules:{},oas2Rules:{},oas3_0Rules:{},oas3_1Rules:{},oas3_2Rules:{},async2Rules:{},async3Rules:{},arazzo1Rules:{},overlay1Rules:{},preprocessors:{},oas2Preprocessors:{},oas3_0Preprocessors:{},oas3_1Preprocessors:{},oas3_2Preprocessors:{},async2Preprocessors:{},async3Preprocessors:{},arazzo1Preprocessors:{},overlay1Preprocessors:{},decorators:{},oas2Decorators:{},oas3_0Decorators:{},oas3_1Decorators:{},oas3_2Decorators:{},async2Decorators:{},async3Decorators:{},arazzo1Decorators:{},overlay1Decorators:{}};for(const a of u){if(Du(a)&&"extends"in a&&a.extends!==void 0)throw new Error(`'extends' is not supported in shared configs yet:
221
221
  ${JSON.stringify(a,null,2)}`);ta(e.rules,a.rules),ta(e.oas2Rules,a.oas2Rules),ga(e.oas2Rules,a.rules),ta(e.oas3_0Rules,a.oas3_0Rules),ga(e.oas3_0Rules,a.rules),ta(e.oas3_1Rules,a.oas3_1Rules),ga(e.oas3_1Rules,a.rules),ta(e.oas3_2Rules,a.oas3_2Rules),ga(e.oas3_2Rules,a.rules),ta(e.async2Rules,a.async2Rules),ga(e.async2Rules,a.rules),ta(e.async3Rules,a.async3Rules),ga(e.async3Rules,a.rules),ta(e.arazzo1Rules,a.arazzo1Rules),ga(e.arazzo1Rules,a.rules),ta(e.overlay1Rules,a.overlay1Rules),ga(e.overlay1Rules,a.rules),ta(e.preprocessors,a.preprocessors),ta(e.oas2Preprocessors,a.oas2Preprocessors),ga(e.oas2Preprocessors,a.preprocessors),ta(e.oas3_0Preprocessors,a.oas3_0Preprocessors),ga(e.oas3_0Preprocessors,a.preprocessors),ta(e.oas3_1Preprocessors,a.oas3_1Preprocessors),ga(e.oas3_1Preprocessors,a.preprocessors),ta(e.oas3_2Preprocessors,a.oas3_2Preprocessors),ga(e.oas3_2Preprocessors,a.preprocessors),ta(e.async2Preprocessors,a.async2Preprocessors),ga(e.async2Preprocessors,a.preprocessors),ta(e.async3Preprocessors,a.async3Preprocessors),ga(e.async3Preprocessors,a.preprocessors),ta(e.arazzo1Preprocessors,a.arazzo1Preprocessors),ga(e.arazzo1Preprocessors,a.preprocessors),ta(e.overlay1Preprocessors,a.overlay1Preprocessors),ga(e.overlay1Preprocessors,a.preprocessors),ta(e.decorators,a.decorators),ta(e.oas2Decorators,a.oas2Decorators),ga(e.oas2Decorators,a.decorators),ta(e.oas3_0Decorators,a.oas3_0Decorators),ga(e.oas3_0Decorators,a.decorators),ta(e.oas3_1Decorators,a.oas3_1Decorators),ga(e.oas3_1Decorators,a.decorators),ta(e.oas3_2Decorators,a.oas3_2Decorators),ga(e.oas3_2Decorators,a.decorators),ta(e.async2Decorators,a.async2Decorators),ga(e.async2Decorators,a.decorators),ta(e.async3Decorators,a.async3Decorators),ga(e.async3Decorators,a.decorators),ta(e.arazzo1Decorators,a.arazzo1Decorators),ga(e.arazzo1Decorators,a.decorators),ta(e.overlay1Decorators,a.overlay1Decorators),ga(e.overlay1Decorators,a.decorators)}return e}function exe(u){return new Map(JSON.parse(JSON.stringify([...u])))}function Nz(u){return u!==void 0&&typeof u=="object"&&"id"in u}function uxe(u){return typeof u=="function"}function _z(u,e){return{prev:u,value:e}}function Lz(u){return u?.prev??null}function axe(u){const e={};for(;u.parent;)e[u.parent.type.name]=u.parent.activatedOn?.value.node,u=u.parent;return e}function txe(u){const e={};for(;u.parent;)u.parent.activatedOn?.value.location&&(e[u.parent.type.name]=u.parent.activatedOn?.value.location),u=u.parent;return e}function G1(u){const{document:e,rootType:a,normalizedVisitors:t,resolvedRefMap:r,ctx:n}=u,i={},o=new Set;s(e.parsed,a,new cx(e.source,"#/"),void 0,"");function s(l,c,d,E,p){const x=(B,z=g.source.absoluteRef)=>{if(!Ra(B))return{location:d,node:B};const P=ld(z,B.$ref),L=r.get(P);if(!L)return{location:void 0,node:void 0};const{resolved:I,node:G,document:X,nodePointer:U,error:ae}=L;return{location:I?new cx(X.source,U):ae instanceof vc?new cx(ae.source,""):void 0,node:G,error:ae}},m=d;let g=d;const{node:h,location:f,error:k}=x(l),y=new Set;if(Ra(l)){const B=t.ref.enter;for(const{visit:z,ruleId:P,severity:L,message:I,context:G}of B){y.add(G);const X=b.bind(void 0,P,L,I);z(l,{report:X,resolve:x,rawNode:l,rawLocation:m,location:d,type:c,parent:E,key:p,parentLocations:{},specVersion:n.specVersion,config:n.config,getVisitorData:C.bind(void 0,P)},{node:h,location:f,error:k}),f?.source.absoluteRef&&n.refTypes&&n.refTypes.set(f?.source.absoluteRef,c)}}if(h!==void 0&&f&&c.name!=="scalar"){g=f;const B=i[c.name]?.has?.(h);let z=!1;const L=t.any.enter.concat(t[c.name]?.enter||[]),I=[];for(const{context:U,visit:ae,skip:Ee,ruleId:re,severity:he,message:j}of L){if(o.has(`${g.absolutePointer}${g.pointer}`))break;if(U.isSkippedLevel)U.parent.activatedOn&&!U.parent.activatedOn.value.nextLevelTypeActivated&&!U.seen.has(l)&&(U.seen.add(l),z=!0,I.push(U));else if(U.parent&&U.parent.activatedOn&&U.activatedOn?.value.withParentNode!==U.parent.activatedOn.value.node&&U.parent.activatedOn.value.nextLevelTypeActivated?.value!==c||!U.parent&&!B){I.push(U);const T={node:h,location:f,nextLevelTypeActivated:null,withParentNode:U.parent?.activatedOn?.value.node,skipped:(U.parent?.activatedOn?.value.skipped||Ee?.(h,p,{location:d,rawLocation:m,resolve:x,rawNode:l}))??!1};U.activatedOn=_z(U.activatedOn,T);let V=U.parent;for(;V;)V.activatedOn.value.nextLevelTypeActivated=_z(V.activatedOn.value.nextLevelTypeActivated,c),V=V.parent;T.skipped||(z=!0,y.add(U),v(ae,h,l,U,re,he,j))}}if(z||!B){if(i[c.name]=i[c.name]||new Set,i[c.name].add(h),Array.isArray(h)){const U=c.items;if(U!==void 0){const ae=typeof U=="function";for(let Ee=0;Ee<h.length;Ee++){let re=ae?U(h[Ee],f.child([Ee]).absolutePointer):U,he=h[Ee];re?.directResolveAs&&(re=re.directResolveAs,he={$ref:he}),Os(re)&&s(he,re,f.child([Ee]),h,Ee)}}}else if(typeof h=="object"&&h!==null){const U=Object.keys(c.properties);c.additionalProperties?U.push(...Object.keys(h).filter(ae=>!U.includes(ae))):c.extensionsPrefix&&U.push(...Object.keys(h).filter(ae=>ae.startsWith(c.extensionsPrefix))),Ra(l)&&U.push(...Object.keys(l).filter(ae=>ae!=="$ref"&&!U.includes(ae)));for(const ae of U){let Ee=h[ae],re=f;Ee===void 0&&(Ee=l[ae],re=d);let he=Fo(c.properties,ae);if(he===void 0&&(he=c.additionalProperties),typeof he=="function"&&(he=he(Ee,ae)),he===void 0&&c.extensionsPrefix&&ae.startsWith(c.extensionsPrefix)&&(he=ws),!Os(he)&&he?.directResolveAs&&(he=he.directResolveAs,Ee={$ref:Ee}),he&&he.name===void 0&&he.resolvable!==!1&&(he={name:"scalar",properties:{}}),Ra(l[ae])&&he?.name==="scalar"){s(l[ae],he,d.child([ae]),l,ae);continue}!Os(he)||he.name==="scalar"&&!Ra(Ee)||s(Ee,he,re.child([ae]),h,ae)}}}const G=t.any.leave,X=(t[c.name]?.leave||[]).concat(G);for(const U of I.reverse())if(U.isSkippedLevel)U.seen.delete(h);else if(U.activatedOn=Lz(U.activatedOn),U.parent){let ae=U.parent;for(;ae;)ae.activatedOn.value.nextLevelTypeActivated=Lz(ae.activatedOn.value.nextLevelTypeActivated),ae=ae.parent}for(const{context:U,visit:ae,ruleId:Ee,severity:re,message:he}of X)!U.isSkippedLevel&&y.has(U)&&v(ae,h,l,U,Ee,re,he)}if(g=d,Ra(l)){const B=t.ref.leave;for(const{visit:z,ruleId:P,severity:L,context:I,message:G}of B)if(y.has(I)){const X=b.bind(void 0,P,L,G);z(l,{report:X,resolve:x,rawNode:l,rawLocation:m,location:d,type:c,parent:E,key:p,parentLocations:{},specVersion:n.specVersion,config:n.config,getVisitorData:C.bind(void 0,P)},{node:h,location:f,error:k})}}function v(B,z,P,L,I,G,X){const U=b.bind(void 0,I,G,X);B(z,{report:U,resolve:x,rawNode:P,location:g,rawLocation:m,type:c,parent:E,key:p,parentLocations:txe(L),specVersion:n.specVersion,config:n.config,ignoreNextVisitorsOnNode:()=>{o.add(`${g.absolutePointer}${g.pointer}`)},getVisitorData:C.bind(void 0,I)},axe(L),L)}function b(B,z,P,L){const G=(L.location?Array.isArray(L.location)?L.location:[L.location]:[{...g,reportOnKey:!1}]).map(U=>({...g,reportOnKey:!1,...U})),X=L.forceSeverity||z;X!=="off"&&n.problems.push({ruleId:L.ruleId||B,severity:X,...L,message:P?P.replace("{{message}}",L.message):L.message,suggest:L.suggest||[],location:G})}function C(B){return n.visitorsData[B]=n.visitorsData[B]||{},n.visitorsData[B]}}}const rxe={Root:"DefinitionRoot",ServerVariablesMap:"ServerVariableMap",Paths:["PathMap","PathsMap"],CallbacksMap:"CallbackMap",MediaTypesMap:"MediaTypeMap",ExamplesMap:"ExampleMap",EncodingMap:"EncodingsMap",HeadersMap:"HeaderMap",LinksMap:"LinkMap",OAuth2Flows:"SecuritySchemeFlows",Responses:"ResponsesMap"};function H1(u,e){const a={};a.any={enter:[],leave:[]};for(const i of Object.keys(e))a[i]={enter:[],leave:[]};a.ref={enter:[],leave:[]};for(const{ruleId:i,severity:o,message:s,visitor:l}of u)n({ruleId:i,severity:o,message:s},l,null);for(const i of Object.keys(a))a[i].enter.sort((o,s)=>s.depth-o.depth),a[i].leave.sort((o,s)=>o.depth-s.depth);return a;function t(i,o,s,l,c=[]){if(c.includes(o))return;c=[...c,o];const d=new Set;for(const p of Object.values(o.properties)){if(p===s){E(i,c);continue}typeof p=="object"&&p!==null&&p.name&&d.add(p)}o.additionalProperties&&typeof o.additionalProperties!="function"&&(o.additionalProperties===s?E(i,c):o.additionalProperties.name!==void 0&&d.add(o.additionalProperties)),o.items&&typeof o.items!="function"&&(o.items===s?E(i,c):o.items.name!==void 0&&d.add(o.items)),o.extensionsPrefix&&d.add(ws);for(const p of Array.from(d.values()))t(i,p,s,l,c);function E(p,x){for(const m of x.slice(1))a[m.name]=a[m.name]||{enter:[],leave:[]},a[m.name].enter.push({...p,visit:()=>{},depth:0,context:{isSkippedLevel:!0,seen:new Set,parent:l}})}}function r(i,o){if(Array.isArray(o)){const s=o.find(l=>i[l])||void 0;return s&&i[s]}return i[o]}function n(i,o,s,l=0){const c=Object.keys(e);if(l===0)c.push("any"),c.push("ref");else{if(o.any)throw new Error("any() is allowed only on top level");if(o.ref)throw new Error("ref() is allowed only on top level")}for(const d of c){const E=o[d]||r(o,rxe[d]),p=a[d];if(!E)continue;let x,m,g;const h=Du(E);if(d==="ref"&&h&&E.skip)throw new Error("ref() visitor does not support skip");typeof E=="function"?x=E:h&&(x=E.enter,m=E.leave,g=E.skip);const f=(x?1:0)+(m?1:0)+(g?1:0),k=h&&Object.keys(E).length>f,y={activatedOn:null,type:e[d],parent:s,isSkippedLevel:!1};if(k&&n(i,E,y,l+1),s&&t(i,s.type,e[d],s),x||h){if(x&&typeof x!="function")throw new Error("DEV: should be function");p.enter.push({...i,visit:x||(()=>{}),skip:g,depth:l,context:y})}if(m){if(typeof m!="function")throw new Error("DEV: should be function");p.leave.push({...i,visit:m,depth:l,context:y})}}}}function HH({node:u,ctx:e,plugins:a}){if(!u.extends)return u;const t=(u.extends||[]).map(r=>{if(!Ja(r)&&!Ns.extname(r))return hxe(r,a);const n=e.resolve({$ref:r});return n.location&&n.node!==void 0?n.node:null}).filter(H0);return GH([...t.map(r=>HH({node:r,ctx:e,plugins:a})),{...u,extends:void 0}])}function Qp(u,e){if(Du(u)&&Array.isArray(u.plugins)){const{plugins:a,rootConfigDir:t}=e.getVisitorData();a.push(...u.plugins.map(r=>qH(r,e.location.source.absoluteRef.replace(/^file:\/\//,""),t)))}}const nxe=H1([{severity:"error",ruleId:WG,visitor:{ref:{},ConfigGovernance:{leave(u,e){Qp(u,e)}},ConfigApisProperties:{leave(u,e){Qp(u,e)}},"rootRedoclyConfigSchema.scorecard.levels_items":{leave(u,e){Qp(u,e)}},ConfigRoot:{leave(u,e){Qp(u,e)}}}}],FE);function Yp(u,e){if(Du(u)&&u.extends){const{plugins:a}=e.getVisitorData(),t=HH({node:u,ctx:e,plugins:a});Object.assign(u,t),delete u.extends}}const ixe=H1([{severity:"error",ruleId:qG,visitor:{ref:{leave(u,e,a){Zb(u,a,e)}},ConfigGovernance:{leave(u,e){Yp(u,e)}},ConfigApisProperties:{leave(u,e){Yp(u,e)}},"rootRedoclyConfigSchema.scorecard.levels_items":{leave(u,e){Yp(u,e)}},ConfigRoot:{leave(u,e){Yp(u,e)}}}}],FE);function Iz(u,e){switch(e){case"oas3":switch(u){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";default:return null}case"oas2":switch(u){case"Schema":return"definitions";case"Parameter":return"parameters";case"Response":return"responses";default:return null}case"async2":switch(u){case"Schema":return"schemas";case"Parameter":return"parameters";default:return null}case"async3":switch(u){case"Schema":return"schemas";case"Parameter":return"parameters";default:return null}case"arazzo1":switch(u){case"Root.workflows_items.parameters_items":case"Root.workflows_items.steps_items.parameters_items":return"parameters";default:return null}case"overlay1":return null}}function oxe(u,e,a,t,r){let n,i;const o={ref:{leave(E,p,x){if(!x.location||x.node===void 0){sd(x,p.report,p.location);return}if(x.location.source===a.source&&x.location.source===p.location.source&&p.type.name!=="scalar"&&!e){E.$ref!==x.location.pointer&&(E.$ref=x.location.pointer);return}if(r&&Ja(E.$ref))return;const m=Iz(p.type.name,u);m?e?(l(m,x,p),Zb(E,x,p)):(E.$ref=l(m,x,p),s(E,x,p)):Zb(E,x,p)}},Example:{leave(E,p){if(YI(E)&&E.value===void 0){const x=p.resolve({$ref:E.externalValue});if(!x.location||x.node===void 0){sd(x,p.report,p.location);return}if(r&&Ja(E.externalValue))return;E.value=p.resolve({$ref:E.externalValue}).node,delete E.externalValue}}},Root:{enter(E,p){i=p.location,u==="oas3"?n=E.components=E.components||{}:u==="oas2"?n=E:u==="async2"?n=E.components=E.components||{}:u==="async3"?n=E.components=E.components||{}:u==="arazzo1"&&(n=E.components=E.components||{})}}};u==="oas3"&&(o.DiscriminatorMapping={leave(E,p){for(const x of Object.keys(E)){const m=E[x],g=p.resolve({$ref:m});if(!g.location||g.node===void 0){sd(g,p.report,p.location.child(x));return}const h=Iz("Schema",u);E[x]=l(h,g,p)}}});function s(E,p,x){const m=ld(x.location.source.absoluteRef,E.$ref);t.set(m,{document:a,isRemote:!1,node:p.node,nodePointer:E.$ref,resolved:!0})}function l(E,p,x){n[E]=n[E]||{};const m=d(p,E,x);return n[E][m]=p.node,u==="oas3"||u==="async2"||u==="async3"?`#/components/${E}/${m}`:`#/${E}/${m}`}function c(E,p,x){return Ra(E)&&x.resolve(E,i.absolutePointer).location?.absolutePointer===p.location.absolutePointer?!0:Jb(E,p.node)}function d(E,p,x){const[m,g]=[E.location.source.absoluteRef,E.location.pointer],h=n[p];let f="";const k=g.slice(2).split("/").filter(H0);for(;k.length>0;)if(f=k.pop()+(f?`-${f}`:""),!h||!h[f]||c(h[f],E,x))return f;if(f=Jne(m)+(f?`_${f}`:""),!h[f]||c(h[f],E,x))return f;const y=f;let v=2;for(;h[f]&&!c(h[f],E,x);)f=`${y}-${v}`,v++;return h[f]||x.report({message:`Two schemas are referenced with the same name but different content. Renamed ${y} to ${f}.`,location:x.location,forceSeverity:"warn"}),f}return o}async function sxe(u){const{document:e,config:a,types:t,externalRefResolver:r,dereference:n=!1,removeUnusedComponents:i=!1,keepUrlRefs:o=!1}=u,s=Pf(e.parsed),l=GG(s),c=a.getRulesForSpecVersion(l),d=l2(a.extendTypes(t,s),a),E=C5(c,a,"preprocessors",s),p=C5(c,a,"decorators",s),x={problems:[],specVersion:s,config:a,refTypes:new Map,visitorsData:{}};i&&!p.some(h=>h.ruleId==="remove-unused-components")&&p.push({severity:"error",ruleId:"remove-unused-components",visitor:l==="oas2"?VH():KH()});let m=await Rd({rootDocument:e,rootType:d.Root,externalRefResolver:r});E.length>0&&(G1({document:e,rootType:d.Root,normalizedVisitors:H1(E,d),resolvedRefMap:m,ctx:x}),m=await Rd({rootDocument:e,rootType:d.Root,externalRefResolver:r}));const g=H1([{severity:"error",ruleId:"bundler",visitor:oxe(l,n,e,m,o)},...p],d);return G1({document:e,rootType:d.Root,normalizedVisitors:g,resolvedRefMap:m,ctx:x}),{bundle:e,problems:x.problems.map(h=>a.addProblemToIgnore(h)),fileDependencies:r.getFiles(),rootType:d.Root,refTypes:x.refTypes,visitorsData:x.visitorsData}}function lxe(u,e,a){const t={plugins:[],rootConfigDir:a},r={problems:[],specVersion:"oas3_0",refTypes:new Map,visitorsData:{[WG]:t}};return G1({document:u,rootType:FE.ConfigRoot,normalizedVisitors:nxe,resolvedRefMap:e,ctx:r}),t.plugins}function cxe(u,e,a){const t={plugins:a},r={problems:[],specVersion:"oas3_0",refTypes:new Map,visitorsData:{[qG]:t}};return G1({document:u,rootType:FE.ConfigRoot,normalizedVisitors:ixe,resolvedRefMap:e,ctx:r}),u.parsed??{}}async function dxe(u){const{ref:e,doc:a,externalRefResolver:t=new If(u.config.resolve),base:r=null}=u;if(!(e||a))throw new Error(`Document or reference is required.
222
- `);const n=a===void 0?await t.resolveDocument(r,e,!0):a;if(n instanceof Error)throw n;return u.collectSpecData?.(n.parsed),sxe({document:n,...u,externalRefResolver:t,types:h2(Pf(n.parsed))})}const I6=new Map;async function Exe({rawConfigDocument:u,configPath:e,externalRefResolver:a,customExtends:t}){const r=u===void 0?_3e:u.parsed;if(t!==void 0&&Du(r)&&(r.extends=t),Du(r)&&r?.extends?.some(Jhe))throw new Error("Configuration format not detected in extends: values must be strings.");const n=u??{source:new V1(e??"",JSON.stringify(r)),parsed:r},i=await Rd({rootDocument:n,rootType:FE.ConfigRoot,externalRefResolver:a??new If(HG(r?.resolve))});let o=[],s,l="";Xa?s=[...(r?.plugins||[]).filter(p=>!z0(p)),$z]:(l=$u.dirname(e??""),o=lxe(n,i,l),s=[...await mxe(o.map(p=>Kz(p)?p.absolutePath:p),l),$z]);const c=cxe(n,exe(i),s);c.apis&&(c.apis=Object.fromEntries(Object.entries(c.apis).map(([E,p])=>{const x=GH([c,p]);return[E,{...p,...x}]})));const d=o.length?o.map(E=>Kz(E)&&E.isModule?E.rawPath:E.absolutePath&&$u.relative(l,E.absolutePath)).filter(y5):void 0;return{resolvedConfig:{...c,plugins:d},resolvedRefMap:i,plugins:s}}function pxe(u){for(const e of I3e)(void 0)($u.resolve(u,e))}function Kz(u){return"isModule"in u}const qH=(u,e,a)=>{if(!z0(u))return u;const t=$u.resolve($u.dirname(e),u);return(void 0)(t)?{absolutePath:t,rawPath:u,isModule:!1}:{absolutePath:qI.createRequire((typeof document>"u"?require("url").pathToFileURL(__filename).href:_n&&_n.tagName.toUpperCase()==="SCRIPT"&&_n.src||new URL("replay-index-ChC-Qqf9.js",document.baseURI).href)??__dirname).resolve(u,{paths:[a,(typeof document>"u"?require("url").pathToFileURL(__filename).href:_n&&_n.tagName.toUpperCase()==="SCRIPT"&&_n.src||new URL("replay-index-ChC-Qqf9.js",document.baseURI).href)?$u.dirname((void 0)(typeof document>"u"?require("url").pathToFileURL(__filename).href:_n&&_n.tagName.toUpperCase()==="SCRIPT"&&_n.src||new URL("replay-index-ChC-Qqf9.js",document.baseURI).href)):__dirname]}),isModule:!0,rawPath:u}};async function mxe(u,e){if(!u)return[];const a=async o=>{if(!z0(o))return o;try{const s=$u.isAbsolute(o)?o:qH(o,$u.join(e,N3e),e).absolutePath;if(!I6.has(s)){let l;if(typeof __webpack_require__=="function")l=__non_webpack_require__(s);else{const x=await import((void 0)(s).pathname);l=x.default||x}const c={contentDir:e},d=Array.isArray(l)?l:[l];for(const x of d)x?.id&&Nz(x)&&na.info(`Deprecated plugin format detected: ${x.id}
222
+ `);const n=a===void 0?await t.resolveDocument(r,e,!0):a;if(n instanceof Error)throw n;return u.collectSpecData?.(n.parsed),sxe({document:n,...u,externalRefResolver:t,types:h2(Pf(n.parsed))})}const I6=new Map;async function Exe({rawConfigDocument:u,configPath:e,externalRefResolver:a,customExtends:t}){const r=u===void 0?_3e:u.parsed;if(t!==void 0&&Du(r)&&(r.extends=t),Du(r)&&r?.extends?.some(Jhe))throw new Error("Configuration format not detected in extends: values must be strings.");const n=u??{source:new V1(e??"",JSON.stringify(r)),parsed:r},i=await Rd({rootDocument:n,rootType:FE.ConfigRoot,externalRefResolver:a??new If(HG(r?.resolve))});let o=[],s,l="";Xa?s=[...(r?.plugins||[]).filter(p=>!z0(p)),$z]:(l=$u.dirname(e??""),o=lxe(n,i,l),s=[...await mxe(o.map(p=>Kz(p)?p.absolutePath:p),l),$z]);const c=cxe(n,exe(i),s);c.apis&&(c.apis=Object.fromEntries(Object.entries(c.apis).map(([E,p])=>{const x=GH([c,p]);return[E,{...p,...x}]})));const d=o.length?o.map(E=>Kz(E)&&E.isModule?E.rawPath:E.absolutePath&&$u.relative(l,E.absolutePath)).filter(y5):void 0;return{resolvedConfig:{...c,plugins:d},resolvedRefMap:i,plugins:s}}function pxe(u){for(const e of I3e)(void 0)($u.resolve(u,e))}function Kz(u){return"isModule"in u}const qH=(u,e,a)=>{if(!z0(u))return u;const t=$u.resolve($u.dirname(e),u);return(void 0)(t)?{absolutePath:t,rawPath:u,isModule:!1}:{absolutePath:qI.createRequire((typeof document>"u"?require("url").pathToFileURL(__filename).href:_n&&_n.tagName.toUpperCase()==="SCRIPT"&&_n.src||new URL("replay-index-Cw-gfJ-4.js",document.baseURI).href)??__dirname).resolve(u,{paths:[a,(typeof document>"u"?require("url").pathToFileURL(__filename).href:_n&&_n.tagName.toUpperCase()==="SCRIPT"&&_n.src||new URL("replay-index-Cw-gfJ-4.js",document.baseURI).href)?$u.dirname((void 0)(typeof document>"u"?require("url").pathToFileURL(__filename).href:_n&&_n.tagName.toUpperCase()==="SCRIPT"&&_n.src||new URL("replay-index-Cw-gfJ-4.js",document.baseURI).href)):__dirname]}),isModule:!0,rawPath:u}};async function mxe(u,e){if(!u)return[];const a=async o=>{if(!z0(o))return o;try{const s=$u.isAbsolute(o)?o:qH(o,$u.join(e,N3e),e).absolutePath;if(!I6.has(s)){let l;if(typeof __webpack_require__=="function")l=__non_webpack_require__(s);else{const x=await import((void 0)(s).pathname);l=x.default||x}const c={contentDir:e},d=Array.isArray(l)?l:[l];for(const x of d)x?.id&&Nz(x)&&na.info(`Deprecated plugin format detected: ${x.id}
223
223
  `);const E=Nz(l)?l:uxe(l)?await l(c):await l?.default?.(c),p=Array.isArray(E)?E:[E];E&&I6.set(s,p.map(x=>({...x,path:o,absolutePath:s})))}return I6.get(s)}catch(s){throw new Error(`Failed to load plugin "${o}": ${s.message}
224
224
 
225
225
  ${s.stack}`)}},t=new Map,r=pxe(e);r&&u.push(r);const n=new Set;return(await Promise.all(u.map(async o=>{if(z0(o)){if(Ja(o))throw new Error(Ru.red("We don't support remote plugins yet."));if(n.has(o))return;n.add(o)}const s=await a(o);if(!s)return;const l=Array.isArray(s)?s:[s];return(await Promise.all(l.map(async c=>{if(!c)return;const d=c.id;if(typeof d!="string")throw new Error(Ru.red(`Plugin must define \`id\` property in ${Ru.blue(o.toString())}.`));const E=c.absolutePath??o.toString(),p=t.get(d);if(p){if(E!==p)throw new Error(Ru.red(`Plugin "id" must be unique. Plugin ${Ru.blue(E)} uses id "${Ru.blue(d)}" already seen in ${Ru.blue(E)}`));return}t.set(d,E);const x={id:d,...c.configs?{configs:c.configs}:{},...c.typeExtension?{typeExtension:c.typeExtension}:{}};if(c.rules){if(!c.rules.oas3&&!c.rules.oas2&&!c.rules.async2&&!c.rules.async3&&!c.rules.arazzo1&&!c.rules.overlay1)throw new Error(`Plugin rules must have \`oas3\`, \`oas2\`, \`async2\`, \`async3\`, \`arazzo\`, or \`overlay1\` rules "${o}.`);x.rules={},c.rules.oas3&&(x.rules.oas3=Ya(c.rules.oas3,d)),c.rules.oas2&&(x.rules.oas2=Ya(c.rules.oas2,d)),c.rules.async2&&(x.rules.async2=Ya(c.rules.async2,d)),c.rules.async3&&(x.rules.async3=Ya(c.rules.async3,d)),c.rules.arazzo1&&(x.rules.arazzo1=Ya(c.rules.arazzo1,d)),c.rules.overlay1&&(x.rules.overlay1=Ya(c.rules.overlay1,d))}if(c.preprocessors){if(!c.preprocessors.oas3&&!c.preprocessors.oas2&&!c.preprocessors.async2&&!c.preprocessors.async3&&!c.preprocessors.arazzo1&&!c.preprocessors.overlay1)throw new Error(`Plugin \`preprocessors\` must have \`oas3\`, \`oas2\`, \`async2\`, \`async3\`, \`arazzo1\`, or \`overlay1\` preprocessors "${o}.`);x.preprocessors={},c.preprocessors.oas3&&(x.preprocessors.oas3=Ya(c.preprocessors.oas3,d)),c.preprocessors.oas2&&(x.preprocessors.oas2=Ya(c.preprocessors.oas2,d)),c.preprocessors.async2&&(x.preprocessors.async2=Ya(c.preprocessors.async2,d)),c.preprocessors.async3&&(x.preprocessors.async3=Ya(c.preprocessors.async3,d)),c.preprocessors.arazzo1&&(x.preprocessors.arazzo1=Ya(c.preprocessors.arazzo1,d)),c.preprocessors.overlay1&&(x.preprocessors.overlay1=Ya(c.preprocessors.overlay1,d))}if(c.decorators){if(!c.decorators.oas3&&!c.decorators.oas2&&!c.decorators.async2&&!c.decorators.async3&&!c.decorators.arazzo1&&!c.decorators.overlay1)throw new Error(`Plugin \`decorators\` must have \`oas3\`, \`oas2\`, \`async2\`, \`async3\`, \`arazzo1\`, or \`overlay1\` decorators "${o}.`);x.decorators={},c.decorators.oas3&&(x.decorators.oas3=Ya(c.decorators.oas3,d)),c.decorators.oas2&&(x.decorators.oas2=Ya(c.decorators.oas2,d)),c.decorators.async2&&(x.decorators.async2=Ya(c.decorators.async2,d)),c.decorators.async3&&(x.decorators.async3=Ya(c.decorators.async3,d)),c.decorators.arazzo1&&(x.decorators.arazzo1=Ya(c.decorators.arazzo1,d)),c.decorators.overlay1&&(x.decorators.overlay1=Ya(c.decorators.overlay1,d))}return c.assertions&&(x.assertions=c.assertions),{...c,...x}}))).filter(y5)}))).filter(y5).flat()}function hxe(u,e){const{pluginId:a,configName:t}=Xhe(u),r=e.find(i=>i.id===a);if(!r)throw new Error(`Invalid config ${Ru.red(u)}: plugin ${a} is not included.`);const n=r.configs?.[t];if(!n)throw new Error(a?`Invalid config ${Ru.red(u)}: plugin ${a} doesn't export config with name ${t}.`:`Invalid config ${Ru.red(u)}: there is no such built-in config.`);return n}async function WH(u,{configPath:e,externalRefResolver:a}={}){const r=Zhe(typeof u=="string"?u:"",e??"");typeof u!="string"&&u&&(r.parsed=u);const{resolvedConfig:n,resolvedRefMap:i,plugins:o}=await Exe({rawConfigDocument:xxe(r),configPath:e,externalRefResolver:a});return new S2(n,{configPath:e,document:r,resolvedRefMap:i,plugins:o})}function xxe(u){if(!u.parsed)return u;const{plugins:e,resolve:a,...t}=u.parsed,r={...structuredClone(t),plugins:e?.slice(),...a&&{resolve:{...a}}};return{...u,parsed:r}}var K6={},dr={},V6={},Vz;function Kf(){return Vz||(Vz=1,(function(u){Object.defineProperty(u,"__esModule",{value:!0});var e;(function(s){s[s.SCALAR=0]="SCALAR",s[s.MAPPING=1]="MAPPING",s[s.MAP=2]="MAP",s[s.SEQ=3]="SEQ",s[s.ANCHOR_REF=4]="ANCHOR_REF",s[s.INCLUDE_REF=5]="INCLUDE_REF"})(e=u.Kind||(u.Kind={}));function a(s,l){var c=l?l.endPosition:s.endPosition+1,d={key:s,value:l,startPosition:s.startPosition,endPosition:c,kind:e.MAPPING,parent:null,errors:[]};return d}u.newMapping=a;function t(s,l,c,d){return{errors:[],referencesAnchor:s,value:d,startPosition:l,endPosition:c,kind:e.ANCHOR_REF,parent:null}}u.newAnchorRef=t;function r(s){s===void 0&&(s="");var l={errors:[],startPosition:-1,endPosition:-1,value:""+s,kind:e.SCALAR,parent:null,doubleQuoted:!1,rawValue:""+s};return typeof s!="string"&&(l.valueObject=s),l}u.newScalar=r;function n(){return{errors:[],startPosition:-1,endPosition:-1,items:[],kind:e.SEQ,parent:null}}u.newItems=n;function i(){return n()}u.newSeq=i;function o(s){return{errors:[],startPosition:-1,endPosition:-1,mappings:s||[],kind:e.MAP,parent:null}}u.newMap=o})(V6)),V6}var Un={},Gz;function bc(){if(Gz)return Un;Gz=1,Object.defineProperty(Un,"__esModule",{value:!0});function u(i){return typeof i>"u"||i===null}Un.isNothing=u;function e(i){return typeof i=="object"&&i!==null}Un.isObject=e;function a(i){return Array.isArray(i)?i:u(i)?[]:[i]}Un.toArray=a;function t(i,o){var s,l,c,d;if(o)for(d=Object.keys(o),s=0,l=d.length;s<l;s+=1)c=d[s],i[c]=o[c];return i}Un.extend=t;function r(i,o){var s="",l;for(l=0;l<o;l+=1)s+=i;return s}Un.repeat=r;function n(i){return i===0&&Number.NEGATIVE_INFINITY===1/i}return Un.isNegativeZero=n,Un}var G6,Hz;function wE(){if(Hz)return G6;Hz=1;var u=(function(){function e(a,t,r){t===void 0&&(t=null),r===void 0&&(r=!1),this.name="YAMLException",this.reason=a,this.mark=t,this.message=this.toString(!1),this.isWarning=r}return e.isInstance=function(a){if(a!=null&&a.getClassIdentifier&&typeof a.getClassIdentifier=="function")for(var t=0,r=a.getClassIdentifier();t<r.length;t++){var n=r[t];if(n==e.CLASS_IDENTIFIER)return!0}return!1},e.prototype.getClassIdentifier=function(){var a=[];return a.concat(e.CLASS_IDENTIFIER)},e.prototype.toString=function(a){a===void 0&&(a=!1);var t;return t="JS-YAML: "+(this.reason||"(unknown reason)"),!a&&this.mark&&(t+=" "+this.mark.toString()),t},e.CLASS_IDENTIFIER="yaml-ast-parser.YAMLException",e})();return G6=u,G6}var H6,qz;function Dxe(){if(qz)return H6;qz=1;var u=bc(),e=(function(){function a(t,r,n,i,o){this.name=t,this.buffer=r,this.position=n,this.line=i,this.column=o}return a.prototype.getSnippet=function(t,r){t===void 0&&(t=0),r===void 0&&(r=75);var n,i,o,s,l;if(!this.buffer)return null;for(t=t||4,r=r||75,n="",i=this.position;i>0&&`\0\r
@@ -472,7 +472,7 @@ html body {
472
472
  align-self: flex-end;
473
473
  padding-top: var(--spacing-xxs);
474
474
  gap: var(--spacing-xs);
475
- `;function aA({input:u,onSave:e,onCancel:a,...t}){const[r,n]=H.useState(!!u.isSecret),i=({name:o,value:s})=>{e({...u,name:o,value:s,isSecret:r})};return D.jsx(lJ,{variable:u,onSave:i,onCancel:a,...t,children:D.jsx(Vd,{children:D.jsx(sJ,{value:r,onChange:o=>n(o),title:"Make it secret"})})})}const jy=()=>({name:"",value:"",isSecret:!1}),va=u=>HI+"$inputs."+u+s2,M1u=(u,e)=>e.inputs.find(a=>a.get().name===u.match(`^${bf}$`)?.[1]);function T1u({environments:u,activeEnvironmentId:e}){return u.get().find(t=>t.name===e.get())?.inputs||[]}function Ji(u){const e=new RegExp(bf,"g"),a=new Set;if(!u)return a;for(const[t,r,n]of u.matchAll(e)){const i=r||n;i&&a.add(i)}return a}function tA(u){const e=/^\{?\$inputs\.([^\}\s]+)\}?$/,a=u.match(e);return a?a[1]:null}function Dx(u){var e=new Error(u);return e.source="ulid",e}var rA="0123456789ABCDEFGHJKMNPQRSTVWXYZ",dd=rA.length,Aj=Math.pow(2,48)-1,$1u=10,R1u=16;function N1u(u){var e=Math.floor(u()*dd);return e===dd&&(e=dd-1),rA.charAt(e)}function _1u(u,e){if(isNaN(u))throw new Error(u+" must be a number");if(u>Aj)throw Dx("cannot encode time greater than "+Aj);if(u<0)throw Dx("time must be positive");if(Number.isInteger(u)===!1)throw Dx("time must be an integer");for(var a=void 0,t="";e>0;e--)a=u%dd,t=rA.charAt(a)+t,u=(u-a)/dd;return t}function L1u(u,e){for(var a="";u>0;u--)a=N1u(e)+a;return a}function I1u(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=arguments[1];e||(e=typeof window<"u"?window:null);var a=e&&(e.crypto||e.msCrypto);if(a)return function(){var r=new Uint8Array(1);return a.getRandomValues(r),r[0]/255};try{var t=require("crypto");return function(){return t.randomBytes(1).readUInt8()/255}}catch{}if(u){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return function(){return Math.random()}}throw Dx("secure crypto unusable, insecure Math.random not allowed")}function K1u(u){return u||(u=I1u()),function(a){return isNaN(a)&&(a=Date.now()),_1u(a,$1u)+L1u(R1u,u)}}var G5=K1u(),V1u=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},As="1.9.0",Bj=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function G1u(u){var e=new Set([u]),a=new Set,t=u.match(Bj);if(!t)return function(){return!1};var r={major:+t[1],minor:+t[2],patch:+t[3],prerelease:t[4]};if(r.prerelease!=null)return function(s){return s===u};function n(o){return a.add(o),!1}function i(o){return e.add(o),!0}return function(s){if(e.has(s))return!0;if(a.has(s))return!1;var l=s.match(Bj);if(!l)return n(s);var c={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return c.prerelease!=null||r.major!==c.major?n(s):r.major===0?r.minor===c.minor&&r.patch<=c.patch?i(s):n(s):r.minor<=c.minor?i(s):n(s)}}var H1u=G1u(As),q1u=As.split(".")[0],Gd=Symbol.for("opentelemetry.js.api."+q1u),Hd=V1u;function TE(u,e,a,t){var r;t===void 0&&(t=!1);var n=Hd[Gd]=(r=Hd[Gd])!==null&&r!==void 0?r:{version:As};if(!t&&n[u]){var i=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+u);return a.error(i.stack||i.message),!1}if(n.version!==As){var i=new Error("@opentelemetry/api: Registration of version v"+n.version+" for "+u+" does not match previously registered API v"+As);return a.error(i.stack||i.message),!1}return n[u]=e,a.debug("@opentelemetry/api: Registered a global for "+u+" v"+As+"."),!0}function Ls(u){var e,a,t=(e=Hd[Gd])===null||e===void 0?void 0:e.version;if(!(!t||!H1u(t)))return(a=Hd[Gd])===null||a===void 0?void 0:a[u]}function $E(u,e){e.debug("@opentelemetry/api: Unregistering a global for "+u+" v"+As+".");var a=Hd[Gd];a&&delete a[u]}var W1u=function(u,e){var a=typeof Symbol=="function"&&u[Symbol.iterator];if(!a)return u;var t=a.call(u),r,n=[],i;try{for(;(e===void 0||e-- >0)&&!(r=t.next()).done;)n.push(r.value)}catch(o){i={error:o}}finally{try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(i)throw i.error}}return n},J1u=function(u,e,a){if(a||arguments.length===2)for(var t=0,r=e.length,n;t<r;t++)(n||!(t in e))&&(n||(n=Array.prototype.slice.call(e,0,t)),n[t]=e[t]);return u.concat(n||Array.prototype.slice.call(e))},U1u=(function(){function u(e){this._namespace=e.namespace||"DiagComponentLogger"}return u.prototype.debug=function(){for(var e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];return k4("debug",this._namespace,e)},u.prototype.error=function(){for(var e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];return k4("error",this._namespace,e)},u.prototype.info=function(){for(var e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];return k4("info",this._namespace,e)},u.prototype.warn=function(){for(var e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];return k4("warn",this._namespace,e)},u.prototype.verbose=function(){for(var e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];return k4("verbose",this._namespace,e)},u})();function k4(u,e,a){var t=Ls("diag");if(t)return a.unshift(e),t[u].apply(t,J1u([],W1u(a),!1))}var A0;(function(u){u[u.NONE=0]="NONE",u[u.ERROR=30]="ERROR",u[u.WARN=50]="WARN",u[u.INFO=60]="INFO",u[u.DEBUG=70]="DEBUG",u[u.VERBOSE=80]="VERBOSE",u[u.ALL=9999]="ALL"})(A0||(A0={}));function Z1u(u,e){u<A0.NONE?u=A0.NONE:u>A0.ALL&&(u=A0.ALL),e=e||{};function a(t,r){var n=e[t];return typeof n=="function"&&u>=r?n.bind(e):function(){}}return{error:a("error",A0.ERROR),warn:a("warn",A0.WARN),info:a("info",A0.INFO),debug:a("debug",A0.DEBUG),verbose:a("verbose",A0.VERBOSE)}}var Q1u=function(u,e){var a=typeof Symbol=="function"&&u[Symbol.iterator];if(!a)return u;var t=a.call(u),r,n=[],i;try{for(;(e===void 0||e-- >0)&&!(r=t.next()).done;)n.push(r.value)}catch(o){i={error:o}}finally{try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(i)throw i.error}}return n},Y1u=function(u,e,a){if(a||arguments.length===2)for(var t=0,r=e.length,n;t<r;t++)(n||!(t in e))&&(n||(n=Array.prototype.slice.call(e,0,t)),n[t]=e[t]);return u.concat(n||Array.prototype.slice.call(e))},X1u="diag",kn=(function(){function u(){function e(r){return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=Ls("diag");if(o)return o[r].apply(o,Y1u([],Q1u(n),!1))}}var a=this,t=function(r,n){var i,o,s;if(n===void 0&&(n={logLevel:A0.INFO}),r===a){var l=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return a.error((i=l.stack)!==null&&i!==void 0?i:l.message),!1}typeof n=="number"&&(n={logLevel:n});var c=Ls("diag"),d=Z1u((o=n.logLevel)!==null&&o!==void 0?o:A0.INFO,r);if(c&&!n.suppressOverrideMessage){var E=(s=new Error().stack)!==null&&s!==void 0?s:"<failed to generate stacktrace>";c.warn("Current logger will be overwritten from "+E),d.warn("Current logger will overwrite one already registered from "+E)}return TE("diag",d,a,!0)};a.setLogger=t,a.disable=function(){$E(X1u,a)},a.createComponentLogger=function(r){return new U1u(r)},a.verbose=e("verbose"),a.debug=e("debug"),a.info=e("info"),a.warn=e("warn"),a.error=e("error")}return u.instance=function(){return this._instance||(this._instance=new u),this._instance},u})(),ecu=function(u,e){var a=typeof Symbol=="function"&&u[Symbol.iterator];if(!a)return u;var t=a.call(u),r,n=[],i;try{for(;(e===void 0||e-- >0)&&!(r=t.next()).done;)n.push(r.value)}catch(o){i={error:o}}finally{try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(i)throw i.error}}return n},ucu=function(u){var e=typeof Symbol=="function"&&Symbol.iterator,a=e&&u[e],t=0;if(a)return a.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&t>=u.length&&(u=void 0),{value:u&&u[t++],done:!u}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},acu=(function(){function u(e){this._entries=e?new Map(e):new Map}return u.prototype.getEntry=function(e){var a=this._entries.get(e);if(a)return Object.assign({},a)},u.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var a=ecu(e,2),t=a[0],r=a[1];return[t,r]})},u.prototype.setEntry=function(e,a){var t=new u(this._entries);return t._entries.set(e,a),t},u.prototype.removeEntry=function(e){var a=new u(this._entries);return a._entries.delete(e),a},u.prototype.removeEntries=function(){for(var e,a,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=new u(this._entries);try{for(var i=ucu(t),o=i.next();!o.done;o=i.next()){var s=o.value;n._entries.delete(s)}}catch(l){e={error:l}}finally{try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(e)throw e.error}}return n},u.prototype.clear=function(){return new u},u})(),tcu=Symbol("BaggageEntryMetadata"),rcu=kn.instance();function ncu(u){return u===void 0&&(u={}),new acu(new Map(Object.entries(u)))}function icu(u){return typeof u!="string"&&(rcu.error("Cannot create baggage metadata from unknown type: "+typeof u),u=""),{__TYPE__:tcu,toString:function(){return u}}}function nA(u){return Symbol.for(u)}var ocu=(function(){function u(e){var a=this;a._currentContext=e?new Map(e):new Map,a.getValue=function(t){return a._currentContext.get(t)},a.setValue=function(t,r){var n=new u(a._currentContext);return n._currentContext.set(t,r),n},a.deleteValue=function(t){var r=new u(a._currentContext);return r._currentContext.delete(t),r}}return u})(),n1=new ocu,al=(function(){var u=function(e,a){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},u(e,a)};return function(e,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");u(e,a);function t(){this.constructor=e}e.prototype=a===null?Object.create(a):(t.prototype=a.prototype,new t)}})(),scu=(function(){function u(){}return u.prototype.createGauge=function(e,a){return fcu},u.prototype.createHistogram=function(e,a){return gcu},u.prototype.createCounter=function(e,a){return Dcu},u.prototype.createUpDownCounter=function(e,a){return vcu},u.prototype.createObservableGauge=function(e,a){return bcu},u.prototype.createObservableCounter=function(e,a){return kcu},u.prototype.createObservableUpDownCounter=function(e,a){return ycu},u.prototype.addBatchObservableCallback=function(e,a){},u.prototype.removeBatchObservableCallback=function(e){},u})(),ag=(function(){function u(){}return u})(),lcu=(function(u){al(e,u);function e(){return u!==null&&u.apply(this,arguments)||this}return e.prototype.add=function(a,t){},e})(ag),ccu=(function(u){al(e,u);function e(){return u!==null&&u.apply(this,arguments)||this}return e.prototype.add=function(a,t){},e})(ag),dcu=(function(u){al(e,u);function e(){return u!==null&&u.apply(this,arguments)||this}return e.prototype.record=function(a,t){},e})(ag),Ecu=(function(u){al(e,u);function e(){return u!==null&&u.apply(this,arguments)||this}return e.prototype.record=function(a,t){},e})(ag),iA=(function(){function u(){}return u.prototype.addCallback=function(e){},u.prototype.removeCallback=function(e){},u})(),pcu=(function(u){al(e,u);function e(){return u!==null&&u.apply(this,arguments)||this}return e})(iA),mcu=(function(u){al(e,u);function e(){return u!==null&&u.apply(this,arguments)||this}return e})(iA),hcu=(function(u){al(e,u);function e(){return u!==null&&u.apply(this,arguments)||this}return e})(iA),xcu=new scu,Dcu=new lcu,fcu=new dcu,gcu=new Ecu,vcu=new ccu,kcu=new pcu,bcu=new mcu,ycu=new hcu,Ccu={get:function(u,e){if(u!=null)return u[e]},keys:function(u){return u==null?[]:Object.keys(u)}},Fcu={set:function(u,e,a){u!=null&&(u[e]=a)}},Acu=function(u,e){var a=typeof Symbol=="function"&&u[Symbol.iterator];if(!a)return u;var t=a.call(u),r,n=[],i;try{for(;(e===void 0||e-- >0)&&!(r=t.next()).done;)n.push(r.value)}catch(o){i={error:o}}finally{try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(i)throw i.error}}return n},Bcu=function(u,e,a){if(a||arguments.length===2)for(var t=0,r=e.length,n;t<r;t++)(n||!(t in e))&&(n||(n=Array.prototype.slice.call(e,0,t)),n[t]=e[t]);return u.concat(n||Array.prototype.slice.call(e))},Scu=(function(){function u(){}return u.prototype.active=function(){return n1},u.prototype.with=function(e,a,t){for(var r=[],n=3;n<arguments.length;n++)r[n-3]=arguments[n];return a.call.apply(a,Bcu([t],Acu(r),!1))},u.prototype.bind=function(e,a){return a},u.prototype.enable=function(){return this},u.prototype.disable=function(){return this},u})(),zcu=function(u,e){var a=typeof Symbol=="function"&&u[Symbol.iterator];if(!a)return u;var t=a.call(u),r,n=[],i;try{for(;(e===void 0||e-- >0)&&!(r=t.next()).done;)n.push(r.value)}catch(o){i={error:o}}finally{try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(i)throw i.error}}return n},wcu=function(u,e,a){if(a||arguments.length===2)for(var t=0,r=e.length,n;t<r;t++)(n||!(t in e))&&(n||(n=Array.prototype.slice.call(e,0,t)),n[t]=e[t]);return u.concat(n||Array.prototype.slice.call(e))},Yv="context",Ocu=new Scu,tg=(function(){function u(){}return u.getInstance=function(){return this._instance||(this._instance=new u),this._instance},u.prototype.setGlobalContextManager=function(e){return TE(Yv,e,kn.instance())},u.prototype.active=function(){return this._getContextManager().active()},u.prototype.with=function(e,a,t){for(var r,n=[],i=3;i<arguments.length;i++)n[i-3]=arguments[i];return(r=this._getContextManager()).with.apply(r,wcu([e,a,t],zcu(n),!1))},u.prototype.bind=function(e,a){return this._getContextManager().bind(e,a)},u.prototype._getContextManager=function(){return Ls(Yv)||Ocu},u.prototype.disable=function(){this._getContextManager().disable(),$E(Yv,kn.instance())},u})(),bi;(function(u){u[u.NONE=0]="NONE",u[u.SAMPLED=1]="SAMPLED"})(bi||(bi={}));var cJ="0000000000000000",dJ="00000000000000000000000000000000",EJ={traceId:dJ,spanId:cJ,traceFlags:bi.NONE},Ed=(function(){function u(e){e===void 0&&(e=EJ),this._spanContext=e}return u.prototype.spanContext=function(){return this._spanContext},u.prototype.setAttribute=function(e,a){return this},u.prototype.setAttributes=function(e){return this},u.prototype.addEvent=function(e,a){return this},u.prototype.addLink=function(e){return this},u.prototype.addLinks=function(e){return this},u.prototype.setStatus=function(e){return this},u.prototype.updateName=function(e){return this},u.prototype.end=function(e){},u.prototype.isRecording=function(){return!1},u.prototype.recordException=function(e,a){},u})(),oA=nA("OpenTelemetry Context Key SPAN");function sA(u){return u.getValue(oA)||void 0}function Pcu(){return sA(tg.getInstance().active())}function lA(u,e){return u.setValue(oA,e)}function jcu(u){return u.deleteValue(oA)}function Mcu(u,e){return lA(u,new Ed(e))}function pJ(u){var e;return(e=sA(u))===null||e===void 0?void 0:e.spanContext()}var Tcu=/^([0-9a-f]{32})$/i,$cu=/^[0-9a-f]{16}$/i;function mJ(u){return Tcu.test(u)&&u!==dJ}function Rcu(u){return $cu.test(u)&&u!==cJ}function rg(u){return mJ(u.traceId)&&Rcu(u.spanId)}function Ncu(u){return new Ed(u)}var Xv=tg.getInstance(),hJ=(function(){function u(){}return u.prototype.startSpan=function(e,a,t){t===void 0&&(t=Xv.active());var r=!!a?.root;if(r)return new Ed;var n=t&&pJ(t);return _cu(n)&&rg(n)?new Ed(n):new Ed},u.prototype.startActiveSpan=function(e,a,t,r){var n,i,o;if(!(arguments.length<2)){arguments.length===2?o=a:arguments.length===3?(n=a,o=t):(n=a,i=t,o=r);var s=i??Xv.active(),l=this.startSpan(e,n,s),c=lA(s,l);return Xv.with(c,o,void 0,l)}},u})();function _cu(u){return typeof u=="object"&&typeof u.spanId=="string"&&typeof u.traceId=="string"&&typeof u.traceFlags=="number"}var Lcu=new hJ,Icu=(function(){function u(e,a,t,r){this._provider=e,this.name=a,this.version=t,this.options=r}return u.prototype.startSpan=function(e,a,t){return this._getTracer().startSpan(e,a,t)},u.prototype.startActiveSpan=function(e,a,t,r){var n=this._getTracer();return Reflect.apply(n.startActiveSpan,n,arguments)},u.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):Lcu},u})(),Kcu=(function(){function u(){}return u.prototype.getTracer=function(e,a,t){return new hJ},u})(),Vcu=new Kcu,Sj=(function(){function u(){}return u.prototype.getTracer=function(e,a,t){var r;return(r=this.getDelegateTracer(e,a,t))!==null&&r!==void 0?r:new Icu(this,e,a,t)},u.prototype.getDelegate=function(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Vcu},u.prototype.setDelegate=function(e){this._delegate=e},u.prototype.getDelegateTracer=function(e,a,t){var r;return(r=this._delegate)===null||r===void 0?void 0:r.getTracer(e,a,t)},u})(),H5;(function(u){u[u.NOT_RECORD=0]="NOT_RECORD",u[u.RECORD=1]="RECORD",u[u.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(H5||(H5={}));var My;(function(u){u[u.INTERNAL=0]="INTERNAL",u[u.SERVER=1]="SERVER",u[u.CLIENT=2]="CLIENT",u[u.PRODUCER=3]="PRODUCER",u[u.CONSUMER=4]="CONSUMER"})(My||(My={}));var qd;(function(u){u[u.UNSET=0]="UNSET",u[u.OK=1]="OK",u[u.ERROR=2]="ERROR"})(qd||(qd={}));var di=tg.getInstance(),Gu=kn.instance(),Gcu=(function(){function u(){}return u.prototype.getMeter=function(e,a,t){return xcu},u})(),Hcu=new Gcu,ek="metrics",qcu=(function(){function u(){}return u.getInstance=function(){return this._instance||(this._instance=new u),this._instance},u.prototype.setGlobalMeterProvider=function(e){return TE(ek,e,kn.instance())},u.prototype.getMeterProvider=function(){return Ls(ek)||Hcu},u.prototype.getMeter=function(e,a,t){return this.getMeterProvider().getMeter(e,a,t)},u.prototype.disable=function(){$E(ek,kn.instance())},u})(),Wcu=qcu.getInstance(),Jcu=(function(){function u(){}return u.prototype.inject=function(e,a){},u.prototype.extract=function(e,a){return e},u.prototype.fields=function(){return[]},u})(),cA=nA("OpenTelemetry Baggage Key");function xJ(u){return u.getValue(cA)||void 0}function Ucu(){return xJ(tg.getInstance().active())}function Zcu(u,e){return u.setValue(cA,e)}function Qcu(u){return u.deleteValue(cA)}var uk="propagation",Ycu=new Jcu,Xcu=(function(){function u(){this.createBaggage=ncu,this.getBaggage=xJ,this.getActiveBaggage=Ucu,this.setBaggage=Zcu,this.deleteBaggage=Qcu}return u.getInstance=function(){return this._instance||(this._instance=new u),this._instance},u.prototype.setGlobalPropagator=function(e){return TE(uk,e,kn.instance())},u.prototype.inject=function(e,a,t){return t===void 0&&(t=Fcu),this._getGlobalPropagator().inject(e,a,t)},u.prototype.extract=function(e,a,t){return t===void 0&&(t=Ccu),this._getGlobalPropagator().extract(e,a,t)},u.prototype.fields=function(){return this._getGlobalPropagator().fields()},u.prototype.disable=function(){$E(uk,kn.instance())},u.prototype._getGlobalPropagator=function(){return Ls(uk)||Ycu},u})(),pd=Xcu.getInstance(),ak="trace",e4u=(function(){function u(){this._proxyTracerProvider=new Sj,this.wrapSpanContext=Ncu,this.isSpanContextValid=rg,this.deleteSpan=jcu,this.getSpan=sA,this.getActiveSpan=Pcu,this.getSpanContext=pJ,this.setSpan=lA,this.setSpanContext=Mcu}return u.getInstance=function(){return this._instance||(this._instance=new u),this._instance},u.prototype.setGlobalTracerProvider=function(e){var a=TE(ak,this._proxyTracerProvider,kn.instance());return a&&this._proxyTracerProvider.setDelegate(e),a},u.prototype.getTracerProvider=function(){return Ls(ak)||this._proxyTracerProvider},u.prototype.getTracer=function(e,a){return this.getTracerProvider().getTracer(e,a)},u.prototype.disable=function(){$E(ak,kn.instance()),this._proxyTracerProvider=new Sj},u})(),O0=e4u.getInstance();const DJ=nA("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function u4u(u){return u.setValue(DJ,!0)}function dA(u){return u.getValue(DJ)===!0}const a4u="=",Ty=";",$y=",",tk="baggage",t4u=180,r4u=4096,n4u=8192;function i4u(u){return u.reduce((e,a)=>{const t=`${e}${e!==""?$y:""}${a}`;return t.length>n4u?e:t},"")}function o4u(u){return u.getAllEntries().map(([e,a])=>{let t=`${encodeURIComponent(e)}=${encodeURIComponent(a.value)}`;return a.metadata!==void 0&&(t+=Ty+a.metadata.toString()),t})}function s4u(u){const e=u.split(Ty);if(e.length<=0)return;const a=e.shift();if(!a)return;const t=a.indexOf(a4u);if(t<=0)return;const r=decodeURIComponent(a.substring(0,t).trim()),n=decodeURIComponent(a.substring(t+1).trim());let i;return e.length>0&&(i=icu(e.join(Ty))),{key:r,value:n,metadata:i}}class l4u{inject(e,a,t){const r=pd.getBaggage(e);if(!r||dA(e))return;const n=o4u(r).filter(o=>o.length<=r4u).slice(0,t4u),i=i4u(n);i.length>0&&t.set(a,tk,i)}extract(e,a,t){const r=t.get(a,tk),n=Array.isArray(r)?r.join($y):r;if(!n)return e;const i={};return n.length===0||(n.split($y).forEach(s=>{const l=s4u(s);if(l){const c={value:l.value};l.metadata&&(c.metadata=l.metadata),i[l.key]=c}}),Object.entries(i).length===0)?e:pd.setBaggage(e,pd.createBaggage(i))}fields(){return[tk]}}function fx(u){const e={};if(typeof u!="object"||u==null)return e;for(const[a,t]of Object.entries(u)){if(!c4u(a)){Gu.warn(`Invalid attribute key: ${a}`);continue}if(!fJ(t)){Gu.warn(`Invalid attribute value set for key: ${a}`);continue}Array.isArray(t)?e[a]=t.slice():e[a]=t}return e}function c4u(u){return typeof u=="string"&&u.length>0}function fJ(u){return u==null?!0:Array.isArray(u)?d4u(u):gJ(u)}function d4u(u){let e;for(const a of u)if(a!=null){if(!e){if(gJ(a)){e=typeof a;continue}return!1}if(typeof a!==e)return!1}return!0}function gJ(u){switch(typeof u){case"number":case"boolean":case"string":return!0}return!1}function E4u(){return u=>{Gu.error(p4u(u))}}function p4u(u){return typeof u=="string"?u:JSON.stringify(m4u(u))}function m4u(u){const e={};let a=u;for(;a!==null;)Object.getOwnPropertyNames(a).forEach(t=>{if(e[t])return;const r=a[t];r&&(e[t]=String(r))}),a=Object.getPrototypeOf(a);return e}let h4u=E4u();function J1(u){try{h4u(u)}catch{}}const C1=performance,x4u="2.0.1",rk="exception.message",D4u="exception.stacktrace",nk="exception.type",vJ="service.name",f4u="service.version",Ry="telemetry.sdk.language",g4u="webjs",Ny="telemetry.sdk.name",_y="telemetry.sdk.version",v4u="process.runtime.name",ik={[Ny]:"opentelemetry",[v4u]:"browser",[Ry]:g4u,[_y]:x4u};const k4u=9,b4u=6,y4u=Math.pow(10,b4u),q5=Math.pow(10,k4u);function m1(u){const e=u/1e3,a=Math.trunc(e),t=Math.round(u%1e3*y4u);return[a,t]}function kJ(){let u=C1.timeOrigin;if(typeof u!="number"){const e=C1;u=e.timing&&e.timing.fetchStart}return u}function C4u(u){const e=m1(kJ()),a=m1(typeof u=="number"?u:C1.now());return yJ(e,a)}function F4u(u,e){let a=e[0]-u[0],t=e[1]-u[1];return t<0&&(a-=1,t+=q5),[a,t]}function A4u(u){return u[0]*q5+u[1]}function bJ(u){return Array.isArray(u)&&u.length===2&&typeof u[0]=="number"&&typeof u[1]=="number"}function zj(u){return bJ(u)||typeof u=="number"||u instanceof Date}function yJ(u,e){const a=[u[0]+e[0],u[1]+e[1]];return a[1]>=q5&&(a[1]-=q5,a[0]+=1),a}var Qr;(function(u){u[u.SUCCESS=0]="SUCCESS",u[u.FAILED=1]="FAILED"})(Qr||(Qr={}));class B4u{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(a=>typeof a.fields=="function"?a.fields():[]).reduce((a,t)=>a.concat(t),[])))}inject(e,a,t){for(const r of this._propagators)try{r.inject(e,a,t)}catch(n){Gu.warn(`Failed to inject with ${r.constructor.name}. Err: ${n.message}`)}}extract(e,a,t){return this._propagators.reduce((r,n)=>{try{return n.extract(r,a,t)}catch(i){Gu.warn(`Failed to extract with ${n.constructor.name}. Err: ${i.message}`)}return r},e)}fields(){return this._fields.slice()}}const Ly="[_0-9a-z-*/]",S4u=`[a-z]${Ly}{0,255}`,z4u=`[a-z0-9]${Ly}{0,240}@[a-z]${Ly}{0,13}`,w4u=new RegExp(`^(?:${S4u}|${z4u})$`),O4u=/^[ -~]{0,255}[!-~]$/,P4u=/,|=/;function j4u(u){return w4u.test(u)}function M4u(u){return O4u.test(u)&&!P4u.test(u)}const wj=32,T4u=512,Oj=",",Pj="=";class EA{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,a){const t=this._clone();return t._internalState.has(e)&&t._internalState.delete(e),t._internalState.set(e,a),t}unset(e){const a=this._clone();return a._internalState.delete(e),a}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,a)=>(e.push(a+Pj+this.get(a)),e),[]).join(Oj)}_parse(e){e.length>T4u||(this._internalState=e.split(Oj).reverse().reduce((a,t)=>{const r=t.trim(),n=r.indexOf(Pj);if(n!==-1){const i=r.slice(0,n),o=r.slice(n+1,t.length);j4u(i)&&M4u(o)&&a.set(i,o)}return a},new Map),this._internalState.size>wj&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,wj))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){const e=new EA;return e._internalState=new Map(this._internalState),e}}const ok="traceparent",sk="tracestate",$4u="00",R4u="(?!ff)[\\da-f]{2}",N4u="(?![0]{32})[\\da-f]{32}",_4u="(?![0]{16})[\\da-f]{16}",L4u="[\\da-f]{2}",I4u=new RegExp(`^\\s?(${R4u})-(${N4u})-(${_4u})-(${L4u})(-.*)?\\s?$`);function K4u(u){const e=I4u.exec(u);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}class V4u{inject(e,a,t){const r=O0.getSpanContext(e);if(!r||dA(e)||!rg(r))return;const n=`${$4u}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||bi.NONE).toString(16)}`;t.set(a,ok,n),r.traceState&&t.set(a,sk,r.traceState.serialize())}extract(e,a,t){const r=t.get(a,ok);if(!r)return e;const n=Array.isArray(r)?r[0]:r;if(typeof n!="string")return e;const i=K4u(n);if(!i)return e;i.isRemote=!0;const o=t.get(a,sk);if(o){const s=Array.isArray(o)?o.join(","):o;i.traceState=new EA(typeof s=="string"?s:void 0)}return O0.setSpanContext(e,i)}fields(){return[ok,sk]}}const G4u="[object Object]",H4u="[object Null]",q4u="[object Undefined]",W4u=Function.prototype,CJ=W4u.toString,J4u=CJ.call(Object),U4u=Object.getPrototypeOf,FJ=Object.prototype,AJ=FJ.hasOwnProperty,fs=Symbol?Symbol.toStringTag:void 0,BJ=FJ.toString;function jj(u){if(!Z4u(u)||Q4u(u)!==G4u)return!1;const e=U4u(u);if(e===null)return!0;const a=AJ.call(e,"constructor")&&e.constructor;return typeof a=="function"&&a instanceof a&&CJ.call(a)===J4u}function Z4u(u){return u!=null&&typeof u=="object"}function Q4u(u){return u==null?u===void 0?q4u:H4u:fs&&fs in Object(u)?Y4u(u):X4u(u)}function Y4u(u){const e=AJ.call(u,fs),a=u[fs];let t=!1;try{u[fs]=void 0,t=!0}catch{}const r=BJ.call(u);return t&&(e?u[fs]=a:delete u[fs]),r}function X4u(u){return BJ.call(u)}const edu=20;function udu(...u){let e=u.shift();const a=new WeakMap;for(;u.length>0;)e=SJ(e,u.shift(),0,a);return e}function lk(u){return W5(u)?u.slice():u}function SJ(u,e,a=0,t){let r;if(!(a>edu)){if(a++,gx(u)||gx(e)||zJ(e))r=lk(e);else if(W5(u)){if(r=u.slice(),W5(e))for(let n=0,i=e.length;n<i;n++)r.push(lk(e[n]));else if(b4(e)){const n=Object.keys(e);for(let i=0,o=n.length;i<o;i++){const s=n[i];r[s]=lk(e[s])}}}else if(b4(u))if(b4(e)){if(!adu(u,e))return e;r=Object.assign({},u);const n=Object.keys(e);for(let i=0,o=n.length;i<o;i++){const s=n[i],l=e[s];if(gx(l))typeof l>"u"?delete r[s]:r[s]=l;else{const c=r[s],d=l;if(Mj(u,s,t)||Mj(e,s,t))delete r[s];else{if(b4(c)&&b4(d)){const E=t.get(c)||[],p=t.get(d)||[];E.push({obj:u,key:s}),p.push({obj:e,key:s}),t.set(c,E),t.set(d,p)}r[s]=SJ(r[s],l,a,t)}}}}else r=e;return r}}function Mj(u,e,a){const t=a.get(u[e])||[];for(let r=0,n=t.length;r<n;r++){const i=t[r];if(i.key===e&&i.obj===u)return!0}return!1}function W5(u){return Array.isArray(u)}function zJ(u){return typeof u=="function"}function b4(u){return!gx(u)&&!W5(u)&&!zJ(u)&&typeof u=="object"}function gx(u){return typeof u=="string"||typeof u=="number"||typeof u=="boolean"||typeof u>"u"||u instanceof Date||u instanceof RegExp||u===null}function adu(u,e){return!(!jj(u)||!jj(e))}class tdu{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,a)=>{this._resolve=e,this._reject=a})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}class rdu{_callback;_that;_isCalled=!1;_deferred=new tdu;constructor(e,a){this._callback=e,this._that=a}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(a=>this._deferred.resolve(a),a=>this._deferred.reject(a))}catch(a){this._deferred.reject(a)}}return this._deferred.promise}}function ndu(){return"unknown_service"}const W4=u=>u!==null&&typeof u=="object"&&typeof u.then=="function";class J5{_rawAttributes;_asyncAttributesPending=!1;_memoizedAttributes;static FromAttributeList(e){const a=new J5({});return a._rawAttributes=Tj(e),a._asyncAttributesPending=e.filter(([t,r])=>W4(r)).length>0,a}constructor(e){const a=e.attributes??{};this._rawAttributes=Object.entries(a).map(([t,r])=>(W4(r)&&(this._asyncAttributesPending=!0),[t,r])),this._rawAttributes=Tj(this._rawAttributes)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){const[a,t]=this._rawAttributes[e];this._rawAttributes[e]=[a,W4(t)?await t:t]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Gu.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const e={};for(const[a,t]of this._rawAttributes){if(W4(t)){Gu.debug(`Unsettled resource attribute ${a} skipped`);continue}t!=null&&(e[a]??=t)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}merge(e){return e==null?this:J5.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()])}}function wJ(u){return J5.FromAttributeList(Object.entries(u))}function idu(){return wJ({[vJ]:ndu(),[Ry]:ik[Ry],[Ny]:ik[Ny],[_y]:ik[_y]})}function Tj(u){return u.map(([e,a])=>W4(a)?[e,a.catch(t=>{Gu.debug("promise rejection for resource attribute: %s - %s",e,t)})]:[e,a])}const odu="exception";class sdu{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;name;status={code:qd.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){const a=Date.now();this._spanContext=e.spanContext,this._performanceStartTime=C1.now(),this._performanceOffset=a-(this._performanceStartTime+kJ()),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??a),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,a){if(a==null||this._isSpanEnded())return this;if(e.length===0)return Gu.warn(`Invalid attribute key: ${e}`),this;if(!fJ(a))return Gu.warn(`Invalid attribute value set for key: ${e}`),this;const{attributeCountLimit:t}=this._spanLimits;return t!==void 0&&Object.keys(this.attributes).length>=t&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(a),this)}setAttributes(e){for(const[a,t]of Object.entries(e))this.setAttribute(a,t);return this}addEvent(e,a,t){if(this._isSpanEnded())return this;const{eventCountLimit:r}=this._spanLimits;if(r===0)return Gu.warn("No events allowed."),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&Gu.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),zj(a)&&(zj(t)||(t=a),a=void 0);const n=fx(a);return this.events.push({name:e,attributes:n,time:this._getTime(t),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"&&(Gu.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()){Gu.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=F4u(this.startTime,this.endTime),this._duration[0]<0&&(Gu.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&&Gu.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e=="number"&&e<=C1.now())return C4u(e+this._performanceOffset);if(typeof e=="number")return m1(e);if(e instanceof Date)return m1(e.getTime());if(bJ(e))return e;if(this._startTimeProvided)return m1(Date.now());const a=C1.now()-this._performanceStartTime;return yJ(this.startTime,m1(a))}isRecording(){return this._ended===!1}recordException(e,a){const t={};typeof e=="string"?t[rk]=e:e&&(e.code?t[nk]=e.code.toString():e.name&&(t[nk]=e.name),e.message&&(t[rk]=e.message),e.stack&&(t[D4u]=e.stack)),t[nk]||t[rk]?this.addEvent(odu,t,a):Gu.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}}`);Gu.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,a){return e.length<=a?e:e.substring(0,a)}_truncateToSize(e){const a=this._attributeValueLengthLimit;return a<=0?(Gu.warn(`Attribute value limit must be positive, got ${a}`),e):typeof e=="string"?this._truncateToLimitUtil(e,a):Array.isArray(e)?e.map(t=>typeof t=="string"?this._truncateToLimitUtil(t,a):t):e}}var U1;(function(u){u[u.NOT_RECORD=0]="NOT_RECORD",u[u.RECORD=1]="RECORD",u[u.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(U1||(U1={}));class U5{shouldSample(){return{decision:U1.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class F1{shouldSample(){return{decision:U1.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class dh{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||(J1(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new F1),this._remoteParentSampled=e.remoteParentSampled??new F1,this._remoteParentNotSampled=e.remoteParentNotSampled??new U5,this._localParentSampled=e.localParentSampled??new F1,this._localParentNotSampled=e.localParentNotSampled??new U5}shouldSample(e,a,t,r,n,i){const o=O0.getSpanContext(e);return!o||!rg(o)?this._root.shouldSample(e,a,t,r,n,i):o.isRemote?o.traceFlags&bi.SAMPLED?this._remoteParentSampled.shouldSample(e,a,t,r,n,i):this._remoteParentNotSampled.shouldSample(e,a,t,r,n,i):o.traceFlags&bi.SAMPLED?this._localParentSampled.shouldSample(e,a,t,r,n,i):this._localParentNotSampled.shouldSample(e,a,t,r,n,i)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}class $j{_ratio;_upperBound;constructor(e=0){this._ratio=e,this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,a){return{decision:mJ(a)&&this._accumulate(a)<this._upperBound?U1.RECORD_AND_SAMPLED:U1.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 a=0;for(let t=0;t<e.length/8;t++){const r=t*8,n=parseInt(e.slice(r,r+8),16);a=(a^n)>>>0}return a}}const Rj=1;function OJ(){return{sampler:PJ(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function PJ(){const u="parentbased_always_on";switch(u){case"always_on":return new F1;case"always_off":return new U5;case"parentbased_always_on":return new dh({root:new F1});case"parentbased_always_off":return new dh({root:new U5});case"traceidratio":return new $j(Nj());case"parentbased_traceidratio":return new dh({root:new $j(Nj())});default:return Gu.error(`OTEL_TRACES_SAMPLER value "${u}" invalid, defaulting to "parentbased_always_on".`),new dh({root:new F1})}}function Nj(){return Gu.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Rj}.`),Rj}const ldu=128,cdu=1/0;function ddu(u){const e={sampler:PJ()},a=OJ(),t=Object.assign({},a,e,u);return t.generalLimits=Object.assign({},a.generalLimits,u.generalLimits||{}),t.spanLimits=Object.assign({},a.spanLimits,u.spanLimits||{}),t}function Edu(u){const e=Object.assign({},u.spanLimits);return e.attributeCountLimit=u.spanLimits?.attributeCountLimit??u.generalLimits?.attributeCountLimit??void 0??void 0??ldu,e.attributeValueLengthLimit=u.spanLimits?.attributeValueLengthLimit??u.generalLimits?.attributeValueLengthLimit??void 0??void 0??cdu,Object.assign({},u,{spanLimits:e})}class pdu{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,a){this._exporter=e,this._maxExportBatchSize=typeof a?.maxExportBatchSize=="number"?a.maxExportBatchSize:512,this._maxQueueSize=typeof a?.maxQueueSize=="number"?a.maxQueueSize:2048,this._scheduledDelayMillis=typeof a?.scheduledDelayMillis=="number"?a.scheduledDelayMillis:5e3,this._exportTimeoutMillis=typeof a?.exportTimeoutMillis=="number"?a.exportTimeoutMillis:3e4,this._shutdownOnce=new rdu(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(Gu.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,a){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&bi.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&&Gu.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(Gu.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,a)=>{const t=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let n=0,i=r;n<i;n++)t.push(this._flushOneBatch());Promise.all(t).then(()=>{e()}).catch(a)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,a)=>{const t=setTimeout(()=>{a(new Error("Timeout"))},this._exportTimeoutMillis);di.with(u4u(di.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);const n=()=>this._exporter.export(r,o=>{clearTimeout(t),o.code===Qr.SUCCESS?e():a(o.error??new Error("BatchSpanProcessor: span export failed"))});let i=null;for(let o=0,s=r.length;o<s;o++){const l=r[o];l.resource.asyncAttributesPending&&l.resource.waitForAsyncAttributes&&(i??=[],i.push(l.resource.waitForAsyncAttributes()))}i===null?n():Promise.all(i).then(n,o=>{J1(o),a(o)})})})}_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(a=>{this._isExporting=!1,J1(a)})};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 mdu extends pdu{_visibilityChangeListener;_pageHideListener;constructor(e,a){super(e,a),this.onInit(a)}onInit(e){e?.disableAutoFlushOnDocumentHide!==!0&&typeof document<"u"&&(this._visibilityChangeListener=()=>{document.visibilityState==="hidden"&&this.forceFlush().catch(a=>{J1(a)})},this._pageHideListener=()=>{this.forceFlush().catch(a=>{J1(a)})},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 hdu=8,xdu=16;class Ddu{generateTraceId=_j(xdu);generateSpanId=_j(hdu)}const Eh=Array(32);function _j(u){return function(){for(let a=0;a<u*2;a++)Eh[a]=Math.floor(Math.random()*16)+48,Eh[a]>=58&&(Eh[a]+=39);return String.fromCharCode.apply(null,Eh.slice(0,u*2))}}class fdu{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;constructor(e,a,t,r){const n=ddu(a);this._sampler=n.sampler,this._generalLimits=n.generalLimits,this._spanLimits=n.spanLimits,this._idGenerator=a.idGenerator||new Ddu,this._resource=t,this._spanProcessor=r,this.instrumentationScope=e}startSpan(e,a={},t=di.active()){a.root&&(t=O0.deleteSpan(t));const r=O0.getSpan(t);if(dA(t))return Gu.debug("Instrumentation suppressed, returning Noop Span"),O0.wrapSpanContext(EJ);const n=r?.spanContext(),i=this._idGenerator.generateSpanId();let o,s,l;!n||!O0.isSpanContextValid(n)?s=this._idGenerator.generateTraceId():(s=n.traceId,l=n.traceState,o=n);const c=a.kind??My.INTERNAL,d=(a.links??[]).map(f=>({context:f.context,attributes:fx(f.attributes)})),E=fx(a.attributes),p=this._sampler.shouldSample(t,s,e,c,E,d);l=p.traceState??l;const x=p.decision===H5.RECORD_AND_SAMPLED?bi.SAMPLED:bi.NONE,m={traceId:s,spanId:i,traceFlags:x,traceState:l};if(p.decision===H5.NOT_RECORD)return Gu.debug("Recording is off, propagating context in a non-recording span"),O0.wrapSpanContext(m);const g=fx(Object.assign(E,p.attributes));return new sdu({resource:this._resource,scope:this.instrumentationScope,context:t,spanContext:m,name:e,kind:c,links:d,parentSpanContext:o,attributes:g,startTime:a.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits})}startActiveSpan(e,a,t,r){let n,i,o;if(arguments.length<2)return;arguments.length===2?o=a:arguments.length===3?(n=a,o=t):(n=a,i=t,o=r);const s=i??di.active(),l=this.startSpan(e,n,s),c=O0.setSpan(s,l);return di.with(c,o,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}class gdu{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){const e=[];for(const a of this._spanProcessors)e.push(a.forceFlush());return new Promise(a=>{Promise.all(e).then(()=>{a()}).catch(t=>{J1(t||new Error("MultiSpanProcessor: forceFlush failed")),a()})})}onStart(e,a){for(const t of this._spanProcessors)t.onStart(e,a)}onEnd(e){for(const a of this._spanProcessors)a.onEnd(e)}shutdown(){const e=[];for(const a of this._spanProcessors)e.push(a.shutdown());return new Promise((a,t)=>{Promise.all(e).then(()=>{a()},t)})}}var gs;(function(u){u[u.resolved=0]="resolved",u[u.timeout=1]="timeout",u[u.error=2]="error",u[u.unresolved=3]="unresolved"})(gs||(gs={}));class vdu{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){const a=udu({},OJ(),Edu(e));this._resource=a.resource??idu(),this._config=Object.assign({},a,{resource:this._resource});const t=[];e.spanProcessors?.length&&t.push(...e.spanProcessors),this._activeSpanProcessor=new gdu(t)}getTracer(e,a,t){const r=`${e}@${a||""}:${t?.schemaUrl||""}`;return this._tracers.has(r)||this._tracers.set(r,new fdu({name:e,version:a,schemaUrl:t?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){const e=this._config.forceFlushTimeoutMillis,a=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(r=>{let n;const i=setTimeout(()=>{r(new Error(`Span processor did not completed within timeout period of ${e} ms`)),n=gs.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),n!==gs.timeout&&(n=gs.resolved,r(n))}).catch(o=>{clearTimeout(i),n=gs.error,r(o)})}));return new Promise((t,r)=>{Promise.all(a).then(n=>{const i=n.filter(o=>o!==gs.resolved);i.length>0?r(i):t()}).catch(n=>r([n]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}class kdu{_enabled=!1;_currentContext=n1;_bindFunction(e=n1,a){const t=this,r=function(...n){return t.with(e,()=>a.apply(this,n))};return Object.defineProperty(r,"length",{enumerable:!1,configurable:!0,writable:!1,value:a.length}),r}active(){return this._currentContext}bind(e,a){return e===void 0&&(e=this.active()),typeof a=="function"?this._bindFunction(e,a):a}disable(){return this._currentContext=n1,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=n1,this)}with(e,a,t,...r){const n=this._currentContext;this._currentContext=e||n1;try{return a.call(t,...r)}finally{this._currentContext=n}}}function bdu(u){if(u!==null){if(u===void 0){const e=new kdu;e.enable(),di.setGlobalContextManager(e);return}u.enable(),di.setGlobalContextManager(u)}}function ydu(u){if(u!==null){if(u===void 0){pd.setGlobalPropagator(new B4u({propagators:[new V4u,new l4u]}));return}pd.setGlobalPropagator(u)}}class Cdu extends vdu{constructor(e={}){super(e)}register(e={}){O0.setGlobalTracerProvider(this),ydu(e.propagator),bdu(e.contextManager)}}class Fdu{_delegate;constructor(e){this._delegate=e}export(e,a){this._delegate.export(e,a)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}class Lj extends Error{code;name="OTLPExporterError";data;constructor(e,a,t){super(e),this.data=t,this.code=a}}function Adu(u){if(Number.isFinite(u)&&u>0)return u;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${u}')`)}function Bdu(u){if(u!=null)return()=>u}function Sdu(u,e,a){return{timeoutMillis:Adu(u.timeoutMillis??e.timeoutMillis??a.timeoutMillis),concurrencyLimit:u.concurrencyLimit??e.concurrencyLimit??a.concurrencyLimit,compression:u.compression??e.compression??a.compression}}function zdu(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}class wdu{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(e);const a=()=>{const t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(a,a)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}function Odu(u){return new wdu(u.concurrencyLimit)}function Pdu(u){return Object.prototype.hasOwnProperty.call(u,"partialSuccess")}function jdu(){return{handleResponse(u){u==null||!Pdu(u)||u.partialSuccess==null||Object.keys(u.partialSuccess).length===0||Gu.warn("Received Partial Success response:",JSON.stringify(u.partialSuccess))}}}class Mdu{_transport;_serializer;_responseHandler;_promiseQueue;_timeout;_diagLogger;constructor(e,a,t,r,n){this._transport=e,this._serializer=a,this._responseHandler=t,this._promiseQueue=r,this._timeout=n,this._diagLogger=Gu.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,a){if(this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit()){a({code:Qr.FAILED,error:new Error("Concurrent export limit reached")});return}const t=this._serializer.serializeRequest(e);if(t==null){a({code:Qr.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(t,this._timeout).then(r=>{if(r.status==="success"){if(r.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(r.data))}catch(n){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",n,r.data)}a({code:Qr.SUCCESS});return}else if(r.status==="failure"&&r.error){a({code:Qr.FAILED,error:r.error});return}else r.status==="retryable"?a({code:Qr.FAILED,error:new Lj("Export failed with retryable status")}):a({code:Qr.FAILED,error:new Lj("Export failed with unknown error")})},r=>a({code:Qr.FAILED,error:r})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function Tdu(u,e){return new Mdu(u.transport,u.serializer,jdu(),u.promiseHandler,e.timeout)}function jJ(u,e,a){return Tdu({transport:a,serializer:e,promiseHandler:Odu(u)},{timeout:u.timeoutMillis})}function Ij(u){return u>=48&&u<=57?u-48:u>=97&&u<=102?u-87:u-55}function MJ(u){const e=new Uint8Array(u.length/2);let a=0;for(let t=0;t<u.length;t+=2){const r=Ij(u.charCodeAt(t)),n=Ij(u.charCodeAt(t+1));e[a++]=r<<4|n}return e}function TJ(u){const e=BigInt(1e9);return BigInt(u[0])*e+BigInt(u[1])}function $du(u){const e=Number(BigInt.asUintN(32,u)),a=Number(BigInt.asUintN(32,u>>BigInt(32)));return{low:e,high:a}}function Rdu(u){const e=TJ(u);return $du(e)}function Ndu(u){return TJ(u).toString()}const _du=typeof BigInt<"u"?Ndu:A4u;function Kj(u){return u}function Ldu(u){if(u!==void 0)return MJ(u)}const Idu={encodeHrTime:Rdu,encodeSpanContext:MJ,encodeOptionalSpanContext:Ldu};function Kdu(u){return u===void 0?Idu:{encodeHrTime:_du,encodeSpanContext:Kj,encodeOptionalSpanContext:Kj}}function Vdu(u){return{attributes:ng(u.attributes),droppedAttributesCount:0}}function Gdu(u){return{name:u.name,version:u.version}}function ng(u){return Object.keys(u).map(e=>$J(e,u[e]))}function $J(u,e){return{key:u,value:RJ(e)}}function RJ(u){const e=typeof u;return e==="string"?{stringValue:u}:e==="number"?Number.isInteger(u)?{intValue:u}:{doubleValue:u}:e==="boolean"?{boolValue:u}:u instanceof Uint8Array?{bytesValue:u}:Array.isArray(u)?{arrayValue:{values:u.map(RJ)}}:e==="object"&&u!=null?{kvlistValue:{values:Object.entries(u).map(([a,t])=>$J(a,t))}}:{}}function Hdu(u,e){const a=u.spanContext(),t=u.status,r=u.parentSpanContext?.spanId?e.encodeSpanContext(u.parentSpanContext?.spanId):void 0;return{traceId:e.encodeSpanContext(a.traceId),spanId:e.encodeSpanContext(a.spanId),parentSpanId:r,traceState:a.traceState?.serialize(),name:u.name,kind:u.kind==null?0:u.kind+1,startTimeUnixNano:e.encodeHrTime(u.startTime),endTimeUnixNano:e.encodeHrTime(u.endTime),attributes:ng(u.attributes),droppedAttributesCount:u.droppedAttributesCount,events:u.events.map(n=>Wdu(n,e)),droppedEventsCount:u.droppedEventsCount,status:{code:t.code,message:t.message},links:u.links.map(n=>qdu(n,e)),droppedLinksCount:u.droppedLinksCount}}function qdu(u,e){return{attributes:u.attributes?ng(u.attributes):[],spanId:e.encodeSpanContext(u.context.spanId),traceId:e.encodeSpanContext(u.context.traceId),traceState:u.context.traceState?.serialize(),droppedAttributesCount:u.droppedAttributesCount||0}}function Wdu(u,e){return{attributes:u.attributes?ng(u.attributes):[],name:u.name,timeUnixNano:e.encodeHrTime(u.time),droppedAttributesCount:u.droppedAttributesCount||0}}function Jdu(u,e){const a=Kdu(e);return{resourceSpans:Zdu(u,a)}}function Udu(u){const e=new Map;for(const a of u){let t=e.get(a.resource);t||(t=new Map,e.set(a.resource,t));const r=`${a.instrumentationScope.name}@${a.instrumentationScope.version||""}:${a.instrumentationScope.schemaUrl||""}`;let n=t.get(r);n||(n=[],t.set(r,n)),n.push(a)}return e}function Zdu(u,e){const a=Udu(u),t=[],r=a.entries();let n=r.next();for(;!n.done;){const[i,o]=n.value,s=[],l=o.values();let c=l.next();for(;!c.done;){const E=c.value;if(E.length>0){const p=E.map(x=>Hdu(x,e));s.push({scope:Gdu(E[0].instrumentationScope),spans:p,schemaUrl:E[0].instrumentationScope.schemaUrl})}c=l.next()}const d={resource:Vdu(i),scopeSpans:s,schemaUrl:void 0};t.push(d),n=r.next()}return t}const Qdu={serializeRequest:u=>{const e=Jdu(u,{});return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:u=>{if(u.length===0)return{};const e=new TextDecoder;return JSON.parse(e.decode(u))}},Ydu=5,Xdu=1e3,eEu=5e3,uEu=1.5,Vj=.2;function aEu(){return Math.random()*(2*Vj)-Vj}class tEu{_transport;constructor(e){this._transport=e}retry(e,a,t){return new Promise((r,n)=>{setTimeout(()=>{this._transport.send(e,a).then(r,n)},t)})}async send(e,a){const t=Date.now()+a;let r=await this._transport.send(e,a),n=Ydu,i=Xdu;for(;r.status==="retryable"&&n>0;){n--;const o=Math.max(Math.min(i,eEu)+aEu(),0);i=i*uEu;const s=r.retryInMillis??o,l=t-Date.now();if(s>l)return r;r=await this.retry(e,l,s)}return r}shutdown(){return this._transport.shutdown()}}function NJ(u){return new tEu(u.transport)}function rEu(u){return[429,502,503,504].includes(u)}function nEu(u){if(u==null)return;const e=Number.parseInt(u,10);if(Number.isInteger(e))return e>0?e*1e3:-1;const a=new Date(u).getTime()-Date.now();return a>=0?a:0}class iEu{_parameters;constructor(e){this._parameters=e}send(e,a){return new Promise(t=>{const r=new XMLHttpRequest;r.timeout=a,r.open("POST",this._parameters.url);const n=this._parameters.headers();Object.entries(n).forEach(([i,o])=>{r.setRequestHeader(i,o)}),r.ontimeout=i=>{t({status:"failure",error:new Error("XHR request timed out")})},r.onreadystatechange=()=>{r.status>=200&&r.status<=299?(Gu.debug("XHR success"),t({status:"success"})):r.status&&rEu(r.status)?t({status:"retryable",retryInMillis:nEu(r.getResponseHeader("Retry-After"))}):r.status!==0&&t({status:"failure",error:new Error("XHR request failed with non-retryable status")})},r.onabort=()=>{t({status:"failure",error:new Error("XHR request aborted")})},r.onerror=()=>{t({status:"failure",error:new Error("XHR request errored")})},r.send(e)})}shutdown(){}}function oEu(u){return new iEu(u)}class sEu{_params;constructor(e){this._params=e}send(e){return new Promise(a=>{navigator.sendBeacon(this._params.url,new Blob([e],{type:this._params.blobType}))?(Gu.debug("SendBeacon success"),a({status:"success"})):a({status:"failure",error:new Error("SendBeacon failed")})})}shutdown(){}}function lEu(u){return new sEu(u)}function cEu(u,e){return jJ(u,e,NJ({transport:oEu(u)}))}function dEu(u,e){return jJ(u,e,NJ({transport:lEu({url:u.url,blobType:u.headers()["Content-Type"]})}))}function EEu(u){return()=>{const e={};return Object.entries(u?.()??{}).forEach(([a,t])=>{typeof t<"u"?e[a]=String(t):Gu.warn(`Header "${a}" has invalid value (${t}) and will be ignored`)}),e}}function pEu(u,e,a){const t={...a()},r={};return()=>(e!=null&&Object.assign(r,e()),u!=null&&Object.assign(r,u()),Object.assign(r,t))}function mEu(u){if(u!=null)try{return new URL(u),u}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${u}'`)}}function hEu(u,e,a){return{...Sdu(u,e,a),headers:pEu(EEu(u.headers),e.headers,a.headers),url:mEu(u.url)??e.url??a.url,agentOptions:u.agentOptions??e.agentOptions??a.agentOptions}}function xEu(u,e){return{...zdu(),headers:()=>u,url:"http://localhost:4318/"+e,agentOptions:{keepAlive:!0}}}function DEu(u,e,a){return hEu({url:u.url,timeoutMillis:u.timeoutMillis,headers:Bdu(u.headers),concurrencyLimit:u.concurrencyLimit},{},xEu(a,e))}function fEu(u,e,a,t){const r=!!u.headers||typeof navigator.sendBeacon!="function",n=DEu(u,a,t);return r?cEu(n,e):dEu(n,e)}class gEu extends Fdu{constructor(e={}){super(fEu(e,Qdu,"v1/traces",{"Content-Type":"application/json"}))}}class _J{emit(e){}}const vEu=new _J;class kEu{getLogger(e,a,t){return new _J}}const LJ=new kEu;class bEu{constructor(e,a,t,r){this._provider=e,this.name=a,this.version=t,this.options=r}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):vEu}}class Gj{getLogger(e,a,t){var r;return(r=this.getDelegateLogger(e,a,t))!==null&&r!==void 0?r:new bEu(this,e,a,t)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:LJ}setDelegate(e){this._delegate=e}getDelegateLogger(e,a,t){var r;return(r=this._delegate)===null||r===void 0?void 0:r.getLogger(e,a,t)}}const yEu=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},ph=Symbol.for("io.opentelemetry.js.api.logs"),y4=yEu;function CEu(u,e,a){return t=>t===u?e:a}const Hj=1;class pA{constructor(){this._proxyLoggerProvider=new Gj}static getInstance(){return this._instance||(this._instance=new pA),this._instance}setGlobalLoggerProvider(e){return y4[ph]?this.getLoggerProvider():(y4[ph]=CEu(Hj,e,LJ),this._proxyLoggerProvider.setDelegate(e),e)}getLoggerProvider(){var e,a;return(a=(e=y4[ph])===null||e===void 0?void 0:e.call(y4,Hj))!==null&&a!==void 0?a:this._proxyLoggerProvider}getLogger(e,a,t){return this.getLoggerProvider().getLogger(e,a,t)}disable(){delete y4[ph],this._proxyLoggerProvider=new Gj}}const FEu=pA.getInstance();function AEu(u,e,a,t){for(let r=0,n=u.length;r<n;r++){const i=u[r];e&&i.setTracerProvider(e),a&&i.setMeterProvider(a),t&&i.setLoggerProvider&&i.setLoggerProvider(t),i.getConfig().enabled||i.enable()}}function BEu(u){u.forEach(e=>e.disable())}function SEu(u){const e=u.tracerProvider||O0.getTracerProvider(),a=u.meterProvider||Wcu.getMeterProvider(),t=u.loggerProvider||FEu.getLoggerProvider(),r=u.instrumentations?.flat()??[];return AEu(r,e,a,t),()=>{BEu(r)}}class zEu{span=void 0;constructor(e){this.span=e}get context(){return this.span?.context}error(e){this.span&&(this.span.setStatus(qd.ERROR,e.message),this.span.recordException(e),this.span.end())}setAttribute(e,a){this.span&&this.span.setAttribute(e,a)}end(){this.span&&(this.span.setStatus(qd.OK),this.span.end())}}class wEu{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 a=e.time?new Date(e.time):new Date;this.tracer.startSpan(`event.${e.type}`,{attributes:this.processAttributes(e,a),startTime:a}).end(a)}catch(a){this.config?.isProd||console.error("Event reporting failed:",a)}}processAttributes(e,a){const r={"cloudevents.event_id":G5(),"cloudevents.event_type":e.type,"cloudevents.event_source":e.source,"cloudevents.event_spec_version":e.specversion,"cloudevents.event_data_content_type":e.datacontenttype||"application/json; charset=utf-8","cloudevents.event_time":a.toISOString(),"cloudevents.event_subject":e.subject??"","cloudevents.page.uri":location.href,"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};if(e.data&&typeof e.data=="object"&&Object.entries(e.data).forEach(([n,i])=>{const o=n.replace(/([A-Z])/g,"_$1").toLowerCase();i!==void 0&&(r[`cloudevents.event_data.${o}`]=i)}),"subjects"in e&&Array.isArray(e.subjects)){const n=e.subjects.reduce((i,o)=>{if(!o||typeof o!="object")return i;const s=o.object;if(!s||typeof s!="string")return i;const l=i.notUpdated.find(({object:c})=>c===s);return l?(i.updated=[l,o],i.notUpdated=i.notUpdated.filter(({object:c})=>c!==s)):i.updated.some(({object:c})=>c===s)||i.notUpdated.push(o),i},{updated:[],notUpdated:[]});n.updated.forEach((i,o)=>{const s=o===0?"after.":"before.",l=`${i.object}.`;Object.entries(i).forEach(([c,d])=>{d!==void 0&&(r[`cloudevents.subjects.${s}${l}${c}`]=d)})}),n.notUpdated.forEach(i=>{const o=`${i.object}.`;Object.entries(i).forEach(([s,l])=>{l!==void 0&&(r[`cloudevents.subjects.${o}${s}`]=l)})})}return Object.entries(e).forEach(([n,i])=>{["id","source","type","specversion","time","datacontenttype","data","subject","sourceDetails","analyticsMetadata","context"].includes(n)||i!==void 0&&(i instanceof Object?Object.entries(i).forEach(([o,s])=>{s!==void 0&&(r[`cloudevents.${n}.${o}`]=s)}):r[`cloudevents.${n}`]=i)}),r}startSpan(e,a){try{if(!this.tracer)return;let t;const r=e.time?new Date(e.time):new Date,n=this.tracer.startSpan(`event.${e.type}`,{attributes:this.processAttributes(e,r),root:!a},a);return a||(t=O0.setSpan(di.active(),n)),{end:()=>n.end(),setAttribute:(i,o)=>{n.setAttribute(`cloudevents.event_data.${this.getKeySnakeValue(i)}`,o)},setStatus:(i,o)=>n.setStatus({code:i,message:o}),parentCtx:t}}catch(t){this.config?.isProd||console.error("Event reporting failed:",t)}}startStepSpan(e){try{if(!this.tracer)return;const a=di.active(),t=e.time?new Date(e.time):new Date,r=this.tracer.startSpan(`event.${e.type}`,{attributes:this.processAttributes(e,t)},a),n=O0.setSpan(a,r);return{end:()=>r.end(),setAttribute:(i,o)=>{r.setAttribute(`cloudevents.event_data.${this.getKeySnakeValue(i)}`,o)},setStatus:(i,o)=>r.setStatus({code:i,message:o}),recordException:i=>r.recordException(i),context:n}}catch(a){this.config?.isProd||console.error("Event reporting failed:",a)}}traceStep(e){const a=this.startStepSpan(e);if(a)return new zEu(a)}async forceFlush(){return this.tracerProvider?.forceFlush()}getKeySnakeValue=e=>e.replace(/([A-Z])/g,"_$1").toLowerCase()}class OEu extends wEu{tracerProvider=null;tracer=null;initialized=!1;constructor(){super()}initTracer(e){if(!e.collectorUrl&&!e.collectorTraceUrl)return;const a=`ses_${G5()}`,t=wJ({[vJ]:e.serviceName,[f4u]:e.serviceVersion,session_id:a}),r=e.collectorTraceUrl||`${e.collectorUrl}/v1/traces`;this.tracerProvider=new Cdu({resource:t,spanProcessors:[new mdu(new gEu({url:r,headers:{}}))]}),this.tracer=this.tracerProvider.getTracer(e.tracerName),this.tracerProvider.register(),SEu({instrumentations:e.instrumentations??[]}),this.initialized=!0}}class PEu{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({organization:{id:"",slug:""},project:{id:"",slug:""},productType:"",sourceDetails:{user:"Anonymous",object:"user",uri:""},request:{source:""}}),this.otelClient=new OEu,this.tracer={traceStep:(e,a)=>{const t=this.constructCloudEvent(e,a);return this.otelClient.traceStep(t)}}}updateCloudEventData=e=>{this.config?.disabled||(this.useCloudEventData=e)};send(e,a){try{if(!this.config?.otel.isProd)return;const t=this.constructCloudEvent(e,a);this.sendToOtelService(t)}catch(t){this.config?.otel.isProd||console.error("Event reporting failed:",t)}}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.instrumentations||[]]}))}startSpan(e,a,t){if(this.config?.disabled)return;const r=this.constructCloudEvent(e,a);return this.otelClient.startSpan(r,t)}constructCloudEvent(e,a){const t=this.useCloudEventData();return{id:`evt_${G5()}`,type:e,source:t.request.source||"",specversion:"1.0",datacontenttype:"application/json",time:new Date().toISOString(),data:a,origin:"ui",sourceDetails:{id:t.sourceDetails.user||`usr_${G5()}`,object:t.sourceDetails.object||"user",uri:t.sourceDetails.uri||""},organization:t.organization,project:t.project,productType:t.productType}}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()}sendTabChangeMessage(e){this.send("tab.change",e)}sendButtonClickMessage(e){this.send("button.click",e)}sendChangeMessage(e){this.send("change",e)}sendContentCopyMessage(e){this.send("content.copy",e)}sendUrlClickMessage(e){this.send("url.click",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)}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)}}const jEu=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],IJ="https://cors.redocly.com/";function MEu(u,e,a){return e in u?Object.defineProperty(u,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):u[e]=a,u}function qj(u,e){var a=Object.keys(u);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(u);e&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(u,r).enumerable})),a.push.apply(a,t)}return a}function Wj(u){for(var e=1;e<arguments.length;e++){var a=arguments[e]!=null?arguments[e]:{};e%2?qj(Object(a),!0).forEach(function(t){MEu(u,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(a)):qj(Object(a)).forEach(function(t){Object.defineProperty(u,t,Object.getOwnPropertyDescriptor(a,t))})}return u}function dt(u){return"Minified Redux error #"+u+"; visit https://redux.js.org/Errors?code="+u+" for the full message or use the non-minified dev environment for full errors. "}var Jj=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),ck=function(){return Math.random().toString(36).substring(7).split("").join(".")},vo={INIT:"@@redux/INIT"+ck(),REPLACE:"@@redux/REPLACE"+ck(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+ck()}};function KJ(u){if(typeof u!="object"||u===null)return!1;for(var e=u;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(u)===e}function TEu(u){if(u===void 0)return"undefined";if(u===null)return"null";var e=typeof u;switch(e){case"boolean":case"string":case"number":case"symbol":case"function":return e}if(Array.isArray(u))return"array";if(NEu(u))return"date";if(REu(u))return"error";var a=$Eu(u);switch(a){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return a}return e.slice(8,-1).toLowerCase().replace(/\s/g,"")}function $Eu(u){return typeof u.constructor=="function"?u.constructor.name:null}function REu(u){return u instanceof Error||typeof u.message=="string"&&u.constructor&&typeof u.constructor.stackTraceLimit=="number"}function NEu(u){return u instanceof Date?!0:typeof u.toDateString=="function"&&typeof u.getDate=="function"&&typeof u.setDate=="function"}function ao(u){var e=typeof u;return process.env.NODE_ENV!=="production"&&(e=TEu(u)),e}function ig(u,e,a){var t;if(typeof e=="function"&&typeof a=="function"||typeof a=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?dt(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 a>"u"&&(a=e,e=void 0),typeof a<"u"){if(typeof a!="function")throw new Error(process.env.NODE_ENV==="production"?dt(1):"Expected the enhancer to be a function. Instead, received: '"+ao(a)+"'");return a(ig)(u,e)}if(typeof u!="function")throw new Error(process.env.NODE_ENV==="production"?dt(2):"Expected the root reducer to be a function. Instead, received: '"+ao(u)+"'");var r=u,n=e,i=[],o=i,s=!1;function l(){o===i&&(o=i.slice())}function c(){if(s)throw new Error(process.env.NODE_ENV==="production"?dt(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 n}function d(m){if(typeof m!="function")throw new Error(process.env.NODE_ENV==="production"?dt(4):"Expected the listener to be a function. Instead, received: '"+ao(m)+"'");if(s)throw new Error(process.env.NODE_ENV==="production"?dt(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 g=!0;return l(),o.push(m),function(){if(g){if(s)throw new Error(process.env.NODE_ENV==="production"?dt(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.");g=!1,l();var f=o.indexOf(m);o.splice(f,1),i=null}}}function E(m){if(!KJ(m))throw new Error(process.env.NODE_ENV==="production"?dt(7):"Actions must be plain objects. Instead, the actual type was: '"+ao(m)+"'. 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 m.type>"u")throw new Error(process.env.NODE_ENV==="production"?dt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(s)throw new Error(process.env.NODE_ENV==="production"?dt(9):"Reducers may not dispatch actions.");try{s=!0,n=r(n,m)}finally{s=!1}for(var g=i=o,h=0;h<g.length;h++){var f=g[h];f()}return m}function p(m){if(typeof m!="function")throw new Error(process.env.NODE_ENV==="production"?dt(10):"Expected the nextReducer to be a function. Instead, received: '"+ao(m));r=m,E({type:vo.REPLACE})}function x(){var m,g=d;return m={subscribe:function(f){if(typeof f!="object"||f===null)throw new Error(process.env.NODE_ENV==="production"?dt(11):"Expected the observer to be an object. Instead, received: '"+ao(f)+"'");function k(){f.next&&f.next(c())}k();var y=g(k);return{unsubscribe:y}}},m[Jj]=function(){return this},m}return E({type:vo.INIT}),t={dispatch:E,subscribe:d,getState:c,replaceReducer:p},t[Jj]=x,t}var _Eu=ig;function Iy(u){typeof console<"u"&&typeof console.error=="function"&&console.error(u);try{throw new Error(u)}catch{}}function LEu(u,e,a,t){var r=Object.keys(e),n=a&&a.type===vo.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(r.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(!KJ(u))return"The "+n+' has unexpected type of "'+ao(u)+'". Expected argument to be an object with the following '+('keys: "'+r.join('", "')+'"');var i=Object.keys(u).filter(function(o){return!e.hasOwnProperty(o)&&!t[o]});if(i.forEach(function(o){t[o]=!0}),!(a&&a.type===vo.REPLACE)&&i.length>0)return"Unexpected "+(i.length>1?"keys":"key")+" "+('"'+i.join('", "')+'" found in '+n+". ")+"Expected to find one of the known reducer keys instead: "+('"'+r.join('", "')+'". Unexpected keys will be ignored.')}function IEu(u){Object.keys(u).forEach(function(e){var a=u[e],t=a(void 0,{type:vo.INIT});if(typeof t>"u")throw new Error(process.env.NODE_ENV==="production"?dt(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 a(void 0,{type:vo.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?dt(13):'The slice reducer for key "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle '"+vo.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 KEu(u){for(var e=Object.keys(u),a={},t=0;t<e.length;t++){var r=e[t];process.env.NODE_ENV!=="production"&&typeof u[r]>"u"&&Iy('No reducer provided for key "'+r+'"'),typeof u[r]=="function"&&(a[r]=u[r])}var n=Object.keys(a),i;process.env.NODE_ENV!=="production"&&(i={});var o;try{IEu(a)}catch(s){o=s}return function(l,c){if(l===void 0&&(l={}),o)throw o;if(process.env.NODE_ENV!=="production"){var d=LEu(l,a,c,i);d&&Iy(d)}for(var E=!1,p={},x=0;x<n.length;x++){var m=n[x],g=a[m],h=l[m],f=g(h,c);if(typeof f>"u"){var k=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?dt(14):"When called with an action of type "+(k?'"'+String(k)+'"':"(unknown type)")+', the slice reducer for key "'+m+'" 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.')}p[m]=f,E=E||f!==h}return E=E||n.length!==Object.keys(l).length,E?p:l}}function Uj(u,e){return function(){return e(u.apply(this,arguments))}}function VEu(u,e){if(typeof u=="function")return Uj(u,e);if(typeof u!="object"||u===null)throw new Error(process.env.NODE_ENV==="production"?dt(16):"bindActionCreators expected an object or a function, but instead received: '"+ao(u)+`'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?`);var a={};for(var t in u){var r=u[t];typeof r=="function"&&(a[t]=Uj(r,e))}return a}function VJ(){for(var u=arguments.length,e=new Array(u),a=0;a<u;a++)e[a]=arguments[a];return e.length===0?function(t){return t}:e.length===1?e[0]:e.reduce(function(t,r){return function(){return t(r.apply(void 0,arguments))}})}function GEu(){for(var u=arguments.length,e=new Array(u),a=0;a<u;a++)e[a]=arguments[a];return function(t){return function(){var r=t.apply(void 0,arguments),n=function(){throw new Error(process.env.NODE_ENV==="production"?dt(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},i={getState:r.getState,dispatch:function(){return n.apply(void 0,arguments)}},o=e.map(function(s){return s(i)});return n=VJ.apply(void 0,o)(r.dispatch),Wj(Wj({},r),{},{dispatch:n})}}}function Zj(){}process.env.NODE_ENV!=="production"&&typeof Zj.name=="string"&&Zj.name!=="isCrushed"&&Iy('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 HEu=Object.freeze({__proto__:null,__DO_NOT_USE__ActionTypes:vo,applyMiddleware:GEu,bindActionCreators:VEu,combineReducers:KEu,compose:VJ,createStore:ig,legacy_createStore:_Eu});function qEu(u){var e=u.default;if(typeof e=="function"){var a=function(){return e.apply(this,arguments)};a.prototype=e.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(u).forEach(function(t){var r=Object.getOwnPropertyDescriptor(u,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:function(){return u[t]}})}),a}var WEu=qEu(HEu);WEu.compose;var JEu=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(u){return u}};function UEu(u,e,a){var t=!1,r=!1,n=ig(function(o,s){if(!r){var l=function(g){return Array.isArray(g)&&g.findIndex(function(h){return typeof h!="string"&&typeof h!="number"})===-1};if(s.type.startsWith("SET")){var c=function(g){try{t=!0,"value"in s?g.set(s.value):g.set(lu)}finally{t=!1}};if(s.path){if(l(s.path)){s.path.length===0&&c(u);for(var d=u,E=!0,p=0,x=s.path;p<x.length;p++){var m=x[p];d[m]?d=d[m]:E=!1}E&&c(d)}}else c(u)}else s.type==="BREAKPOINT"&&a()}return u.promised||u.error?lu:u.get({noproxy:!0})},JEu({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}})),i=function(o,s){if(t)s&&s();else try{r=!0,n.dispatch(o)}finally{r=!1}};return i}function ZEu(u){return function(){var e,a,t=!1;return{onInit:function(r,n){if(!(typeof window>"u"||!("__REDUX_DEVTOOLS_EXTENSION__"in window))){if(u?.key===void 0){if(n.identifier===void 0)throw Error("State is missing Identifiable extension or Devtools key option");e=n.identifier(r)}else e=u.key;a=UEu(r,e,function(){t=!t}),r.promise||a?.({type:"CREATE",state:r.get({noproxy:!0,stealth:!0})})}},onSet:function(r,n){if(a?.({type:"SET [".concat(r.path.join("/"),"]"),state:r.get({noproxy:!0,stealth:!0}),descriptor:n}),t)debugger},onDestroy:function(){a?.({type:"DESTROY"})}}}}var Nu=(u=>(u.Normal="Normal",u.Edit="Edit",u.Draft="Draft",u))(Nu||{});const RE="default",GJ=[{name:RE,inputs:[],servers:[],state:Nu.Normal}],HJ={activeTabIdx:0,tabs:[]};var Ur=(u=>(u.Idle="idle",u.Loading="loading",u.Success="success",u.Error="error",u))(Ur||{});function Ei(u){const e=new WeakMap;function a(t){if(typeof t!="object"||t===null)return t;if(e.has(t))return e.get(t);const r=Array.isArray(t)?[]:{};e.set(t,r);for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=a(t[n]));return r}return a(u)}function Qj(u){return Object.keys(u).forEach(e=>{u[e]===void 0&&delete u[e]}),u}const mn={FS:"fs",WEB:"web"},hn=window.__TAURI__?.http.fetch??globalThis.fetch;function Cc(){return!!window?.__TAURI__}function vx(u){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(u)}function Z5(u){return u.endsWith("/")?u.substring(0,u.length-1):u}function QEu(u){return u.startsWith("/")?u.substring(1):u}function YEu(u){try{const e=new URL(u);return e.search="",e.hash="",e.toString()}catch{return u}}function qJ(u){return/^https?:\/\//i.test(u)}function XEu(u,e){let a;if(e.startsWith("//")){const{protocol:t}=new URL(u);a=`${t||"https:"}${e}`}else if(vx(e))a=e;else if(!e.startsWith("/"))a=Z5(u)+"/"+e;else{const t=new URL(u);t.pathname=e,a=t.toString()}return Z5(a)}function Q5(u,e){let a=u;return e.forEach(({key:t,value:r,active:n})=>{r&&n&&(a=a.replaceAll(`{${t}}`,r))}),a}function mA(u,e){let a=u;return e.forEach(({name:t,value:r})=>{r&&(a=a.replaceAll(`{${t}}`,r))}),a}function e3u(u){return u.startsWith("http://")||u.startsWith("https://")}function mh({url:u,serverUrl:e,corsProxyUrl:a}){const t=e3u(u)||!e?u:`${Z5(e)}/${QEu(u)}`;return a?`${a}${t}`:t}class Yj{constructor(e){this.baseDir=e}async ls(e=""){const a=this.makeKey(e);return Object.keys(localStorage).filter(t=>t.startsWith(a)).map(t=>t.replace(a,""))}async get(e){const a=this.makeKey(e);return localStorage.getItem(a)??null}async set(e,a){const t=this.makeKey(e);localStorage.setItem(t,a)}async remove(e){const a=this.makeKey(e);localStorage.removeItem(a)}makeKey(e){return`replay:fs:${this.baseDir}/${e}`}}class u3u{baseDir="";async ls(e=""){return[]}async get(e){return null}async set(e,a){}async remove(e){}}async function u0(u,e={},a){return window.__TAURI_INTERNALS__.invoke(u,e,a)}var Y5;(function(u){u[u.Audio=1]="Audio",u[u.Cache=2]="Cache",u[u.Config=3]="Config",u[u.Data=4]="Data",u[u.LocalData=5]="LocalData",u[u.Document=6]="Document",u[u.Download=7]="Download",u[u.Picture=8]="Picture",u[u.Public=9]="Public",u[u.Video=10]="Video",u[u.Resource=11]="Resource",u[u.Temp=12]="Temp",u[u.AppConfig=13]="AppConfig",u[u.AppData=14]="AppData",u[u.AppLocalData=15]="AppLocalData",u[u.AppCache=16]="AppCache",u[u.AppLog=17]="AppLog",u[u.Desktop=18]="Desktop",u[u.Executable=19]="Executable",u[u.Font=20]="Font",u[u.Home=21]="Home",u[u.Runtime=22]="Runtime",u[u.Template=23]="Template"})(Y5||(Y5={}));async function a3u(){return u0("plugin:path|resolve_directory",{directory:Y5.AppData})}async function t3u(){return u0("plugin:path|resolve_directory",{directory:Y5.Desktop})}function WJ(){return window.__TAURI_INTERNALS__.plugins.path.sep}async function r3u(...u){return u0("plugin:path|resolve",{paths:u})}async function md(...u){return u0("plugin:path|join",{paths:u})}async function n3u(u){return u0("plugin:path|extname",{path:u})}async function JJ(u,e){return u0("plugin:path|basename",{path:u,ext:e})}async function i3u(u){return u0("plugin:path|is_absolute",{path:u})}var Xj;(function(u){u[u.Start=0]="Start",u[u.Current=1]="Current",u[u.End=2]="End"})(Xj||(Xj={}));async function eM(u,e){if(u instanceof URL&&u.protocol!=="file:")throw new TypeError("Must be a file URL.");await u0("plugin:fs|mkdir",{path:u instanceof URL?u.toString():u,options:e})}async function UJ(u,e){if(u instanceof URL&&u.protocol!=="file:")throw new TypeError("Must be a file URL.");return await u0("plugin:fs|read_dir",{path:u instanceof URL?u.toString():u,options:e})}async function o3u(u,e){if(u instanceof URL&&u.protocol!=="file:")throw new TypeError("Must be a file URL.");const a=await u0("plugin:fs|read_file",{path:u instanceof URL?u.toString():u,options:e});return a instanceof ArrayBuffer?new Uint8Array(a):Uint8Array.from(a)}async function hA(u,e){if(u instanceof URL&&u.protocol!=="file:")throw new TypeError("Must be a file URL.");return await u0("plugin:fs|read_text_file",{path:u instanceof URL?u.toString():u,options:e})}async function s3u(u,e){if(u instanceof URL&&u.protocol!=="file:")throw new TypeError("Must be a file URL.");await u0("plugin:fs|remove",{path:u instanceof URL?u.toString():u,options:e})}async function l3u(u,e,a){if(u instanceof URL&&u.protocol!=="file:")throw new TypeError("Must be a file URL.");await u0("plugin:fs|write_text_file",{path:u instanceof URL?u.toString():u,data:e,options:a})}async function ZJ(u,e){if(u instanceof URL&&u.protocol!=="file:")throw new TypeError("Must be a file URL.");return await u0("plugin:fs|exists",{path:u instanceof URL?u.toString():u,options:e})}class za{static utils=null;static async getUtils(){return za.utils||(za.utils=Cc()?await Promise.resolve().then(()=>require("./replay-tauri-path-CA8WCQAS.js")):await Promise.resolve().then(()=>nne)),za.utils}static async join(...e){return(await za.getUtils()).join(...e)}static async resolve(e){return(await za.getUtils()).resolve(e)}static async isAbsolute(e){return(await za.getUtils()).isAbsolute(e)}static async relative(e,a){return(await za.getUtils()).relative(e,a)}static async extname(e){return(await za.getUtils()).extname(e)}}const c3u=new Set(["node_modules"]);class uM{constructor(e){this.baseDir=e,this.initializeDirectory(e)}async initializeDirectory(e){await eM(e,{recursive:!0})}async ls(e){const a=await this.getFullPath(e);return this.getDirEntryFilesRecursively(a)}async getDirEntryFilesRecursively(e){try{const a=[],t=await UJ(e);for(const r of t)if(r.isDirectory){if(c3u.has(r.name))continue;const n=await md(e,r.name),i=await this.getDirEntryFilesRecursively(n);a.push(...i)}else{const n=await md(e,r.name),i=await za.relative(this.baseDir,n);a.push(i)}return a}catch(a){return a.includes("forbidden path")||console.error(a),[]}}async get(e){const a=await this.getFullPath(e);try{return await hA(a)}catch(t){return!t.includes("No such file or directory")&&!t.includes("forbidden path")&&console.error(t),null}}async set(e,a){const t=await this.getFullPath(e),r=WJ(),n=t.split(r).slice(0,-1).join(r);await eM(n,{recursive:!0}),await l3u(t,a)}async remove(e){const a=await this.getFullPath(e);try{await s3u(a)}catch(t){!t.includes("No such file or directory")&&!t.includes("forbidden path")&&console.error(t)}}async getFullPath(e){return await md(this.baseDir,e??"")}}class d3u{constructor(e){this.projectId=e}async get(){const e=this.getKey();return localStorage.getItem(e)??null}async set(e){const a=this.getKey();localStorage.setItem(a,e)}async remove(){const e=this.getKey();localStorage.removeItem(e)}getKey(){return`replay:secrets:${this.projectId}`}}class QJ{constructor(e){this.storage=e}itemIds=[];async parseMany(e,a){const r=(await Promise.all(e.map(async n=>{try{return await this.parse(n,a)}catch(i){return console.error(`Error parsing from ${n.type} ${n.uri}:`,i),null}}))).filter(n=>n!==null);return this.itemIds=r.map(n=>n.id),r}async write(e){e.state===Nu.Draft||e.srcType!==mn.FS||await this.storage.set(e.id,await this.stringify(e))}async remove(e){await this.storage.remove(e)}async updateRoot(e,a){const t=e.actions;if(t){for(const n in t){const i=parseInt(n);switch(t[n]){case"D":await this.remove(this.itemIds[i]);break;case"I":case"U":await this.write(a[i]);break}}return}const r=this.itemIds.filter(n=>!a.some(i=>i.id===n));await Promise.all([...a.map(n=>this.write(n)),...r.map(n=>this.remove(n))])}async update(e,a){const r={path:e.path.slice(1),actions:e.actions};if(r.path.length===0&&await this.updateRoot(r,a),r.path.length>0){const n=r.path[0];r.path.length===1&&r.actions&&r.actions.id==="U"&&await this.remove(this.itemIds[n]),r.path[1]&&r.path[1]==="id"&&await this.remove(this.itemIds[n]),await this.write(a[n])}this.itemIds=a.map(n=>n.id)}}class E3u extends QJ{parse(e){return{...e.content,id:e.uri,srcType:e.type}}async stringify(e){const{id:a,srcType:t,...r}=e;return await za.extname(a)===".json"?JSON.stringify(r,null,2):gi.dump(r)}}var wt=(u=>(u.SIMPLE="simple",u.REGEX="regex",u.JSONPATH="jsonpath",u.XPATH="xpath",u))(wt||{});const YJ=1024;let p3u=0,U0=class{constructor(e,a){this.from=e,this.to=a}};class vu{constructor(e={}){this.id=p3u++,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=Zt.match(e)),a=>{let t=e(a);return t===void 0?null:[this,t]}}}vu.closedBy=new vu({deserialize:u=>u.split(" ")});vu.openedBy=new vu({deserialize:u=>u.split(" ")});vu.group=new vu({deserialize:u=>u.split(" ")});vu.isolate=new vu({deserialize:u=>{if(u&&u!="rtl"&&u!="ltr"&&u!="auto")throw new RangeError("Invalid value for isolate: "+u);return u||"auto"}});vu.contextHash=new vu({perNode:!0});vu.lookAhead=new vu({perNode:!0});vu.mounted=new vu({perNode:!0});class Wd{constructor(e,a,t){this.tree=e,this.overlay=a,this.parser=t}static get(e){return e&&e.props&&e.props[vu.mounted.id]}}const m3u=Object.create(null);class Zt{constructor(e,a,t,r=0){this.name=e,this.props=a,this.id=t,this.flags=r}static define(e){let a=e.props&&e.props.length?Object.create(null):m3u,t=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new Zt(e.name||"",a,e.id,t);if(e.props){for(let n of e.props)if(Array.isArray(n)||(n=n(r)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");a[n[0].id]=n[1]}}return r}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 a=this.prop(vu.group);return a?a.indexOf(e)>-1:!1}return this.id==e}static match(e){let a=Object.create(null);for(let t in e)for(let r of t.split(" "))a[r]=e[t];return t=>{for(let r=t.prop(vu.group),n=-1;n<(r?r.length:0);n++){let i=a[n<0?t.name:r[n]];if(i)return i}}}}Zt.none=new Zt("",Object.create(null),0,8);class xA{constructor(e){this.types=e;for(let a=0;a<e.length;a++)if(e[a].id!=a)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let a=[];for(let t of this.types){let r=null;for(let n of e){let i=n(t);i&&(r||(r=Object.assign({},t.props)),r[i[0].id]=i[1])}a.push(r?new Zt(t.name,r,t.id,t.flags):t)}return new xA(a)}}const hh=new WeakMap,aM=new WeakMap;var Ea;(function(u){u[u.ExcludeBuffers=1]="ExcludeBuffers",u[u.IncludeAnonymous=2]="IncludeAnonymous",u[u.IgnoreMounts=4]="IgnoreMounts",u[u.IgnoreOverlays=8]="IgnoreOverlays"})(Ea||(Ea={}));let Va=class Ky{constructor(e,a,t,r,n){if(this.type=e,this.children=a,this.positions=t,this.length=r,this.props=null,n&&n.length){this.props=Object.create(null);for(let[i,o]of n)this.props[typeof i=="number"?i:i.id]=o}}toString(){let e=Wd.get(this);if(e&&!e.overlay)return e.tree.toString();let a="";for(let t of this.children){let r=t.toString();r&&(a&&(a+=","),a+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(a.length?"("+a+")":""):a}cursor(e=0){return new X5(this.topNode,e)}cursorAt(e,a=0,t=0){let r=hh.get(this)||this.topNode,n=new X5(r);return n.moveTo(e,a),hh.set(this,n._tree),n}get topNode(){return new ur(this,0,0,null)}resolve(e,a=0){let t=Jd(hh.get(this)||this.topNode,e,a,!1);return hh.set(this,t),t}resolveInner(e,a=0){let t=Jd(aM.get(this)||this.topNode,e,a,!0);return aM.set(this,t),t}resolveStack(e,a=0){return D3u(this,e,a)}iterate(e){let{enter:a,leave:t,from:r=0,to:n=this.length}=e,i=e.mode||0,o=(i&Ea.IncludeAnonymous)>0;for(let s=this.cursor(i|Ea.IncludeAnonymous);;){let l=!1;if(s.from<=n&&s.to>=r&&(!o&&s.type.isAnonymous||a(s)!==!1)){if(s.firstChild())continue;l=!0}for(;l&&t&&(o||!s.type.isAnonymous)&&t(s),!s.nextSibling();){if(!s.parent())return;l=!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 a in this.props)e.push([+a,this.props[a]]);return e}balance(e={}){return this.children.length<=8?this:gA(Zt.none,this.children,this.positions,0,this.children.length,0,this.length,(a,t,r)=>new Ky(this.type,a,t,r,this.propValues),e.makeTree||((a,t,r)=>new Ky(Zt.none,a,t,r)))}static build(e){return f3u(e)}};Va.empty=new Va(Zt.none,[],[],0);class DA{constructor(e,a){this.buffer=e,this.index=a}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 DA(this.buffer,this.index)}}class Bo{constructor(e,a,t){this.buffer=e,this.length=a,this.set=t}get type(){return Zt.none}toString(){let e=[];for(let a=0;a<this.buffer.length;)e.push(this.childString(a)),a=this.buffer[a+3];return e.join(",")}childString(e){let a=this.buffer[e],t=this.buffer[e+3],r=this.set.types[a],n=r.name;if(/\W/.test(n)&&!r.isError&&(n=JSON.stringify(n)),e+=4,t==e)return n;let i=[];for(;e<t;)i.push(this.childString(e)),e=this.buffer[e+3];return n+"("+i.join(",")+")"}findChild(e,a,t,r,n){let{buffer:i}=this,o=-1;for(let s=e;s!=a&&!(XJ(n,r,i[s+1],i[s+2])&&(o=s,t>0));s=i[s+3]);return o}slice(e,a,t){let r=this.buffer,n=new Uint16Array(a-e),i=0;for(let o=e,s=0;o<a;){n[s++]=r[o++],n[s++]=r[o++]-t;let l=n[s++]=r[o++]-t;n[s++]=r[o++]-e,i=Math.max(i,l)}return new Bo(n,i,this.set)}}function XJ(u,e,a,t){switch(u){case-2:return a<e;case-1:return t>=e&&a<e;case 0:return a<e&&t>e;case 1:return a<=e&&t>e;case 2:return t>e;case 4:return!0}}function Jd(u,e,a,t){for(var r;u.from==u.to||(a<1?u.from>=e:u.from>e)||(a>-1?u.to<=e:u.to<e);){let i=!t&&u instanceof ur&&u.index<0?null:u.parent;if(!i)return u;u=i}let n=t?0:Ea.IgnoreOverlays;if(t)for(let i=u,o=i.parent;o;i=o,o=i.parent)i instanceof ur&&i.index<0&&((r=o.enter(e,a,n))===null||r===void 0?void 0:r.from)!=i.from&&(u=o);for(;;){let i=u.enter(e,a,n);if(!i)return u;u=i}}class eU{cursor(e=0){return new X5(this,e)}getChild(e,a=null,t=null){let r=tM(this,e,a,t);return r.length?r[0]:null}getChildren(e,a=null,t=null){return tM(this,e,a,t)}resolve(e,a=0){return Jd(this,e,a,!1)}resolveInner(e,a=0){return Jd(this,e,a,!0)}matchContext(e){return Vy(this.parent,e)}enterUnfinishedNodesBefore(e){let a=this.childBefore(e),t=this;for(;a;){let r=a.lastChild;if(!r||r.to!=a.to)break;r.type.isError&&r.from==r.to?(t=a,a=r.prevSibling):a=r}return t}get node(){return this}get next(){return this.parent}}let ur=class kx extends eU{constructor(e,a,t,r){super(),this._tree=e,this.from=a,this.index=t,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,a,t,r,n=0){for(let i=this;;){for(let{children:o,positions:s}=i._tree,l=a>0?o.length:-1;e!=l;e+=a){let c=o[e],d=s[e]+i.from;if(XJ(r,t,d,d+c.length)){if(c instanceof Bo){if(n&Ea.ExcludeBuffers)continue;let E=c.findChild(0,c.buffer.length,a,t-d,r);if(E>-1)return new nn(new h3u(i,c,e,d),null,E)}else if(n&Ea.IncludeAnonymous||!c.type.isAnonymous||fA(c)){let E;if(!(n&Ea.IgnoreMounts)&&(E=Wd.get(c))&&!E.overlay)return new kx(E.tree,d,e,i);let p=new kx(c,d,e,i);return n&Ea.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(a<0?c.children.length-1:0,a,t,r)}}}if(n&Ea.IncludeAnonymous||!i.type.isAnonymous||(i.index>=0?e=i.index+a:e=a<0?-1:i._parent._tree.children.length,i=i._parent,!i))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,a,t=0){let r;if(!(t&Ea.IgnoreOverlays)&&(r=Wd.get(this._tree))&&r.overlay){let n=e-this.from;for(let{from:i,to:o}of r.overlay)if((a>0?i<=n:i<n)&&(a<0?o>=n:o>n))return new kx(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,a,t)}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 tM(u,e,a,t){let r=u.cursor(),n=[];if(!r.firstChild())return n;if(a!=null){for(let i=!1;!i;)if(i=r.type.is(a),!r.nextSibling())return n}for(;;){if(t!=null&&r.type.is(t))return n;if(r.type.is(e)&&n.push(r.node),!r.nextSibling())return t==null?n:[]}}function Vy(u,e,a=e.length-1){for(let t=u;a>=0;t=t.parent){if(!t)return!1;if(!t.type.isAnonymous){if(e[a]&&e[a]!=t.name)return!1;a--}}return!0}class h3u{constructor(e,a,t,r){this.parent=e,this.buffer=a,this.index=t,this.start=r}}class nn extends eU{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,a,t){super(),this.context=e,this._parent=a,this.index=t,this.type=e.buffer.set.types[e.buffer.buffer[t]]}child(e,a,t){let{buffer:r}=this.context,n=r.findChild(this.index+4,r.buffer[this.index+3],e,a-this.context.start,t);return n<0?null:new nn(this.context,this,n)}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,a,t=0){if(t&Ea.ExcludeBuffers)return null;let{buffer:r}=this.context,n=r.findChild(this.index+4,r.buffer[this.index+3],a>0?1:-1,e-this.context.start,a);return n<0?null:new nn(this.context,this,n)}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,a=e.buffer[this.index+3];return a<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new nn(this.context,this._parent,a):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,a=this._parent?this._parent.index+4:0;return this.index==a?this.externalSibling(-1):new nn(this.context,this._parent,e.findChild(a,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],a=[],{buffer:t}=this.context,r=this.index+4,n=t.buffer[this.index+3];if(n>r){let i=t.buffer[this.index+1];e.push(t.slice(r,n,i)),a.push(0)}return new Va(this.type,e,a,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function uU(u){if(!u.length)return null;let e=0,a=u[0];for(let n=1;n<u.length;n++){let i=u[n];(i.from>a.from||i.to<a.to)&&(a=i,e=n)}let t=a instanceof ur&&a.index<0?null:a.parent,r=u.slice();return t?r[e]=t:r.splice(e,1),new x3u(r,a)}class x3u{constructor(e,a){this.heads=e,this.node=a}get next(){return uU(this.heads)}}function D3u(u,e,a){let t=u.resolveInner(e,a),r=null;for(let n=t instanceof ur?t:t.context.parent;n;n=n.parent)if(n.index<0){let i=n.parent;(r||(r=[t])).push(i.resolve(e,a)),n=i}else{let i=Wd.get(n.tree);if(i&&i.overlay&&i.overlay[0].from<=e&&i.overlay[i.overlay.length-1].to>=e){let o=new ur(i.tree,i.overlay[0].from+n.from,-1,n);(r||(r=[t])).push(Jd(o,e,a,!1))}}return r?uU(r):t}class X5{get name(){return this.type.name}constructor(e,a=0){if(this.mode=a,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof ur)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.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,a){this.index=e;let{start:t,buffer:r}=this.buffer;return this.type=a||r.set.types[r.buffer[e]],this.from=t+r.buffer[e+1],this.to=t+r.buffer[e+2],!0}yield(e){return e?e instanceof ur?(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,a,t){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,a,t,this.mode));let{buffer:r}=this.buffer,n=r.findChild(this.index+4,r.buffer[this.index+3],e,a-this.buffer.start,t);return n<0?!1:(this.stack.push(this.index),this.yieldBuf(n))}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,a,t=this.mode){return this.buffer?t&Ea.ExcludeBuffers?!1:this.enterChild(1,e,a):this.yield(this._tree.enter(e,a,t))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ea.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ea.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:a}=this.buffer,t=this.stack.length-1;if(e<0){let r=t<0?0:this.stack[t]+4;if(this.index!=r)return this.yieldBuf(a.findChild(r,this.index,-1,0,4))}else{let r=a.buffer[this.index+3];if(r<(t<0?a.buffer.length:a.buffer[this.stack[t]+3]))return this.yieldBuf(r)}return t<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 a,t,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let n=0;n<this.index;n++)if(r.buffer.buffer[n+3]<this.index)return!1;({index:a,parent:t}=r)}else({index:a,_parent:t}=this._tree);for(;t;{index:a,_parent:t}=t)if(a>-1)for(let n=a+e,i=e<0?-1:t._tree.children.length;n!=i;n+=e){let o=t._tree.children[n];if(this.mode&Ea.IncludeAnonymous||o instanceof Bo||!o.type.isAnonymous||fA(o))return!1}return!0}move(e,a){if(a&&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,a=0){for(;(this.from==this.to||(a<1?this.from>=e:this.from>e)||(a>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,a););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,a=null,t=0;if(e&&e.context==this.buffer)e:for(let r=this.index,n=this.stack.length;n>=0;){for(let i=e;i;i=i._parent)if(i.index==r){if(r==this.index)return i;a=i,t=n+1;break e}r=this.stack[--n]}for(let r=t;r<this.stack.length;r++)a=new nn(this.buffer,a,this.stack[r]);return this.bufferNode=new nn(this.buffer,a,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,a){for(let t=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){t++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&a&&a(this),r=this.type.isAnonymous,!t)return;if(this.nextSibling())break;this.parent(),t--,r=!0}}}matchContext(e){if(!this.buffer)return Vy(this.node.parent,e);let{buffer:a}=this.buffer,{types:t}=a.set;for(let r=e.length-1,n=this.stack.length-1;r>=0;n--){if(n<0)return Vy(this._tree,e,r);let i=t[a.buffer[this.stack[n]]];if(!i.isAnonymous){if(e[r]&&e[r]!=i.name)return!1;r--}}return!0}}function fA(u){return u.children.some(e=>e instanceof Bo||!e.type.isAnonymous||fA(e))}function f3u(u){var e;let{buffer:a,nodeSet:t,maxBufferLength:r=YJ,reused:n=[],minRepeatType:i=t.types.length}=u,o=Array.isArray(a)?new DA(a,a.length):a,s=t.types,l=0,c=0;function d(v,b,C,B,z,P){let{id:L,start:I,end:G,size:X}=o,U=c,ae=l;for(;X<0;)if(o.next(),X==-1){let T=n[L];C.push(T),B.push(I-v);return}else if(X==-3){l=L;return}else if(X==-4){c=L;return}else throw new RangeError(`Unrecognized record size: ${X}`);let Ee=s[L],re,he,j=I-v;if(G-I<=r&&(he=g(o.pos-b,z))){let T=new Uint16Array(he.size-he.skip),V=o.pos-he.size,O=T.length;for(;o.pos>V;)O=h(he.start,T,O);re=new Bo(T,G-he.start,t),j=he.start-v}else{let T=o.pos-X;o.next();let V=[],O=[],F=L>=i?L:-1,S=0,$=G;for(;o.pos>T;)F>=0&&o.id==F&&o.size>=0?(o.end<=$-r&&(x(V,O,I,S,o.end,$,F,U,ae),S=V.length,$=o.end),o.next()):P>2500?E(I,T,V,O):d(I,T,V,O,F,P+1);if(F>=0&&S>0&&S<V.length&&x(V,O,I,S,I,$,F,U,ae),V.reverse(),O.reverse(),F>-1&&S>0){let q=p(Ee,ae);re=gA(Ee,V,O,0,V.length,0,G-I,q,q)}else re=m(Ee,V,O,G-I,U-G,ae)}C.push(re),B.push(j)}function E(v,b,C,B){let z=[],P=0,L=-1;for(;o.pos>b;){let{id:I,start:G,end:X,size:U}=o;if(U>4)o.next();else{if(L>-1&&G<L)break;L<0&&(L=X-r),z.push(I,G,X),P++,o.next()}}if(P){let I=new Uint16Array(P*4),G=z[z.length-2];for(let X=z.length-3,U=0;X>=0;X-=3)I[U++]=z[X],I[U++]=z[X+1]-G,I[U++]=z[X+2]-G,I[U++]=U;C.push(new Bo(I,z[2]-G,t)),B.push(G-v)}}function p(v,b){return(C,B,z)=>{let P=0,L=C.length-1,I,G;if(L>=0&&(I=C[L])instanceof Va){if(!L&&I.type==v&&I.length==z)return I;(G=I.prop(vu.lookAhead))&&(P=B[L]+I.length+G)}return m(v,C,B,z,P,b)}}function x(v,b,C,B,z,P,L,I,G){let X=[],U=[];for(;v.length>B;)X.push(v.pop()),U.push(b.pop()+C-z);v.push(m(t.types[L],X,U,P-z,I-P,G)),b.push(z-C)}function m(v,b,C,B,z,P,L){if(P){let I=[vu.contextHash,P];L=L?[I].concat(L):[I]}if(z>25){let I=[vu.lookAhead,z];L=L?[I].concat(L):[I]}return new Va(v,b,C,B,L)}function g(v,b){let C=o.fork(),B=0,z=0,P=0,L=C.end-r,I={size:0,start:0,skip:0};e:for(let G=C.pos-v;C.pos>G;){let X=C.size;if(C.id==b&&X>=0){I.size=B,I.start=z,I.skip=P,P+=4,B+=4,C.next();continue}let U=C.pos-X;if(X<0||U<G||C.start<L)break;let ae=C.id>=i?4:0,Ee=C.start;for(C.next();C.pos>U;){if(C.size<0)if(C.size==-3)ae+=4;else break e;else C.id>=i&&(ae+=4);C.next()}z=Ee,B+=X,P+=ae}return(b<0||B==v)&&(I.size=B,I.start=z,I.skip=P),I.size>4?I:void 0}function h(v,b,C){let{id:B,start:z,end:P,size:L}=o;if(o.next(),L>=0&&B<i){let I=C;if(L>4){let G=o.pos-(L-4);for(;o.pos>G;)C=h(v,b,C)}b[--C]=I,b[--C]=P-v,b[--C]=z-v,b[--C]=B}else L==-3?l=B:L==-4&&(c=B);return C}let f=[],k=[];for(;o.pos>0;)d(u.start||0,u.bufferStart||0,f,k,-1,0);let y=(e=u.length)!==null&&e!==void 0?e:f.length?k[0]+f[0].length:0;return new Va(s[u.topID],f.reverse(),k.reverse(),y)}const rM=new WeakMap;function bx(u,e){if(!u.isAnonymous||e instanceof Bo||e.type!=u)return 1;let a=rM.get(e);if(a==null){a=1;for(let t of e.children){if(t.type!=u||!(t instanceof Va)){a=1;break}a+=bx(u,t)}rM.set(e,a)}return a}function gA(u,e,a,t,r,n,i,o,s){let l=0;for(let x=t;x<r;x++)l+=bx(u,e[x]);let c=Math.ceil(l*1.5/8),d=[],E=[];function p(x,m,g,h,f){for(let k=g;k<h;){let y=k,v=m[k],b=bx(u,x[k]);for(k++;k<h;k++){let C=bx(u,x[k]);if(b+C>=c)break;b+=C}if(k==y+1){if(b>c){let C=x[y];p(C.children,C.positions,0,C.children.length,m[y]+f);continue}d.push(x[y])}else{let C=m[k-1]+x[k-1].length-v;d.push(gA(u,x,m,y,k,v,C,null,s))}E.push(v+f-n)}}return p(e,a,t,r,0),(o||s)(d,E,i)}class aU{constructor(){this.map=new WeakMap}setBuffer(e,a,t){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(a,t)}getBuffer(e,a){let t=this.map.get(e);return t&&t.get(a)}set(e,a){e instanceof nn?this.setBuffer(e.context.buffer,e.index,a):e instanceof ur&&this.map.set(e.tree,a)}get(e){return e instanceof nn?this.getBuffer(e.context.buffer,e.index):e instanceof ur?this.map.get(e.tree):void 0}cursorSet(e,a){e.buffer?this.setBuffer(e.buffer.buffer,e.index,a):this.map.set(e.tree,a)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class pi{constructor(e,a,t,r,n=!1,i=!1){this.from=e,this.to=a,this.tree=t,this.offset=r,this.open=(n?1:0)|(i?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,a=[],t=!1){let r=[new pi(0,e.length,e,0,!1,t)];for(let n of a)n.to>e.length&&r.push(n);return r}static applyChanges(e,a,t=128){if(!a.length)return e;let r=[],n=1,i=e.length?e[0]:null;for(let o=0,s=0,l=0;;o++){let c=o<a.length?a[o]:null,d=c?c.fromA:1e9;if(d-s>=t)for(;i&&i.from<d;){let E=i;if(s>=E.from||d<=E.to||l){let p=Math.max(E.from,s)-l,x=Math.min(E.to,d)-l;E=p>=x?null:new pi(p,x,E.tree,E.offset+l,o>0,!!c)}if(E&&r.push(E),i.to>d)break;i=n<e.length?e[n++]:null}if(!c)break;s=c.toA,l=c.toA-c.toB}return r}}let tU=class{startParse(e,a,t){return typeof e=="string"&&(e=new g3u(e)),t=t?t.length?t.map(r=>new U0(r.from,r.to)):[new U0(0,0)]:[new U0(0,e.length)],this.createParse(e,a||[],t)}parse(e,a,t){let r=this.startParse(e,a,t);for(;;){let n=r.advance();if(n)return n}}};class g3u{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,a){return this.string.slice(e,a)}}function v3u(u){return(e,a,t,r)=>new b3u(e,u,a,t,r)}class nM{constructor(e,a,t,r,n){this.parser=e,this.parse=a,this.overlay=t,this.target=r,this.from=n}}function iM(u){if(!u.length||u.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(u))}class k3u{constructor(e,a,t,r,n,i,o){this.parser=e,this.predicate=a,this.mounts=t,this.index=r,this.start=n,this.target=i,this.prev=o,this.depth=0,this.ranges=[]}}const Gy=new vu({perNode:!0});class b3u{constructor(e,a,t,r,n){this.nest=a,this.input=t,this.fragments=r,this.ranges=n,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return this.stoppedAt!=null&&(t=new Va(t.type,t.children,t.positions,t.length,t.propValues.concat([[Gy,this.stoppedAt]]))),t}let e=this.inner[this.innerDone],a=e.parse.advance();if(a){this.innerDone++;let t=Object.assign(Object.create(null),e.target.props);t[vu.mounted.id]=new Wd(a,e.overlay,e.parser),e.target.props=t}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let a=this.innerDone;a<this.inner.length;a++)this.inner[a].from<e&&(e=Math.min(e,this.inner[a].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let a=this.innerDone;a<this.inner.length;a++)this.inner[a].parse.stopAt(e)}startInner(){let e=new F3u(this.fragments),a=null,t=null,r=new X5(new ur(this.baseTree,this.ranges[0].from,0,null),Ea.IncludeAnonymous|Ea.IgnoreMounts);e:for(let n,i;;){let o=!0,s;if(this.stoppedAt!=null&&r.from>=this.stoppedAt)o=!1;else if(e.hasNode(r)){if(a){let l=a.mounts.find(c=>c.frag.from<=r.from&&c.frag.to>=r.to&&c.mount.overlay);if(l)for(let c of l.mount.overlay){let d=c.from+l.pos,E=c.to+l.pos;d>=r.from&&E<=r.to&&!a.ranges.some(p=>p.from<E&&p.to>d)&&a.ranges.push({from:d,to:E})}}o=!1}else if(t&&(i=y3u(t.ranges,r.from,r.to)))o=i!=2;else if(!r.type.isAnonymous&&(n=this.nest(r,this.input))&&(r.from<r.to||!n.overlay)){r.tree||C3u(r);let l=e.findMounts(r.from,n.parser);if(typeof n.overlay=="function")a=new k3u(n.parser,n.overlay,l,this.inner.length,r.from,r.tree,a);else{let c=lM(this.ranges,n.overlay||(r.from<r.to?[new U0(r.from,r.to)]:[]));c.length&&iM(c),(c.length||!n.overlay)&&this.inner.push(new nM(n.parser,c.length?n.parser.startParse(this.input,cM(l,c),c):n.parser.startParse(""),n.overlay?n.overlay.map(d=>new U0(d.from-r.from,d.to-r.from)):null,r.tree,c.length?c[0].from:r.from)),n.overlay?c.length&&(t={ranges:c,depth:0,prev:t}):o=!1}}else if(a&&(s=a.predicate(r))&&(s===!0&&(s=new U0(r.from,r.to)),s.from<s.to)){let l=a.ranges.length-1;l>=0&&a.ranges[l].to==s.from?a.ranges[l]={from:a.ranges[l].from,to:s.to}:a.ranges.push(s)}if(o&&r.firstChild())a&&a.depth++,t&&t.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(a&&!--a.depth){let l=lM(this.ranges,a.ranges);l.length&&(iM(l),this.inner.splice(a.index,0,new nM(a.parser,a.parser.startParse(this.input,cM(a.mounts,l),l),a.ranges.map(c=>new U0(c.from-a.start,c.to-a.start)),a.target,l[0].from))),a=a.prev}t&&!--t.depth&&(t=t.prev)}}}}function y3u(u,e,a){for(let t of u){if(t.from>=a)break;if(t.to>e)return t.from<=e&&t.to>=a?2:1}return 0}function oM(u,e,a,t,r,n){if(e<a){let i=u.buffer[e+1];t.push(u.slice(e,a,i)),r.push(i-n)}}function C3u(u){let{node:e}=u,a=[],t=e.context.buffer;do a.push(u.index),u.parent();while(!u.tree);let r=u.tree,n=r.children.indexOf(t),i=r.children[n],o=i.buffer,s=[n];function l(c,d,E,p,x,m){let g=a[m],h=[],f=[];oM(i,c,g,h,f,p);let k=o[g+1],y=o[g+2];s.push(h.length);let v=m?l(g+4,o[g+3],i.set.types[o[g]],k,y-k,m-1):e.toTree();return h.push(v),f.push(k-p),oM(i,o[g+3],d,h,f,p),new Va(E,h,f,x)}r.children[n]=l(0,o.length,Zt.none,0,i.length,a.length-1);for(let c of s){let d=u.tree.children[c],E=u.tree.positions[c];u.yield(new ur(d,E+u.from,c,u._tree))}}class sM{constructor(e,a){this.offset=a,this.done=!1,this.cursor=e.cursor(Ea.IncludeAnonymous|Ea.IgnoreMounts)}moveTo(e){let{cursor:a}=this,t=e-this.offset;for(;!this.done&&a.from<t;)a.to>=e&&a.enter(t,1,Ea.IgnoreOverlays|Ea.ExcludeBuffers)||a.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 a=this.cursor.tree;;){if(a==e.tree)return!0;if(a.children.length&&a.positions[0]==0&&a.children[0]instanceof Va)a=a.children[0];else break}return!1}}let F3u=class{constructor(e){var a;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let t=this.curFrag=e[0];this.curTo=(a=t.tree.prop(Gy))!==null&&a!==void 0?a:t.to,this.inner=new sM(t.tree,-t.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 a=this.curFrag=this.fragments[this.fragI];this.curTo=(e=a.tree.prop(Gy))!==null&&e!==void 0?e:a.to,this.inner=new sM(a.tree,-a.offset)}}findMounts(e,a){var t;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let n=this.inner.cursor.node;n;n=n.parent){let i=(t=n.tree)===null||t===void 0?void 0:t.prop(vu.mounted);if(i&&i.parser==a)for(let o=this.fragI;o<this.fragments.length;o++){let s=this.fragments[o];if(s.from>=n.to)break;s.tree==this.curFrag.tree&&r.push({frag:s,pos:n.from-s.offset,mount:i})}}}return r}};function lM(u,e){let a=null,t=e;for(let r=1,n=0;r<u.length;r++){let i=u[r-1].to,o=u[r].from;for(;n<t.length;n++){let s=t[n];if(s.from>=o)break;s.to<=i||(a||(t=a=e.slice()),s.from<i?(a[n]=new U0(s.from,i),s.to>o&&a.splice(n+1,0,new U0(o,s.to))):s.to>o?a[n--]=new U0(o,s.to):a.splice(n--,1))}}return t}function A3u(u,e,a,t){let r=0,n=0,i=!1,o=!1,s=-1e9,l=[];for(;;){let c=r==u.length?1e9:i?u[r].to:u[r].from,d=n==e.length?1e9:o?e[n].to:e[n].from;if(i!=o){let E=Math.max(s,a),p=Math.min(c,d,t);E<p&&l.push(new U0(E,p))}if(s=Math.min(c,d),s==1e9)break;c==s&&(i?(i=!1,r++):i=!0),d==s&&(o?(o=!1,n++):o=!0)}return l}function cM(u,e){let a=[];for(let{pos:t,mount:r,frag:n}of u){let i=t+(r.overlay?r.overlay[0].from:0),o=i+r.tree.length,s=Math.max(n.from,i),l=Math.min(n.to,o);if(r.overlay){let c=r.overlay.map(E=>new U0(E.from+t,E.to+t)),d=A3u(e,c,s,l);for(let E=0,p=s;;E++){let x=E==d.length,m=x?l:d[E].from;if(m>p&&a.push(new pi(p,m,r.tree,-i,n.from>=p||n.openStart,n.to<=m||n.openEnd)),x)break;p=d[E].to}}else a.push(new pi(s,l,r.tree,-i,n.from>=i||n.openStart,n.to<=o||n.openEnd))}return a}class eD{constructor(e,a,t,r,n,i,o,s,l,c=0,d){this.p=e,this.stack=a,this.state=t,this.reducePos=r,this.pos=n,this.score=i,this.buffer=o,this.bufferBase=s,this.curContext=l,this.lookAhead=c,this.parent=d}toString(){return`[${this.stack.filter((e,a)=>a%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,a,t=0){let r=e.parser.context;return new eD(e,[],a,t,t,0,[],0,r?new dM(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,a){this.stack.push(this.state,a,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var a;let t=e>>19,r=e&65535,{parser:n}=this.p,i=this.reducePos<this.pos-25;i&&this.setLookAhead(this.pos);let o=n.dynamicPrecedence(r);if(o&&(this.score+=o),t==0){this.pushState(n.getGoto(this.state,r,!0),this.reducePos),r<n.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(r,this.reducePos);return}let s=this.stack.length-(t-1)*3-(e&262144?6:0),l=s?this.stack[s-2]:this.p.ranges[0].from,c=this.reducePos-l;c>=2e3&&!(!((a=this.p.parser.nodeSet.types[r])===null||a===void 0)&&a.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=c));let d=s?this.stack[s-1]:0,E=this.bufferBase+this.buffer.length-d;if(r<n.minRepeatTerm||e&131072){let p=n.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,l,p,E+4,!0)}if(e&262144)this.state=this.stack[s];else{let p=this.stack[s-3];this.state=n.getGoto(p,r,!0)}for(;this.stack.length>s;)this.stack.pop();this.reduceContext(r,l)}storeNode(e,a,t,r=4,n=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let i=this,o=this.buffer.length;if(o==0&&i.parent&&(o=i.bufferBase-i.parent.bufferBase,i=i.parent),o>0&&i.buffer[o-4]==0&&i.buffer[o-1]>-1){if(a==t)return;if(i.buffer[o-2]>=a){i.buffer[o-2]=t;return}}}if(!n||this.pos==t)this.buffer.push(e,a,t,r);else{let i=this.buffer.length;if(i>0&&this.buffer[i-4]!=0){let o=!1;for(let s=i;s>0&&this.buffer[s-2]>t;s-=4)if(this.buffer[s-1]>=0){o=!0;break}if(o)for(;i>0&&this.buffer[i-2]>t;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=a,this.buffer[i+2]=t,this.buffer[i+3]=r}}shift(e,a,t,r){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let n=e,{parser:i}=this.p;(r>this.pos||a<=i.maxNode)&&(this.pos=r,i.stateFlag(n,1)||(this.reducePos=r)),this.pushState(n,t),this.shiftContext(a,t),a<=i.maxNode&&this.buffer.push(a,t,r,4)}else this.pos=r,this.shiftContext(a,t),a<=this.p.parser.maxNode&&this.buffer.push(a,t,r,4)}apply(e,a,t,r){e&65536?this.reduce(e):this.shift(e,a,t,r)}useNode(e,a){let t=this.p.reused.length-1;(t<0||this.p.reused[t]!=e)&&(this.p.reused.push(e),t++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(a,r),this.buffer.push(t,r,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,a=e.buffer.length;for(;a>0&&e.buffer[a-2]>e.reducePos;)a-=4;let t=e.buffer.slice(a),r=e.bufferBase+a;for(;e&&r==e.bufferBase;)e=e.parent;return new eD(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,t,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,a){let t=e<=this.p.parser.maxNode;t&&this.storeNode(e,this.pos,a,4),this.storeNode(0,this.pos,a,t?8:4),this.pos=this.reducePos=a,this.score-=190}canShift(e){for(let a=new B3u(this);;){let t=this.p.parser.stateSlot(a.state,4)||this.p.parser.hasAction(a.state,e);if(t==0)return!1;if((t&65536)==0)return!0;a.reduce(t)}}recoverByInsert(e){if(this.stack.length>=300)return[];let a=this.p.parser.nextStates(this.state);if(a.length>8||this.stack.length>=120){let r=[];for(let n=0,i;n<a.length;n+=2)(i=a[n+1])!=this.state&&this.p.parser.hasAction(i,e)&&r.push(a[n],i);if(this.stack.length<120)for(let n=0;r.length<8&&n<a.length;n+=2){let i=a[n+1];r.some((o,s)=>s&1&&o==i)||r.push(a[n],i)}a=r}let t=[];for(let r=0;r<a.length&&t.length<4;r+=2){let n=a[r+1];if(n==this.state)continue;let i=this.split();i.pushState(n,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(a[r],this.pos),i.reducePos=this.pos,i.score-=200,t.push(i)}return t}forceReduce(){let{parser:e}=this.p,a=e.stateSlot(this.state,5);if((a&65536)==0)return!1;if(!e.validAction(this.state,a)){let t=a>>19,r=a&65535,n=this.stack.length-t*3;if(n<0||e.getGoto(this.stack[n],r,!1)<0){let i=this.findForcedReduction();if(i==null)return!1;a=i}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(a),!0}findForcedReduction(){let{parser:e}=this.p,a=[],t=(r,n)=>{if(!a.includes(r))return a.push(r),e.allActions(r,i=>{if(!(i&393216))if(i&65536){let o=(i>>19)-n;if(o>1){let s=i&65535,l=this.stack.length-o*3;if(l>=0&&e.getGoto(this.stack[l],s,!1)>=0)return o<<19|65536|s}}else{let o=t(i,n+1);if(o!=null)return o}})};return t(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 a=0;a<this.stack.length;a+=3)if(this.stack[a]!=e.stack[a])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,a){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(a)))}reduceContext(e,a){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(a)))}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 a=new dM(this.curContext.tracker,e);a.hash!=this.curContext.hash&&this.emitContext(),this.curContext=a}}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 dM{constructor(e,a){this.tracker=e,this.context=a,this.hash=e.strict?e.hash(a):0}}class B3u{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let a=e&65535,t=e>>19;t==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(t-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],a,!0);this.state=r}}class uD{constructor(e,a,t){this.stack=e,this.pos=a,this.index=t,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,a=e.bufferBase+e.buffer.length){return new uD(e,a,a-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 uD(this.stack,this.pos,this.index)}}function J4(u,e=Uint16Array){if(typeof u!="string")return u;let a=null;for(let t=0,r=0;t<u.length;){let n=0;for(;;){let i=u.charCodeAt(t++),o=!1;if(i==126){n=65535;break}i>=92&&i--,i>=34&&i--;let s=i-32;if(s>=46&&(s-=46,o=!0),n+=s,o)break;n*=46}a?a[r++]=n:a=new e(n)}return a}class yx{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const EM=new yx;class S3u{constructor(e,a){this.input=e,this.ranges=a,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=EM,this.rangeIndex=0,this.pos=this.chunkPos=a[0].from,this.range=a[0],this.end=a[a.length-1].to,this.readNext()}resolveOffset(e,a){let t=this.range,r=this.rangeIndex,n=this.pos+e;for(;n<t.from;){if(!r)return null;let i=this.ranges[--r];n-=t.from-i.to,t=i}for(;a<0?n>t.to:n>=t.to;){if(r==this.ranges.length-1)return null;let i=this.ranges[++r];n+=i.from-t.to,t=i}return n}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let a of this.ranges)if(a.to>e)return Math.max(e,a.from);return this.end}peek(e){let a=this.chunkOff+e,t,r;if(a>=0&&a<this.chunk.length)t=this.pos+e,r=this.chunk.charCodeAt(a);else{let n=this.resolveOffset(e,1);if(n==null)return-1;if(t=n,t>=this.chunk2Pos&&t<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(t-this.chunk2Pos);else{let i=this.rangeIndex,o=this.range;for(;o.to<=t;)o=this.ranges[++i];this.chunk2=this.input.chunk(this.chunk2Pos=t),t+this.chunk2.length>o.to&&(this.chunk2=this.chunk2.slice(0,o.to-t)),r=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),r}acceptToken(e,a=0){let t=a?this.resolveOffset(a,-1):this.pos;if(t==null||t<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=t}acceptTokenTo(e,a){this.token.value=e,this.token.end=a}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:a}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=a,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),a=this.pos+e.length;this.chunk=a>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,a){if(a?(this.token=a,a.start=e,a.lookAhead=e+1,a.value=a.extended=-1):this.token=EM,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,a){if(e>=this.chunkPos&&a<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,a-this.chunkPos);if(e>=this.chunk2Pos&&a<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,a-this.chunk2Pos);if(e>=this.range.from&&a<=this.range.to)return this.input.read(e,a);let t="";for(let r of this.ranges){if(r.from>=a)break;r.to>e&&(t+=this.input.read(Math.max(r.from,e),Math.min(r.to,a)))}return t}}class A1{constructor(e,a){this.data=e,this.id=a}token(e,a){let{parser:t}=a.p;rU(this.data,e,a,this.id,t.data,t.tokenPrecTable)}}A1.prototype.contextual=A1.prototype.fallback=A1.prototype.extend=!1;class aD{constructor(e,a,t){this.precTable=a,this.elseToken=t,this.data=typeof e=="string"?J4(e):e}token(e,a){let t=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(rU(this.data,e,a,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(t,e.token),e.acceptToken(this.elseToken,r))}}aD.prototype.contextual=A1.prototype.fallback=A1.prototype.extend=!1;class vt{constructor(e,a={}){this.token=e,this.contextual=!!a.contextual,this.fallback=!!a.fallback,this.extend=!!a.extend}}function rU(u,e,a,t,r,n){let i=0,o=1<<t,{dialect:s}=a.p.parser;e:for(;(o&u[i])!=0;){let l=u[i+1];for(let p=i+3;p<l;p+=2)if((u[p+1]&o)>0){let x=u[p];if(s.allows(x)&&(e.token.value==-1||e.token.value==x||z3u(x,e.token.value,r,n))){e.acceptToken(x);break}}let c=e.next,d=0,E=u[i+2];if(e.next<0&&E>d&&u[l+E*3-3]==65535){i=u[l+E*3-1];continue e}for(;d<E;){let p=d+E>>1,x=l+p+(p<<1),m=u[x],g=u[x+1]||65536;if(c<m)E=p;else if(c>=g)d=p+1;else{i=u[x+2],e.advance();continue e}}break}}function pM(u,e,a){for(let t=e,r;(r=u[t])!=65535;t++)if(r==a)return t-e;return-1}function z3u(u,e,a,t){let r=pM(a,t,e);return r<0||pM(a,t,u)<r}const g0=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let dk=null;function mM(u,e,a){let t=u.cursor(Ea.IncludeAnonymous);for(t.moveTo(e);;)if(!(a<0?t.childBefore(e):t.childAfter(e)))for(;;){if((a<0?t.to<e:t.from>e)&&!t.type.isError)return a<0?Math.max(0,Math.min(t.to-1,e-25)):Math.min(u.length,Math.max(t.from+1,e+25));if(a<0?t.prevSibling():t.nextSibling())break;if(!t.parent())return a<0?0:u.length}}class w3u{constructor(e,a){this.fragments=e,this.nodeSet=a,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?mM(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?mM(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 a=this.trees.length-1;if(a<0)return this.nextFragment(),null;let t=this.trees[a],r=this.index[a];if(r==t.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let n=t.children[r],i=this.start[a]+t.positions[r];if(i>e)return this.nextStart=i,null;if(n instanceof Va){if(i==e){if(i<this.safeFrom)return null;let o=i+n.length;if(o<=this.safeTo){let s=n.prop(vu.lookAhead);if(!s||o+s<this.fragment.to)return n}}this.index[a]++,i+n.length>=Math.max(this.safeFrom,e)&&(this.trees.push(n),this.start.push(i),this.index.push(0))}else this.index[a]++,this.nextStart=i+n.length}}}class O3u{constructor(e,a){this.stream=a,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(t=>new yx)}getActions(e){let a=0,t=null,{parser:r}=e.p,{tokenizers:n}=r,i=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let l=0;l<n.length;l++){if((1<<l&i)==0)continue;let c=n[l],d=this.tokens[l];if(!(t&&!c.fallback)&&((c.contextual||d.start!=e.pos||d.mask!=i||d.context!=o)&&(this.updateCachedToken(d,c,e),d.mask=i,d.context=o),d.lookAhead>d.end+25&&(s=Math.max(d.lookAhead,s)),d.value!=0)){let E=a;if(d.extended>-1&&(a=this.addActions(e,d.extended,d.end,a)),a=this.addActions(e,d.value,d.end,a),!c.extend&&(t=d,a>E))break}}for(;this.actions.length>a;)this.actions.pop();return s&&e.setLookAhead(s),!t&&e.pos==this.stream.end&&(t=new yx,t.value=e.p.parser.eofTerm,t.start=t.end=e.pos,a=this.addActions(e,t.value,t.end,a)),this.mainToken=t,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let a=new yx,{pos:t,p:r}=e;return a.start=t,a.end=Math.min(t+1,r.stream.end),a.value=t==r.stream.end?r.parser.eofTerm:0,a}updateCachedToken(e,a,t){let r=this.stream.clipPos(t.pos);if(a.token(this.stream.reset(r,e),t),e.value>-1){let{parser:n}=t.p;for(let i=0;i<n.specialized.length;i++)if(n.specialized[i]==e.value){let o=n.specializers[i](this.stream.read(e.start,e.end),t);if(o>=0&&t.p.parser.dialect.allows(o>>1)){(o&1)==0?e.value=o>>1:e.extended=o>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,a,t,r){for(let n=0;n<r;n+=3)if(this.actions[n]==e)return r;return this.actions[r++]=e,this.actions[r++]=a,this.actions[r++]=t,r}addActions(e,a,t,r){let{state:n}=e,{parser:i}=e.p,{data:o}=i;for(let s=0;s<2;s++)for(let l=i.stateSlot(n,s?2:1);;l+=3){if(o[l]==65535)if(o[l+1]==1)l=ni(o,l+2);else{r==0&&o[l+1]==2&&(r=this.putAction(ni(o,l+2),a,t,r));break}o[l]==a&&(r=this.putAction(ni(o,l+1),a,t,r))}return r}}class P3u{constructor(e,a,t,r){this.parser=e,this.input=a,this.ranges=r,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 S3u(a,r),this.tokens=new O3u(e,this.stream),this.topTerm=e.top[1];let{from:n}=r[0];this.stacks=[eD.start(this,e.top[0],n)],this.fragments=t.length&&this.stream.end-n>e.bufferLength*4?new w3u(t,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,a=this.minStackPos,t=this.stacks=[],r,n;if(this.bigReductionCount>300&&e.length==1){let[i]=e;for(;i.forceReduce()&&i.stack.length&&i.stack[i.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let i=0;i<e.length;i++){let o=e[i];for(;;){if(this.tokens.mainToken=null,o.pos>a)t.push(o);else{if(this.advanceStack(o,t,e))continue;{r||(r=[],n=[]),r.push(o);let s=this.tokens.getMainToken(o);n.push(s.value,s.end)}}break}}if(!t.length){let i=r&&M3u(r);if(i)return g0&&console.log("Finish with "+this.stackID(i)),this.stackToTree(i);if(this.parser.strict)throw g0&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+a);this.recovering||(this.recovering=5)}if(this.recovering&&r){let i=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,n,t);if(i)return g0&&console.log("Force-finish "+this.stackID(i)),this.stackToTree(i.forceAll())}if(this.recovering){let i=this.recovering==1?1:this.recovering*3;if(t.length>i)for(t.sort((o,s)=>s.score-o.score);t.length>i;)t.pop();t.some(o=>o.reducePos>a)&&this.recovering--}else if(t.length>1){e:for(let i=0;i<t.length-1;i++){let o=t[i];for(let s=i+1;s<t.length;s++){let l=t[s];if(o.sameState(l)||o.buffer.length>500&&l.buffer.length>500)if((o.score-l.score||o.buffer.length-l.buffer.length)>0)t.splice(s--,1);else{t.splice(i--,1);continue e}}}t.length>12&&t.splice(12,t.length-12)}this.minStackPos=t[0].pos;for(let i=1;i<t.length;i++)t[i].pos<this.minStackPos&&(this.minStackPos=t[i].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,a,t){let r=e.pos,{parser:n}=this,i=g0?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let l=e.curContext&&e.curContext.tracker.strict,c=l?e.curContext.hash:0;for(let d=this.fragments.nodeAt(r);d;){let E=this.parser.nodeSet.types[d.type.id]==d.type?n.getGoto(e.state,d.type.id):-1;if(E>-1&&d.length&&(!l||(d.prop(vu.contextHash)||0)==c))return e.useNode(d,E),g0&&console.log(i+this.stackID(e)+` (via reuse of ${n.getName(d.type.id)})`),!0;if(!(d instanceof Va)||d.children.length==0||d.positions[0]>0)break;let p=d.children[0];if(p instanceof Va&&d.positions[0]==0)d=p;else break}}let o=n.stateSlot(e.state,4);if(o>0)return e.reduce(o),g0&&console.log(i+this.stackID(e)+` (via always-reduce ${n.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let s=this.tokens.getActions(e);for(let l=0;l<s.length;){let c=s[l++],d=s[l++],E=s[l++],p=l==s.length||!t,x=p?e:e.split(),m=this.tokens.mainToken;if(x.apply(c,d,m?m.start:x.pos,E),g0&&console.log(i+this.stackID(x)+` (via ${(c&65536)==0?"shift":`reduce of ${n.getName(c&65535)}`} for ${n.getName(d)} @ ${r}${x==e?"":", split"})`),p)return!0;x.pos>r?a.push(x):t.push(x)}return!1}advanceFully(e,a){let t=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>t)return hM(e,a),!0}}runRecovery(e,a,t){let r=null,n=!1;for(let i=0;i<e.length;i++){let o=e[i],s=a[i<<1],l=a[(i<<1)+1],c=g0?this.stackID(o)+" -> ":"";if(o.deadEnd&&(n||(n=!0,o.restart(),g0&&console.log(c+this.stackID(o)+" (restarted)"),this.advanceFully(o,t))))continue;let d=o.split(),E=c;for(let p=0;d.forceReduce()&&p<10&&(g0&&console.log(E+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,t));p++)g0&&(E=this.stackID(d)+" -> ");for(let p of o.recoverByInsert(s))g0&&console.log(c+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,t);this.stream.end>o.pos?(l==o.pos&&(l++,s=0),o.recoverByDelete(s,l),g0&&console.log(c+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),hM(o,t)):(!r||r.score<o.score)&&(r=o)}return r}stackToTree(e){return e.close(),Va.build({buffer:uD.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 a=(dk||(dk=new WeakMap)).get(e);return a||dk.set(e,a=String.fromCodePoint(this.nextStackID++)),a+e}}function hM(u,e){for(let a=0;a<e.length;a++){let t=e[a];if(t.pos==u.pos&&t.sameState(u)){e[a].score<u.score&&(e[a]=u);return}}e.push(u)}class j3u{constructor(e,a,t){this.source=e,this.flags=a,this.disabled=t}allows(e){return!this.disabled||this.disabled[e]==0}}const Ek=u=>u;class og{constructor(e){this.start=e.start,this.shift=e.shift||Ek,this.reduce=e.reduce||Ek,this.reuse=e.reuse||Ek,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class yi extends tU{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let a=e.nodeNames.split(" ");this.minRepeatTerm=a.length;for(let o=0;o<e.repeatNodeCount;o++)a.push("");let t=Object.keys(e.topRules).map(o=>e.topRules[o][1]),r=[];for(let o=0;o<a.length;o++)r.push([]);function n(o,s,l){r[o].push([s,s.deserialize(String(l))])}if(e.nodeProps)for(let o of e.nodeProps){let s=o[0];typeof s=="string"&&(s=vu[s]);for(let l=1;l<o.length;){let c=o[l++];if(c>=0)n(c,s,o[l++]);else{let d=o[l+-c];for(let E=-c;E>0;E--)n(o[l++],s,d);l++}}}this.nodeSet=new xA(a.map((o,s)=>Zt.define({name:s>=this.minRepeatTerm?void 0:o,id:s,props:r[s],top:t.indexOf(s)>-1,error:s==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(s)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=YJ;let i=J4(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let o=0;o<this.specializerSpecs.length;o++)this.specialized[o]=this.specializerSpecs[o].term;this.specializers=this.specializerSpecs.map(xM),this.states=J4(e.states,Uint32Array),this.data=J4(e.stateData),this.goto=J4(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(o=>typeof o=="number"?new A1(i,o):o),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,a,t){let r=new P3u(this,e,a,t);for(let n of this.wrappers)r=n(r,e,a,t);return r}getGoto(e,a,t=!1){let r=this.goto;if(a>=r[0])return-1;for(let n=r[a+1];;){let i=r[n++],o=i&1,s=r[n++];if(o&&t)return s;for(let l=n+(i>>1);n<l;n++)if(r[n]==e)return s;if(o)return-1}}hasAction(e,a){let t=this.data;for(let r=0;r<2;r++)for(let n=this.stateSlot(e,r?2:1),i;;n+=3){if((i=t[n])==65535)if(t[n+1]==1)i=t[n=ni(t,n+2)];else{if(t[n+1]==2)return ni(t,n+2);break}if(i==a||i==0)return ni(t,n+1)}return 0}stateSlot(e,a){return this.states[e*6+a]}stateFlag(e,a){return(this.stateSlot(e,0)&a)>0}validAction(e,a){return!!this.allActions(e,t=>t==a?!0:null)}allActions(e,a){let t=this.stateSlot(e,4),r=t?a(t):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=ni(this.data,n+2);else break;r=a(ni(this.data,n+1))}return r}nextStates(e){let a=[];for(let t=this.stateSlot(e,1);;t+=3){if(this.data[t]==65535)if(this.data[t+1]==1)t=ni(this.data,t+2);else break;if((this.data[t+2]&1)==0){let r=this.data[t+1];a.some((n,i)=>i&1&&n==r)||a.push(this.data[t],r)}}return a}configure(e){let a=Object.assign(Object.create(yi.prototype),this);if(e.props&&(a.nodeSet=this.nodeSet.extend(...e.props)),e.top){let t=this.topRules[e.top];if(!t)throw new RangeError(`Invalid top rule name ${e.top}`);a.top=t}return e.tokenizers&&(a.tokenizers=this.tokenizers.map(t=>{let r=e.tokenizers.find(n=>n.from==t);return r?r.to:t})),e.specializers&&(a.specializers=this.specializers.slice(),a.specializerSpecs=this.specializerSpecs.map((t,r)=>{let n=e.specializers.find(o=>o.from==t.external);if(!n)return t;let i=Object.assign(Object.assign({},t),{external:n.to});return a.specializers[r]=xM(i),i})),e.contextTracker&&(a.context=e.contextTracker),e.dialect&&(a.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(a.strict=e.strict),e.wrap&&(a.wrappers=a.wrappers.concat(e.wrap)),e.bufferLength!=null&&(a.bufferLength=e.bufferLength),a}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 a=this.dynamicPrecedences;return a==null?0:a[e]||0}parseDialect(e){let a=Object.keys(this.dialects),t=a.map(()=>!1);if(e)for(let n of e.split(" ")){let i=a.indexOf(n);i>=0&&(t[i]=!0)}let r=null;for(let n=0;n<a.length;n++)if(!t[n])for(let i=this.dialects[a[n]],o;(o=this.data[i++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[o]=1;return new j3u(e,t,r)}static deserialize(e){return new yi(e)}}function ni(u,e){return u[e]|u[e+1]<<16}function M3u(u){let e=null;for(let a of u){let t=a.p.stoppedAt;(a.pos==a.p.stream.end||t!=null&&a.pos>t)&&a.p.parser.stateFlag(a.state,2)&&(!e||e.score<a.score)&&(e=a)}return e}function xM(u){if(u.external){let e=u.extend?1:0;return(a,t)=>u.external(a,t)<<1|e}return u.get}let T3u=0,ii=class Hy{constructor(e,a,t,r){this.name=e,this.set=a,this.base=t,this.modified=r,this.id=T3u++}toString(){let{name:e}=this;for(let a of this.modified)a.name&&(e=`${a.name}(${e})`);return e}static define(e,a){let t=typeof e=="string"?e:"?";if(e instanceof Hy&&(a=e),a?.base)throw new Error("Can not derive from a modified tag");let r=new Hy(t,[],null,[]);if(r.set.push(r),a)for(let n of a.set)r.set.push(n);return r}static defineModifier(e){let a=new tD(e);return t=>t.modified.indexOf(a)>-1?t:tD.get(t.base||t,t.modified.concat(a).sort((r,n)=>r.id-n.id))}},$3u=0;class tD{constructor(e){this.name=e,this.instances=[],this.id=$3u++}static get(e,a){if(!a.length)return e;let t=a[0].instances.find(o=>o.base==e&&R3u(a,o.modified));if(t)return t;let r=[],n=new ii(e.name,r,e,a);for(let o of a)o.instances.push(n);let i=N3u(a);for(let o of e.set)if(!o.modified.length)for(let s of i)r.push(tD.get(o,s));return n}}function R3u(u,e){return u.length==e.length&&u.every((a,t)=>a==e[t])}function N3u(u){let e=[[]];for(let a=0;a<u.length;a++)for(let t=0,r=e.length;t<r;t++)e.push(e[t].concat(u[a]));return e.sort((a,t)=>t.length-a.length)}function tl(u){let e=Object.create(null);for(let a in u){let t=u[a];Array.isArray(t)||(t=[t]);for(let r of a.split(" "))if(r){let n=[],i=2,o=r;for(let d=0;;){if(o=="..."&&d>0&&d+3==r.length){i=1;break}let E=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!E)throw new RangeError("Invalid path: "+r);if(n.push(E[0]=="*"?"":E[0][0]=='"'?JSON.parse(E[0]):E[0]),d+=E[0].length,d==r.length)break;let p=r[d++];if(d==r.length&&p=="!"){i=0;break}if(p!="/")throw new RangeError("Invalid path: "+r);o=r.slice(d)}let s=n.length-1,l=n[s];if(!l)throw new RangeError("Invalid path: "+r);let c=new rD(t,i,s>0?n.slice(0,s):null);e[l]=c.sort(e[l])}}return nU.add(e)}const nU=new vu;class rD{constructor(e,a,t,r){this.tags=e,this.mode=a,this.context=t,this.next=r}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 iU(u,e){let a=Object.create(null);for(let n of u)if(!Array.isArray(n.tag))a[n.tag.id]=n.class;else for(let i of n.tag)a[i.id]=n.class;let{scope:t,all:r=null}=e||{};return{style:n=>{let i=r;for(let o of n)for(let s of o.set){let l=a[s.id];if(l){i=i?i+" "+l:l;break}}return i},scope:t}}function _3u(u,e){let a=null;for(let t of u){let r=t.style(e);r&&(a=a?a+" "+r:r)}return a}function L3u(u,e,a,t=0,r=u.length){let n=new I3u(t,Array.isArray(e)?e:[e],a);n.highlightRange(u.cursor(),t,r,"",n.highlighters),n.flush(r)}class I3u{constructor(e,a,t){this.at=e,this.highlighters=a,this.span=t,this.class=""}startSpan(e,a){a!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=a)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,a,t,r,n){let{type:i,from:o,to:s}=e;if(o>=t||s<=a)return;i.isTop&&(n=this.highlighters.filter(p=>!p.scope||p.scope(i)));let l=r,c=K3u(e)||rD.empty,d=_3u(n,c.tags);if(d&&(l&&(l+=" "),l+=d,c.mode==1&&(r+=(r?" ":"")+d)),this.startSpan(Math.max(a,o),l),c.opaque)return;let E=e.tree&&e.tree.prop(vu.mounted);if(E&&E.overlay){let p=e.node.enter(E.overlay[0].from+o,1),x=this.highlighters.filter(g=>!g.scope||g.scope(E.tree.type)),m=e.firstChild();for(let g=0,h=o;;g++){let f=g<E.overlay.length?E.overlay[g]:null,k=f?f.from+o:s,y=Math.max(a,h),v=Math.min(t,k);if(y<v&&m)for(;e.from<v&&(this.highlightRange(e,y,v,r,n),this.startSpan(Math.min(v,e.to),l),!(e.to>=k||!e.nextSibling())););if(!f||k>t)break;h=f.to+o,h>a&&(this.highlightRange(p.cursor(),Math.max(a,f.from+o),Math.min(t,h),"",x),this.startSpan(Math.min(t,h),l))}m&&e.parent()}else if(e.firstChild()){E&&(r="");do if(!(e.to<=a)){if(e.from>=t)break;this.highlightRange(e,a,t,r,n),this.startSpan(Math.min(t,e.to),l)}while(e.nextSibling());e.parent()}}}function K3u(u){let e=u.type.prop(nU);for(;e&&e.context&&!u.matchContext(e.context);)e=e.next;return e||null}const $e=ii.define,xh=$e(),to=$e(),DM=$e(to),fM=$e(to),ro=$e(),Dh=$e(ro),pk=$e(ro),Wr=$e(),Es=$e(Wr),Kr=$e(),Vr=$e(),qy=$e(),C4=$e(qy),fh=$e(),Z={comment:xh,lineComment:$e(xh),blockComment:$e(xh),docComment:$e(xh),name:to,variableName:$e(to),typeName:DM,tagName:$e(DM),propertyName:fM,attributeName:$e(fM),className:$e(to),labelName:$e(to),namespace:$e(to),macroName:$e(to),literal:ro,string:Dh,docString:$e(Dh),character:$e(Dh),attributeValue:$e(Dh),number:pk,integer:$e(pk),float:$e(pk),bool:$e(ro),regexp:$e(ro),escape:$e(ro),color:$e(ro),url:$e(ro),keyword:Kr,self:$e(Kr),null:$e(Kr),atom:$e(Kr),unit:$e(Kr),modifier:$e(Kr),operatorKeyword:$e(Kr),controlKeyword:$e(Kr),definitionKeyword:$e(Kr),moduleKeyword:$e(Kr),operator:Vr,derefOperator:$e(Vr),arithmeticOperator:$e(Vr),logicOperator:$e(Vr),bitwiseOperator:$e(Vr),compareOperator:$e(Vr),updateOperator:$e(Vr),definitionOperator:$e(Vr),typeOperator:$e(Vr),controlOperator:$e(Vr),punctuation:qy,separator:$e(qy),bracket:C4,angleBracket:$e(C4),squareBracket:$e(C4),paren:$e(C4),brace:$e(C4),content:Wr,heading:Es,heading1:$e(Es),heading2:$e(Es),heading3:$e(Es),heading4:$e(Es),heading5:$e(Es),heading6:$e(Es),contentSeparator:$e(Wr),list:$e(Wr),quote:$e(Wr),emphasis:$e(Wr),strong:$e(Wr),link:$e(Wr),monospace:$e(Wr),strikethrough:$e(Wr),inserted:$e(),deleted:$e(),changed:$e(),invalid:$e(),meta:fh,documentMeta:$e(fh),annotation:$e(fh),processingInstruction:$e(fh),definition:ii.defineModifier("definition"),constant:ii.defineModifier("constant"),function:ii.defineModifier("function"),standard:ii.defineModifier("standard"),local:ii.defineModifier("local"),special:ii.defineModifier("special")};for(let u in Z){let e=Z[u];e instanceof ii&&(e.name=u)}iU([{tag:Z.link,class:"tok-link"},{tag:Z.heading,class:"tok-heading"},{tag:Z.emphasis,class:"tok-emphasis"},{tag:Z.strong,class:"tok-strong"},{tag:Z.keyword,class:"tok-keyword"},{tag:Z.atom,class:"tok-atom"},{tag:Z.bool,class:"tok-bool"},{tag:Z.url,class:"tok-url"},{tag:Z.labelName,class:"tok-labelName"},{tag:Z.inserted,class:"tok-inserted"},{tag:Z.deleted,class:"tok-deleted"},{tag:Z.literal,class:"tok-literal"},{tag:Z.string,class:"tok-string"},{tag:Z.number,class:"tok-number"},{tag:[Z.regexp,Z.escape,Z.special(Z.string)],class:"tok-string2"},{tag:Z.variableName,class:"tok-variableName"},{tag:Z.local(Z.variableName),class:"tok-variableName tok-local"},{tag:Z.definition(Z.variableName),class:"tok-variableName tok-definition"},{tag:Z.special(Z.variableName),class:"tok-variableName2"},{tag:Z.definition(Z.propertyName),class:"tok-propertyName tok-definition"},{tag:Z.typeName,class:"tok-typeName"},{tag:Z.namespace,class:"tok-namespace"},{tag:Z.className,class:"tok-className"},{tag:Z.macroName,class:"tok-macroName"},{tag:Z.propertyName,class:"tok-propertyName"},{tag:Z.operator,class:"tok-operator"},{tag:Z.comment,class:"tok-comment"},{tag:Z.meta,class:"tok-meta"},{tag:Z.invalid,class:"tok-invalid"},{tag:Z.punctuation,class:"tok-punctuation"}]);const V3u=tl({String:Z.string,Number:Z.number,"True False":Z.bool,PropertyName:Z.propertyName,Null:Z.null,",":Z.separator,"[ ]":Z.squareBracket,"{ }":Z.brace}),G3u=yi.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:[V3u],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 Wy=[],oU=[];(()=>{let u="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,a=0;e<u.length;e++)(e%2?oU:Wy).push(a=a+u[e])})();function H3u(u){if(u<768)return!1;for(let e=0,a=Wy.length;;){let t=e+a>>1;if(u<Wy[t])a=t;else if(u>=oU[t])e=t+1;else return!0;if(e==a)return!1}}function gM(u){return u>=127462&&u<=127487}const vM=8205;function q3u(u,e,a=!0,t=!0){return(a?sU:W3u)(u,e,t)}function sU(u,e,a){if(e==u.length)return e;e&&lU(u.charCodeAt(e))&&cU(u.charCodeAt(e-1))&&e--;let t=mk(u,e);for(e+=kM(t);e<u.length;){let r=mk(u,e);if(t==vM||r==vM||a&&H3u(r))e+=kM(r),t=r;else if(gM(r)){let n=0,i=e-2;for(;i>=0&&gM(mk(u,i));)n++,i-=2;if(n%2==0)break;e+=2}else break}return e}function W3u(u,e,a){for(;e>0;){let t=sU(u,e-2,a);if(t<e)return t;e--}return 0}function mk(u,e){let a=u.charCodeAt(e);if(!cU(a)||e+1==u.length)return a;let t=u.charCodeAt(e+1);return lU(t)?(a-55296<<10)+(t-56320)+65536:a}function lU(u){return u>=56320&&u<57344}function cU(u){return u>=55296&&u<56320}function kM(u){return u<65536?1:2}class Mu{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,a,t){[e,a]=Z1(this,e,a);let r=[];return this.decompose(0,e,r,2),t.length&&t.decompose(0,t.length,r,3),this.decompose(a,this.length,r,1),un.from(r,this.length-(a-e)+t.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,a=this.length){[e,a]=Z1(this,e,a);let t=[];return this.decompose(e,a,t,0),un.from(t,a-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let a=this.scanIdentical(e,1),t=this.length-this.scanIdentical(e,-1),r=new hd(this),n=new hd(e);for(let i=a,o=a;;){if(r.next(i),n.next(i),i=0,r.lineBreak!=n.lineBreak||r.done!=n.done||r.value!=n.value)return!1;if(o+=r.value.length,r.done||o>=t)return!0}}iter(e=1){return new hd(this,e)}iterRange(e,a=this.length){return new dU(this,e,a)}iterLines(e,a){let t;if(e==null)t=this.iter();else{a==null&&(a=this.lines+1);let r=this.line(e).from;t=this.iterRange(r,Math.max(r,a==this.lines+1?this.length:a<=1?0:this.line(a-1).to))}return new EU(t)}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]?Mu.empty:e.length<=32?new $a(e):un.from($a.split(e,[]))}}class $a extends Mu{constructor(e,a=J3u(e)){super(),this.text=e,this.length=a}get lines(){return this.text.length}get children(){return null}lineInner(e,a,t,r){for(let n=0;;n++){let i=this.text[n],o=r+i.length;if((a?t:o)>=e)return new U3u(r,o,t,i);r=o+1,t++}}decompose(e,a,t,r){let n=e<=0&&a>=this.length?this:new $a(bM(this.text,e,a),Math.min(a,this.length)-Math.max(0,e));if(r&1){let i=t.pop(),o=Cx(n.text,i.text.slice(),0,n.length);if(o.length<=32)t.push(new $a(o,i.length+n.length));else{let s=o.length>>1;t.push(new $a(o.slice(0,s)),new $a(o.slice(s)))}}else t.push(n)}replace(e,a,t){if(!(t instanceof $a))return super.replace(e,a,t);[e,a]=Z1(this,e,a);let r=Cx(this.text,Cx(t.text,bM(this.text,0,e)),a),n=this.length+t.length-(a-e);return r.length<=32?new $a(r,n):un.from($a.split(r,[]),n)}sliceString(e,a=this.length,t=`
475
+ `;function aA({input:u,onSave:e,onCancel:a,...t}){const[r,n]=H.useState(!!u.isSecret),i=({name:o,value:s})=>{e({...u,name:o,value:s,isSecret:r})};return D.jsx(lJ,{variable:u,onSave:i,onCancel:a,...t,children:D.jsx(Vd,{children:D.jsx(sJ,{value:r,onChange:o=>n(o),title:"Make it secret"})})})}const jy=()=>({name:"",value:"",isSecret:!1}),va=u=>HI+"$inputs."+u+s2,M1u=(u,e)=>e.inputs.find(a=>a.get().name===u.match(`^${bf}$`)?.[1]);function T1u({environments:u,activeEnvironmentId:e}){return u.get().find(t=>t.name===e.get())?.inputs||[]}function Ji(u){const e=new RegExp(bf,"g"),a=new Set;if(!u)return a;for(const[t,r,n]of u.matchAll(e)){const i=r||n;i&&a.add(i)}return a}function tA(u){const e=/^\{?\$inputs\.([^\}\s]+)\}?$/,a=u.match(e);return a?a[1]:null}function Dx(u){var e=new Error(u);return e.source="ulid",e}var rA="0123456789ABCDEFGHJKMNPQRSTVWXYZ",dd=rA.length,Aj=Math.pow(2,48)-1,$1u=10,R1u=16;function N1u(u){var e=Math.floor(u()*dd);return e===dd&&(e=dd-1),rA.charAt(e)}function _1u(u,e){if(isNaN(u))throw new Error(u+" must be a number");if(u>Aj)throw Dx("cannot encode time greater than "+Aj);if(u<0)throw Dx("time must be positive");if(Number.isInteger(u)===!1)throw Dx("time must be an integer");for(var a=void 0,t="";e>0;e--)a=u%dd,t=rA.charAt(a)+t,u=(u-a)/dd;return t}function L1u(u,e){for(var a="";u>0;u--)a=N1u(e)+a;return a}function I1u(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=arguments[1];e||(e=typeof window<"u"?window:null);var a=e&&(e.crypto||e.msCrypto);if(a)return function(){var r=new Uint8Array(1);return a.getRandomValues(r),r[0]/255};try{var t=require("crypto");return function(){return t.randomBytes(1).readUInt8()/255}}catch{}if(u){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return function(){return Math.random()}}throw Dx("secure crypto unusable, insecure Math.random not allowed")}function K1u(u){return u||(u=I1u()),function(a){return isNaN(a)&&(a=Date.now()),_1u(a,$1u)+L1u(R1u,u)}}var G5=K1u(),V1u=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},As="1.9.0",Bj=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function G1u(u){var e=new Set([u]),a=new Set,t=u.match(Bj);if(!t)return function(){return!1};var r={major:+t[1],minor:+t[2],patch:+t[3],prerelease:t[4]};if(r.prerelease!=null)return function(s){return s===u};function n(o){return a.add(o),!1}function i(o){return e.add(o),!0}return function(s){if(e.has(s))return!0;if(a.has(s))return!1;var l=s.match(Bj);if(!l)return n(s);var c={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return c.prerelease!=null||r.major!==c.major?n(s):r.major===0?r.minor===c.minor&&r.patch<=c.patch?i(s):n(s):r.minor<=c.minor?i(s):n(s)}}var H1u=G1u(As),q1u=As.split(".")[0],Gd=Symbol.for("opentelemetry.js.api."+q1u),Hd=V1u;function TE(u,e,a,t){var r;t===void 0&&(t=!1);var n=Hd[Gd]=(r=Hd[Gd])!==null&&r!==void 0?r:{version:As};if(!t&&n[u]){var i=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+u);return a.error(i.stack||i.message),!1}if(n.version!==As){var i=new Error("@opentelemetry/api: Registration of version v"+n.version+" for "+u+" does not match previously registered API v"+As);return a.error(i.stack||i.message),!1}return n[u]=e,a.debug("@opentelemetry/api: Registered a global for "+u+" v"+As+"."),!0}function Ls(u){var e,a,t=(e=Hd[Gd])===null||e===void 0?void 0:e.version;if(!(!t||!H1u(t)))return(a=Hd[Gd])===null||a===void 0?void 0:a[u]}function $E(u,e){e.debug("@opentelemetry/api: Unregistering a global for "+u+" v"+As+".");var a=Hd[Gd];a&&delete a[u]}var W1u=function(u,e){var a=typeof Symbol=="function"&&u[Symbol.iterator];if(!a)return u;var t=a.call(u),r,n=[],i;try{for(;(e===void 0||e-- >0)&&!(r=t.next()).done;)n.push(r.value)}catch(o){i={error:o}}finally{try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(i)throw i.error}}return n},J1u=function(u,e,a){if(a||arguments.length===2)for(var t=0,r=e.length,n;t<r;t++)(n||!(t in e))&&(n||(n=Array.prototype.slice.call(e,0,t)),n[t]=e[t]);return u.concat(n||Array.prototype.slice.call(e))},U1u=(function(){function u(e){this._namespace=e.namespace||"DiagComponentLogger"}return u.prototype.debug=function(){for(var e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];return k4("debug",this._namespace,e)},u.prototype.error=function(){for(var e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];return k4("error",this._namespace,e)},u.prototype.info=function(){for(var e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];return k4("info",this._namespace,e)},u.prototype.warn=function(){for(var e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];return k4("warn",this._namespace,e)},u.prototype.verbose=function(){for(var e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];return k4("verbose",this._namespace,e)},u})();function k4(u,e,a){var t=Ls("diag");if(t)return a.unshift(e),t[u].apply(t,J1u([],W1u(a),!1))}var A0;(function(u){u[u.NONE=0]="NONE",u[u.ERROR=30]="ERROR",u[u.WARN=50]="WARN",u[u.INFO=60]="INFO",u[u.DEBUG=70]="DEBUG",u[u.VERBOSE=80]="VERBOSE",u[u.ALL=9999]="ALL"})(A0||(A0={}));function Z1u(u,e){u<A0.NONE?u=A0.NONE:u>A0.ALL&&(u=A0.ALL),e=e||{};function a(t,r){var n=e[t];return typeof n=="function"&&u>=r?n.bind(e):function(){}}return{error:a("error",A0.ERROR),warn:a("warn",A0.WARN),info:a("info",A0.INFO),debug:a("debug",A0.DEBUG),verbose:a("verbose",A0.VERBOSE)}}var Q1u=function(u,e){var a=typeof Symbol=="function"&&u[Symbol.iterator];if(!a)return u;var t=a.call(u),r,n=[],i;try{for(;(e===void 0||e-- >0)&&!(r=t.next()).done;)n.push(r.value)}catch(o){i={error:o}}finally{try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(i)throw i.error}}return n},Y1u=function(u,e,a){if(a||arguments.length===2)for(var t=0,r=e.length,n;t<r;t++)(n||!(t in e))&&(n||(n=Array.prototype.slice.call(e,0,t)),n[t]=e[t]);return u.concat(n||Array.prototype.slice.call(e))},X1u="diag",kn=(function(){function u(){function e(r){return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=Ls("diag");if(o)return o[r].apply(o,Y1u([],Q1u(n),!1))}}var a=this,t=function(r,n){var i,o,s;if(n===void 0&&(n={logLevel:A0.INFO}),r===a){var l=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return a.error((i=l.stack)!==null&&i!==void 0?i:l.message),!1}typeof n=="number"&&(n={logLevel:n});var c=Ls("diag"),d=Z1u((o=n.logLevel)!==null&&o!==void 0?o:A0.INFO,r);if(c&&!n.suppressOverrideMessage){var E=(s=new Error().stack)!==null&&s!==void 0?s:"<failed to generate stacktrace>";c.warn("Current logger will be overwritten from "+E),d.warn("Current logger will overwrite one already registered from "+E)}return TE("diag",d,a,!0)};a.setLogger=t,a.disable=function(){$E(X1u,a)},a.createComponentLogger=function(r){return new U1u(r)},a.verbose=e("verbose"),a.debug=e("debug"),a.info=e("info"),a.warn=e("warn"),a.error=e("error")}return u.instance=function(){return this._instance||(this._instance=new u),this._instance},u})(),ecu=function(u,e){var a=typeof Symbol=="function"&&u[Symbol.iterator];if(!a)return u;var t=a.call(u),r,n=[],i;try{for(;(e===void 0||e-- >0)&&!(r=t.next()).done;)n.push(r.value)}catch(o){i={error:o}}finally{try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(i)throw i.error}}return n},ucu=function(u){var e=typeof Symbol=="function"&&Symbol.iterator,a=e&&u[e],t=0;if(a)return a.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&t>=u.length&&(u=void 0),{value:u&&u[t++],done:!u}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},acu=(function(){function u(e){this._entries=e?new Map(e):new Map}return u.prototype.getEntry=function(e){var a=this._entries.get(e);if(a)return Object.assign({},a)},u.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var a=ecu(e,2),t=a[0],r=a[1];return[t,r]})},u.prototype.setEntry=function(e,a){var t=new u(this._entries);return t._entries.set(e,a),t},u.prototype.removeEntry=function(e){var a=new u(this._entries);return a._entries.delete(e),a},u.prototype.removeEntries=function(){for(var e,a,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=new u(this._entries);try{for(var i=ucu(t),o=i.next();!o.done;o=i.next()){var s=o.value;n._entries.delete(s)}}catch(l){e={error:l}}finally{try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(e)throw e.error}}return n},u.prototype.clear=function(){return new u},u})(),tcu=Symbol("BaggageEntryMetadata"),rcu=kn.instance();function ncu(u){return u===void 0&&(u={}),new acu(new Map(Object.entries(u)))}function icu(u){return typeof u!="string"&&(rcu.error("Cannot create baggage metadata from unknown type: "+typeof u),u=""),{__TYPE__:tcu,toString:function(){return u}}}function nA(u){return Symbol.for(u)}var ocu=(function(){function u(e){var a=this;a._currentContext=e?new Map(e):new Map,a.getValue=function(t){return a._currentContext.get(t)},a.setValue=function(t,r){var n=new u(a._currentContext);return n._currentContext.set(t,r),n},a.deleteValue=function(t){var r=new u(a._currentContext);return r._currentContext.delete(t),r}}return u})(),n1=new ocu,al=(function(){var u=function(e,a){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},u(e,a)};return function(e,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");u(e,a);function t(){this.constructor=e}e.prototype=a===null?Object.create(a):(t.prototype=a.prototype,new t)}})(),scu=(function(){function u(){}return u.prototype.createGauge=function(e,a){return fcu},u.prototype.createHistogram=function(e,a){return gcu},u.prototype.createCounter=function(e,a){return Dcu},u.prototype.createUpDownCounter=function(e,a){return vcu},u.prototype.createObservableGauge=function(e,a){return bcu},u.prototype.createObservableCounter=function(e,a){return kcu},u.prototype.createObservableUpDownCounter=function(e,a){return ycu},u.prototype.addBatchObservableCallback=function(e,a){},u.prototype.removeBatchObservableCallback=function(e){},u})(),ag=(function(){function u(){}return u})(),lcu=(function(u){al(e,u);function e(){return u!==null&&u.apply(this,arguments)||this}return e.prototype.add=function(a,t){},e})(ag),ccu=(function(u){al(e,u);function e(){return u!==null&&u.apply(this,arguments)||this}return e.prototype.add=function(a,t){},e})(ag),dcu=(function(u){al(e,u);function e(){return u!==null&&u.apply(this,arguments)||this}return e.prototype.record=function(a,t){},e})(ag),Ecu=(function(u){al(e,u);function e(){return u!==null&&u.apply(this,arguments)||this}return e.prototype.record=function(a,t){},e})(ag),iA=(function(){function u(){}return u.prototype.addCallback=function(e){},u.prototype.removeCallback=function(e){},u})(),pcu=(function(u){al(e,u);function e(){return u!==null&&u.apply(this,arguments)||this}return e})(iA),mcu=(function(u){al(e,u);function e(){return u!==null&&u.apply(this,arguments)||this}return e})(iA),hcu=(function(u){al(e,u);function e(){return u!==null&&u.apply(this,arguments)||this}return e})(iA),xcu=new scu,Dcu=new lcu,fcu=new dcu,gcu=new Ecu,vcu=new ccu,kcu=new pcu,bcu=new mcu,ycu=new hcu,Ccu={get:function(u,e){if(u!=null)return u[e]},keys:function(u){return u==null?[]:Object.keys(u)}},Fcu={set:function(u,e,a){u!=null&&(u[e]=a)}},Acu=function(u,e){var a=typeof Symbol=="function"&&u[Symbol.iterator];if(!a)return u;var t=a.call(u),r,n=[],i;try{for(;(e===void 0||e-- >0)&&!(r=t.next()).done;)n.push(r.value)}catch(o){i={error:o}}finally{try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(i)throw i.error}}return n},Bcu=function(u,e,a){if(a||arguments.length===2)for(var t=0,r=e.length,n;t<r;t++)(n||!(t in e))&&(n||(n=Array.prototype.slice.call(e,0,t)),n[t]=e[t]);return u.concat(n||Array.prototype.slice.call(e))},Scu=(function(){function u(){}return u.prototype.active=function(){return n1},u.prototype.with=function(e,a,t){for(var r=[],n=3;n<arguments.length;n++)r[n-3]=arguments[n];return a.call.apply(a,Bcu([t],Acu(r),!1))},u.prototype.bind=function(e,a){return a},u.prototype.enable=function(){return this},u.prototype.disable=function(){return this},u})(),zcu=function(u,e){var a=typeof Symbol=="function"&&u[Symbol.iterator];if(!a)return u;var t=a.call(u),r,n=[],i;try{for(;(e===void 0||e-- >0)&&!(r=t.next()).done;)n.push(r.value)}catch(o){i={error:o}}finally{try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(i)throw i.error}}return n},wcu=function(u,e,a){if(a||arguments.length===2)for(var t=0,r=e.length,n;t<r;t++)(n||!(t in e))&&(n||(n=Array.prototype.slice.call(e,0,t)),n[t]=e[t]);return u.concat(n||Array.prototype.slice.call(e))},Yv="context",Ocu=new Scu,tg=(function(){function u(){}return u.getInstance=function(){return this._instance||(this._instance=new u),this._instance},u.prototype.setGlobalContextManager=function(e){return TE(Yv,e,kn.instance())},u.prototype.active=function(){return this._getContextManager().active()},u.prototype.with=function(e,a,t){for(var r,n=[],i=3;i<arguments.length;i++)n[i-3]=arguments[i];return(r=this._getContextManager()).with.apply(r,wcu([e,a,t],zcu(n),!1))},u.prototype.bind=function(e,a){return this._getContextManager().bind(e,a)},u.prototype._getContextManager=function(){return Ls(Yv)||Ocu},u.prototype.disable=function(){this._getContextManager().disable(),$E(Yv,kn.instance())},u})(),bi;(function(u){u[u.NONE=0]="NONE",u[u.SAMPLED=1]="SAMPLED"})(bi||(bi={}));var cJ="0000000000000000",dJ="00000000000000000000000000000000",EJ={traceId:dJ,spanId:cJ,traceFlags:bi.NONE},Ed=(function(){function u(e){e===void 0&&(e=EJ),this._spanContext=e}return u.prototype.spanContext=function(){return this._spanContext},u.prototype.setAttribute=function(e,a){return this},u.prototype.setAttributes=function(e){return this},u.prototype.addEvent=function(e,a){return this},u.prototype.addLink=function(e){return this},u.prototype.addLinks=function(e){return this},u.prototype.setStatus=function(e){return this},u.prototype.updateName=function(e){return this},u.prototype.end=function(e){},u.prototype.isRecording=function(){return!1},u.prototype.recordException=function(e,a){},u})(),oA=nA("OpenTelemetry Context Key SPAN");function sA(u){return u.getValue(oA)||void 0}function Pcu(){return sA(tg.getInstance().active())}function lA(u,e){return u.setValue(oA,e)}function jcu(u){return u.deleteValue(oA)}function Mcu(u,e){return lA(u,new Ed(e))}function pJ(u){var e;return(e=sA(u))===null||e===void 0?void 0:e.spanContext()}var Tcu=/^([0-9a-f]{32})$/i,$cu=/^[0-9a-f]{16}$/i;function mJ(u){return Tcu.test(u)&&u!==dJ}function Rcu(u){return $cu.test(u)&&u!==cJ}function rg(u){return mJ(u.traceId)&&Rcu(u.spanId)}function Ncu(u){return new Ed(u)}var Xv=tg.getInstance(),hJ=(function(){function u(){}return u.prototype.startSpan=function(e,a,t){t===void 0&&(t=Xv.active());var r=!!a?.root;if(r)return new Ed;var n=t&&pJ(t);return _cu(n)&&rg(n)?new Ed(n):new Ed},u.prototype.startActiveSpan=function(e,a,t,r){var n,i,o;if(!(arguments.length<2)){arguments.length===2?o=a:arguments.length===3?(n=a,o=t):(n=a,i=t,o=r);var s=i??Xv.active(),l=this.startSpan(e,n,s),c=lA(s,l);return Xv.with(c,o,void 0,l)}},u})();function _cu(u){return typeof u=="object"&&typeof u.spanId=="string"&&typeof u.traceId=="string"&&typeof u.traceFlags=="number"}var Lcu=new hJ,Icu=(function(){function u(e,a,t,r){this._provider=e,this.name=a,this.version=t,this.options=r}return u.prototype.startSpan=function(e,a,t){return this._getTracer().startSpan(e,a,t)},u.prototype.startActiveSpan=function(e,a,t,r){var n=this._getTracer();return Reflect.apply(n.startActiveSpan,n,arguments)},u.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):Lcu},u})(),Kcu=(function(){function u(){}return u.prototype.getTracer=function(e,a,t){return new hJ},u})(),Vcu=new Kcu,Sj=(function(){function u(){}return u.prototype.getTracer=function(e,a,t){var r;return(r=this.getDelegateTracer(e,a,t))!==null&&r!==void 0?r:new Icu(this,e,a,t)},u.prototype.getDelegate=function(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Vcu},u.prototype.setDelegate=function(e){this._delegate=e},u.prototype.getDelegateTracer=function(e,a,t){var r;return(r=this._delegate)===null||r===void 0?void 0:r.getTracer(e,a,t)},u})(),H5;(function(u){u[u.NOT_RECORD=0]="NOT_RECORD",u[u.RECORD=1]="RECORD",u[u.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(H5||(H5={}));var My;(function(u){u[u.INTERNAL=0]="INTERNAL",u[u.SERVER=1]="SERVER",u[u.CLIENT=2]="CLIENT",u[u.PRODUCER=3]="PRODUCER",u[u.CONSUMER=4]="CONSUMER"})(My||(My={}));var qd;(function(u){u[u.UNSET=0]="UNSET",u[u.OK=1]="OK",u[u.ERROR=2]="ERROR"})(qd||(qd={}));var di=tg.getInstance(),Gu=kn.instance(),Gcu=(function(){function u(){}return u.prototype.getMeter=function(e,a,t){return xcu},u})(),Hcu=new Gcu,ek="metrics",qcu=(function(){function u(){}return u.getInstance=function(){return this._instance||(this._instance=new u),this._instance},u.prototype.setGlobalMeterProvider=function(e){return TE(ek,e,kn.instance())},u.prototype.getMeterProvider=function(){return Ls(ek)||Hcu},u.prototype.getMeter=function(e,a,t){return this.getMeterProvider().getMeter(e,a,t)},u.prototype.disable=function(){$E(ek,kn.instance())},u})(),Wcu=qcu.getInstance(),Jcu=(function(){function u(){}return u.prototype.inject=function(e,a){},u.prototype.extract=function(e,a){return e},u.prototype.fields=function(){return[]},u})(),cA=nA("OpenTelemetry Baggage Key");function xJ(u){return u.getValue(cA)||void 0}function Ucu(){return xJ(tg.getInstance().active())}function Zcu(u,e){return u.setValue(cA,e)}function Qcu(u){return u.deleteValue(cA)}var uk="propagation",Ycu=new Jcu,Xcu=(function(){function u(){this.createBaggage=ncu,this.getBaggage=xJ,this.getActiveBaggage=Ucu,this.setBaggage=Zcu,this.deleteBaggage=Qcu}return u.getInstance=function(){return this._instance||(this._instance=new u),this._instance},u.prototype.setGlobalPropagator=function(e){return TE(uk,e,kn.instance())},u.prototype.inject=function(e,a,t){return t===void 0&&(t=Fcu),this._getGlobalPropagator().inject(e,a,t)},u.prototype.extract=function(e,a,t){return t===void 0&&(t=Ccu),this._getGlobalPropagator().extract(e,a,t)},u.prototype.fields=function(){return this._getGlobalPropagator().fields()},u.prototype.disable=function(){$E(uk,kn.instance())},u.prototype._getGlobalPropagator=function(){return Ls(uk)||Ycu},u})(),pd=Xcu.getInstance(),ak="trace",e4u=(function(){function u(){this._proxyTracerProvider=new Sj,this.wrapSpanContext=Ncu,this.isSpanContextValid=rg,this.deleteSpan=jcu,this.getSpan=sA,this.getActiveSpan=Pcu,this.getSpanContext=pJ,this.setSpan=lA,this.setSpanContext=Mcu}return u.getInstance=function(){return this._instance||(this._instance=new u),this._instance},u.prototype.setGlobalTracerProvider=function(e){var a=TE(ak,this._proxyTracerProvider,kn.instance());return a&&this._proxyTracerProvider.setDelegate(e),a},u.prototype.getTracerProvider=function(){return Ls(ak)||this._proxyTracerProvider},u.prototype.getTracer=function(e,a){return this.getTracerProvider().getTracer(e,a)},u.prototype.disable=function(){$E(ak,kn.instance()),this._proxyTracerProvider=new Sj},u})(),O0=e4u.getInstance();const DJ=nA("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function u4u(u){return u.setValue(DJ,!0)}function dA(u){return u.getValue(DJ)===!0}const a4u="=",Ty=";",$y=",",tk="baggage",t4u=180,r4u=4096,n4u=8192;function i4u(u){return u.reduce((e,a)=>{const t=`${e}${e!==""?$y:""}${a}`;return t.length>n4u?e:t},"")}function o4u(u){return u.getAllEntries().map(([e,a])=>{let t=`${encodeURIComponent(e)}=${encodeURIComponent(a.value)}`;return a.metadata!==void 0&&(t+=Ty+a.metadata.toString()),t})}function s4u(u){const e=u.split(Ty);if(e.length<=0)return;const a=e.shift();if(!a)return;const t=a.indexOf(a4u);if(t<=0)return;const r=decodeURIComponent(a.substring(0,t).trim()),n=decodeURIComponent(a.substring(t+1).trim());let i;return e.length>0&&(i=icu(e.join(Ty))),{key:r,value:n,metadata:i}}class l4u{inject(e,a,t){const r=pd.getBaggage(e);if(!r||dA(e))return;const n=o4u(r).filter(o=>o.length<=r4u).slice(0,t4u),i=i4u(n);i.length>0&&t.set(a,tk,i)}extract(e,a,t){const r=t.get(a,tk),n=Array.isArray(r)?r.join($y):r;if(!n)return e;const i={};return n.length===0||(n.split($y).forEach(s=>{const l=s4u(s);if(l){const c={value:l.value};l.metadata&&(c.metadata=l.metadata),i[l.key]=c}}),Object.entries(i).length===0)?e:pd.setBaggage(e,pd.createBaggage(i))}fields(){return[tk]}}function fx(u){const e={};if(typeof u!="object"||u==null)return e;for(const[a,t]of Object.entries(u)){if(!c4u(a)){Gu.warn(`Invalid attribute key: ${a}`);continue}if(!fJ(t)){Gu.warn(`Invalid attribute value set for key: ${a}`);continue}Array.isArray(t)?e[a]=t.slice():e[a]=t}return e}function c4u(u){return typeof u=="string"&&u.length>0}function fJ(u){return u==null?!0:Array.isArray(u)?d4u(u):gJ(u)}function d4u(u){let e;for(const a of u)if(a!=null){if(!e){if(gJ(a)){e=typeof a;continue}return!1}if(typeof a!==e)return!1}return!0}function gJ(u){switch(typeof u){case"number":case"boolean":case"string":return!0}return!1}function E4u(){return u=>{Gu.error(p4u(u))}}function p4u(u){return typeof u=="string"?u:JSON.stringify(m4u(u))}function m4u(u){const e={};let a=u;for(;a!==null;)Object.getOwnPropertyNames(a).forEach(t=>{if(e[t])return;const r=a[t];r&&(e[t]=String(r))}),a=Object.getPrototypeOf(a);return e}let h4u=E4u();function J1(u){try{h4u(u)}catch{}}const C1=performance,x4u="2.0.1",rk="exception.message",D4u="exception.stacktrace",nk="exception.type",vJ="service.name",f4u="service.version",Ry="telemetry.sdk.language",g4u="webjs",Ny="telemetry.sdk.name",_y="telemetry.sdk.version",v4u="process.runtime.name",ik={[Ny]:"opentelemetry",[v4u]:"browser",[Ry]:g4u,[_y]:x4u};const k4u=9,b4u=6,y4u=Math.pow(10,b4u),q5=Math.pow(10,k4u);function m1(u){const e=u/1e3,a=Math.trunc(e),t=Math.round(u%1e3*y4u);return[a,t]}function kJ(){let u=C1.timeOrigin;if(typeof u!="number"){const e=C1;u=e.timing&&e.timing.fetchStart}return u}function C4u(u){const e=m1(kJ()),a=m1(typeof u=="number"?u:C1.now());return yJ(e,a)}function F4u(u,e){let a=e[0]-u[0],t=e[1]-u[1];return t<0&&(a-=1,t+=q5),[a,t]}function A4u(u){return u[0]*q5+u[1]}function bJ(u){return Array.isArray(u)&&u.length===2&&typeof u[0]=="number"&&typeof u[1]=="number"}function zj(u){return bJ(u)||typeof u=="number"||u instanceof Date}function yJ(u,e){const a=[u[0]+e[0],u[1]+e[1]];return a[1]>=q5&&(a[1]-=q5,a[0]+=1),a}var Qr;(function(u){u[u.SUCCESS=0]="SUCCESS",u[u.FAILED=1]="FAILED"})(Qr||(Qr={}));class B4u{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(a=>typeof a.fields=="function"?a.fields():[]).reduce((a,t)=>a.concat(t),[])))}inject(e,a,t){for(const r of this._propagators)try{r.inject(e,a,t)}catch(n){Gu.warn(`Failed to inject with ${r.constructor.name}. Err: ${n.message}`)}}extract(e,a,t){return this._propagators.reduce((r,n)=>{try{return n.extract(r,a,t)}catch(i){Gu.warn(`Failed to extract with ${n.constructor.name}. Err: ${i.message}`)}return r},e)}fields(){return this._fields.slice()}}const Ly="[_0-9a-z-*/]",S4u=`[a-z]${Ly}{0,255}`,z4u=`[a-z0-9]${Ly}{0,240}@[a-z]${Ly}{0,13}`,w4u=new RegExp(`^(?:${S4u}|${z4u})$`),O4u=/^[ -~]{0,255}[!-~]$/,P4u=/,|=/;function j4u(u){return w4u.test(u)}function M4u(u){return O4u.test(u)&&!P4u.test(u)}const wj=32,T4u=512,Oj=",",Pj="=";class EA{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,a){const t=this._clone();return t._internalState.has(e)&&t._internalState.delete(e),t._internalState.set(e,a),t}unset(e){const a=this._clone();return a._internalState.delete(e),a}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,a)=>(e.push(a+Pj+this.get(a)),e),[]).join(Oj)}_parse(e){e.length>T4u||(this._internalState=e.split(Oj).reverse().reduce((a,t)=>{const r=t.trim(),n=r.indexOf(Pj);if(n!==-1){const i=r.slice(0,n),o=r.slice(n+1,t.length);j4u(i)&&M4u(o)&&a.set(i,o)}return a},new Map),this._internalState.size>wj&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,wj))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){const e=new EA;return e._internalState=new Map(this._internalState),e}}const ok="traceparent",sk="tracestate",$4u="00",R4u="(?!ff)[\\da-f]{2}",N4u="(?![0]{32})[\\da-f]{32}",_4u="(?![0]{16})[\\da-f]{16}",L4u="[\\da-f]{2}",I4u=new RegExp(`^\\s?(${R4u})-(${N4u})-(${_4u})-(${L4u})(-.*)?\\s?$`);function K4u(u){const e=I4u.exec(u);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}class V4u{inject(e,a,t){const r=O0.getSpanContext(e);if(!r||dA(e)||!rg(r))return;const n=`${$4u}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||bi.NONE).toString(16)}`;t.set(a,ok,n),r.traceState&&t.set(a,sk,r.traceState.serialize())}extract(e,a,t){const r=t.get(a,ok);if(!r)return e;const n=Array.isArray(r)?r[0]:r;if(typeof n!="string")return e;const i=K4u(n);if(!i)return e;i.isRemote=!0;const o=t.get(a,sk);if(o){const s=Array.isArray(o)?o.join(","):o;i.traceState=new EA(typeof s=="string"?s:void 0)}return O0.setSpanContext(e,i)}fields(){return[ok,sk]}}const G4u="[object Object]",H4u="[object Null]",q4u="[object Undefined]",W4u=Function.prototype,CJ=W4u.toString,J4u=CJ.call(Object),U4u=Object.getPrototypeOf,FJ=Object.prototype,AJ=FJ.hasOwnProperty,fs=Symbol?Symbol.toStringTag:void 0,BJ=FJ.toString;function jj(u){if(!Z4u(u)||Q4u(u)!==G4u)return!1;const e=U4u(u);if(e===null)return!0;const a=AJ.call(e,"constructor")&&e.constructor;return typeof a=="function"&&a instanceof a&&CJ.call(a)===J4u}function Z4u(u){return u!=null&&typeof u=="object"}function Q4u(u){return u==null?u===void 0?q4u:H4u:fs&&fs in Object(u)?Y4u(u):X4u(u)}function Y4u(u){const e=AJ.call(u,fs),a=u[fs];let t=!1;try{u[fs]=void 0,t=!0}catch{}const r=BJ.call(u);return t&&(e?u[fs]=a:delete u[fs]),r}function X4u(u){return BJ.call(u)}const edu=20;function udu(...u){let e=u.shift();const a=new WeakMap;for(;u.length>0;)e=SJ(e,u.shift(),0,a);return e}function lk(u){return W5(u)?u.slice():u}function SJ(u,e,a=0,t){let r;if(!(a>edu)){if(a++,gx(u)||gx(e)||zJ(e))r=lk(e);else if(W5(u)){if(r=u.slice(),W5(e))for(let n=0,i=e.length;n<i;n++)r.push(lk(e[n]));else if(b4(e)){const n=Object.keys(e);for(let i=0,o=n.length;i<o;i++){const s=n[i];r[s]=lk(e[s])}}}else if(b4(u))if(b4(e)){if(!adu(u,e))return e;r=Object.assign({},u);const n=Object.keys(e);for(let i=0,o=n.length;i<o;i++){const s=n[i],l=e[s];if(gx(l))typeof l>"u"?delete r[s]:r[s]=l;else{const c=r[s],d=l;if(Mj(u,s,t)||Mj(e,s,t))delete r[s];else{if(b4(c)&&b4(d)){const E=t.get(c)||[],p=t.get(d)||[];E.push({obj:u,key:s}),p.push({obj:e,key:s}),t.set(c,E),t.set(d,p)}r[s]=SJ(r[s],l,a,t)}}}}else r=e;return r}}function Mj(u,e,a){const t=a.get(u[e])||[];for(let r=0,n=t.length;r<n;r++){const i=t[r];if(i.key===e&&i.obj===u)return!0}return!1}function W5(u){return Array.isArray(u)}function zJ(u){return typeof u=="function"}function b4(u){return!gx(u)&&!W5(u)&&!zJ(u)&&typeof u=="object"}function gx(u){return typeof u=="string"||typeof u=="number"||typeof u=="boolean"||typeof u>"u"||u instanceof Date||u instanceof RegExp||u===null}function adu(u,e){return!(!jj(u)||!jj(e))}class tdu{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,a)=>{this._resolve=e,this._reject=a})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}class rdu{_callback;_that;_isCalled=!1;_deferred=new tdu;constructor(e,a){this._callback=e,this._that=a}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(a=>this._deferred.resolve(a),a=>this._deferred.reject(a))}catch(a){this._deferred.reject(a)}}return this._deferred.promise}}function ndu(){return"unknown_service"}const W4=u=>u!==null&&typeof u=="object"&&typeof u.then=="function";class J5{_rawAttributes;_asyncAttributesPending=!1;_memoizedAttributes;static FromAttributeList(e){const a=new J5({});return a._rawAttributes=Tj(e),a._asyncAttributesPending=e.filter(([t,r])=>W4(r)).length>0,a}constructor(e){const a=e.attributes??{};this._rawAttributes=Object.entries(a).map(([t,r])=>(W4(r)&&(this._asyncAttributesPending=!0),[t,r])),this._rawAttributes=Tj(this._rawAttributes)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){const[a,t]=this._rawAttributes[e];this._rawAttributes[e]=[a,W4(t)?await t:t]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Gu.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const e={};for(const[a,t]of this._rawAttributes){if(W4(t)){Gu.debug(`Unsettled resource attribute ${a} skipped`);continue}t!=null&&(e[a]??=t)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}merge(e){return e==null?this:J5.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()])}}function wJ(u){return J5.FromAttributeList(Object.entries(u))}function idu(){return wJ({[vJ]:ndu(),[Ry]:ik[Ry],[Ny]:ik[Ny],[_y]:ik[_y]})}function Tj(u){return u.map(([e,a])=>W4(a)?[e,a.catch(t=>{Gu.debug("promise rejection for resource attribute: %s - %s",e,t)})]:[e,a])}const odu="exception";class sdu{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;name;status={code:qd.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){const a=Date.now();this._spanContext=e.spanContext,this._performanceStartTime=C1.now(),this._performanceOffset=a-(this._performanceStartTime+kJ()),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??a),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,a){if(a==null||this._isSpanEnded())return this;if(e.length===0)return Gu.warn(`Invalid attribute key: ${e}`),this;if(!fJ(a))return Gu.warn(`Invalid attribute value set for key: ${e}`),this;const{attributeCountLimit:t}=this._spanLimits;return t!==void 0&&Object.keys(this.attributes).length>=t&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(a),this)}setAttributes(e){for(const[a,t]of Object.entries(e))this.setAttribute(a,t);return this}addEvent(e,a,t){if(this._isSpanEnded())return this;const{eventCountLimit:r}=this._spanLimits;if(r===0)return Gu.warn("No events allowed."),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&Gu.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),zj(a)&&(zj(t)||(t=a),a=void 0);const n=fx(a);return this.events.push({name:e,attributes:n,time:this._getTime(t),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"&&(Gu.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()){Gu.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=F4u(this.startTime,this.endTime),this._duration[0]<0&&(Gu.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&&Gu.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e=="number"&&e<=C1.now())return C4u(e+this._performanceOffset);if(typeof e=="number")return m1(e);if(e instanceof Date)return m1(e.getTime());if(bJ(e))return e;if(this._startTimeProvided)return m1(Date.now());const a=C1.now()-this._performanceStartTime;return yJ(this.startTime,m1(a))}isRecording(){return this._ended===!1}recordException(e,a){const t={};typeof e=="string"?t[rk]=e:e&&(e.code?t[nk]=e.code.toString():e.name&&(t[nk]=e.name),e.message&&(t[rk]=e.message),e.stack&&(t[D4u]=e.stack)),t[nk]||t[rk]?this.addEvent(odu,t,a):Gu.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}}`);Gu.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,a){return e.length<=a?e:e.substring(0,a)}_truncateToSize(e){const a=this._attributeValueLengthLimit;return a<=0?(Gu.warn(`Attribute value limit must be positive, got ${a}`),e):typeof e=="string"?this._truncateToLimitUtil(e,a):Array.isArray(e)?e.map(t=>typeof t=="string"?this._truncateToLimitUtil(t,a):t):e}}var U1;(function(u){u[u.NOT_RECORD=0]="NOT_RECORD",u[u.RECORD=1]="RECORD",u[u.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(U1||(U1={}));class U5{shouldSample(){return{decision:U1.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class F1{shouldSample(){return{decision:U1.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class dh{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||(J1(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new F1),this._remoteParentSampled=e.remoteParentSampled??new F1,this._remoteParentNotSampled=e.remoteParentNotSampled??new U5,this._localParentSampled=e.localParentSampled??new F1,this._localParentNotSampled=e.localParentNotSampled??new U5}shouldSample(e,a,t,r,n,i){const o=O0.getSpanContext(e);return!o||!rg(o)?this._root.shouldSample(e,a,t,r,n,i):o.isRemote?o.traceFlags&bi.SAMPLED?this._remoteParentSampled.shouldSample(e,a,t,r,n,i):this._remoteParentNotSampled.shouldSample(e,a,t,r,n,i):o.traceFlags&bi.SAMPLED?this._localParentSampled.shouldSample(e,a,t,r,n,i):this._localParentNotSampled.shouldSample(e,a,t,r,n,i)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}class $j{_ratio;_upperBound;constructor(e=0){this._ratio=e,this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,a){return{decision:mJ(a)&&this._accumulate(a)<this._upperBound?U1.RECORD_AND_SAMPLED:U1.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 a=0;for(let t=0;t<e.length/8;t++){const r=t*8,n=parseInt(e.slice(r,r+8),16);a=(a^n)>>>0}return a}}const Rj=1;function OJ(){return{sampler:PJ(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function PJ(){const u="parentbased_always_on";switch(u){case"always_on":return new F1;case"always_off":return new U5;case"parentbased_always_on":return new dh({root:new F1});case"parentbased_always_off":return new dh({root:new U5});case"traceidratio":return new $j(Nj());case"parentbased_traceidratio":return new dh({root:new $j(Nj())});default:return Gu.error(`OTEL_TRACES_SAMPLER value "${u}" invalid, defaulting to "parentbased_always_on".`),new dh({root:new F1})}}function Nj(){return Gu.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Rj}.`),Rj}const ldu=128,cdu=1/0;function ddu(u){const e={sampler:PJ()},a=OJ(),t=Object.assign({},a,e,u);return t.generalLimits=Object.assign({},a.generalLimits,u.generalLimits||{}),t.spanLimits=Object.assign({},a.spanLimits,u.spanLimits||{}),t}function Edu(u){const e=Object.assign({},u.spanLimits);return e.attributeCountLimit=u.spanLimits?.attributeCountLimit??u.generalLimits?.attributeCountLimit??void 0??void 0??ldu,e.attributeValueLengthLimit=u.spanLimits?.attributeValueLengthLimit??u.generalLimits?.attributeValueLengthLimit??void 0??void 0??cdu,Object.assign({},u,{spanLimits:e})}class pdu{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,a){this._exporter=e,this._maxExportBatchSize=typeof a?.maxExportBatchSize=="number"?a.maxExportBatchSize:512,this._maxQueueSize=typeof a?.maxQueueSize=="number"?a.maxQueueSize:2048,this._scheduledDelayMillis=typeof a?.scheduledDelayMillis=="number"?a.scheduledDelayMillis:5e3,this._exportTimeoutMillis=typeof a?.exportTimeoutMillis=="number"?a.exportTimeoutMillis:3e4,this._shutdownOnce=new rdu(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(Gu.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,a){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&bi.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&&Gu.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(Gu.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,a)=>{const t=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let n=0,i=r;n<i;n++)t.push(this._flushOneBatch());Promise.all(t).then(()=>{e()}).catch(a)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,a)=>{const t=setTimeout(()=>{a(new Error("Timeout"))},this._exportTimeoutMillis);di.with(u4u(di.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);const n=()=>this._exporter.export(r,o=>{clearTimeout(t),o.code===Qr.SUCCESS?e():a(o.error??new Error("BatchSpanProcessor: span export failed"))});let i=null;for(let o=0,s=r.length;o<s;o++){const l=r[o];l.resource.asyncAttributesPending&&l.resource.waitForAsyncAttributes&&(i??=[],i.push(l.resource.waitForAsyncAttributes()))}i===null?n():Promise.all(i).then(n,o=>{J1(o),a(o)})})})}_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(a=>{this._isExporting=!1,J1(a)})};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 mdu extends pdu{_visibilityChangeListener;_pageHideListener;constructor(e,a){super(e,a),this.onInit(a)}onInit(e){e?.disableAutoFlushOnDocumentHide!==!0&&typeof document<"u"&&(this._visibilityChangeListener=()=>{document.visibilityState==="hidden"&&this.forceFlush().catch(a=>{J1(a)})},this._pageHideListener=()=>{this.forceFlush().catch(a=>{J1(a)})},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 hdu=8,xdu=16;class Ddu{generateTraceId=_j(xdu);generateSpanId=_j(hdu)}const Eh=Array(32);function _j(u){return function(){for(let a=0;a<u*2;a++)Eh[a]=Math.floor(Math.random()*16)+48,Eh[a]>=58&&(Eh[a]+=39);return String.fromCharCode.apply(null,Eh.slice(0,u*2))}}class fdu{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;constructor(e,a,t,r){const n=ddu(a);this._sampler=n.sampler,this._generalLimits=n.generalLimits,this._spanLimits=n.spanLimits,this._idGenerator=a.idGenerator||new Ddu,this._resource=t,this._spanProcessor=r,this.instrumentationScope=e}startSpan(e,a={},t=di.active()){a.root&&(t=O0.deleteSpan(t));const r=O0.getSpan(t);if(dA(t))return Gu.debug("Instrumentation suppressed, returning Noop Span"),O0.wrapSpanContext(EJ);const n=r?.spanContext(),i=this._idGenerator.generateSpanId();let o,s,l;!n||!O0.isSpanContextValid(n)?s=this._idGenerator.generateTraceId():(s=n.traceId,l=n.traceState,o=n);const c=a.kind??My.INTERNAL,d=(a.links??[]).map(f=>({context:f.context,attributes:fx(f.attributes)})),E=fx(a.attributes),p=this._sampler.shouldSample(t,s,e,c,E,d);l=p.traceState??l;const x=p.decision===H5.RECORD_AND_SAMPLED?bi.SAMPLED:bi.NONE,m={traceId:s,spanId:i,traceFlags:x,traceState:l};if(p.decision===H5.NOT_RECORD)return Gu.debug("Recording is off, propagating context in a non-recording span"),O0.wrapSpanContext(m);const g=fx(Object.assign(E,p.attributes));return new sdu({resource:this._resource,scope:this.instrumentationScope,context:t,spanContext:m,name:e,kind:c,links:d,parentSpanContext:o,attributes:g,startTime:a.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits})}startActiveSpan(e,a,t,r){let n,i,o;if(arguments.length<2)return;arguments.length===2?o=a:arguments.length===3?(n=a,o=t):(n=a,i=t,o=r);const s=i??di.active(),l=this.startSpan(e,n,s),c=O0.setSpan(s,l);return di.with(c,o,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}class gdu{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){const e=[];for(const a of this._spanProcessors)e.push(a.forceFlush());return new Promise(a=>{Promise.all(e).then(()=>{a()}).catch(t=>{J1(t||new Error("MultiSpanProcessor: forceFlush failed")),a()})})}onStart(e,a){for(const t of this._spanProcessors)t.onStart(e,a)}onEnd(e){for(const a of this._spanProcessors)a.onEnd(e)}shutdown(){const e=[];for(const a of this._spanProcessors)e.push(a.shutdown());return new Promise((a,t)=>{Promise.all(e).then(()=>{a()},t)})}}var gs;(function(u){u[u.resolved=0]="resolved",u[u.timeout=1]="timeout",u[u.error=2]="error",u[u.unresolved=3]="unresolved"})(gs||(gs={}));class vdu{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){const a=udu({},OJ(),Edu(e));this._resource=a.resource??idu(),this._config=Object.assign({},a,{resource:this._resource});const t=[];e.spanProcessors?.length&&t.push(...e.spanProcessors),this._activeSpanProcessor=new gdu(t)}getTracer(e,a,t){const r=`${e}@${a||""}:${t?.schemaUrl||""}`;return this._tracers.has(r)||this._tracers.set(r,new fdu({name:e,version:a,schemaUrl:t?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){const e=this._config.forceFlushTimeoutMillis,a=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(r=>{let n;const i=setTimeout(()=>{r(new Error(`Span processor did not completed within timeout period of ${e} ms`)),n=gs.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),n!==gs.timeout&&(n=gs.resolved,r(n))}).catch(o=>{clearTimeout(i),n=gs.error,r(o)})}));return new Promise((t,r)=>{Promise.all(a).then(n=>{const i=n.filter(o=>o!==gs.resolved);i.length>0?r(i):t()}).catch(n=>r([n]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}class kdu{_enabled=!1;_currentContext=n1;_bindFunction(e=n1,a){const t=this,r=function(...n){return t.with(e,()=>a.apply(this,n))};return Object.defineProperty(r,"length",{enumerable:!1,configurable:!0,writable:!1,value:a.length}),r}active(){return this._currentContext}bind(e,a){return e===void 0&&(e=this.active()),typeof a=="function"?this._bindFunction(e,a):a}disable(){return this._currentContext=n1,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=n1,this)}with(e,a,t,...r){const n=this._currentContext;this._currentContext=e||n1;try{return a.call(t,...r)}finally{this._currentContext=n}}}function bdu(u){if(u!==null){if(u===void 0){const e=new kdu;e.enable(),di.setGlobalContextManager(e);return}u.enable(),di.setGlobalContextManager(u)}}function ydu(u){if(u!==null){if(u===void 0){pd.setGlobalPropagator(new B4u({propagators:[new V4u,new l4u]}));return}pd.setGlobalPropagator(u)}}class Cdu extends vdu{constructor(e={}){super(e)}register(e={}){O0.setGlobalTracerProvider(this),ydu(e.propagator),bdu(e.contextManager)}}class Fdu{_delegate;constructor(e){this._delegate=e}export(e,a){this._delegate.export(e,a)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}class Lj extends Error{code;name="OTLPExporterError";data;constructor(e,a,t){super(e),this.data=t,this.code=a}}function Adu(u){if(Number.isFinite(u)&&u>0)return u;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${u}')`)}function Bdu(u){if(u!=null)return()=>u}function Sdu(u,e,a){return{timeoutMillis:Adu(u.timeoutMillis??e.timeoutMillis??a.timeoutMillis),concurrencyLimit:u.concurrencyLimit??e.concurrencyLimit??a.concurrencyLimit,compression:u.compression??e.compression??a.compression}}function zdu(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}class wdu{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(e);const a=()=>{const t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(a,a)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}function Odu(u){return new wdu(u.concurrencyLimit)}function Pdu(u){return Object.prototype.hasOwnProperty.call(u,"partialSuccess")}function jdu(){return{handleResponse(u){u==null||!Pdu(u)||u.partialSuccess==null||Object.keys(u.partialSuccess).length===0||Gu.warn("Received Partial Success response:",JSON.stringify(u.partialSuccess))}}}class Mdu{_transport;_serializer;_responseHandler;_promiseQueue;_timeout;_diagLogger;constructor(e,a,t,r,n){this._transport=e,this._serializer=a,this._responseHandler=t,this._promiseQueue=r,this._timeout=n,this._diagLogger=Gu.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,a){if(this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit()){a({code:Qr.FAILED,error:new Error("Concurrent export limit reached")});return}const t=this._serializer.serializeRequest(e);if(t==null){a({code:Qr.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(t,this._timeout).then(r=>{if(r.status==="success"){if(r.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(r.data))}catch(n){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",n,r.data)}a({code:Qr.SUCCESS});return}else if(r.status==="failure"&&r.error){a({code:Qr.FAILED,error:r.error});return}else r.status==="retryable"?a({code:Qr.FAILED,error:new Lj("Export failed with retryable status")}):a({code:Qr.FAILED,error:new Lj("Export failed with unknown error")})},r=>a({code:Qr.FAILED,error:r})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function Tdu(u,e){return new Mdu(u.transport,u.serializer,jdu(),u.promiseHandler,e.timeout)}function jJ(u,e,a){return Tdu({transport:a,serializer:e,promiseHandler:Odu(u)},{timeout:u.timeoutMillis})}function Ij(u){return u>=48&&u<=57?u-48:u>=97&&u<=102?u-87:u-55}function MJ(u){const e=new Uint8Array(u.length/2);let a=0;for(let t=0;t<u.length;t+=2){const r=Ij(u.charCodeAt(t)),n=Ij(u.charCodeAt(t+1));e[a++]=r<<4|n}return e}function TJ(u){const e=BigInt(1e9);return BigInt(u[0])*e+BigInt(u[1])}function $du(u){const e=Number(BigInt.asUintN(32,u)),a=Number(BigInt.asUintN(32,u>>BigInt(32)));return{low:e,high:a}}function Rdu(u){const e=TJ(u);return $du(e)}function Ndu(u){return TJ(u).toString()}const _du=typeof BigInt<"u"?Ndu:A4u;function Kj(u){return u}function Ldu(u){if(u!==void 0)return MJ(u)}const Idu={encodeHrTime:Rdu,encodeSpanContext:MJ,encodeOptionalSpanContext:Ldu};function Kdu(u){return u===void 0?Idu:{encodeHrTime:_du,encodeSpanContext:Kj,encodeOptionalSpanContext:Kj}}function Vdu(u){return{attributes:ng(u.attributes),droppedAttributesCount:0}}function Gdu(u){return{name:u.name,version:u.version}}function ng(u){return Object.keys(u).map(e=>$J(e,u[e]))}function $J(u,e){return{key:u,value:RJ(e)}}function RJ(u){const e=typeof u;return e==="string"?{stringValue:u}:e==="number"?Number.isInteger(u)?{intValue:u}:{doubleValue:u}:e==="boolean"?{boolValue:u}:u instanceof Uint8Array?{bytesValue:u}:Array.isArray(u)?{arrayValue:{values:u.map(RJ)}}:e==="object"&&u!=null?{kvlistValue:{values:Object.entries(u).map(([a,t])=>$J(a,t))}}:{}}function Hdu(u,e){const a=u.spanContext(),t=u.status,r=u.parentSpanContext?.spanId?e.encodeSpanContext(u.parentSpanContext?.spanId):void 0;return{traceId:e.encodeSpanContext(a.traceId),spanId:e.encodeSpanContext(a.spanId),parentSpanId:r,traceState:a.traceState?.serialize(),name:u.name,kind:u.kind==null?0:u.kind+1,startTimeUnixNano:e.encodeHrTime(u.startTime),endTimeUnixNano:e.encodeHrTime(u.endTime),attributes:ng(u.attributes),droppedAttributesCount:u.droppedAttributesCount,events:u.events.map(n=>Wdu(n,e)),droppedEventsCount:u.droppedEventsCount,status:{code:t.code,message:t.message},links:u.links.map(n=>qdu(n,e)),droppedLinksCount:u.droppedLinksCount}}function qdu(u,e){return{attributes:u.attributes?ng(u.attributes):[],spanId:e.encodeSpanContext(u.context.spanId),traceId:e.encodeSpanContext(u.context.traceId),traceState:u.context.traceState?.serialize(),droppedAttributesCount:u.droppedAttributesCount||0}}function Wdu(u,e){return{attributes:u.attributes?ng(u.attributes):[],name:u.name,timeUnixNano:e.encodeHrTime(u.time),droppedAttributesCount:u.droppedAttributesCount||0}}function Jdu(u,e){const a=Kdu(e);return{resourceSpans:Zdu(u,a)}}function Udu(u){const e=new Map;for(const a of u){let t=e.get(a.resource);t||(t=new Map,e.set(a.resource,t));const r=`${a.instrumentationScope.name}@${a.instrumentationScope.version||""}:${a.instrumentationScope.schemaUrl||""}`;let n=t.get(r);n||(n=[],t.set(r,n)),n.push(a)}return e}function Zdu(u,e){const a=Udu(u),t=[],r=a.entries();let n=r.next();for(;!n.done;){const[i,o]=n.value,s=[],l=o.values();let c=l.next();for(;!c.done;){const E=c.value;if(E.length>0){const p=E.map(x=>Hdu(x,e));s.push({scope:Gdu(E[0].instrumentationScope),spans:p,schemaUrl:E[0].instrumentationScope.schemaUrl})}c=l.next()}const d={resource:Vdu(i),scopeSpans:s,schemaUrl:void 0};t.push(d),n=r.next()}return t}const Qdu={serializeRequest:u=>{const e=Jdu(u,{});return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:u=>{if(u.length===0)return{};const e=new TextDecoder;return JSON.parse(e.decode(u))}},Ydu=5,Xdu=1e3,eEu=5e3,uEu=1.5,Vj=.2;function aEu(){return Math.random()*(2*Vj)-Vj}class tEu{_transport;constructor(e){this._transport=e}retry(e,a,t){return new Promise((r,n)=>{setTimeout(()=>{this._transport.send(e,a).then(r,n)},t)})}async send(e,a){const t=Date.now()+a;let r=await this._transport.send(e,a),n=Ydu,i=Xdu;for(;r.status==="retryable"&&n>0;){n--;const o=Math.max(Math.min(i,eEu)+aEu(),0);i=i*uEu;const s=r.retryInMillis??o,l=t-Date.now();if(s>l)return r;r=await this.retry(e,l,s)}return r}shutdown(){return this._transport.shutdown()}}function NJ(u){return new tEu(u.transport)}function rEu(u){return[429,502,503,504].includes(u)}function nEu(u){if(u==null)return;const e=Number.parseInt(u,10);if(Number.isInteger(e))return e>0?e*1e3:-1;const a=new Date(u).getTime()-Date.now();return a>=0?a:0}class iEu{_parameters;constructor(e){this._parameters=e}send(e,a){return new Promise(t=>{const r=new XMLHttpRequest;r.timeout=a,r.open("POST",this._parameters.url);const n=this._parameters.headers();Object.entries(n).forEach(([i,o])=>{r.setRequestHeader(i,o)}),r.ontimeout=i=>{t({status:"failure",error:new Error("XHR request timed out")})},r.onreadystatechange=()=>{r.status>=200&&r.status<=299?(Gu.debug("XHR success"),t({status:"success"})):r.status&&rEu(r.status)?t({status:"retryable",retryInMillis:nEu(r.getResponseHeader("Retry-After"))}):r.status!==0&&t({status:"failure",error:new Error("XHR request failed with non-retryable status")})},r.onabort=()=>{t({status:"failure",error:new Error("XHR request aborted")})},r.onerror=()=>{t({status:"failure",error:new Error("XHR request errored")})},r.send(e)})}shutdown(){}}function oEu(u){return new iEu(u)}class sEu{_params;constructor(e){this._params=e}send(e){return new Promise(a=>{navigator.sendBeacon(this._params.url,new Blob([e],{type:this._params.blobType}))?(Gu.debug("SendBeacon success"),a({status:"success"})):a({status:"failure",error:new Error("SendBeacon failed")})})}shutdown(){}}function lEu(u){return new sEu(u)}function cEu(u,e){return jJ(u,e,NJ({transport:oEu(u)}))}function dEu(u,e){return jJ(u,e,NJ({transport:lEu({url:u.url,blobType:u.headers()["Content-Type"]})}))}function EEu(u){return()=>{const e={};return Object.entries(u?.()??{}).forEach(([a,t])=>{typeof t<"u"?e[a]=String(t):Gu.warn(`Header "${a}" has invalid value (${t}) and will be ignored`)}),e}}function pEu(u,e,a){const t={...a()},r={};return()=>(e!=null&&Object.assign(r,e()),u!=null&&Object.assign(r,u()),Object.assign(r,t))}function mEu(u){if(u!=null)try{return new URL(u),u}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${u}'`)}}function hEu(u,e,a){return{...Sdu(u,e,a),headers:pEu(EEu(u.headers),e.headers,a.headers),url:mEu(u.url)??e.url??a.url,agentOptions:u.agentOptions??e.agentOptions??a.agentOptions}}function xEu(u,e){return{...zdu(),headers:()=>u,url:"http://localhost:4318/"+e,agentOptions:{keepAlive:!0}}}function DEu(u,e,a){return hEu({url:u.url,timeoutMillis:u.timeoutMillis,headers:Bdu(u.headers),concurrencyLimit:u.concurrencyLimit},{},xEu(a,e))}function fEu(u,e,a,t){const r=!!u.headers||typeof navigator.sendBeacon!="function",n=DEu(u,a,t);return r?cEu(n,e):dEu(n,e)}class gEu extends Fdu{constructor(e={}){super(fEu(e,Qdu,"v1/traces",{"Content-Type":"application/json"}))}}class _J{emit(e){}}const vEu=new _J;class kEu{getLogger(e,a,t){return new _J}}const LJ=new kEu;class bEu{constructor(e,a,t,r){this._provider=e,this.name=a,this.version=t,this.options=r}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):vEu}}class Gj{getLogger(e,a,t){var r;return(r=this.getDelegateLogger(e,a,t))!==null&&r!==void 0?r:new bEu(this,e,a,t)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:LJ}setDelegate(e){this._delegate=e}getDelegateLogger(e,a,t){var r;return(r=this._delegate)===null||r===void 0?void 0:r.getLogger(e,a,t)}}const yEu=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},ph=Symbol.for("io.opentelemetry.js.api.logs"),y4=yEu;function CEu(u,e,a){return t=>t===u?e:a}const Hj=1;class pA{constructor(){this._proxyLoggerProvider=new Gj}static getInstance(){return this._instance||(this._instance=new pA),this._instance}setGlobalLoggerProvider(e){return y4[ph]?this.getLoggerProvider():(y4[ph]=CEu(Hj,e,LJ),this._proxyLoggerProvider.setDelegate(e),e)}getLoggerProvider(){var e,a;return(a=(e=y4[ph])===null||e===void 0?void 0:e.call(y4,Hj))!==null&&a!==void 0?a:this._proxyLoggerProvider}getLogger(e,a,t){return this.getLoggerProvider().getLogger(e,a,t)}disable(){delete y4[ph],this._proxyLoggerProvider=new Gj}}const FEu=pA.getInstance();function AEu(u,e,a,t){for(let r=0,n=u.length;r<n;r++){const i=u[r];e&&i.setTracerProvider(e),a&&i.setMeterProvider(a),t&&i.setLoggerProvider&&i.setLoggerProvider(t),i.getConfig().enabled||i.enable()}}function BEu(u){u.forEach(e=>e.disable())}function SEu(u){const e=u.tracerProvider||O0.getTracerProvider(),a=u.meterProvider||Wcu.getMeterProvider(),t=u.loggerProvider||FEu.getLoggerProvider(),r=u.instrumentations?.flat()??[];return AEu(r,e,a,t),()=>{BEu(r)}}class zEu{span=void 0;constructor(e){this.span=e}get context(){return this.span?.context}error(e){this.span&&(this.span.setStatus(qd.ERROR,e.message),this.span.recordException(e),this.span.end())}setAttribute(e,a){this.span&&this.span.setAttribute(e,a)}end(){this.span&&(this.span.setStatus(qd.OK),this.span.end())}}class wEu{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 a=e.time?new Date(e.time):new Date;this.tracer.startSpan(`event.${e.type}`,{attributes:this.processAttributes(e,a),startTime:a}).end(a)}catch(a){this.config?.isProd||console.error("Event reporting failed:",a)}}processAttributes(e,a){const r={"cloudevents.event_id":G5(),"cloudevents.event_type":e.type,"cloudevents.event_source":e.source,"cloudevents.event_spec_version":e.specversion,"cloudevents.event_data_content_type":e.datacontenttype||"application/json; charset=utf-8","cloudevents.event_time":a.toISOString(),"cloudevents.event_subject":e.subject??"","cloudevents.page.uri":location.href,"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};if(e.data&&typeof e.data=="object"&&Object.entries(e.data).forEach(([n,i])=>{const o=n.replace(/([A-Z])/g,"_$1").toLowerCase();i!==void 0&&(r[`cloudevents.event_data.${o}`]=i)}),"subjects"in e&&Array.isArray(e.subjects)){const n=e.subjects.reduce((i,o)=>{if(!o||typeof o!="object")return i;const s=o.object;if(!s||typeof s!="string")return i;const l=i.notUpdated.find(({object:c})=>c===s);return l?(i.updated=[l,o],i.notUpdated=i.notUpdated.filter(({object:c})=>c!==s)):i.updated.some(({object:c})=>c===s)||i.notUpdated.push(o),i},{updated:[],notUpdated:[]});n.updated.forEach((i,o)=>{const s=o===0?"after.":"before.",l=`${i.object}.`;Object.entries(i).forEach(([c,d])=>{d!==void 0&&(r[`cloudevents.subjects.${s}${l}${c}`]=d)})}),n.notUpdated.forEach(i=>{const o=`${i.object}.`;Object.entries(i).forEach(([s,l])=>{l!==void 0&&(r[`cloudevents.subjects.${o}${s}`]=l)})})}return Object.entries(e).forEach(([n,i])=>{["id","source","type","specversion","time","datacontenttype","data","subject","sourceDetails","analyticsMetadata","context"].includes(n)||i!==void 0&&(i instanceof Object?Object.entries(i).forEach(([o,s])=>{s!==void 0&&(r[`cloudevents.${n}.${o}`]=s)}):r[`cloudevents.${n}`]=i)}),r}startSpan(e,a){try{if(!this.tracer)return;let t;const r=e.time?new Date(e.time):new Date,n=this.tracer.startSpan(`event.${e.type}`,{attributes:this.processAttributes(e,r),root:!a},a);return a||(t=O0.setSpan(di.active(),n)),{end:()=>n.end(),setAttribute:(i,o)=>{n.setAttribute(`cloudevents.event_data.${this.getKeySnakeValue(i)}`,o)},setStatus:(i,o)=>n.setStatus({code:i,message:o}),parentCtx:t}}catch(t){this.config?.isProd||console.error("Event reporting failed:",t)}}startStepSpan(e){try{if(!this.tracer)return;const a=di.active(),t=e.time?new Date(e.time):new Date,r=this.tracer.startSpan(`event.${e.type}`,{attributes:this.processAttributes(e,t)},a),n=O0.setSpan(a,r);return{end:()=>r.end(),setAttribute:(i,o)=>{r.setAttribute(`cloudevents.event_data.${this.getKeySnakeValue(i)}`,o)},setStatus:(i,o)=>r.setStatus({code:i,message:o}),recordException:i=>r.recordException(i),context:n}}catch(a){this.config?.isProd||console.error("Event reporting failed:",a)}}traceStep(e){const a=this.startStepSpan(e);if(a)return new zEu(a)}async forceFlush(){return this.tracerProvider?.forceFlush()}getKeySnakeValue=e=>e.replace(/([A-Z])/g,"_$1").toLowerCase()}class OEu extends wEu{tracerProvider=null;tracer=null;initialized=!1;constructor(){super()}initTracer(e){if(!e.collectorUrl&&!e.collectorTraceUrl)return;const a=`ses_${G5()}`,t=wJ({[vJ]:e.serviceName,[f4u]:e.serviceVersion,session_id:a}),r=e.collectorTraceUrl||`${e.collectorUrl}/v1/traces`;this.tracerProvider=new Cdu({resource:t,spanProcessors:[new mdu(new gEu({url:r,headers:{}}))]}),this.tracer=this.tracerProvider.getTracer(e.tracerName),this.tracerProvider.register(),SEu({instrumentations:e.instrumentations??[]}),this.initialized=!0}}class PEu{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({organization:{id:"",slug:""},project:{id:"",slug:""},productType:"",sourceDetails:{user:"Anonymous",object:"user",uri:""},request:{source:""}}),this.otelClient=new OEu,this.tracer={traceStep:(e,a)=>{const t=this.constructCloudEvent(e,a);return this.otelClient.traceStep(t)}}}updateCloudEventData=e=>{this.config?.disabled||(this.useCloudEventData=e)};send(e,a){try{if(!this.config?.otel.isProd)return;const t=this.constructCloudEvent(e,a);this.sendToOtelService(t)}catch(t){this.config?.otel.isProd||console.error("Event reporting failed:",t)}}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.instrumentations||[]]}))}startSpan(e,a,t){if(this.config?.disabled)return;const r=this.constructCloudEvent(e,a);return this.otelClient.startSpan(r,t)}constructCloudEvent(e,a){const t=this.useCloudEventData();return{id:`evt_${G5()}`,type:e,source:t.request.source||"",specversion:"1.0",datacontenttype:"application/json",time:new Date().toISOString(),data:a,origin:"ui",sourceDetails:{id:t.sourceDetails.user||`usr_${G5()}`,object:t.sourceDetails.object||"user",uri:t.sourceDetails.uri||""},organization:t.organization,project:t.project,productType:t.productType}}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()}sendTabChangeMessage(e){this.send("tab.change",e)}sendButtonClickMessage(e){this.send("button.click",e)}sendChangeMessage(e){this.send("change",e)}sendContentCopyMessage(e){this.send("content.copy",e)}sendUrlClickMessage(e){this.send("url.click",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)}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)}}const jEu=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],IJ="https://cors.redocly.com/";function MEu(u,e,a){return e in u?Object.defineProperty(u,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):u[e]=a,u}function qj(u,e){var a=Object.keys(u);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(u);e&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(u,r).enumerable})),a.push.apply(a,t)}return a}function Wj(u){for(var e=1;e<arguments.length;e++){var a=arguments[e]!=null?arguments[e]:{};e%2?qj(Object(a),!0).forEach(function(t){MEu(u,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(a)):qj(Object(a)).forEach(function(t){Object.defineProperty(u,t,Object.getOwnPropertyDescriptor(a,t))})}return u}function dt(u){return"Minified Redux error #"+u+"; visit https://redux.js.org/Errors?code="+u+" for the full message or use the non-minified dev environment for full errors. "}var Jj=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),ck=function(){return Math.random().toString(36).substring(7).split("").join(".")},vo={INIT:"@@redux/INIT"+ck(),REPLACE:"@@redux/REPLACE"+ck(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+ck()}};function KJ(u){if(typeof u!="object"||u===null)return!1;for(var e=u;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(u)===e}function TEu(u){if(u===void 0)return"undefined";if(u===null)return"null";var e=typeof u;switch(e){case"boolean":case"string":case"number":case"symbol":case"function":return e}if(Array.isArray(u))return"array";if(NEu(u))return"date";if(REu(u))return"error";var a=$Eu(u);switch(a){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return a}return e.slice(8,-1).toLowerCase().replace(/\s/g,"")}function $Eu(u){return typeof u.constructor=="function"?u.constructor.name:null}function REu(u){return u instanceof Error||typeof u.message=="string"&&u.constructor&&typeof u.constructor.stackTraceLimit=="number"}function NEu(u){return u instanceof Date?!0:typeof u.toDateString=="function"&&typeof u.getDate=="function"&&typeof u.setDate=="function"}function ao(u){var e=typeof u;return process.env.NODE_ENV!=="production"&&(e=TEu(u)),e}function ig(u,e,a){var t;if(typeof e=="function"&&typeof a=="function"||typeof a=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?dt(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 a>"u"&&(a=e,e=void 0),typeof a<"u"){if(typeof a!="function")throw new Error(process.env.NODE_ENV==="production"?dt(1):"Expected the enhancer to be a function. Instead, received: '"+ao(a)+"'");return a(ig)(u,e)}if(typeof u!="function")throw new Error(process.env.NODE_ENV==="production"?dt(2):"Expected the root reducer to be a function. Instead, received: '"+ao(u)+"'");var r=u,n=e,i=[],o=i,s=!1;function l(){o===i&&(o=i.slice())}function c(){if(s)throw new Error(process.env.NODE_ENV==="production"?dt(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 n}function d(m){if(typeof m!="function")throw new Error(process.env.NODE_ENV==="production"?dt(4):"Expected the listener to be a function. Instead, received: '"+ao(m)+"'");if(s)throw new Error(process.env.NODE_ENV==="production"?dt(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 g=!0;return l(),o.push(m),function(){if(g){if(s)throw new Error(process.env.NODE_ENV==="production"?dt(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.");g=!1,l();var f=o.indexOf(m);o.splice(f,1),i=null}}}function E(m){if(!KJ(m))throw new Error(process.env.NODE_ENV==="production"?dt(7):"Actions must be plain objects. Instead, the actual type was: '"+ao(m)+"'. 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 m.type>"u")throw new Error(process.env.NODE_ENV==="production"?dt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(s)throw new Error(process.env.NODE_ENV==="production"?dt(9):"Reducers may not dispatch actions.");try{s=!0,n=r(n,m)}finally{s=!1}for(var g=i=o,h=0;h<g.length;h++){var f=g[h];f()}return m}function p(m){if(typeof m!="function")throw new Error(process.env.NODE_ENV==="production"?dt(10):"Expected the nextReducer to be a function. Instead, received: '"+ao(m));r=m,E({type:vo.REPLACE})}function x(){var m,g=d;return m={subscribe:function(f){if(typeof f!="object"||f===null)throw new Error(process.env.NODE_ENV==="production"?dt(11):"Expected the observer to be an object. Instead, received: '"+ao(f)+"'");function k(){f.next&&f.next(c())}k();var y=g(k);return{unsubscribe:y}}},m[Jj]=function(){return this},m}return E({type:vo.INIT}),t={dispatch:E,subscribe:d,getState:c,replaceReducer:p},t[Jj]=x,t}var _Eu=ig;function Iy(u){typeof console<"u"&&typeof console.error=="function"&&console.error(u);try{throw new Error(u)}catch{}}function LEu(u,e,a,t){var r=Object.keys(e),n=a&&a.type===vo.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(r.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(!KJ(u))return"The "+n+' has unexpected type of "'+ao(u)+'". Expected argument to be an object with the following '+('keys: "'+r.join('", "')+'"');var i=Object.keys(u).filter(function(o){return!e.hasOwnProperty(o)&&!t[o]});if(i.forEach(function(o){t[o]=!0}),!(a&&a.type===vo.REPLACE)&&i.length>0)return"Unexpected "+(i.length>1?"keys":"key")+" "+('"'+i.join('", "')+'" found in '+n+". ")+"Expected to find one of the known reducer keys instead: "+('"'+r.join('", "')+'". Unexpected keys will be ignored.')}function IEu(u){Object.keys(u).forEach(function(e){var a=u[e],t=a(void 0,{type:vo.INIT});if(typeof t>"u")throw new Error(process.env.NODE_ENV==="production"?dt(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 a(void 0,{type:vo.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?dt(13):'The slice reducer for key "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle '"+vo.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 KEu(u){for(var e=Object.keys(u),a={},t=0;t<e.length;t++){var r=e[t];process.env.NODE_ENV!=="production"&&typeof u[r]>"u"&&Iy('No reducer provided for key "'+r+'"'),typeof u[r]=="function"&&(a[r]=u[r])}var n=Object.keys(a),i;process.env.NODE_ENV!=="production"&&(i={});var o;try{IEu(a)}catch(s){o=s}return function(l,c){if(l===void 0&&(l={}),o)throw o;if(process.env.NODE_ENV!=="production"){var d=LEu(l,a,c,i);d&&Iy(d)}for(var E=!1,p={},x=0;x<n.length;x++){var m=n[x],g=a[m],h=l[m],f=g(h,c);if(typeof f>"u"){var k=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?dt(14):"When called with an action of type "+(k?'"'+String(k)+'"':"(unknown type)")+', the slice reducer for key "'+m+'" 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.')}p[m]=f,E=E||f!==h}return E=E||n.length!==Object.keys(l).length,E?p:l}}function Uj(u,e){return function(){return e(u.apply(this,arguments))}}function VEu(u,e){if(typeof u=="function")return Uj(u,e);if(typeof u!="object"||u===null)throw new Error(process.env.NODE_ENV==="production"?dt(16):"bindActionCreators expected an object or a function, but instead received: '"+ao(u)+`'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?`);var a={};for(var t in u){var r=u[t];typeof r=="function"&&(a[t]=Uj(r,e))}return a}function VJ(){for(var u=arguments.length,e=new Array(u),a=0;a<u;a++)e[a]=arguments[a];return e.length===0?function(t){return t}:e.length===1?e[0]:e.reduce(function(t,r){return function(){return t(r.apply(void 0,arguments))}})}function GEu(){for(var u=arguments.length,e=new Array(u),a=0;a<u;a++)e[a]=arguments[a];return function(t){return function(){var r=t.apply(void 0,arguments),n=function(){throw new Error(process.env.NODE_ENV==="production"?dt(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},i={getState:r.getState,dispatch:function(){return n.apply(void 0,arguments)}},o=e.map(function(s){return s(i)});return n=VJ.apply(void 0,o)(r.dispatch),Wj(Wj({},r),{},{dispatch:n})}}}function Zj(){}process.env.NODE_ENV!=="production"&&typeof Zj.name=="string"&&Zj.name!=="isCrushed"&&Iy('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 HEu=Object.freeze({__proto__:null,__DO_NOT_USE__ActionTypes:vo,applyMiddleware:GEu,bindActionCreators:VEu,combineReducers:KEu,compose:VJ,createStore:ig,legacy_createStore:_Eu});function qEu(u){var e=u.default;if(typeof e=="function"){var a=function(){return e.apply(this,arguments)};a.prototype=e.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(u).forEach(function(t){var r=Object.getOwnPropertyDescriptor(u,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:function(){return u[t]}})}),a}var WEu=qEu(HEu);WEu.compose;var JEu=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(u){return u}};function UEu(u,e,a){var t=!1,r=!1,n=ig(function(o,s){if(!r){var l=function(g){return Array.isArray(g)&&g.findIndex(function(h){return typeof h!="string"&&typeof h!="number"})===-1};if(s.type.startsWith("SET")){var c=function(g){try{t=!0,"value"in s?g.set(s.value):g.set(lu)}finally{t=!1}};if(s.path){if(l(s.path)){s.path.length===0&&c(u);for(var d=u,E=!0,p=0,x=s.path;p<x.length;p++){var m=x[p];d[m]?d=d[m]:E=!1}E&&c(d)}}else c(u)}else s.type==="BREAKPOINT"&&a()}return u.promised||u.error?lu:u.get({noproxy:!0})},JEu({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}})),i=function(o,s){if(t)s&&s();else try{r=!0,n.dispatch(o)}finally{r=!1}};return i}function ZEu(u){return function(){var e,a,t=!1;return{onInit:function(r,n){if(!(typeof window>"u"||!("__REDUX_DEVTOOLS_EXTENSION__"in window))){if(u?.key===void 0){if(n.identifier===void 0)throw Error("State is missing Identifiable extension or Devtools key option");e=n.identifier(r)}else e=u.key;a=UEu(r,e,function(){t=!t}),r.promise||a?.({type:"CREATE",state:r.get({noproxy:!0,stealth:!0})})}},onSet:function(r,n){if(a?.({type:"SET [".concat(r.path.join("/"),"]"),state:r.get({noproxy:!0,stealth:!0}),descriptor:n}),t)debugger},onDestroy:function(){a?.({type:"DESTROY"})}}}}var Nu=(u=>(u.Normal="Normal",u.Edit="Edit",u.Draft="Draft",u))(Nu||{});const RE="default",GJ=[{name:RE,inputs:[],servers:[],state:Nu.Normal}],HJ={activeTabIdx:0,tabs:[]};var Ur=(u=>(u.Idle="idle",u.Loading="loading",u.Success="success",u.Error="error",u))(Ur||{});function Ei(u){const e=new WeakMap;function a(t){if(typeof t!="object"||t===null)return t;if(e.has(t))return e.get(t);const r=Array.isArray(t)?[]:{};e.set(t,r);for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=a(t[n]));return r}return a(u)}function Qj(u){return Object.keys(u).forEach(e=>{u[e]===void 0&&delete u[e]}),u}const mn={FS:"fs",WEB:"web"},hn=window.__TAURI__?.http.fetch??globalThis.fetch;function Cc(){return!!window?.__TAURI__}function vx(u){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(u)}function Z5(u){return u.endsWith("/")?u.substring(0,u.length-1):u}function QEu(u){return u.startsWith("/")?u.substring(1):u}function YEu(u){try{const e=new URL(u);return e.search="",e.hash="",e.toString()}catch{return u}}function qJ(u){return/^https?:\/\//i.test(u)}function XEu(u,e){let a;if(e.startsWith("//")){const{protocol:t}=new URL(u);a=`${t||"https:"}${e}`}else if(vx(e))a=e;else if(!e.startsWith("/"))a=Z5(u)+"/"+e;else{const t=new URL(u);t.pathname=e,a=t.toString()}return Z5(a)}function Q5(u,e){let a=u;return e.forEach(({key:t,value:r,active:n})=>{r&&n&&(a=a.replaceAll(`{${t}}`,r))}),a}function mA(u,e){let a=u;return e.forEach(({name:t,value:r})=>{r&&(a=a.replaceAll(`{${t}}`,r))}),a}function e3u(u){return u.startsWith("http://")||u.startsWith("https://")}function mh({url:u,serverUrl:e,corsProxyUrl:a}){const t=e3u(u)||!e?u:`${Z5(e)}/${QEu(u)}`;return a?`${a}${t}`:t}class Yj{constructor(e){this.baseDir=e}async ls(e=""){const a=this.makeKey(e);return Object.keys(localStorage).filter(t=>t.startsWith(a)).map(t=>t.replace(a,""))}async get(e){const a=this.makeKey(e);return localStorage.getItem(a)??null}async set(e,a){const t=this.makeKey(e);localStorage.setItem(t,a)}async remove(e){const a=this.makeKey(e);localStorage.removeItem(a)}makeKey(e){return`replay:fs:${this.baseDir}/${e}`}}class u3u{baseDir="";async ls(e=""){return[]}async get(e){return null}async set(e,a){}async remove(e){}}async function u0(u,e={},a){return window.__TAURI_INTERNALS__.invoke(u,e,a)}var Y5;(function(u){u[u.Audio=1]="Audio",u[u.Cache=2]="Cache",u[u.Config=3]="Config",u[u.Data=4]="Data",u[u.LocalData=5]="LocalData",u[u.Document=6]="Document",u[u.Download=7]="Download",u[u.Picture=8]="Picture",u[u.Public=9]="Public",u[u.Video=10]="Video",u[u.Resource=11]="Resource",u[u.Temp=12]="Temp",u[u.AppConfig=13]="AppConfig",u[u.AppData=14]="AppData",u[u.AppLocalData=15]="AppLocalData",u[u.AppCache=16]="AppCache",u[u.AppLog=17]="AppLog",u[u.Desktop=18]="Desktop",u[u.Executable=19]="Executable",u[u.Font=20]="Font",u[u.Home=21]="Home",u[u.Runtime=22]="Runtime",u[u.Template=23]="Template"})(Y5||(Y5={}));async function a3u(){return u0("plugin:path|resolve_directory",{directory:Y5.AppData})}async function t3u(){return u0("plugin:path|resolve_directory",{directory:Y5.Desktop})}function WJ(){return window.__TAURI_INTERNALS__.plugins.path.sep}async function r3u(...u){return u0("plugin:path|resolve",{paths:u})}async function md(...u){return u0("plugin:path|join",{paths:u})}async function n3u(u){return u0("plugin:path|extname",{path:u})}async function JJ(u,e){return u0("plugin:path|basename",{path:u,ext:e})}async function i3u(u){return u0("plugin:path|is_absolute",{path:u})}var Xj;(function(u){u[u.Start=0]="Start",u[u.Current=1]="Current",u[u.End=2]="End"})(Xj||(Xj={}));async function eM(u,e){if(u instanceof URL&&u.protocol!=="file:")throw new TypeError("Must be a file URL.");await u0("plugin:fs|mkdir",{path:u instanceof URL?u.toString():u,options:e})}async function UJ(u,e){if(u instanceof URL&&u.protocol!=="file:")throw new TypeError("Must be a file URL.");return await u0("plugin:fs|read_dir",{path:u instanceof URL?u.toString():u,options:e})}async function o3u(u,e){if(u instanceof URL&&u.protocol!=="file:")throw new TypeError("Must be a file URL.");const a=await u0("plugin:fs|read_file",{path:u instanceof URL?u.toString():u,options:e});return a instanceof ArrayBuffer?new Uint8Array(a):Uint8Array.from(a)}async function hA(u,e){if(u instanceof URL&&u.protocol!=="file:")throw new TypeError("Must be a file URL.");return await u0("plugin:fs|read_text_file",{path:u instanceof URL?u.toString():u,options:e})}async function s3u(u,e){if(u instanceof URL&&u.protocol!=="file:")throw new TypeError("Must be a file URL.");await u0("plugin:fs|remove",{path:u instanceof URL?u.toString():u,options:e})}async function l3u(u,e,a){if(u instanceof URL&&u.protocol!=="file:")throw new TypeError("Must be a file URL.");await u0("plugin:fs|write_text_file",{path:u instanceof URL?u.toString():u,data:e,options:a})}async function ZJ(u,e){if(u instanceof URL&&u.protocol!=="file:")throw new TypeError("Must be a file URL.");return await u0("plugin:fs|exists",{path:u instanceof URL?u.toString():u,options:e})}class za{static utils=null;static async getUtils(){return za.utils||(za.utils=Cc()?await Promise.resolve().then(()=>require("./replay-tauri-path-HHx_7ddM.js")):await Promise.resolve().then(()=>nne)),za.utils}static async join(...e){return(await za.getUtils()).join(...e)}static async resolve(e){return(await za.getUtils()).resolve(e)}static async isAbsolute(e){return(await za.getUtils()).isAbsolute(e)}static async relative(e,a){return(await za.getUtils()).relative(e,a)}static async extname(e){return(await za.getUtils()).extname(e)}}const c3u=new Set(["node_modules"]);class uM{constructor(e){this.baseDir=e,this.initializeDirectory(e)}async initializeDirectory(e){await eM(e,{recursive:!0})}async ls(e){const a=await this.getFullPath(e);return this.getDirEntryFilesRecursively(a)}async getDirEntryFilesRecursively(e){try{const a=[],t=await UJ(e);for(const r of t)if(r.isDirectory){if(c3u.has(r.name))continue;const n=await md(e,r.name),i=await this.getDirEntryFilesRecursively(n);a.push(...i)}else{const n=await md(e,r.name),i=await za.relative(this.baseDir,n);a.push(i)}return a}catch(a){return a.includes("forbidden path")||console.error(a),[]}}async get(e){const a=await this.getFullPath(e);try{return await hA(a)}catch(t){return!t.includes("No such file or directory")&&!t.includes("forbidden path")&&console.error(t),null}}async set(e,a){const t=await this.getFullPath(e),r=WJ(),n=t.split(r).slice(0,-1).join(r);await eM(n,{recursive:!0}),await l3u(t,a)}async remove(e){const a=await this.getFullPath(e);try{await s3u(a)}catch(t){!t.includes("No such file or directory")&&!t.includes("forbidden path")&&console.error(t)}}async getFullPath(e){return await md(this.baseDir,e??"")}}class d3u{constructor(e){this.projectId=e}async get(){const e=this.getKey();return localStorage.getItem(e)??null}async set(e){const a=this.getKey();localStorage.setItem(a,e)}async remove(){const e=this.getKey();localStorage.removeItem(e)}getKey(){return`replay:secrets:${this.projectId}`}}class QJ{constructor(e){this.storage=e}itemIds=[];async parseMany(e,a){const r=(await Promise.all(e.map(async n=>{try{return await this.parse(n,a)}catch(i){return console.error(`Error parsing from ${n.type} ${n.uri}:`,i),null}}))).filter(n=>n!==null);return this.itemIds=r.map(n=>n.id),r}async write(e){e.state===Nu.Draft||e.srcType!==mn.FS||await this.storage.set(e.id,await this.stringify(e))}async remove(e){await this.storage.remove(e)}async updateRoot(e,a){const t=e.actions;if(t){for(const n in t){const i=parseInt(n);switch(t[n]){case"D":await this.remove(this.itemIds[i]);break;case"I":case"U":await this.write(a[i]);break}}return}const r=this.itemIds.filter(n=>!a.some(i=>i.id===n));await Promise.all([...a.map(n=>this.write(n)),...r.map(n=>this.remove(n))])}async update(e,a){const r={path:e.path.slice(1),actions:e.actions};if(r.path.length===0&&await this.updateRoot(r,a),r.path.length>0){const n=r.path[0];r.path.length===1&&r.actions&&r.actions.id==="U"&&await this.remove(this.itemIds[n]),r.path[1]&&r.path[1]==="id"&&await this.remove(this.itemIds[n]),await this.write(a[n])}this.itemIds=a.map(n=>n.id)}}class E3u extends QJ{parse(e){return{...e.content,id:e.uri,srcType:e.type}}async stringify(e){const{id:a,srcType:t,...r}=e;return await za.extname(a)===".json"?JSON.stringify(r,null,2):gi.dump(r)}}var wt=(u=>(u.SIMPLE="simple",u.REGEX="regex",u.JSONPATH="jsonpath",u.XPATH="xpath",u))(wt||{});const YJ=1024;let p3u=0,U0=class{constructor(e,a){this.from=e,this.to=a}};class vu{constructor(e={}){this.id=p3u++,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=Zt.match(e)),a=>{let t=e(a);return t===void 0?null:[this,t]}}}vu.closedBy=new vu({deserialize:u=>u.split(" ")});vu.openedBy=new vu({deserialize:u=>u.split(" ")});vu.group=new vu({deserialize:u=>u.split(" ")});vu.isolate=new vu({deserialize:u=>{if(u&&u!="rtl"&&u!="ltr"&&u!="auto")throw new RangeError("Invalid value for isolate: "+u);return u||"auto"}});vu.contextHash=new vu({perNode:!0});vu.lookAhead=new vu({perNode:!0});vu.mounted=new vu({perNode:!0});class Wd{constructor(e,a,t){this.tree=e,this.overlay=a,this.parser=t}static get(e){return e&&e.props&&e.props[vu.mounted.id]}}const m3u=Object.create(null);class Zt{constructor(e,a,t,r=0){this.name=e,this.props=a,this.id=t,this.flags=r}static define(e){let a=e.props&&e.props.length?Object.create(null):m3u,t=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new Zt(e.name||"",a,e.id,t);if(e.props){for(let n of e.props)if(Array.isArray(n)||(n=n(r)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");a[n[0].id]=n[1]}}return r}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 a=this.prop(vu.group);return a?a.indexOf(e)>-1:!1}return this.id==e}static match(e){let a=Object.create(null);for(let t in e)for(let r of t.split(" "))a[r]=e[t];return t=>{for(let r=t.prop(vu.group),n=-1;n<(r?r.length:0);n++){let i=a[n<0?t.name:r[n]];if(i)return i}}}}Zt.none=new Zt("",Object.create(null),0,8);class xA{constructor(e){this.types=e;for(let a=0;a<e.length;a++)if(e[a].id!=a)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let a=[];for(let t of this.types){let r=null;for(let n of e){let i=n(t);i&&(r||(r=Object.assign({},t.props)),r[i[0].id]=i[1])}a.push(r?new Zt(t.name,r,t.id,t.flags):t)}return new xA(a)}}const hh=new WeakMap,aM=new WeakMap;var Ea;(function(u){u[u.ExcludeBuffers=1]="ExcludeBuffers",u[u.IncludeAnonymous=2]="IncludeAnonymous",u[u.IgnoreMounts=4]="IgnoreMounts",u[u.IgnoreOverlays=8]="IgnoreOverlays"})(Ea||(Ea={}));let Va=class Ky{constructor(e,a,t,r,n){if(this.type=e,this.children=a,this.positions=t,this.length=r,this.props=null,n&&n.length){this.props=Object.create(null);for(let[i,o]of n)this.props[typeof i=="number"?i:i.id]=o}}toString(){let e=Wd.get(this);if(e&&!e.overlay)return e.tree.toString();let a="";for(let t of this.children){let r=t.toString();r&&(a&&(a+=","),a+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(a.length?"("+a+")":""):a}cursor(e=0){return new X5(this.topNode,e)}cursorAt(e,a=0,t=0){let r=hh.get(this)||this.topNode,n=new X5(r);return n.moveTo(e,a),hh.set(this,n._tree),n}get topNode(){return new ur(this,0,0,null)}resolve(e,a=0){let t=Jd(hh.get(this)||this.topNode,e,a,!1);return hh.set(this,t),t}resolveInner(e,a=0){let t=Jd(aM.get(this)||this.topNode,e,a,!0);return aM.set(this,t),t}resolveStack(e,a=0){return D3u(this,e,a)}iterate(e){let{enter:a,leave:t,from:r=0,to:n=this.length}=e,i=e.mode||0,o=(i&Ea.IncludeAnonymous)>0;for(let s=this.cursor(i|Ea.IncludeAnonymous);;){let l=!1;if(s.from<=n&&s.to>=r&&(!o&&s.type.isAnonymous||a(s)!==!1)){if(s.firstChild())continue;l=!0}for(;l&&t&&(o||!s.type.isAnonymous)&&t(s),!s.nextSibling();){if(!s.parent())return;l=!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 a in this.props)e.push([+a,this.props[a]]);return e}balance(e={}){return this.children.length<=8?this:gA(Zt.none,this.children,this.positions,0,this.children.length,0,this.length,(a,t,r)=>new Ky(this.type,a,t,r,this.propValues),e.makeTree||((a,t,r)=>new Ky(Zt.none,a,t,r)))}static build(e){return f3u(e)}};Va.empty=new Va(Zt.none,[],[],0);class DA{constructor(e,a){this.buffer=e,this.index=a}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 DA(this.buffer,this.index)}}class Bo{constructor(e,a,t){this.buffer=e,this.length=a,this.set=t}get type(){return Zt.none}toString(){let e=[];for(let a=0;a<this.buffer.length;)e.push(this.childString(a)),a=this.buffer[a+3];return e.join(",")}childString(e){let a=this.buffer[e],t=this.buffer[e+3],r=this.set.types[a],n=r.name;if(/\W/.test(n)&&!r.isError&&(n=JSON.stringify(n)),e+=4,t==e)return n;let i=[];for(;e<t;)i.push(this.childString(e)),e=this.buffer[e+3];return n+"("+i.join(",")+")"}findChild(e,a,t,r,n){let{buffer:i}=this,o=-1;for(let s=e;s!=a&&!(XJ(n,r,i[s+1],i[s+2])&&(o=s,t>0));s=i[s+3]);return o}slice(e,a,t){let r=this.buffer,n=new Uint16Array(a-e),i=0;for(let o=e,s=0;o<a;){n[s++]=r[o++],n[s++]=r[o++]-t;let l=n[s++]=r[o++]-t;n[s++]=r[o++]-e,i=Math.max(i,l)}return new Bo(n,i,this.set)}}function XJ(u,e,a,t){switch(u){case-2:return a<e;case-1:return t>=e&&a<e;case 0:return a<e&&t>e;case 1:return a<=e&&t>e;case 2:return t>e;case 4:return!0}}function Jd(u,e,a,t){for(var r;u.from==u.to||(a<1?u.from>=e:u.from>e)||(a>-1?u.to<=e:u.to<e);){let i=!t&&u instanceof ur&&u.index<0?null:u.parent;if(!i)return u;u=i}let n=t?0:Ea.IgnoreOverlays;if(t)for(let i=u,o=i.parent;o;i=o,o=i.parent)i instanceof ur&&i.index<0&&((r=o.enter(e,a,n))===null||r===void 0?void 0:r.from)!=i.from&&(u=o);for(;;){let i=u.enter(e,a,n);if(!i)return u;u=i}}class eU{cursor(e=0){return new X5(this,e)}getChild(e,a=null,t=null){let r=tM(this,e,a,t);return r.length?r[0]:null}getChildren(e,a=null,t=null){return tM(this,e,a,t)}resolve(e,a=0){return Jd(this,e,a,!1)}resolveInner(e,a=0){return Jd(this,e,a,!0)}matchContext(e){return Vy(this.parent,e)}enterUnfinishedNodesBefore(e){let a=this.childBefore(e),t=this;for(;a;){let r=a.lastChild;if(!r||r.to!=a.to)break;r.type.isError&&r.from==r.to?(t=a,a=r.prevSibling):a=r}return t}get node(){return this}get next(){return this.parent}}let ur=class kx extends eU{constructor(e,a,t,r){super(),this._tree=e,this.from=a,this.index=t,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,a,t,r,n=0){for(let i=this;;){for(let{children:o,positions:s}=i._tree,l=a>0?o.length:-1;e!=l;e+=a){let c=o[e],d=s[e]+i.from;if(XJ(r,t,d,d+c.length)){if(c instanceof Bo){if(n&Ea.ExcludeBuffers)continue;let E=c.findChild(0,c.buffer.length,a,t-d,r);if(E>-1)return new nn(new h3u(i,c,e,d),null,E)}else if(n&Ea.IncludeAnonymous||!c.type.isAnonymous||fA(c)){let E;if(!(n&Ea.IgnoreMounts)&&(E=Wd.get(c))&&!E.overlay)return new kx(E.tree,d,e,i);let p=new kx(c,d,e,i);return n&Ea.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(a<0?c.children.length-1:0,a,t,r)}}}if(n&Ea.IncludeAnonymous||!i.type.isAnonymous||(i.index>=0?e=i.index+a:e=a<0?-1:i._parent._tree.children.length,i=i._parent,!i))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,a,t=0){let r;if(!(t&Ea.IgnoreOverlays)&&(r=Wd.get(this._tree))&&r.overlay){let n=e-this.from;for(let{from:i,to:o}of r.overlay)if((a>0?i<=n:i<n)&&(a<0?o>=n:o>n))return new kx(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,a,t)}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 tM(u,e,a,t){let r=u.cursor(),n=[];if(!r.firstChild())return n;if(a!=null){for(let i=!1;!i;)if(i=r.type.is(a),!r.nextSibling())return n}for(;;){if(t!=null&&r.type.is(t))return n;if(r.type.is(e)&&n.push(r.node),!r.nextSibling())return t==null?n:[]}}function Vy(u,e,a=e.length-1){for(let t=u;a>=0;t=t.parent){if(!t)return!1;if(!t.type.isAnonymous){if(e[a]&&e[a]!=t.name)return!1;a--}}return!0}class h3u{constructor(e,a,t,r){this.parent=e,this.buffer=a,this.index=t,this.start=r}}class nn extends eU{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,a,t){super(),this.context=e,this._parent=a,this.index=t,this.type=e.buffer.set.types[e.buffer.buffer[t]]}child(e,a,t){let{buffer:r}=this.context,n=r.findChild(this.index+4,r.buffer[this.index+3],e,a-this.context.start,t);return n<0?null:new nn(this.context,this,n)}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,a,t=0){if(t&Ea.ExcludeBuffers)return null;let{buffer:r}=this.context,n=r.findChild(this.index+4,r.buffer[this.index+3],a>0?1:-1,e-this.context.start,a);return n<0?null:new nn(this.context,this,n)}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,a=e.buffer[this.index+3];return a<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new nn(this.context,this._parent,a):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,a=this._parent?this._parent.index+4:0;return this.index==a?this.externalSibling(-1):new nn(this.context,this._parent,e.findChild(a,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],a=[],{buffer:t}=this.context,r=this.index+4,n=t.buffer[this.index+3];if(n>r){let i=t.buffer[this.index+1];e.push(t.slice(r,n,i)),a.push(0)}return new Va(this.type,e,a,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function uU(u){if(!u.length)return null;let e=0,a=u[0];for(let n=1;n<u.length;n++){let i=u[n];(i.from>a.from||i.to<a.to)&&(a=i,e=n)}let t=a instanceof ur&&a.index<0?null:a.parent,r=u.slice();return t?r[e]=t:r.splice(e,1),new x3u(r,a)}class x3u{constructor(e,a){this.heads=e,this.node=a}get next(){return uU(this.heads)}}function D3u(u,e,a){let t=u.resolveInner(e,a),r=null;for(let n=t instanceof ur?t:t.context.parent;n;n=n.parent)if(n.index<0){let i=n.parent;(r||(r=[t])).push(i.resolve(e,a)),n=i}else{let i=Wd.get(n.tree);if(i&&i.overlay&&i.overlay[0].from<=e&&i.overlay[i.overlay.length-1].to>=e){let o=new ur(i.tree,i.overlay[0].from+n.from,-1,n);(r||(r=[t])).push(Jd(o,e,a,!1))}}return r?uU(r):t}class X5{get name(){return this.type.name}constructor(e,a=0){if(this.mode=a,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof ur)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.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,a){this.index=e;let{start:t,buffer:r}=this.buffer;return this.type=a||r.set.types[r.buffer[e]],this.from=t+r.buffer[e+1],this.to=t+r.buffer[e+2],!0}yield(e){return e?e instanceof ur?(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,a,t){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,a,t,this.mode));let{buffer:r}=this.buffer,n=r.findChild(this.index+4,r.buffer[this.index+3],e,a-this.buffer.start,t);return n<0?!1:(this.stack.push(this.index),this.yieldBuf(n))}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,a,t=this.mode){return this.buffer?t&Ea.ExcludeBuffers?!1:this.enterChild(1,e,a):this.yield(this._tree.enter(e,a,t))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ea.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ea.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:a}=this.buffer,t=this.stack.length-1;if(e<0){let r=t<0?0:this.stack[t]+4;if(this.index!=r)return this.yieldBuf(a.findChild(r,this.index,-1,0,4))}else{let r=a.buffer[this.index+3];if(r<(t<0?a.buffer.length:a.buffer[this.stack[t]+3]))return this.yieldBuf(r)}return t<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 a,t,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let n=0;n<this.index;n++)if(r.buffer.buffer[n+3]<this.index)return!1;({index:a,parent:t}=r)}else({index:a,_parent:t}=this._tree);for(;t;{index:a,_parent:t}=t)if(a>-1)for(let n=a+e,i=e<0?-1:t._tree.children.length;n!=i;n+=e){let o=t._tree.children[n];if(this.mode&Ea.IncludeAnonymous||o instanceof Bo||!o.type.isAnonymous||fA(o))return!1}return!0}move(e,a){if(a&&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,a=0){for(;(this.from==this.to||(a<1?this.from>=e:this.from>e)||(a>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,a););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,a=null,t=0;if(e&&e.context==this.buffer)e:for(let r=this.index,n=this.stack.length;n>=0;){for(let i=e;i;i=i._parent)if(i.index==r){if(r==this.index)return i;a=i,t=n+1;break e}r=this.stack[--n]}for(let r=t;r<this.stack.length;r++)a=new nn(this.buffer,a,this.stack[r]);return this.bufferNode=new nn(this.buffer,a,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,a){for(let t=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){t++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&a&&a(this),r=this.type.isAnonymous,!t)return;if(this.nextSibling())break;this.parent(),t--,r=!0}}}matchContext(e){if(!this.buffer)return Vy(this.node.parent,e);let{buffer:a}=this.buffer,{types:t}=a.set;for(let r=e.length-1,n=this.stack.length-1;r>=0;n--){if(n<0)return Vy(this._tree,e,r);let i=t[a.buffer[this.stack[n]]];if(!i.isAnonymous){if(e[r]&&e[r]!=i.name)return!1;r--}}return!0}}function fA(u){return u.children.some(e=>e instanceof Bo||!e.type.isAnonymous||fA(e))}function f3u(u){var e;let{buffer:a,nodeSet:t,maxBufferLength:r=YJ,reused:n=[],minRepeatType:i=t.types.length}=u,o=Array.isArray(a)?new DA(a,a.length):a,s=t.types,l=0,c=0;function d(v,b,C,B,z,P){let{id:L,start:I,end:G,size:X}=o,U=c,ae=l;for(;X<0;)if(o.next(),X==-1){let T=n[L];C.push(T),B.push(I-v);return}else if(X==-3){l=L;return}else if(X==-4){c=L;return}else throw new RangeError(`Unrecognized record size: ${X}`);let Ee=s[L],re,he,j=I-v;if(G-I<=r&&(he=g(o.pos-b,z))){let T=new Uint16Array(he.size-he.skip),V=o.pos-he.size,O=T.length;for(;o.pos>V;)O=h(he.start,T,O);re=new Bo(T,G-he.start,t),j=he.start-v}else{let T=o.pos-X;o.next();let V=[],O=[],F=L>=i?L:-1,S=0,$=G;for(;o.pos>T;)F>=0&&o.id==F&&o.size>=0?(o.end<=$-r&&(x(V,O,I,S,o.end,$,F,U,ae),S=V.length,$=o.end),o.next()):P>2500?E(I,T,V,O):d(I,T,V,O,F,P+1);if(F>=0&&S>0&&S<V.length&&x(V,O,I,S,I,$,F,U,ae),V.reverse(),O.reverse(),F>-1&&S>0){let q=p(Ee,ae);re=gA(Ee,V,O,0,V.length,0,G-I,q,q)}else re=m(Ee,V,O,G-I,U-G,ae)}C.push(re),B.push(j)}function E(v,b,C,B){let z=[],P=0,L=-1;for(;o.pos>b;){let{id:I,start:G,end:X,size:U}=o;if(U>4)o.next();else{if(L>-1&&G<L)break;L<0&&(L=X-r),z.push(I,G,X),P++,o.next()}}if(P){let I=new Uint16Array(P*4),G=z[z.length-2];for(let X=z.length-3,U=0;X>=0;X-=3)I[U++]=z[X],I[U++]=z[X+1]-G,I[U++]=z[X+2]-G,I[U++]=U;C.push(new Bo(I,z[2]-G,t)),B.push(G-v)}}function p(v,b){return(C,B,z)=>{let P=0,L=C.length-1,I,G;if(L>=0&&(I=C[L])instanceof Va){if(!L&&I.type==v&&I.length==z)return I;(G=I.prop(vu.lookAhead))&&(P=B[L]+I.length+G)}return m(v,C,B,z,P,b)}}function x(v,b,C,B,z,P,L,I,G){let X=[],U=[];for(;v.length>B;)X.push(v.pop()),U.push(b.pop()+C-z);v.push(m(t.types[L],X,U,P-z,I-P,G)),b.push(z-C)}function m(v,b,C,B,z,P,L){if(P){let I=[vu.contextHash,P];L=L?[I].concat(L):[I]}if(z>25){let I=[vu.lookAhead,z];L=L?[I].concat(L):[I]}return new Va(v,b,C,B,L)}function g(v,b){let C=o.fork(),B=0,z=0,P=0,L=C.end-r,I={size:0,start:0,skip:0};e:for(let G=C.pos-v;C.pos>G;){let X=C.size;if(C.id==b&&X>=0){I.size=B,I.start=z,I.skip=P,P+=4,B+=4,C.next();continue}let U=C.pos-X;if(X<0||U<G||C.start<L)break;let ae=C.id>=i?4:0,Ee=C.start;for(C.next();C.pos>U;){if(C.size<0)if(C.size==-3)ae+=4;else break e;else C.id>=i&&(ae+=4);C.next()}z=Ee,B+=X,P+=ae}return(b<0||B==v)&&(I.size=B,I.start=z,I.skip=P),I.size>4?I:void 0}function h(v,b,C){let{id:B,start:z,end:P,size:L}=o;if(o.next(),L>=0&&B<i){let I=C;if(L>4){let G=o.pos-(L-4);for(;o.pos>G;)C=h(v,b,C)}b[--C]=I,b[--C]=P-v,b[--C]=z-v,b[--C]=B}else L==-3?l=B:L==-4&&(c=B);return C}let f=[],k=[];for(;o.pos>0;)d(u.start||0,u.bufferStart||0,f,k,-1,0);let y=(e=u.length)!==null&&e!==void 0?e:f.length?k[0]+f[0].length:0;return new Va(s[u.topID],f.reverse(),k.reverse(),y)}const rM=new WeakMap;function bx(u,e){if(!u.isAnonymous||e instanceof Bo||e.type!=u)return 1;let a=rM.get(e);if(a==null){a=1;for(let t of e.children){if(t.type!=u||!(t instanceof Va)){a=1;break}a+=bx(u,t)}rM.set(e,a)}return a}function gA(u,e,a,t,r,n,i,o,s){let l=0;for(let x=t;x<r;x++)l+=bx(u,e[x]);let c=Math.ceil(l*1.5/8),d=[],E=[];function p(x,m,g,h,f){for(let k=g;k<h;){let y=k,v=m[k],b=bx(u,x[k]);for(k++;k<h;k++){let C=bx(u,x[k]);if(b+C>=c)break;b+=C}if(k==y+1){if(b>c){let C=x[y];p(C.children,C.positions,0,C.children.length,m[y]+f);continue}d.push(x[y])}else{let C=m[k-1]+x[k-1].length-v;d.push(gA(u,x,m,y,k,v,C,null,s))}E.push(v+f-n)}}return p(e,a,t,r,0),(o||s)(d,E,i)}class aU{constructor(){this.map=new WeakMap}setBuffer(e,a,t){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(a,t)}getBuffer(e,a){let t=this.map.get(e);return t&&t.get(a)}set(e,a){e instanceof nn?this.setBuffer(e.context.buffer,e.index,a):e instanceof ur&&this.map.set(e.tree,a)}get(e){return e instanceof nn?this.getBuffer(e.context.buffer,e.index):e instanceof ur?this.map.get(e.tree):void 0}cursorSet(e,a){e.buffer?this.setBuffer(e.buffer.buffer,e.index,a):this.map.set(e.tree,a)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class pi{constructor(e,a,t,r,n=!1,i=!1){this.from=e,this.to=a,this.tree=t,this.offset=r,this.open=(n?1:0)|(i?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,a=[],t=!1){let r=[new pi(0,e.length,e,0,!1,t)];for(let n of a)n.to>e.length&&r.push(n);return r}static applyChanges(e,a,t=128){if(!a.length)return e;let r=[],n=1,i=e.length?e[0]:null;for(let o=0,s=0,l=0;;o++){let c=o<a.length?a[o]:null,d=c?c.fromA:1e9;if(d-s>=t)for(;i&&i.from<d;){let E=i;if(s>=E.from||d<=E.to||l){let p=Math.max(E.from,s)-l,x=Math.min(E.to,d)-l;E=p>=x?null:new pi(p,x,E.tree,E.offset+l,o>0,!!c)}if(E&&r.push(E),i.to>d)break;i=n<e.length?e[n++]:null}if(!c)break;s=c.toA,l=c.toA-c.toB}return r}}let tU=class{startParse(e,a,t){return typeof e=="string"&&(e=new g3u(e)),t=t?t.length?t.map(r=>new U0(r.from,r.to)):[new U0(0,0)]:[new U0(0,e.length)],this.createParse(e,a||[],t)}parse(e,a,t){let r=this.startParse(e,a,t);for(;;){let n=r.advance();if(n)return n}}};class g3u{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,a){return this.string.slice(e,a)}}function v3u(u){return(e,a,t,r)=>new b3u(e,u,a,t,r)}class nM{constructor(e,a,t,r,n){this.parser=e,this.parse=a,this.overlay=t,this.target=r,this.from=n}}function iM(u){if(!u.length||u.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(u))}class k3u{constructor(e,a,t,r,n,i,o){this.parser=e,this.predicate=a,this.mounts=t,this.index=r,this.start=n,this.target=i,this.prev=o,this.depth=0,this.ranges=[]}}const Gy=new vu({perNode:!0});class b3u{constructor(e,a,t,r,n){this.nest=a,this.input=t,this.fragments=r,this.ranges=n,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return this.stoppedAt!=null&&(t=new Va(t.type,t.children,t.positions,t.length,t.propValues.concat([[Gy,this.stoppedAt]]))),t}let e=this.inner[this.innerDone],a=e.parse.advance();if(a){this.innerDone++;let t=Object.assign(Object.create(null),e.target.props);t[vu.mounted.id]=new Wd(a,e.overlay,e.parser),e.target.props=t}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let a=this.innerDone;a<this.inner.length;a++)this.inner[a].from<e&&(e=Math.min(e,this.inner[a].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let a=this.innerDone;a<this.inner.length;a++)this.inner[a].parse.stopAt(e)}startInner(){let e=new F3u(this.fragments),a=null,t=null,r=new X5(new ur(this.baseTree,this.ranges[0].from,0,null),Ea.IncludeAnonymous|Ea.IgnoreMounts);e:for(let n,i;;){let o=!0,s;if(this.stoppedAt!=null&&r.from>=this.stoppedAt)o=!1;else if(e.hasNode(r)){if(a){let l=a.mounts.find(c=>c.frag.from<=r.from&&c.frag.to>=r.to&&c.mount.overlay);if(l)for(let c of l.mount.overlay){let d=c.from+l.pos,E=c.to+l.pos;d>=r.from&&E<=r.to&&!a.ranges.some(p=>p.from<E&&p.to>d)&&a.ranges.push({from:d,to:E})}}o=!1}else if(t&&(i=y3u(t.ranges,r.from,r.to)))o=i!=2;else if(!r.type.isAnonymous&&(n=this.nest(r,this.input))&&(r.from<r.to||!n.overlay)){r.tree||C3u(r);let l=e.findMounts(r.from,n.parser);if(typeof n.overlay=="function")a=new k3u(n.parser,n.overlay,l,this.inner.length,r.from,r.tree,a);else{let c=lM(this.ranges,n.overlay||(r.from<r.to?[new U0(r.from,r.to)]:[]));c.length&&iM(c),(c.length||!n.overlay)&&this.inner.push(new nM(n.parser,c.length?n.parser.startParse(this.input,cM(l,c),c):n.parser.startParse(""),n.overlay?n.overlay.map(d=>new U0(d.from-r.from,d.to-r.from)):null,r.tree,c.length?c[0].from:r.from)),n.overlay?c.length&&(t={ranges:c,depth:0,prev:t}):o=!1}}else if(a&&(s=a.predicate(r))&&(s===!0&&(s=new U0(r.from,r.to)),s.from<s.to)){let l=a.ranges.length-1;l>=0&&a.ranges[l].to==s.from?a.ranges[l]={from:a.ranges[l].from,to:s.to}:a.ranges.push(s)}if(o&&r.firstChild())a&&a.depth++,t&&t.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(a&&!--a.depth){let l=lM(this.ranges,a.ranges);l.length&&(iM(l),this.inner.splice(a.index,0,new nM(a.parser,a.parser.startParse(this.input,cM(a.mounts,l),l),a.ranges.map(c=>new U0(c.from-a.start,c.to-a.start)),a.target,l[0].from))),a=a.prev}t&&!--t.depth&&(t=t.prev)}}}}function y3u(u,e,a){for(let t of u){if(t.from>=a)break;if(t.to>e)return t.from<=e&&t.to>=a?2:1}return 0}function oM(u,e,a,t,r,n){if(e<a){let i=u.buffer[e+1];t.push(u.slice(e,a,i)),r.push(i-n)}}function C3u(u){let{node:e}=u,a=[],t=e.context.buffer;do a.push(u.index),u.parent();while(!u.tree);let r=u.tree,n=r.children.indexOf(t),i=r.children[n],o=i.buffer,s=[n];function l(c,d,E,p,x,m){let g=a[m],h=[],f=[];oM(i,c,g,h,f,p);let k=o[g+1],y=o[g+2];s.push(h.length);let v=m?l(g+4,o[g+3],i.set.types[o[g]],k,y-k,m-1):e.toTree();return h.push(v),f.push(k-p),oM(i,o[g+3],d,h,f,p),new Va(E,h,f,x)}r.children[n]=l(0,o.length,Zt.none,0,i.length,a.length-1);for(let c of s){let d=u.tree.children[c],E=u.tree.positions[c];u.yield(new ur(d,E+u.from,c,u._tree))}}class sM{constructor(e,a){this.offset=a,this.done=!1,this.cursor=e.cursor(Ea.IncludeAnonymous|Ea.IgnoreMounts)}moveTo(e){let{cursor:a}=this,t=e-this.offset;for(;!this.done&&a.from<t;)a.to>=e&&a.enter(t,1,Ea.IgnoreOverlays|Ea.ExcludeBuffers)||a.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 a=this.cursor.tree;;){if(a==e.tree)return!0;if(a.children.length&&a.positions[0]==0&&a.children[0]instanceof Va)a=a.children[0];else break}return!1}}let F3u=class{constructor(e){var a;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let t=this.curFrag=e[0];this.curTo=(a=t.tree.prop(Gy))!==null&&a!==void 0?a:t.to,this.inner=new sM(t.tree,-t.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 a=this.curFrag=this.fragments[this.fragI];this.curTo=(e=a.tree.prop(Gy))!==null&&e!==void 0?e:a.to,this.inner=new sM(a.tree,-a.offset)}}findMounts(e,a){var t;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let n=this.inner.cursor.node;n;n=n.parent){let i=(t=n.tree)===null||t===void 0?void 0:t.prop(vu.mounted);if(i&&i.parser==a)for(let o=this.fragI;o<this.fragments.length;o++){let s=this.fragments[o];if(s.from>=n.to)break;s.tree==this.curFrag.tree&&r.push({frag:s,pos:n.from-s.offset,mount:i})}}}return r}};function lM(u,e){let a=null,t=e;for(let r=1,n=0;r<u.length;r++){let i=u[r-1].to,o=u[r].from;for(;n<t.length;n++){let s=t[n];if(s.from>=o)break;s.to<=i||(a||(t=a=e.slice()),s.from<i?(a[n]=new U0(s.from,i),s.to>o&&a.splice(n+1,0,new U0(o,s.to))):s.to>o?a[n--]=new U0(o,s.to):a.splice(n--,1))}}return t}function A3u(u,e,a,t){let r=0,n=0,i=!1,o=!1,s=-1e9,l=[];for(;;){let c=r==u.length?1e9:i?u[r].to:u[r].from,d=n==e.length?1e9:o?e[n].to:e[n].from;if(i!=o){let E=Math.max(s,a),p=Math.min(c,d,t);E<p&&l.push(new U0(E,p))}if(s=Math.min(c,d),s==1e9)break;c==s&&(i?(i=!1,r++):i=!0),d==s&&(o?(o=!1,n++):o=!0)}return l}function cM(u,e){let a=[];for(let{pos:t,mount:r,frag:n}of u){let i=t+(r.overlay?r.overlay[0].from:0),o=i+r.tree.length,s=Math.max(n.from,i),l=Math.min(n.to,o);if(r.overlay){let c=r.overlay.map(E=>new U0(E.from+t,E.to+t)),d=A3u(e,c,s,l);for(let E=0,p=s;;E++){let x=E==d.length,m=x?l:d[E].from;if(m>p&&a.push(new pi(p,m,r.tree,-i,n.from>=p||n.openStart,n.to<=m||n.openEnd)),x)break;p=d[E].to}}else a.push(new pi(s,l,r.tree,-i,n.from>=i||n.openStart,n.to<=o||n.openEnd))}return a}class eD{constructor(e,a,t,r,n,i,o,s,l,c=0,d){this.p=e,this.stack=a,this.state=t,this.reducePos=r,this.pos=n,this.score=i,this.buffer=o,this.bufferBase=s,this.curContext=l,this.lookAhead=c,this.parent=d}toString(){return`[${this.stack.filter((e,a)=>a%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,a,t=0){let r=e.parser.context;return new eD(e,[],a,t,t,0,[],0,r?new dM(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,a){this.stack.push(this.state,a,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var a;let t=e>>19,r=e&65535,{parser:n}=this.p,i=this.reducePos<this.pos-25;i&&this.setLookAhead(this.pos);let o=n.dynamicPrecedence(r);if(o&&(this.score+=o),t==0){this.pushState(n.getGoto(this.state,r,!0),this.reducePos),r<n.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(r,this.reducePos);return}let s=this.stack.length-(t-1)*3-(e&262144?6:0),l=s?this.stack[s-2]:this.p.ranges[0].from,c=this.reducePos-l;c>=2e3&&!(!((a=this.p.parser.nodeSet.types[r])===null||a===void 0)&&a.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=c));let d=s?this.stack[s-1]:0,E=this.bufferBase+this.buffer.length-d;if(r<n.minRepeatTerm||e&131072){let p=n.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,l,p,E+4,!0)}if(e&262144)this.state=this.stack[s];else{let p=this.stack[s-3];this.state=n.getGoto(p,r,!0)}for(;this.stack.length>s;)this.stack.pop();this.reduceContext(r,l)}storeNode(e,a,t,r=4,n=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let i=this,o=this.buffer.length;if(o==0&&i.parent&&(o=i.bufferBase-i.parent.bufferBase,i=i.parent),o>0&&i.buffer[o-4]==0&&i.buffer[o-1]>-1){if(a==t)return;if(i.buffer[o-2]>=a){i.buffer[o-2]=t;return}}}if(!n||this.pos==t)this.buffer.push(e,a,t,r);else{let i=this.buffer.length;if(i>0&&this.buffer[i-4]!=0){let o=!1;for(let s=i;s>0&&this.buffer[s-2]>t;s-=4)if(this.buffer[s-1]>=0){o=!0;break}if(o)for(;i>0&&this.buffer[i-2]>t;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=a,this.buffer[i+2]=t,this.buffer[i+3]=r}}shift(e,a,t,r){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let n=e,{parser:i}=this.p;(r>this.pos||a<=i.maxNode)&&(this.pos=r,i.stateFlag(n,1)||(this.reducePos=r)),this.pushState(n,t),this.shiftContext(a,t),a<=i.maxNode&&this.buffer.push(a,t,r,4)}else this.pos=r,this.shiftContext(a,t),a<=this.p.parser.maxNode&&this.buffer.push(a,t,r,4)}apply(e,a,t,r){e&65536?this.reduce(e):this.shift(e,a,t,r)}useNode(e,a){let t=this.p.reused.length-1;(t<0||this.p.reused[t]!=e)&&(this.p.reused.push(e),t++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(a,r),this.buffer.push(t,r,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,a=e.buffer.length;for(;a>0&&e.buffer[a-2]>e.reducePos;)a-=4;let t=e.buffer.slice(a),r=e.bufferBase+a;for(;e&&r==e.bufferBase;)e=e.parent;return new eD(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,t,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,a){let t=e<=this.p.parser.maxNode;t&&this.storeNode(e,this.pos,a,4),this.storeNode(0,this.pos,a,t?8:4),this.pos=this.reducePos=a,this.score-=190}canShift(e){for(let a=new B3u(this);;){let t=this.p.parser.stateSlot(a.state,4)||this.p.parser.hasAction(a.state,e);if(t==0)return!1;if((t&65536)==0)return!0;a.reduce(t)}}recoverByInsert(e){if(this.stack.length>=300)return[];let a=this.p.parser.nextStates(this.state);if(a.length>8||this.stack.length>=120){let r=[];for(let n=0,i;n<a.length;n+=2)(i=a[n+1])!=this.state&&this.p.parser.hasAction(i,e)&&r.push(a[n],i);if(this.stack.length<120)for(let n=0;r.length<8&&n<a.length;n+=2){let i=a[n+1];r.some((o,s)=>s&1&&o==i)||r.push(a[n],i)}a=r}let t=[];for(let r=0;r<a.length&&t.length<4;r+=2){let n=a[r+1];if(n==this.state)continue;let i=this.split();i.pushState(n,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(a[r],this.pos),i.reducePos=this.pos,i.score-=200,t.push(i)}return t}forceReduce(){let{parser:e}=this.p,a=e.stateSlot(this.state,5);if((a&65536)==0)return!1;if(!e.validAction(this.state,a)){let t=a>>19,r=a&65535,n=this.stack.length-t*3;if(n<0||e.getGoto(this.stack[n],r,!1)<0){let i=this.findForcedReduction();if(i==null)return!1;a=i}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(a),!0}findForcedReduction(){let{parser:e}=this.p,a=[],t=(r,n)=>{if(!a.includes(r))return a.push(r),e.allActions(r,i=>{if(!(i&393216))if(i&65536){let o=(i>>19)-n;if(o>1){let s=i&65535,l=this.stack.length-o*3;if(l>=0&&e.getGoto(this.stack[l],s,!1)>=0)return o<<19|65536|s}}else{let o=t(i,n+1);if(o!=null)return o}})};return t(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 a=0;a<this.stack.length;a+=3)if(this.stack[a]!=e.stack[a])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,a){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(a)))}reduceContext(e,a){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(a)))}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 a=new dM(this.curContext.tracker,e);a.hash!=this.curContext.hash&&this.emitContext(),this.curContext=a}}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 dM{constructor(e,a){this.tracker=e,this.context=a,this.hash=e.strict?e.hash(a):0}}class B3u{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let a=e&65535,t=e>>19;t==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(t-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],a,!0);this.state=r}}class uD{constructor(e,a,t){this.stack=e,this.pos=a,this.index=t,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,a=e.bufferBase+e.buffer.length){return new uD(e,a,a-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 uD(this.stack,this.pos,this.index)}}function J4(u,e=Uint16Array){if(typeof u!="string")return u;let a=null;for(let t=0,r=0;t<u.length;){let n=0;for(;;){let i=u.charCodeAt(t++),o=!1;if(i==126){n=65535;break}i>=92&&i--,i>=34&&i--;let s=i-32;if(s>=46&&(s-=46,o=!0),n+=s,o)break;n*=46}a?a[r++]=n:a=new e(n)}return a}class yx{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const EM=new yx;class S3u{constructor(e,a){this.input=e,this.ranges=a,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=EM,this.rangeIndex=0,this.pos=this.chunkPos=a[0].from,this.range=a[0],this.end=a[a.length-1].to,this.readNext()}resolveOffset(e,a){let t=this.range,r=this.rangeIndex,n=this.pos+e;for(;n<t.from;){if(!r)return null;let i=this.ranges[--r];n-=t.from-i.to,t=i}for(;a<0?n>t.to:n>=t.to;){if(r==this.ranges.length-1)return null;let i=this.ranges[++r];n+=i.from-t.to,t=i}return n}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let a of this.ranges)if(a.to>e)return Math.max(e,a.from);return this.end}peek(e){let a=this.chunkOff+e,t,r;if(a>=0&&a<this.chunk.length)t=this.pos+e,r=this.chunk.charCodeAt(a);else{let n=this.resolveOffset(e,1);if(n==null)return-1;if(t=n,t>=this.chunk2Pos&&t<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(t-this.chunk2Pos);else{let i=this.rangeIndex,o=this.range;for(;o.to<=t;)o=this.ranges[++i];this.chunk2=this.input.chunk(this.chunk2Pos=t),t+this.chunk2.length>o.to&&(this.chunk2=this.chunk2.slice(0,o.to-t)),r=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),r}acceptToken(e,a=0){let t=a?this.resolveOffset(a,-1):this.pos;if(t==null||t<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=t}acceptTokenTo(e,a){this.token.value=e,this.token.end=a}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:a}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=a,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),a=this.pos+e.length;this.chunk=a>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,a){if(a?(this.token=a,a.start=e,a.lookAhead=e+1,a.value=a.extended=-1):this.token=EM,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,a){if(e>=this.chunkPos&&a<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,a-this.chunkPos);if(e>=this.chunk2Pos&&a<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,a-this.chunk2Pos);if(e>=this.range.from&&a<=this.range.to)return this.input.read(e,a);let t="";for(let r of this.ranges){if(r.from>=a)break;r.to>e&&(t+=this.input.read(Math.max(r.from,e),Math.min(r.to,a)))}return t}}class A1{constructor(e,a){this.data=e,this.id=a}token(e,a){let{parser:t}=a.p;rU(this.data,e,a,this.id,t.data,t.tokenPrecTable)}}A1.prototype.contextual=A1.prototype.fallback=A1.prototype.extend=!1;class aD{constructor(e,a,t){this.precTable=a,this.elseToken=t,this.data=typeof e=="string"?J4(e):e}token(e,a){let t=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(rU(this.data,e,a,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(t,e.token),e.acceptToken(this.elseToken,r))}}aD.prototype.contextual=A1.prototype.fallback=A1.prototype.extend=!1;class vt{constructor(e,a={}){this.token=e,this.contextual=!!a.contextual,this.fallback=!!a.fallback,this.extend=!!a.extend}}function rU(u,e,a,t,r,n){let i=0,o=1<<t,{dialect:s}=a.p.parser;e:for(;(o&u[i])!=0;){let l=u[i+1];for(let p=i+3;p<l;p+=2)if((u[p+1]&o)>0){let x=u[p];if(s.allows(x)&&(e.token.value==-1||e.token.value==x||z3u(x,e.token.value,r,n))){e.acceptToken(x);break}}let c=e.next,d=0,E=u[i+2];if(e.next<0&&E>d&&u[l+E*3-3]==65535){i=u[l+E*3-1];continue e}for(;d<E;){let p=d+E>>1,x=l+p+(p<<1),m=u[x],g=u[x+1]||65536;if(c<m)E=p;else if(c>=g)d=p+1;else{i=u[x+2],e.advance();continue e}}break}}function pM(u,e,a){for(let t=e,r;(r=u[t])!=65535;t++)if(r==a)return t-e;return-1}function z3u(u,e,a,t){let r=pM(a,t,e);return r<0||pM(a,t,u)<r}const g0=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let dk=null;function mM(u,e,a){let t=u.cursor(Ea.IncludeAnonymous);for(t.moveTo(e);;)if(!(a<0?t.childBefore(e):t.childAfter(e)))for(;;){if((a<0?t.to<e:t.from>e)&&!t.type.isError)return a<0?Math.max(0,Math.min(t.to-1,e-25)):Math.min(u.length,Math.max(t.from+1,e+25));if(a<0?t.prevSibling():t.nextSibling())break;if(!t.parent())return a<0?0:u.length}}class w3u{constructor(e,a){this.fragments=e,this.nodeSet=a,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?mM(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?mM(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 a=this.trees.length-1;if(a<0)return this.nextFragment(),null;let t=this.trees[a],r=this.index[a];if(r==t.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let n=t.children[r],i=this.start[a]+t.positions[r];if(i>e)return this.nextStart=i,null;if(n instanceof Va){if(i==e){if(i<this.safeFrom)return null;let o=i+n.length;if(o<=this.safeTo){let s=n.prop(vu.lookAhead);if(!s||o+s<this.fragment.to)return n}}this.index[a]++,i+n.length>=Math.max(this.safeFrom,e)&&(this.trees.push(n),this.start.push(i),this.index.push(0))}else this.index[a]++,this.nextStart=i+n.length}}}class O3u{constructor(e,a){this.stream=a,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(t=>new yx)}getActions(e){let a=0,t=null,{parser:r}=e.p,{tokenizers:n}=r,i=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let l=0;l<n.length;l++){if((1<<l&i)==0)continue;let c=n[l],d=this.tokens[l];if(!(t&&!c.fallback)&&((c.contextual||d.start!=e.pos||d.mask!=i||d.context!=o)&&(this.updateCachedToken(d,c,e),d.mask=i,d.context=o),d.lookAhead>d.end+25&&(s=Math.max(d.lookAhead,s)),d.value!=0)){let E=a;if(d.extended>-1&&(a=this.addActions(e,d.extended,d.end,a)),a=this.addActions(e,d.value,d.end,a),!c.extend&&(t=d,a>E))break}}for(;this.actions.length>a;)this.actions.pop();return s&&e.setLookAhead(s),!t&&e.pos==this.stream.end&&(t=new yx,t.value=e.p.parser.eofTerm,t.start=t.end=e.pos,a=this.addActions(e,t.value,t.end,a)),this.mainToken=t,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let a=new yx,{pos:t,p:r}=e;return a.start=t,a.end=Math.min(t+1,r.stream.end),a.value=t==r.stream.end?r.parser.eofTerm:0,a}updateCachedToken(e,a,t){let r=this.stream.clipPos(t.pos);if(a.token(this.stream.reset(r,e),t),e.value>-1){let{parser:n}=t.p;for(let i=0;i<n.specialized.length;i++)if(n.specialized[i]==e.value){let o=n.specializers[i](this.stream.read(e.start,e.end),t);if(o>=0&&t.p.parser.dialect.allows(o>>1)){(o&1)==0?e.value=o>>1:e.extended=o>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,a,t,r){for(let n=0;n<r;n+=3)if(this.actions[n]==e)return r;return this.actions[r++]=e,this.actions[r++]=a,this.actions[r++]=t,r}addActions(e,a,t,r){let{state:n}=e,{parser:i}=e.p,{data:o}=i;for(let s=0;s<2;s++)for(let l=i.stateSlot(n,s?2:1);;l+=3){if(o[l]==65535)if(o[l+1]==1)l=ni(o,l+2);else{r==0&&o[l+1]==2&&(r=this.putAction(ni(o,l+2),a,t,r));break}o[l]==a&&(r=this.putAction(ni(o,l+1),a,t,r))}return r}}class P3u{constructor(e,a,t,r){this.parser=e,this.input=a,this.ranges=r,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 S3u(a,r),this.tokens=new O3u(e,this.stream),this.topTerm=e.top[1];let{from:n}=r[0];this.stacks=[eD.start(this,e.top[0],n)],this.fragments=t.length&&this.stream.end-n>e.bufferLength*4?new w3u(t,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,a=this.minStackPos,t=this.stacks=[],r,n;if(this.bigReductionCount>300&&e.length==1){let[i]=e;for(;i.forceReduce()&&i.stack.length&&i.stack[i.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let i=0;i<e.length;i++){let o=e[i];for(;;){if(this.tokens.mainToken=null,o.pos>a)t.push(o);else{if(this.advanceStack(o,t,e))continue;{r||(r=[],n=[]),r.push(o);let s=this.tokens.getMainToken(o);n.push(s.value,s.end)}}break}}if(!t.length){let i=r&&M3u(r);if(i)return g0&&console.log("Finish with "+this.stackID(i)),this.stackToTree(i);if(this.parser.strict)throw g0&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+a);this.recovering||(this.recovering=5)}if(this.recovering&&r){let i=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,n,t);if(i)return g0&&console.log("Force-finish "+this.stackID(i)),this.stackToTree(i.forceAll())}if(this.recovering){let i=this.recovering==1?1:this.recovering*3;if(t.length>i)for(t.sort((o,s)=>s.score-o.score);t.length>i;)t.pop();t.some(o=>o.reducePos>a)&&this.recovering--}else if(t.length>1){e:for(let i=0;i<t.length-1;i++){let o=t[i];for(let s=i+1;s<t.length;s++){let l=t[s];if(o.sameState(l)||o.buffer.length>500&&l.buffer.length>500)if((o.score-l.score||o.buffer.length-l.buffer.length)>0)t.splice(s--,1);else{t.splice(i--,1);continue e}}}t.length>12&&t.splice(12,t.length-12)}this.minStackPos=t[0].pos;for(let i=1;i<t.length;i++)t[i].pos<this.minStackPos&&(this.minStackPos=t[i].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,a,t){let r=e.pos,{parser:n}=this,i=g0?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let l=e.curContext&&e.curContext.tracker.strict,c=l?e.curContext.hash:0;for(let d=this.fragments.nodeAt(r);d;){let E=this.parser.nodeSet.types[d.type.id]==d.type?n.getGoto(e.state,d.type.id):-1;if(E>-1&&d.length&&(!l||(d.prop(vu.contextHash)||0)==c))return e.useNode(d,E),g0&&console.log(i+this.stackID(e)+` (via reuse of ${n.getName(d.type.id)})`),!0;if(!(d instanceof Va)||d.children.length==0||d.positions[0]>0)break;let p=d.children[0];if(p instanceof Va&&d.positions[0]==0)d=p;else break}}let o=n.stateSlot(e.state,4);if(o>0)return e.reduce(o),g0&&console.log(i+this.stackID(e)+` (via always-reduce ${n.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let s=this.tokens.getActions(e);for(let l=0;l<s.length;){let c=s[l++],d=s[l++],E=s[l++],p=l==s.length||!t,x=p?e:e.split(),m=this.tokens.mainToken;if(x.apply(c,d,m?m.start:x.pos,E),g0&&console.log(i+this.stackID(x)+` (via ${(c&65536)==0?"shift":`reduce of ${n.getName(c&65535)}`} for ${n.getName(d)} @ ${r}${x==e?"":", split"})`),p)return!0;x.pos>r?a.push(x):t.push(x)}return!1}advanceFully(e,a){let t=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>t)return hM(e,a),!0}}runRecovery(e,a,t){let r=null,n=!1;for(let i=0;i<e.length;i++){let o=e[i],s=a[i<<1],l=a[(i<<1)+1],c=g0?this.stackID(o)+" -> ":"";if(o.deadEnd&&(n||(n=!0,o.restart(),g0&&console.log(c+this.stackID(o)+" (restarted)"),this.advanceFully(o,t))))continue;let d=o.split(),E=c;for(let p=0;d.forceReduce()&&p<10&&(g0&&console.log(E+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,t));p++)g0&&(E=this.stackID(d)+" -> ");for(let p of o.recoverByInsert(s))g0&&console.log(c+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,t);this.stream.end>o.pos?(l==o.pos&&(l++,s=0),o.recoverByDelete(s,l),g0&&console.log(c+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),hM(o,t)):(!r||r.score<o.score)&&(r=o)}return r}stackToTree(e){return e.close(),Va.build({buffer:uD.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 a=(dk||(dk=new WeakMap)).get(e);return a||dk.set(e,a=String.fromCodePoint(this.nextStackID++)),a+e}}function hM(u,e){for(let a=0;a<e.length;a++){let t=e[a];if(t.pos==u.pos&&t.sameState(u)){e[a].score<u.score&&(e[a]=u);return}}e.push(u)}class j3u{constructor(e,a,t){this.source=e,this.flags=a,this.disabled=t}allows(e){return!this.disabled||this.disabled[e]==0}}const Ek=u=>u;class og{constructor(e){this.start=e.start,this.shift=e.shift||Ek,this.reduce=e.reduce||Ek,this.reuse=e.reuse||Ek,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class yi extends tU{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let a=e.nodeNames.split(" ");this.minRepeatTerm=a.length;for(let o=0;o<e.repeatNodeCount;o++)a.push("");let t=Object.keys(e.topRules).map(o=>e.topRules[o][1]),r=[];for(let o=0;o<a.length;o++)r.push([]);function n(o,s,l){r[o].push([s,s.deserialize(String(l))])}if(e.nodeProps)for(let o of e.nodeProps){let s=o[0];typeof s=="string"&&(s=vu[s]);for(let l=1;l<o.length;){let c=o[l++];if(c>=0)n(c,s,o[l++]);else{let d=o[l+-c];for(let E=-c;E>0;E--)n(o[l++],s,d);l++}}}this.nodeSet=new xA(a.map((o,s)=>Zt.define({name:s>=this.minRepeatTerm?void 0:o,id:s,props:r[s],top:t.indexOf(s)>-1,error:s==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(s)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=YJ;let i=J4(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let o=0;o<this.specializerSpecs.length;o++)this.specialized[o]=this.specializerSpecs[o].term;this.specializers=this.specializerSpecs.map(xM),this.states=J4(e.states,Uint32Array),this.data=J4(e.stateData),this.goto=J4(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(o=>typeof o=="number"?new A1(i,o):o),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,a,t){let r=new P3u(this,e,a,t);for(let n of this.wrappers)r=n(r,e,a,t);return r}getGoto(e,a,t=!1){let r=this.goto;if(a>=r[0])return-1;for(let n=r[a+1];;){let i=r[n++],o=i&1,s=r[n++];if(o&&t)return s;for(let l=n+(i>>1);n<l;n++)if(r[n]==e)return s;if(o)return-1}}hasAction(e,a){let t=this.data;for(let r=0;r<2;r++)for(let n=this.stateSlot(e,r?2:1),i;;n+=3){if((i=t[n])==65535)if(t[n+1]==1)i=t[n=ni(t,n+2)];else{if(t[n+1]==2)return ni(t,n+2);break}if(i==a||i==0)return ni(t,n+1)}return 0}stateSlot(e,a){return this.states[e*6+a]}stateFlag(e,a){return(this.stateSlot(e,0)&a)>0}validAction(e,a){return!!this.allActions(e,t=>t==a?!0:null)}allActions(e,a){let t=this.stateSlot(e,4),r=t?a(t):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=ni(this.data,n+2);else break;r=a(ni(this.data,n+1))}return r}nextStates(e){let a=[];for(let t=this.stateSlot(e,1);;t+=3){if(this.data[t]==65535)if(this.data[t+1]==1)t=ni(this.data,t+2);else break;if((this.data[t+2]&1)==0){let r=this.data[t+1];a.some((n,i)=>i&1&&n==r)||a.push(this.data[t],r)}}return a}configure(e){let a=Object.assign(Object.create(yi.prototype),this);if(e.props&&(a.nodeSet=this.nodeSet.extend(...e.props)),e.top){let t=this.topRules[e.top];if(!t)throw new RangeError(`Invalid top rule name ${e.top}`);a.top=t}return e.tokenizers&&(a.tokenizers=this.tokenizers.map(t=>{let r=e.tokenizers.find(n=>n.from==t);return r?r.to:t})),e.specializers&&(a.specializers=this.specializers.slice(),a.specializerSpecs=this.specializerSpecs.map((t,r)=>{let n=e.specializers.find(o=>o.from==t.external);if(!n)return t;let i=Object.assign(Object.assign({},t),{external:n.to});return a.specializers[r]=xM(i),i})),e.contextTracker&&(a.context=e.contextTracker),e.dialect&&(a.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(a.strict=e.strict),e.wrap&&(a.wrappers=a.wrappers.concat(e.wrap)),e.bufferLength!=null&&(a.bufferLength=e.bufferLength),a}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 a=this.dynamicPrecedences;return a==null?0:a[e]||0}parseDialect(e){let a=Object.keys(this.dialects),t=a.map(()=>!1);if(e)for(let n of e.split(" ")){let i=a.indexOf(n);i>=0&&(t[i]=!0)}let r=null;for(let n=0;n<a.length;n++)if(!t[n])for(let i=this.dialects[a[n]],o;(o=this.data[i++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[o]=1;return new j3u(e,t,r)}static deserialize(e){return new yi(e)}}function ni(u,e){return u[e]|u[e+1]<<16}function M3u(u){let e=null;for(let a of u){let t=a.p.stoppedAt;(a.pos==a.p.stream.end||t!=null&&a.pos>t)&&a.p.parser.stateFlag(a.state,2)&&(!e||e.score<a.score)&&(e=a)}return e}function xM(u){if(u.external){let e=u.extend?1:0;return(a,t)=>u.external(a,t)<<1|e}return u.get}let T3u=0,ii=class Hy{constructor(e,a,t,r){this.name=e,this.set=a,this.base=t,this.modified=r,this.id=T3u++}toString(){let{name:e}=this;for(let a of this.modified)a.name&&(e=`${a.name}(${e})`);return e}static define(e,a){let t=typeof e=="string"?e:"?";if(e instanceof Hy&&(a=e),a?.base)throw new Error("Can not derive from a modified tag");let r=new Hy(t,[],null,[]);if(r.set.push(r),a)for(let n of a.set)r.set.push(n);return r}static defineModifier(e){let a=new tD(e);return t=>t.modified.indexOf(a)>-1?t:tD.get(t.base||t,t.modified.concat(a).sort((r,n)=>r.id-n.id))}},$3u=0;class tD{constructor(e){this.name=e,this.instances=[],this.id=$3u++}static get(e,a){if(!a.length)return e;let t=a[0].instances.find(o=>o.base==e&&R3u(a,o.modified));if(t)return t;let r=[],n=new ii(e.name,r,e,a);for(let o of a)o.instances.push(n);let i=N3u(a);for(let o of e.set)if(!o.modified.length)for(let s of i)r.push(tD.get(o,s));return n}}function R3u(u,e){return u.length==e.length&&u.every((a,t)=>a==e[t])}function N3u(u){let e=[[]];for(let a=0;a<u.length;a++)for(let t=0,r=e.length;t<r;t++)e.push(e[t].concat(u[a]));return e.sort((a,t)=>t.length-a.length)}function tl(u){let e=Object.create(null);for(let a in u){let t=u[a];Array.isArray(t)||(t=[t]);for(let r of a.split(" "))if(r){let n=[],i=2,o=r;for(let d=0;;){if(o=="..."&&d>0&&d+3==r.length){i=1;break}let E=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!E)throw new RangeError("Invalid path: "+r);if(n.push(E[0]=="*"?"":E[0][0]=='"'?JSON.parse(E[0]):E[0]),d+=E[0].length,d==r.length)break;let p=r[d++];if(d==r.length&&p=="!"){i=0;break}if(p!="/")throw new RangeError("Invalid path: "+r);o=r.slice(d)}let s=n.length-1,l=n[s];if(!l)throw new RangeError("Invalid path: "+r);let c=new rD(t,i,s>0?n.slice(0,s):null);e[l]=c.sort(e[l])}}return nU.add(e)}const nU=new vu;class rD{constructor(e,a,t,r){this.tags=e,this.mode=a,this.context=t,this.next=r}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 iU(u,e){let a=Object.create(null);for(let n of u)if(!Array.isArray(n.tag))a[n.tag.id]=n.class;else for(let i of n.tag)a[i.id]=n.class;let{scope:t,all:r=null}=e||{};return{style:n=>{let i=r;for(let o of n)for(let s of o.set){let l=a[s.id];if(l){i=i?i+" "+l:l;break}}return i},scope:t}}function _3u(u,e){let a=null;for(let t of u){let r=t.style(e);r&&(a=a?a+" "+r:r)}return a}function L3u(u,e,a,t=0,r=u.length){let n=new I3u(t,Array.isArray(e)?e:[e],a);n.highlightRange(u.cursor(),t,r,"",n.highlighters),n.flush(r)}class I3u{constructor(e,a,t){this.at=e,this.highlighters=a,this.span=t,this.class=""}startSpan(e,a){a!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=a)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,a,t,r,n){let{type:i,from:o,to:s}=e;if(o>=t||s<=a)return;i.isTop&&(n=this.highlighters.filter(p=>!p.scope||p.scope(i)));let l=r,c=K3u(e)||rD.empty,d=_3u(n,c.tags);if(d&&(l&&(l+=" "),l+=d,c.mode==1&&(r+=(r?" ":"")+d)),this.startSpan(Math.max(a,o),l),c.opaque)return;let E=e.tree&&e.tree.prop(vu.mounted);if(E&&E.overlay){let p=e.node.enter(E.overlay[0].from+o,1),x=this.highlighters.filter(g=>!g.scope||g.scope(E.tree.type)),m=e.firstChild();for(let g=0,h=o;;g++){let f=g<E.overlay.length?E.overlay[g]:null,k=f?f.from+o:s,y=Math.max(a,h),v=Math.min(t,k);if(y<v&&m)for(;e.from<v&&(this.highlightRange(e,y,v,r,n),this.startSpan(Math.min(v,e.to),l),!(e.to>=k||!e.nextSibling())););if(!f||k>t)break;h=f.to+o,h>a&&(this.highlightRange(p.cursor(),Math.max(a,f.from+o),Math.min(t,h),"",x),this.startSpan(Math.min(t,h),l))}m&&e.parent()}else if(e.firstChild()){E&&(r="");do if(!(e.to<=a)){if(e.from>=t)break;this.highlightRange(e,a,t,r,n),this.startSpan(Math.min(t,e.to),l)}while(e.nextSibling());e.parent()}}}function K3u(u){let e=u.type.prop(nU);for(;e&&e.context&&!u.matchContext(e.context);)e=e.next;return e||null}const $e=ii.define,xh=$e(),to=$e(),DM=$e(to),fM=$e(to),ro=$e(),Dh=$e(ro),pk=$e(ro),Wr=$e(),Es=$e(Wr),Kr=$e(),Vr=$e(),qy=$e(),C4=$e(qy),fh=$e(),Z={comment:xh,lineComment:$e(xh),blockComment:$e(xh),docComment:$e(xh),name:to,variableName:$e(to),typeName:DM,tagName:$e(DM),propertyName:fM,attributeName:$e(fM),className:$e(to),labelName:$e(to),namespace:$e(to),macroName:$e(to),literal:ro,string:Dh,docString:$e(Dh),character:$e(Dh),attributeValue:$e(Dh),number:pk,integer:$e(pk),float:$e(pk),bool:$e(ro),regexp:$e(ro),escape:$e(ro),color:$e(ro),url:$e(ro),keyword:Kr,self:$e(Kr),null:$e(Kr),atom:$e(Kr),unit:$e(Kr),modifier:$e(Kr),operatorKeyword:$e(Kr),controlKeyword:$e(Kr),definitionKeyword:$e(Kr),moduleKeyword:$e(Kr),operator:Vr,derefOperator:$e(Vr),arithmeticOperator:$e(Vr),logicOperator:$e(Vr),bitwiseOperator:$e(Vr),compareOperator:$e(Vr),updateOperator:$e(Vr),definitionOperator:$e(Vr),typeOperator:$e(Vr),controlOperator:$e(Vr),punctuation:qy,separator:$e(qy),bracket:C4,angleBracket:$e(C4),squareBracket:$e(C4),paren:$e(C4),brace:$e(C4),content:Wr,heading:Es,heading1:$e(Es),heading2:$e(Es),heading3:$e(Es),heading4:$e(Es),heading5:$e(Es),heading6:$e(Es),contentSeparator:$e(Wr),list:$e(Wr),quote:$e(Wr),emphasis:$e(Wr),strong:$e(Wr),link:$e(Wr),monospace:$e(Wr),strikethrough:$e(Wr),inserted:$e(),deleted:$e(),changed:$e(),invalid:$e(),meta:fh,documentMeta:$e(fh),annotation:$e(fh),processingInstruction:$e(fh),definition:ii.defineModifier("definition"),constant:ii.defineModifier("constant"),function:ii.defineModifier("function"),standard:ii.defineModifier("standard"),local:ii.defineModifier("local"),special:ii.defineModifier("special")};for(let u in Z){let e=Z[u];e instanceof ii&&(e.name=u)}iU([{tag:Z.link,class:"tok-link"},{tag:Z.heading,class:"tok-heading"},{tag:Z.emphasis,class:"tok-emphasis"},{tag:Z.strong,class:"tok-strong"},{tag:Z.keyword,class:"tok-keyword"},{tag:Z.atom,class:"tok-atom"},{tag:Z.bool,class:"tok-bool"},{tag:Z.url,class:"tok-url"},{tag:Z.labelName,class:"tok-labelName"},{tag:Z.inserted,class:"tok-inserted"},{tag:Z.deleted,class:"tok-deleted"},{tag:Z.literal,class:"tok-literal"},{tag:Z.string,class:"tok-string"},{tag:Z.number,class:"tok-number"},{tag:[Z.regexp,Z.escape,Z.special(Z.string)],class:"tok-string2"},{tag:Z.variableName,class:"tok-variableName"},{tag:Z.local(Z.variableName),class:"tok-variableName tok-local"},{tag:Z.definition(Z.variableName),class:"tok-variableName tok-definition"},{tag:Z.special(Z.variableName),class:"tok-variableName2"},{tag:Z.definition(Z.propertyName),class:"tok-propertyName tok-definition"},{tag:Z.typeName,class:"tok-typeName"},{tag:Z.namespace,class:"tok-namespace"},{tag:Z.className,class:"tok-className"},{tag:Z.macroName,class:"tok-macroName"},{tag:Z.propertyName,class:"tok-propertyName"},{tag:Z.operator,class:"tok-operator"},{tag:Z.comment,class:"tok-comment"},{tag:Z.meta,class:"tok-meta"},{tag:Z.invalid,class:"tok-invalid"},{tag:Z.punctuation,class:"tok-punctuation"}]);const V3u=tl({String:Z.string,Number:Z.number,"True False":Z.bool,PropertyName:Z.propertyName,Null:Z.null,",":Z.separator,"[ ]":Z.squareBracket,"{ }":Z.brace}),G3u=yi.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:[V3u],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 Wy=[],oU=[];(()=>{let u="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,a=0;e<u.length;e++)(e%2?oU:Wy).push(a=a+u[e])})();function H3u(u){if(u<768)return!1;for(let e=0,a=Wy.length;;){let t=e+a>>1;if(u<Wy[t])a=t;else if(u>=oU[t])e=t+1;else return!0;if(e==a)return!1}}function gM(u){return u>=127462&&u<=127487}const vM=8205;function q3u(u,e,a=!0,t=!0){return(a?sU:W3u)(u,e,t)}function sU(u,e,a){if(e==u.length)return e;e&&lU(u.charCodeAt(e))&&cU(u.charCodeAt(e-1))&&e--;let t=mk(u,e);for(e+=kM(t);e<u.length;){let r=mk(u,e);if(t==vM||r==vM||a&&H3u(r))e+=kM(r),t=r;else if(gM(r)){let n=0,i=e-2;for(;i>=0&&gM(mk(u,i));)n++,i-=2;if(n%2==0)break;e+=2}else break}return e}function W3u(u,e,a){for(;e>0;){let t=sU(u,e-2,a);if(t<e)return t;e--}return 0}function mk(u,e){let a=u.charCodeAt(e);if(!cU(a)||e+1==u.length)return a;let t=u.charCodeAt(e+1);return lU(t)?(a-55296<<10)+(t-56320)+65536:a}function lU(u){return u>=56320&&u<57344}function cU(u){return u>=55296&&u<56320}function kM(u){return u<65536?1:2}class Mu{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,a,t){[e,a]=Z1(this,e,a);let r=[];return this.decompose(0,e,r,2),t.length&&t.decompose(0,t.length,r,3),this.decompose(a,this.length,r,1),un.from(r,this.length-(a-e)+t.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,a=this.length){[e,a]=Z1(this,e,a);let t=[];return this.decompose(e,a,t,0),un.from(t,a-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let a=this.scanIdentical(e,1),t=this.length-this.scanIdentical(e,-1),r=new hd(this),n=new hd(e);for(let i=a,o=a;;){if(r.next(i),n.next(i),i=0,r.lineBreak!=n.lineBreak||r.done!=n.done||r.value!=n.value)return!1;if(o+=r.value.length,r.done||o>=t)return!0}}iter(e=1){return new hd(this,e)}iterRange(e,a=this.length){return new dU(this,e,a)}iterLines(e,a){let t;if(e==null)t=this.iter();else{a==null&&(a=this.lines+1);let r=this.line(e).from;t=this.iterRange(r,Math.max(r,a==this.lines+1?this.length:a<=1?0:this.line(a-1).to))}return new EU(t)}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]?Mu.empty:e.length<=32?new $a(e):un.from($a.split(e,[]))}}class $a extends Mu{constructor(e,a=J3u(e)){super(),this.text=e,this.length=a}get lines(){return this.text.length}get children(){return null}lineInner(e,a,t,r){for(let n=0;;n++){let i=this.text[n],o=r+i.length;if((a?t:o)>=e)return new U3u(r,o,t,i);r=o+1,t++}}decompose(e,a,t,r){let n=e<=0&&a>=this.length?this:new $a(bM(this.text,e,a),Math.min(a,this.length)-Math.max(0,e));if(r&1){let i=t.pop(),o=Cx(n.text,i.text.slice(),0,n.length);if(o.length<=32)t.push(new $a(o,i.length+n.length));else{let s=o.length>>1;t.push(new $a(o.slice(0,s)),new $a(o.slice(s)))}}else t.push(n)}replace(e,a,t){if(!(t instanceof $a))return super.replace(e,a,t);[e,a]=Z1(this,e,a);let r=Cx(this.text,Cx(t.text,bM(this.text,0,e)),a),n=this.length+t.length-(a-e);return r.length<=32?new $a(r,n):un.from($a.split(r,[]),n)}sliceString(e,a=this.length,t=`
476
476
  `){[e,a]=Z1(this,e,a);let r="";for(let n=0,i=0;n<=a&&i<this.text.length;i++){let o=this.text[i],s=n+o.length;n>e&&i&&(r+=t),e<s&&a>n&&(r+=o.slice(Math.max(0,e-n),a-n)),n=s+1}return r}flatten(e){for(let a of this.text)e.push(a)}scanIdentical(){return 0}static split(e,a){let t=[],r=-1;for(let n of e)t.push(n),r+=n.length+1,t.length==32&&(a.push(new $a(t,r)),t=[],r=-1);return r>-1&&a.push(new $a(t,r)),a}}class un extends Mu{constructor(e,a){super(),this.children=e,this.length=a,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,a,t,r){for(let n=0;;n++){let i=this.children[n],o=r+i.length,s=t+i.lines-1;if((a?s:o)>=e)return i.lineInner(e,a,t,r);r=o+1,t=s+1}}decompose(e,a,t,r){for(let n=0,i=0;i<=a&&n<this.children.length;n++){let o=this.children[n],s=i+o.length;if(e<=s&&a>=i){let l=r&((i<=e?1:0)|(s>=a?2:0));i>=e&&s<=a&&!l?t.push(o):o.decompose(e-i,a-i,t,l)}i=s+1}}replace(e,a,t){if([e,a]=Z1(this,e,a),t.lines<this.lines)for(let r=0,n=0;r<this.children.length;r++){let i=this.children[r],o=n+i.length;if(e>=n&&a<=o){let s=i.replace(e-n,a-n,t),l=this.lines-i.lines+s.lines;if(s.lines<l>>4&&s.lines>l>>6){let c=this.children.slice();return c[r]=s,new un(c,this.length-(a-e)+t.length)}return super.replace(n,o,s)}n=o+1}return super.replace(e,a,t)}sliceString(e,a=this.length,t=`
477
477
  `){[e,a]=Z1(this,e,a);let r="";for(let n=0,i=0;n<this.children.length&&i<=a;n++){let o=this.children[n],s=i+o.length;i>e&&n&&(r+=t),e<s&&a>i&&(r+=o.sliceString(e-i,a-i,t)),i=s+1}return r}flatten(e){for(let a of this.children)a.flatten(e)}scanIdentical(e,a){if(!(e instanceof un))return 0;let t=0,[r,n,i,o]=a>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=a,n+=a){if(r==i||n==o)return t;let s=this.children[r],l=e.children[n];if(s!=l)return t+s.scanIdentical(l,a);t+=s.length+1}}static from(e,a=e.reduce((t,r)=>t+r.length+1,-1)){let t=0;for(let p of e)t+=p.lines;if(t<32){let p=[];for(let x of e)x.flatten(p);return new $a(p,a)}let r=Math.max(32,t>>5),n=r<<1,i=r>>1,o=[],s=0,l=-1,c=[];function d(p){let x;if(p.lines>n&&p instanceof un)for(let m of p.children)d(m);else p.lines>i&&(s>i||!s)?(E(),o.push(p)):p instanceof $a&&s&&(x=c[c.length-1])instanceof $a&&p.lines+x.lines<=32?(s+=p.lines,l+=p.length+1,c[c.length-1]=new $a(x.text.concat(p.text),x.length+1+p.length)):(s+p.lines>r&&E(),s+=p.lines,l+=p.length+1,c.push(p))}function E(){s!=0&&(o.push(c.length==1?c[0]:un.from(c,l)),l=-1,s=c.length=0)}for(let p of e)d(p);return E(),o.length==1?o[0]:new un(o,a)}}Mu.empty=new $a([""],0);function J3u(u){let e=-1;for(let a of u)e+=a.length+1;return e}function Cx(u,e,a=0,t=1e9){for(let r=0,n=0,i=!0;n<u.length&&r<=t;n++){let o=u[n],s=r+o.length;s>=a&&(s>t&&(o=o.slice(0,t-r)),r<a&&(o=o.slice(a-r)),i?(e[e.length-1]+=o,i=!1):e.push(o)),r=s+1}return e}function bM(u,e,a){return Cx(u,[""],e,a)}class hd{constructor(e,a=1){this.dir=a,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[a>0?1:(e instanceof $a?e.text.length:e.children.length)<<1]}nextInner(e,a){for(this.done=this.lineBreak=!1;;){let t=this.nodes.length-1,r=this.nodes[t],n=this.offsets[t],i=n>>1,o=r instanceof $a?r.text.length:r.children.length;if(i==(a>0?o:0)){if(t==0)return this.done=!0,this.value="",this;a>0&&this.offsets[t-1]++,this.nodes.pop(),this.offsets.pop()}else if((n&1)==(a>0?0:1)){if(this.offsets[t]+=a,e==0)return this.lineBreak=!0,this.value=`
478
478
  `,this;e--}else if(r instanceof $a){let s=r.text[i+(a<0?-1:0)];if(this.offsets[t]+=a,s.length>Math.max(0,e))return this.value=e==0?s:a>0?s.slice(e):s.slice(0,s.length-e),this;e-=s.length}else{let s=r.children[i+(a<0?-1:0)];e>s.length?(e-=s.length,this.offsets[t]+=a):(a<0&&this.offsets[t]--,this.nodes.push(s),this.offsets.push(a>0?1:(s instanceof $a?s.text.length:s.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class dU{constructor(e,a,t){this.value="",this.done=!1,this.cursor=new hd(e,a>t?-1:1),this.pos=a>t?e.length:0,this.from=Math.min(a,t),this.to=Math.max(a,t)}nextInner(e,a){if(a<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,a<0?this.pos-this.to:this.from-this.pos);let t=a<0?this.pos-this.from:this.to-this.pos;e>t&&(e=t),t-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*a,this.value=r.length<=t?r:a<0?r.slice(r.length-t):r.slice(0,t),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 EU{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:a,lineBreak:t,value:r}=this.inner.next(e);return a&&this.afterBreak?(this.value="",this.afterBreak=!1):a?(this.done=!0,this.value=""):t?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Mu.prototype[Symbol.iterator]=function(){return this.iter()},hd.prototype[Symbol.iterator]=dU.prototype[Symbol.iterator]=EU.prototype[Symbol.iterator]=function(){return this});let U3u=class{constructor(e,a,t,r){this.from=e,this.to=a,this.number=t,this.text=r}get length(){return this.to-this.from}};function Z1(u,e,a){return e=Math.max(0,Math.min(u.length,e)),[e,Math.max(e,Math.min(u.length,a))]}function xt(u,e,a=!0,t=!0){return q3u(u,e,a,t)}function Z3u(u){return u>=56320&&u<57344}function Q3u(u){return u>=55296&&u<56320}function s0(u,e){let a=u.charCodeAt(e);if(!Q3u(a)||e+1==u.length)return a;let t=u.charCodeAt(e+1);return Z3u(t)?(a-55296<<10)+(t-56320)+65536:a}function vA(u){return u<=65535?String.fromCharCode(u):(u-=65536,String.fromCharCode((u>>10)+55296,(u&1023)+56320))}function an(u){return u<65536?1:2}const Jy=/\r\n?|\n/;var ht=(function(u){return u[u.Simple=0]="Simple",u[u.TrackDel=1]="TrackDel",u[u.TrackBefore=2]="TrackBefore",u[u.TrackAfter=3]="TrackAfter",u})(ht||(ht={}));class xn{constructor(e){this.sections=e}get length(){let e=0;for(let a=0;a<this.sections.length;a+=2)e+=this.sections[a];return e}get newLength(){let e=0;for(let a=0;a<this.sections.length;a+=2){let t=this.sections[a+1];e+=t<0?this.sections[a]:t}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let a=0,t=0,r=0;a<this.sections.length;){let n=this.sections[a++],i=this.sections[a++];i<0?(e(t,r,n),r+=n):r+=i,t+=n}}iterChangedRanges(e,a=!1){Uy(this,e,a)}get invertedDesc(){let e=[];for(let a=0;a<this.sections.length;){let t=this.sections[a++],r=this.sections[a++];r<0?e.push(t,r):e.push(r,t)}return new xn(e)}composeDesc(e){return this.empty?e:e.empty?this:pU(this,e)}mapDesc(e,a=!1){return e.empty?this:Zy(this,e,a)}mapPos(e,a=-1,t=ht.Simple){let r=0,n=0;for(let i=0;i<this.sections.length;){let o=this.sections[i++],s=this.sections[i++],l=r+o;if(s<0){if(l>e)return n+(e-r);n+=o}else{if(t!=ht.Simple&&l>=e&&(t==ht.TrackDel&&r<e&&l>e||t==ht.TrackBefore&&r<e||t==ht.TrackAfter&&l>e))return null;if(l>e||l==e&&a<0&&!o)return e==r||a<0?n:n+s;n+=s}r=l}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return n}touchesRange(e,a=e){for(let t=0,r=0;t<this.sections.length&&r<=a;){let n=this.sections[t++],i=this.sections[t++],o=r+n;if(i>=0&&r<=a&&o>=e)return r<e&&o>a?"cover":!0;r=o}return!1}toString(){let e="";for(let a=0;a<this.sections.length;){let t=this.sections[a++],r=this.sections[a++];e+=(e?" ":"")+t+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(a=>typeof a!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new xn(e)}static create(e){return new xn(e)}}class Ua extends xn{constructor(e,a){super(e),this.inserted=a}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Uy(this,(a,t,r,n,i)=>e=e.replace(r,r+(t-a),i),!1),e}mapDesc(e,a=!1){return Zy(this,e,a,!0)}invert(e){let a=this.sections.slice(),t=[];for(let r=0,n=0;r<a.length;r+=2){let i=a[r],o=a[r+1];if(o>=0){a[r]=o,a[r+1]=i;let s=r>>1;for(;t.length<s;)t.push(Mu.empty);t.push(i?e.slice(n,n+i):Mu.empty)}n+=i}return new Ua(a,t)}compose(e){return this.empty?e:e.empty?this:pU(this,e,!0)}map(e,a=!1){return e.empty?this:Zy(this,e,a,!0)}iterChanges(e,a=!1){Uy(this,e,a)}get desc(){return xn.create(this.sections)}filter(e){let a=[],t=[],r=[],n=new Ud(this);e:for(let i=0,o=0;;){let s=i==e.length?1e9:e[i++];for(;o<s||o==s&&n.len==0;){if(n.done)break e;let c=Math.min(n.len,s-o);Ot(r,c,-1);let d=n.ins==-1?-1:n.off==0?n.ins:0;Ot(a,c,d),d>0&&lo(t,a,n.text),n.forward(c),o+=c}let l=e[i++];for(;o<l;){if(n.done)break e;let c=Math.min(n.len,l-o);Ot(a,c,-1),Ot(r,c,n.ins==-1?-1:n.off==0?n.ins:0),n.forward(c),o+=c}}return{changes:new Ua(a,t),filtered:xn.create(r)}}toJSON(){let e=[];for(let a=0;a<this.sections.length;a+=2){let t=this.sections[a],r=this.sections[a+1];r<0?e.push(t):r==0?e.push([t]):e.push([t].concat(this.inserted[a>>1].toJSON()))}return e}static of(e,a,t){let r=[],n=[],i=0,o=null;function s(c=!1){if(!c&&!r.length)return;i<a&&Ot(r,a-i,-1);let d=new Ua(r,n);o=o?o.compose(d.map(o)):d,r=[],n=[],i=0}function l(c){if(Array.isArray(c))for(let d of c)l(d);else if(c instanceof Ua){if(c.length!=a)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${a})`);s(),o=o?o.compose(c.map(o)):c}else{let{from:d,to:E=d,insert:p}=c;if(d>E||d<0||E>a)throw new RangeError(`Invalid change range ${d} to ${E} (in doc of length ${a})`);let x=p?typeof p=="string"?Mu.of(p.split(t||Jy)):p:Mu.empty,m=x.length;if(d==E&&m==0)return;d<i&&s(),d>i&&Ot(r,d-i,-1),Ot(r,E-d,m),lo(n,r,x),i=E}}return l(e),s(!o),o}static empty(e){return new Ua(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let a=[],t=[];for(let r=0;r<e.length;r++){let n=e[r];if(typeof n=="number")a.push(n,-1);else{if(!Array.isArray(n)||typeof n[0]!="number"||n.some((i,o)=>o&&typeof i!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(n.length==1)a.push(n[0],0);else{for(;t.length<r;)t.push(Mu.empty);t[r]=Mu.of(n.slice(1)),a.push(n[0],t[r].length)}}}return new Ua(a,t)}static createSet(e,a){return new Ua(e,a)}}function Ot(u,e,a,t=!1){if(e==0&&a<=0)return;let r=u.length-2;r>=0&&a<=0&&a==u[r+1]?u[r]+=e:r>=0&&e==0&&u[r]==0?u[r+1]+=a:t?(u[r]+=e,u[r+1]+=a):u.push(e,a)}function lo(u,e,a){if(a.length==0)return;let t=e.length-2>>1;if(t<u.length)u[u.length-1]=u[u.length-1].append(a);else{for(;u.length<t;)u.push(Mu.empty);u.push(a)}}function Uy(u,e,a){let t=u.inserted;for(let r=0,n=0,i=0;i<u.sections.length;){let o=u.sections[i++],s=u.sections[i++];if(s<0)r+=o,n+=o;else{let l=r,c=n,d=Mu.empty;for(;l+=o,c+=s,s&&t&&(d=d.append(t[i-2>>1])),!(a||i==u.sections.length||u.sections[i+1]<0);)o=u.sections[i++],s=u.sections[i++];e(r,l,n,c,d),r=l,n=c}}}function Zy(u,e,a,t=!1){let r=[],n=t?[]:null,i=new Ud(u),o=new Ud(e);for(let s=-1;;){if(i.done&&o.len||o.done&&i.len)throw new Error("Mismatched change set lengths");if(i.ins==-1&&o.ins==-1){let l=Math.min(i.len,o.len);Ot(r,l,-1),i.forward(l),o.forward(l)}else if(o.ins>=0&&(i.ins<0||s==i.i||i.off==0&&(o.len<i.len||o.len==i.len&&!a))){let l=o.len;for(Ot(r,o.ins,-1);l;){let c=Math.min(i.len,l);i.ins>=0&&s<i.i&&i.len<=c&&(Ot(r,0,i.ins),n&&lo(n,r,i.text),s=i.i),i.forward(c),l-=c}o.next()}else if(i.ins>=0){let l=0,c=i.len;for(;c;)if(o.ins==-1){let d=Math.min(c,o.len);l+=d,c-=d,o.forward(d)}else if(o.ins==0&&o.len<c)c-=o.len,o.next();else break;Ot(r,l,s<i.i?i.ins:0),n&&s<i.i&&lo(n,r,i.text),s=i.i,i.forward(i.len-c)}else{if(i.done&&o.done)return n?Ua.createSet(r,n):xn.create(r);throw new Error("Mismatched change set lengths")}}}function pU(u,e,a=!1){let t=[],r=a?[]:null,n=new Ud(u),i=new Ud(e);for(let o=!1;;){if(n.done&&i.done)return r?Ua.createSet(t,r):xn.create(t);if(n.ins==0)Ot(t,n.len,0,o),n.next();else if(i.len==0&&!i.done)Ot(t,0,i.ins,o),r&&lo(r,t,i.text),i.next();else{if(n.done||i.done)throw new Error("Mismatched change set lengths");{let s=Math.min(n.len2,i.len),l=t.length;if(n.ins==-1){let c=i.ins==-1?-1:i.off?0:i.ins;Ot(t,s,c,o),r&&c&&lo(r,t,i.text)}else i.ins==-1?(Ot(t,n.off?0:n.len,s,o),r&&lo(r,t,n.textBit(s))):(Ot(t,n.off?0:n.len,i.off?0:i.ins,o),r&&!i.off&&lo(r,t,i.text));o=(n.ins>s||i.ins>=0&&i.len>s)&&(o||t.length>l),n.forward2(s),i.forward(s)}}}}class Ud{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,a=this.i-2>>1;return a>=e.length?Mu.empty:e[a]}textBit(e){let{inserted:a}=this.set,t=this.i-2>>1;return t>=a.length&&!e?Mu.empty:a[t].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 gh=class Qy{constructor(e,a,t){this.from=e,this.to=a,this.flags=t}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,a=-1){let t,r;return this.empty?t=r=e.mapPos(this.from,a):(t=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),t==this.from&&r==this.to?this:new Qy(t,r,this.flags)}extend(e,a=e){if(e<=this.anchor&&a>=this.anchor)return Se.range(e,a);let t=Math.abs(e-this.anchor)>Math.abs(a-this.anchor)?e:a;return Se.range(this.anchor,t)}eq(e,a=!1){return this.anchor==e.anchor&&this.head==e.head&&(!a||!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 Se.range(e.anchor,e.head)}static create(e,a,t){return new Qy(e,a,t)}};class Se{constructor(e,a){this.ranges=e,this.mainIndex=a}map(e,a=-1){return e.empty?this:Se.create(this.ranges.map(t=>t.map(e,a)),this.mainIndex)}eq(e,a=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;t<this.ranges.length;t++)if(!this.ranges[t].eq(e.ranges[t],a))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Se([this.main],0)}addRange(e,a=!0){return Se.create([e].concat(this.ranges),a?0:this.mainIndex+1)}replaceRange(e,a=this.mainIndex){let t=this.ranges.slice();return t[a]=e,Se.create(t,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 Se(e.ranges.map(a=>gh.fromJSON(a)),e.main)}static single(e,a=e){return new Se([Se.range(e,a)],0)}static create(e,a=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let t=0,r=0;r<e.length;r++){let n=e[r];if(n.empty?n.from<=t:n.from<t)return Se.normalized(e.slice(),a);t=n.to}return new Se(e,a)}static cursor(e,a=0,t,r){return gh.create(e,e,(a==0?0:a<0?8:16)|(t==null?7:Math.min(6,t))|(r??16777215)<<6)}static range(e,a,t,r){let n=(t??16777215)<<6|(r==null?7:Math.min(6,r));return a<e?gh.create(a,e,48|n):gh.create(e,a,(a>e?8:0)|n)}static normalized(e,a=0){let t=e[a];e.sort((r,n)=>r.from-n.from),a=e.indexOf(t);for(let r=1;r<e.length;r++){let n=e[r],i=e[r-1];if(n.empty?n.from<=i.to:n.from<i.to){let o=i.from,s=Math.max(n.to,i.to);r<=a&&a--,e.splice(--r,2,n.anchor>n.head?Se.range(s,o):Se.range(o,s))}}return new Se(e,a)}}function mU(u,e){for(let a of u.ranges)if(a.to>e)throw new RangeError("Selection points outside of document")}let kA=0;class Ne{constructor(e,a,t,r,n){this.combine=e,this.compareInput=a,this.compare=t,this.isStatic=r,this.id=kA++,this.default=e([]),this.extensions=typeof n=="function"?n(this):n}get reader(){return this}static define(e={}){return new Ne(e.combine||(a=>a),e.compareInput||((a,t)=>a===t),e.compare||(e.combine?(a,t)=>a===t:bA),!!e.static,e.enables)}of(e){return new Fx([],this,0,e)}compute(e,a){if(this.isStatic)throw new Error("Can't compute a static facet");return new Fx(e,this,1,a)}computeN(e,a){if(this.isStatic)throw new Error("Can't compute a static facet");return new Fx(e,this,2,a)}from(e,a){return a||(a=t=>t),this.compute([e],t=>a(t.field(e)))}}function bA(u,e){return u==e||u.length==e.length&&u.every((a,t)=>a===e[t])}class Fx{constructor(e,a,t,r){this.dependencies=e,this.facet=a,this.type=t,this.value=r,this.id=kA++}dynamicSlot(e){var a;let t=this.value,r=this.facet.compareInput,n=this.id,i=e[n]>>1,o=this.type==2,s=!1,l=!1,c=[];for(let d of this.dependencies)d=="doc"?s=!0:d=="selection"?l=!0:(((a=e[d.id])!==null&&a!==void 0?a:1)&1)==0&&c.push(e[d.id]);return{create(d){return d.values[i]=t(d),1},update(d,E){if(s&&E.docChanged||l&&(E.docChanged||E.selection)||Yy(d,c)){let p=t(d);if(o?!yM(p,d.values[i],r):!r(p,d.values[i]))return d.values[i]=p,1}return 0},reconfigure:(d,E)=>{let p,x=E.config.address[n];if(x!=null){let m=iD(E,x);if(this.dependencies.every(g=>g instanceof Ne?E.facet(g)===d.facet(g):g instanceof Qa?E.field(g,!1)==d.field(g,!1):!0)||(o?yM(p=t(d),m,r):r(p=t(d),m)))return d.values[i]=m,0}else p=t(d);return d.values[i]=p,1}}}}function yM(u,e,a){if(u.length!=e.length)return!1;for(let t=0;t<u.length;t++)if(!a(u[t],e[t]))return!1;return!0}function Yy(u,e){let a=!1;for(let t of e)xd(u,t)&1&&(a=!0);return a}function Y3u(u,e,a){let t=a.map(s=>u[s.id]),r=a.map(s=>s.type),n=t.filter(s=>!(s&1)),i=u[e.id]>>1;function o(s){let l=[];for(let c=0;c<t.length;c++){let d=iD(s,t[c]);if(r[c]==2)for(let E of d)l.push(E);else l.push(d)}return e.combine(l)}return{create(s){for(let l of t)xd(s,l);return s.values[i]=o(s),1},update(s,l){if(!Yy(s,n))return 0;let c=o(s);return e.compare(c,s.values[i])?0:(s.values[i]=c,1)},reconfigure(s,l){let c=Yy(s,t),d=l.config.facets[e.id],E=l.facet(e);if(d&&!c&&bA(a,d))return s.values[i]=E,0;let p=o(s);return e.compare(p,E)?(s.values[i]=E,0):(s.values[i]=p,1)}}}const vh=Ne.define({static:!0});class Qa{constructor(e,a,t,r,n){this.id=e,this.createF=a,this.updateF=t,this.compareF=r,this.spec=n,this.provides=void 0}static define(e){let a=new Qa(kA++,e.create,e.update,e.compare||((t,r)=>t===r),e);return e.provide&&(a.provides=e.provide(a)),a}create(e){let a=e.facet(vh).find(t=>t.field==this);return(a?.create||this.createF)(e)}slot(e){let a=e[this.id]>>1;return{create:t=>(t.values[a]=this.create(t),1),update:(t,r)=>{let n=t.values[a],i=this.updateF(n,r);return this.compareF(n,i)?0:(t.values[a]=i,1)},reconfigure:(t,r)=>{let n=t.facet(vh),i=r.facet(vh),o;return(o=n.find(s=>s.field==this))&&o!=i.find(s=>s.field==this)?(t.values[a]=o.create(t),1):r.config.address[this.id]!=null?(t.values[a]=r.field(this),0):(t.values[a]=this.create(t),1)}}}init(e){return[this,vh.of({field:this,create:e})]}get extension(){return this}}const vs={lowest:4,low:3,default:2,high:1,highest:0};function F4(u){return e=>new hU(e,u)}const Cn={highest:F4(vs.highest),high:F4(vs.high),default:F4(vs.default),low:F4(vs.low),lowest:F4(vs.lowest)};class hU{constructor(e,a){this.inner=e,this.prec=a}}class sg{of(e){return new Xy(this,e)}reconfigure(e){return sg.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Xy{constructor(e,a){this.compartment=e,this.inner=a}}class nD{constructor(e,a,t,r,n,i){for(this.base=e,this.compartments=a,this.dynamicSlots=t,this.address=r,this.staticValues=n,this.facets=i,this.statusTemplate=[];this.statusTemplate.length<t.length;)this.statusTemplate.push(0)}staticFacet(e){let a=this.address[e.id];return a==null?e.default:this.staticValues[a>>1]}static resolve(e,a,t){let r=[],n=Object.create(null),i=new Map;for(let E of X3u(e,a,i))E instanceof Qa?r.push(E):(n[E.facet.id]||(n[E.facet.id]=[])).push(E);let o=Object.create(null),s=[],l=[];for(let E of r)o[E.id]=l.length<<1,l.push(p=>E.slot(p));let c=t?.config.facets;for(let E in n){let p=n[E],x=p[0].facet,m=c&&c[E]||[];if(p.every(g=>g.type==0))if(o[x.id]=s.length<<1|1,bA(m,p))s.push(t.facet(x));else{let g=x.combine(p.map(h=>h.value));s.push(t&&x.compare(g,t.facet(x))?t.facet(x):g)}else{for(let g of p)g.type==0?(o[g.id]=s.length<<1|1,s.push(g.value)):(o[g.id]=l.length<<1,l.push(h=>g.dynamicSlot(h)));o[x.id]=l.length<<1,l.push(g=>Y3u(g,x,p))}}let d=l.map(E=>E(o));return new nD(e,i,d,o,s,n)}}function X3u(u,e,a){let t=[[],[],[],[],[]],r=new Map;function n(i,o){let s=r.get(i);if(s!=null){if(s<=o)return;let l=t[s].indexOf(i);l>-1&&t[s].splice(l,1),i instanceof Xy&&a.delete(i.compartment)}if(r.set(i,o),Array.isArray(i))for(let l of i)n(l,o);else if(i instanceof Xy){if(a.has(i.compartment))throw new RangeError("Duplicate use of compartment in extensions");let l=e.get(i.compartment)||i.inner;a.set(i.compartment,l),n(l,o)}else if(i instanceof hU)n(i.inner,i.prec);else if(i instanceof Qa)t[o].push(i),i.provides&&n(i.provides,o);else if(i instanceof Fx)t[o].push(i),i.facet.extensions&&n(i.facet.extensions,vs.default);else{let l=i.extension;if(!l)throw new Error(`Unrecognized extension value in extension set (${i}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);n(l,o)}}return n(u,vs.default),t.reduce((i,o)=>i.concat(o))}function xd(u,e){if(e&1)return 2;let a=e>>1,t=u.status[a];if(t==4)throw new Error("Cyclic dependency between fields and/or facets");if(t&2)return t;u.status[a]=4;let r=u.computeSlot(u,u.config.dynamicSlots[a]);return u.status[a]=2|r}function iD(u,e){return e&1?u.config.staticValues[e>>1]:u.values[e>>1]}const xU=Ne.define(),eC=Ne.define({combine:u=>u.some(e=>e),static:!0}),DU=Ne.define({combine:u=>u.length?u[0]:void 0,static:!0}),fU=Ne.define(),gU=Ne.define(),vU=Ne.define(),kU=Ne.define({combine:u=>u.length?u[0]:!1});class Fn{constructor(e,a){this.type=e,this.value=a}static define(){return new epu}}class epu{of(e){return new Fn(this,e)}}class upu{constructor(e){this.map=e}of(e){return new iu(this,e)}}class iu{constructor(e,a){this.type=e,this.value=a}map(e){let a=this.type.map(this.value,e);return a===void 0?void 0:a==this.value?this:new iu(this.type,a)}is(e){return this.type==e}static define(e={}){return new upu(e.map||(a=>a))}static mapEffects(e,a){if(!e.length)return e;let t=[];for(let r of e){let n=r.map(a);n&&t.push(n)}return t}}iu.reconfigure=iu.define();iu.appendConfig=iu.define();class Ga{constructor(e,a,t,r,n,i){this.startState=e,this.changes=a,this.selection=t,this.effects=r,this.annotations=n,this.scrollIntoView=i,this._doc=null,this._state=null,t&&mU(t,a.newLength),n.some(o=>o.type==Ga.time)||(this.annotations=n.concat(Ga.time.of(Date.now())))}static create(e,a,t,r,n,i){return new Ga(e,a,t,r,n,i)}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 a of this.annotations)if(a.type==e)return a.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let a=this.annotation(Ga.userEvent);return!!(a&&(a==e||a.length>e.length&&a.slice(0,e.length)==e&&a[e.length]=="."))}}Ga.time=Fn.define();Ga.userEvent=Fn.define();Ga.addToHistory=Fn.define();Ga.remote=Fn.define();function apu(u,e){let a=[];for(let t=0,r=0;;){let n,i;if(t<u.length&&(r==e.length||e[r]>=u[t]))n=u[t++],i=u[t++];else if(r<e.length)n=e[r++],i=e[r++];else return a;!a.length||a[a.length-1]<n?a.push(n,i):a[a.length-1]<i&&(a[a.length-1]=i)}}function bU(u,e,a){var t;let r,n,i;return a?(r=e.changes,n=Ua.empty(e.changes.length),i=u.changes.compose(e.changes)):(r=e.changes.map(u.changes),n=u.changes.mapDesc(e.changes,!0),i=u.changes.compose(r)),{changes:i,selection:e.selection?e.selection.map(n):(t=u.selection)===null||t===void 0?void 0:t.map(r),effects:iu.mapEffects(u.effects,r).concat(iu.mapEffects(e.effects,n)),annotations:u.annotations.length?u.annotations.concat(e.annotations):e.annotations,scrollIntoView:u.scrollIntoView||e.scrollIntoView}}function uC(u,e,a){let t=e.selection,r=B1(e.annotations);return e.userEvent&&(r=r.concat(Ga.userEvent.of(e.userEvent))),{changes:e.changes instanceof Ua?e.changes:Ua.of(e.changes||[],a,u.facet(DU)),selection:t&&(t instanceof Se?t:Se.single(t.anchor,t.head)),effects:B1(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function yU(u,e,a){let t=uC(u,e.length?e[0]:{},u.doc.length);e.length&&e[0].filter===!1&&(a=!1);for(let n=1;n<e.length;n++){e[n].filter===!1&&(a=!1);let i=!!e[n].sequential;t=bU(t,uC(u,e[n],i?t.changes.newLength:u.doc.length),i)}let r=Ga.create(u,t.changes,t.selection,t.effects,t.annotations,t.scrollIntoView);return rpu(a?tpu(r):r)}function tpu(u){let e=u.startState,a=!0;for(let r of e.facet(fU)){let n=r(u);if(n===!1){a=!1;break}Array.isArray(n)&&(a=a===!0?n:apu(a,n))}if(a!==!0){let r,n;if(a===!1)n=u.changes.invertedDesc,r=Ua.empty(e.doc.length);else{let i=u.changes.filter(a);r=i.changes,n=i.filtered.mapDesc(i.changes).invertedDesc}u=Ga.create(e,r,u.selection&&u.selection.map(n),iu.mapEffects(u.effects,n),u.annotations,u.scrollIntoView)}let t=e.facet(gU);for(let r=t.length-1;r>=0;r--){let n=t[r](u);n instanceof Ga?u=n:Array.isArray(n)&&n.length==1&&n[0]instanceof Ga?u=n[0]:u=yU(e,B1(n),!1)}return u}function rpu(u){let e=u.startState,a=e.facet(vU),t=u;for(let r=a.length-1;r>=0;r--){let n=a[r](u);n&&Object.keys(n).length&&(t=bU(t,uC(e,n,u.changes.newLength),!0))}return t==u?u:Ga.create(e,u.changes,u.selection,t.effects,t.annotations,t.scrollIntoView)}const npu=[];function B1(u){return u==null?npu:Array.isArray(u)?u:[u]}var ba=(function(u){return u[u.Word=0]="Word",u[u.Space=1]="Space",u[u.Other=2]="Other",u})(ba||(ba={}));const ipu=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let aC;try{aC=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function opu(u){if(aC)return aC.test(u);for(let e=0;e<u.length;e++){let a=u[e];if(/\w/.test(a)||a>"€"&&(a.toUpperCase()!=a.toLowerCase()||ipu.test(a)))return!0}return!1}function spu(u){return e=>{if(!/\S/.test(e))return ba.Space;if(opu(e))return ba.Word;for(let a=0;a<u.length;a++)if(e.indexOf(u[a])>-1)return ba.Word;return ba.Other}}class Ou{constructor(e,a,t,r,n,i){this.config=e,this.doc=a,this.selection=t,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=n,i&&(i._state=this);for(let o=0;o<this.config.dynamicSlots.length;o++)xd(this,o<<1);this.computeSlot=null}field(e,a=!0){let t=this.config.address[e.id];if(t==null){if(a)throw new RangeError("Field is not present in this state");return}return xd(this,t),iD(this,t)}update(...e){return yU(this,e,!0)}applyTransaction(e){let a=this.config,{base:t,compartments:r}=a;for(let o of e.effects)o.is(sg.reconfigure)?(a&&(r=new Map,a.compartments.forEach((s,l)=>r.set(l,s)),a=null),r.set(o.value.compartment,o.value.extension)):o.is(iu.reconfigure)?(a=null,t=o.value):o.is(iu.appendConfig)&&(a=null,t=B1(t).concat(o.value));let n;a?n=e.startState.values.slice():(a=nD.resolve(t,r,this),n=new Ou(a,this.doc,this.selection,a.dynamicSlots.map(()=>null),(s,l)=>l.reconfigure(s,this),null).values);let i=e.startState.facet(eC)?e.newSelection:e.newSelection.asSingle();new Ou(a,e.newDoc,i,n,(o,s)=>s.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(a=>({changes:{from:a.from,to:a.to,insert:e},range:Se.cursor(a.from+e.length)}))}changeByRange(e){let a=this.selection,t=e(a.ranges[0]),r=this.changes(t.changes),n=[t.range],i=B1(t.effects);for(let o=1;o<a.ranges.length;o++){let s=e(a.ranges[o]),l=this.changes(s.changes),c=l.map(r);for(let E=0;E<o;E++)n[E]=n[E].map(c);let d=r.mapDesc(l,!0);n.push(s.range.map(d)),r=r.compose(c),i=iu.mapEffects(i,c).concat(iu.mapEffects(B1(s.effects),d))}return{changes:r,selection:Se.create(n,a.mainIndex),effects:i}}changes(e=[]){return e instanceof Ua?e:Ua.of(e,this.doc.length,this.facet(Ou.lineSeparator))}toText(e){return Mu.of(e.split(this.facet(Ou.lineSeparator)||Jy))}sliceDoc(e=0,a=this.doc.length){return this.doc.sliceString(e,a,this.lineBreak)}facet(e){let a=this.config.address[e.id];return a==null?e.default:(xd(this,a),iD(this,a))}toJSON(e){let a={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let t in e){let r=e[t];r instanceof Qa&&this.config.address[r.id]!=null&&(a[t]=r.spec.toJSON(this.field(e[t]),this))}return a}static fromJSON(e,a={},t){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(t){for(let n in t)if(Object.prototype.hasOwnProperty.call(e,n)){let i=t[n],o=e[n];r.push(i.init(s=>i.spec.fromJSON(o,s)))}}return Ou.create({doc:e.doc,selection:Se.fromJSON(e.selection),extensions:a.extensions?r.concat([a.extensions]):r})}static create(e={}){let a=nD.resolve(e.extensions||[],new Map),t=e.doc instanceof Mu?e.doc:Mu.of((e.doc||"").split(a.staticFacet(Ou.lineSeparator)||Jy)),r=e.selection?e.selection instanceof Se?e.selection:Se.single(e.selection.anchor,e.selection.head):Se.single(0);return mU(r,t.length),a.staticFacet(eC)||(r=r.asSingle()),new Ou(a,t,r,a.dynamicSlots.map(()=>null),(n,i)=>i.create(n),null)}get tabSize(){return this.facet(Ou.tabSize)}get lineBreak(){return this.facet(Ou.lineSeparator)||`
@@ -521,7 +521,7 @@ html body {
521
521
  `),y+="`"+Zvu(k)+"`: "+f),l([y])}return null})},u})();function Yk(u){if(u){var e=u.replace(/([^\n\r])(\r?\n)([^\n\r])/gm,`$1
522
522
 
523
523
  $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function Zvu(u){return u.indexOf("`")!==-1?"`` "+u+" ``":u}var Qvu=(function(){var u=function(e,a){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])},u(e,a)};return function(e,a){u(e,a);function t(){this.constructor=e}e.prototype=a===null?Object.create(a):(t.prototype=a.prototype,new t)}})(),Ma,EE;if(typeof process=="object")EE=process.platform==="win32";else if(typeof navigator=="object"){var Yvu=navigator.userAgent;EE=Yvu.indexOf("Windows")>=0}var Xvu=/^\w[\w\d+.-]*$/,eku=/^\//,uku=/^\/\//;function aku(u,e){if(!u.scheme&&e)throw new Error('[UriError]: Scheme is missing: {scheme: "", authority: "'+u.authority+'", path: "'+u.path+'", query: "'+u.query+'", fragment: "'+u.fragment+'"}');if(u.scheme&&!Xvu.test(u.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(u.path){if(u.authority){if(!eku.test(u.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(uku.test(u.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function tku(u,e){return!u&&!e?"file":u}function rku(u,e){switch(u){case"https":case"http":case"file":e?e[0]!==fr&&(e=fr+e):e=fr;break}return e}var ra="",fr="/",nku=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,pF=(function(){function u(e,a,t,r,n,i){i===void 0&&(i=!1),typeof e=="object"?(this.scheme=e.scheme||ra,this.authority=e.authority||ra,this.path=e.path||ra,this.query=e.query||ra,this.fragment=e.fragment||ra):(this.scheme=tku(e,i),this.authority=a||ra,this.path=rku(this.scheme,t||ra),this.query=r||ra,this.fragment=n||ra,aku(this,i))}return u.isUri=function(e){return e instanceof u?!0:e?typeof e.authority=="string"&&typeof e.fragment=="string"&&typeof e.path=="string"&&typeof e.query=="string"&&typeof e.scheme=="string"&&typeof e.fsPath=="function"&&typeof e.with=="function"&&typeof e.toString=="function":!1},Object.defineProperty(u.prototype,"fsPath",{get:function(){return HY(this)},enumerable:!0,configurable:!0}),u.prototype.with=function(e){if(!e)return this;var a=e.scheme,t=e.authority,r=e.path,n=e.query,i=e.fragment;return a===void 0?a=this.scheme:a===null&&(a=ra),t===void 0?t=this.authority:t===null&&(t=ra),r===void 0?r=this.path:r===null&&(r=ra),n===void 0?n=this.query:n===null&&(n=ra),i===void 0?i=this.fragment:i===null&&(i=ra),a===this.scheme&&t===this.authority&&r===this.path&&n===this.query&&i===this.fragment?this:new Vl(a,t,r,n,i)},u.parse=function(e,a){a===void 0&&(a=!1);var t=nku.exec(e);return t?new Vl(t[2]||ra,_h(t[4]||ra),_h(t[5]||ra),_h(t[7]||ra),_h(t[9]||ra),a):new Vl(ra,ra,ra,ra,ra)},u.file=function(e){var a=ra;if(EE&&(e=e.replace(/\\/g,fr)),e[0]===fr&&e[1]===fr){var t=e.indexOf(fr,2);t===-1?(a=e.substring(2),e=fr):(a=e.substring(2,t),e=e.substring(t)||fr)}return new Vl("file",a,e,ra,ra)},u.from=function(e){return new Vl(e.scheme,e.authority,e.path,e.query,e.fragment)},u.prototype.toString=function(e){return e===void 0&&(e=!1),mF(this,e)},u.prototype.toJSON=function(){return this},u.revive=function(e){if(e){if(e instanceof u)return e;var a=new Vl(e);return a._formatted=e.external,a._fsPath=e._sep===VY?e.fsPath:null,a}else return e},u})(),VY=EE?1:void 0,Vl=(function(u){Qvu(e,u);function e(){var a=u!==null&&u.apply(this,arguments)||this;return a._formatted=null,a._fsPath=null,a}return Object.defineProperty(e.prototype,"fsPath",{get:function(){return this._fsPath||(this._fsPath=HY(this)),this._fsPath},enumerable:!0,configurable:!0}),e.prototype.toString=function(a){return a===void 0&&(a=!1),a?mF(this,!0):(this._formatted||(this._formatted=mF(this,!1)),this._formatted)},e.prototype.toJSON=function(){var a={$mid:1};return this._fsPath&&(a.fsPath=this._fsPath,a._sep=VY),this._formatted&&(a.external=this._formatted),this.path&&(a.path=this.path),this.scheme&&(a.scheme=this.scheme),this.authority&&(a.authority=this.authority),this.query&&(a.query=this.query),this.fragment&&(a.fragment=this.fragment),a},e})(pF),GY=(Ma={},Ma[58]="%3A",Ma[47]="%2F",Ma[63]="%3F",Ma[35]="%23",Ma[91]="%5B",Ma[93]="%5D",Ma[64]="%40",Ma[33]="%21",Ma[36]="%24",Ma[38]="%26",Ma[39]="%27",Ma[40]="%28",Ma[41]="%29",Ma[42]="%2A",Ma[43]="%2B",Ma[44]="%2C",Ma[59]="%3B",Ma[61]="%3D",Ma[32]="%20",Ma);function PR(u,e){for(var a=void 0,t=-1,r=0;r<u.length;r++){var n=u.charCodeAt(r);if(n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||n===45||n===46||n===95||n===126||e&&n===47)t!==-1&&(a+=encodeURIComponent(u.substring(t,r)),t=-1),a!==void 0&&(a+=u.charAt(r));else{a===void 0&&(a=u.substr(0,r));var i=GY[n];i!==void 0?(t!==-1&&(a+=encodeURIComponent(u.substring(t,r)),t=-1),a+=i):t===-1&&(t=r)}}return t!==-1&&(a+=encodeURIComponent(u.substring(t))),a!==void 0?a:u}function iku(u){for(var e=void 0,a=0;a<u.length;a++){var t=u.charCodeAt(a);t===35||t===63?(e===void 0&&(e=u.substr(0,a)),e+=GY[t]):e!==void 0&&(e+=u[a])}return e!==void 0?e:u}function HY(u,e){var a;return u.authority&&u.path.length>1&&u.scheme==="file"?a="//"+u.authority+u.path:u.path.charCodeAt(0)===47&&(u.path.charCodeAt(1)>=65&&u.path.charCodeAt(1)<=90||u.path.charCodeAt(1)>=97&&u.path.charCodeAt(1)<=122)&&u.path.charCodeAt(2)===58?a=u.path[1].toLowerCase()+u.path.substr(2):a=u.path,EE&&(a=a.replace(/\//g,"\\")),a}function mF(u,e){var a=e?iku:PR,t="",r=u.scheme,n=u.authority,i=u.path,o=u.query,s=u.fragment;if(r&&(t+=r,t+=":"),(n||r==="file")&&(t+=fr,t+=fr),n){var l=n.indexOf("@");if(l!==-1){var c=n.substr(0,l);n=n.substr(l+1),l=c.indexOf(":"),l===-1?t+=a(c,!1):(t+=a(c.substr(0,l),!1),t+=":",t+=a(c.substr(l+1),!1)),t+="@"}n=n.toLowerCase(),l=n.indexOf(":"),l===-1?t+=a(n,!1):(t+=a(n.substr(0,l),!1),t+=n.substr(l))}if(i){if(i.length>=3&&i.charCodeAt(0)===47&&i.charCodeAt(2)===58){var d=i.charCodeAt(1);d>=65&&d<=90&&(i="/"+String.fromCharCode(d+32)+":"+i.substr(3))}else if(i.length>=2&&i.charCodeAt(1)===58){var d=i.charCodeAt(0);d>=65&&d<=90&&(i=String.fromCharCode(d+32)+":"+i.substr(2))}t+=a(i,!0)}return o&&(t+="?",t+=a(o,!1)),s&&(t+="#",t+=e?s:PR(s,!1)),t}function qY(u){try{return decodeURIComponent(u)}catch{return u.length>3?u.substr(0,3)+qY(u.substr(3)):u}}var jR=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function _h(u){return u.match(jR)?u.replace(jR,function(e){return qY(e)}):u}var oku=(function(){function u(e){try{this.patternRegExp=new RegExp(Hvu(e)+"$")}catch{this.patternRegExp=null}this.schemas=[]}return u.prototype.addSchema=function(e){this.schemas.push(e)},u.prototype.matchesPattern=function(e){return this.patternRegExp&&this.patternRegExp.test(e)},u.prototype.getSchemas=function(){return this.schemas},u})(),sku=(function(){function u(e,a,t){this.service=e,this.url=a,this.dependencies={},t&&(this.unresolvedSchema=this.service.promise.resolve(new g1(t)))}return u.prototype.getUnresolvedSchema=function(){return this.unresolvedSchema||(this.unresolvedSchema=this.service.loadSchema(this.url)),this.unresolvedSchema},u.prototype.getResolvedSchema=function(){var e=this;return this.resolvedSchema||(this.resolvedSchema=this.getUnresolvedSchema().then(function(a){return e.service.resolveSchemaContent(a,e.url,e.dependencies)})),this.resolvedSchema},u.prototype.clearSchema=function(){this.resolvedSchema=null,this.unresolvedSchema=null,this.dependencies={}},u})(),g1=(function(){function u(e,a){a===void 0&&(a=[]),this.schema=e,this.errors=a}return u})(),MR=(function(){function u(e,a){a===void 0&&(a=[]),this.schema=e,this.errors=a}return u.prototype.getSection=function(e){return t0(this.getSectionRecursive(e,this.schema))},u.prototype.getSectionRecursive=function(e,a){if(!a||typeof a=="boolean"||e.length===0)return a;var t=e.shift();if(a.properties&&typeof a.properties[t])return this.getSectionRecursive(e,a.properties[t]);if(a.patternProperties)for(var r=0,n=Object.keys(a.patternProperties);r<n.length;r++){var i=n[r],o=new RegExp(i);if(o.test(t))return this.getSectionRecursive(e,a.patternProperties[i])}else{if(typeof a.additionalProperties=="object")return this.getSectionRecursive(e,a.additionalProperties);if(t.match("[0-9]+")){if(Array.isArray(a.items)){var s=parseInt(t,10);if(!isNaN(s)&&a.items[s])return this.getSectionRecursive(e,a.items[s])}else if(a.items)return this.getSectionRecursive(e,a.items)}}return null},u})(),lku=(function(){function u(e,a,t){this.contextService=a,this.requestService=e,this.promiseConstructor=t||Promise,this.callOnDispose=[],this.contributionSchemas={},this.contributionAssociations={},this.schemasById={},this.filePatternAssociations=[],this.filePatternAssociationById={},this.registeredSchemasIds={}}return u.prototype.getRegisteredSchemaIds=function(e){return Object.keys(this.registeredSchemasIds).filter(function(a){var t=pF.parse(a).scheme;return t!=="schemaservice"&&(!e||e(t))})},Object.defineProperty(u.prototype,"promise",{get:function(){return this.promiseConstructor},enumerable:!0,configurable:!0}),u.prototype.dispose=function(){for(;this.callOnDispose.length>0;)this.callOnDispose.pop()()},u.prototype.onResourceChange=function(e){var a=this,t=!1;e=this.normalizeId(e);for(var r=[e],n=Object.keys(this.schemasById).map(function(l){return a.schemasById[l]});r.length;)for(var i=r.pop(),o=0;o<n.length;o++){var s=n[o];s&&(s.url===i||s.dependencies[i])&&(s.url!==i&&r.push(s.url),s.clearSchema(),n[o]=void 0,t=!0)}return t},u.prototype.normalizeId=function(e){try{return pF.parse(e).toString()}catch{return e}},u.prototype.setSchemaContributions=function(e){if(e.schemas){var a=e.schemas;for(var t in a){var r=this.normalizeId(t);this.contributionSchemas[r]=this.addSchemaHandle(r,a[t])}}if(e.schemaAssociations){var n=e.schemaAssociations;for(var i in n){var o=n[i];this.contributionAssociations[i]=o;for(var s=this.getOrAddFilePatternAssociation(i),l=0,c=o;l<c.length;l++){var d=c[l],t=this.normalizeId(d);s.addSchema(t)}}}},u.prototype.addSchemaHandle=function(e,a){var t=new sku(this,e,a);return this.schemasById[e]=t,t},u.prototype.getOrAddSchemaHandle=function(e,a){return this.schemasById[e]||this.addSchemaHandle(e,a)},u.prototype.getOrAddFilePatternAssociation=function(e){var a=this.filePatternAssociationById[e];return a||(a=new oku(e),this.filePatternAssociationById[e]=a,this.filePatternAssociations.push(a)),a},u.prototype.registerExternalSchema=function(e,a,t){a===void 0&&(a=null);var r=this.normalizeId(e);if(this.registeredSchemasIds[r]=!0,a)for(var n=0,i=a;n<i.length;n++){var o=i[n];this.getOrAddFilePatternAssociation(o).addSchema(r)}return t?this.addSchemaHandle(r,t):this.getOrAddSchemaHandle(r)},u.prototype.clearExternalSchemas=function(){this.schemasById={},this.filePatternAssociations=[],this.filePatternAssociationById={},this.registeredSchemasIds={};for(var e in this.contributionSchemas)this.schemasById[e]=this.contributionSchemas[e],this.registeredSchemasIds[e]=!0;for(var a in this.contributionAssociations)for(var t=this.getOrAddFilePatternAssociation(a),r=0,n=this.contributionAssociations[a];r<n.length;r++){var i=n[r],e=this.normalizeId(i);t.addSchema(e)}},u.prototype.getResolvedSchema=function(e){var a=this.normalizeId(e),t=this.schemasById[a];return t?t.getResolvedSchema():this.promise.resolve(null)},u.prototype.loadSchema=function(e){if(!this.requestService){var a="Unable to load schema from '"+e+"'. No schema request service available";return this.promise.resolve(new g1({},[a]))}return this.requestService(e).then(function(t){if(!t){var r="Unable to load schema from '"+e+"': No content.";return new g1({},[r])}var n={},i=[];n=Bvu(t,i);var o=i.length?["Unable to parse content from '"+e+"': Parse error at offset "+i[0].offset]:[];return new g1(n,o)},function(t){var r="Unable to load schema from '"+e+"': "+t.toString();return new g1({},[r])})},u.prototype.resolveSchemaContent=function(e,a,t){var r=this,n=e.errors.slice(0),i=e.schema;if(i.$schema){var o=this.normalizeId(i.$schema);if(o==="http://json-schema.org/draft-03/schema")return this.promise.resolve(new MR({},["Draft-03 schemas are not supported."]));o==="https://json-schema.org/draft/2019-09/schema"&&e.errors.push("Draft 2019-09 schemas are not yet fully supported.")}var s=this.contextService,l=function(p,x){if(!x)return p;var m=p;return x[0]==="/"&&(x=x.substr(1)),x.split("/").some(function(g){return m=m[g],!m}),m},c=function(p,x,m,g){var h=l(x,g);if(h)for(var f in h)h.hasOwnProperty(f)&&!p.hasOwnProperty(f)&&(p[f]=h[f]);else n.push("$ref '"+g+"' in '"+m+"' can not be resolved.")},d=function(p,x,m,g,h){s&&!/^\w+:\/\/.*/.test(x)&&(x=s.resolveRelativePath(x,g)),x=r.normalizeId(x);var f=r.getOrAddSchemaHandle(x);return f.getUnresolvedSchema().then(function(k){if(h[x]=!0,k.errors.length){var y=m?x+"#"+m:x;n.push("Problems loading reference '"+y+"': "+k.errors[0]+".")}return c(p,k.schema,x,m),E(p,k.schema,x,f.dependencies)})},E=function(p,x,m,g){if(!p||typeof p!="object")return Promise.resolve(null);for(var h=[p],f=[],k=[],y=function(){for(var z=[],P=0;P<arguments.length;P++)z[P]=arguments[P];for(var L=0,I=z;L<I.length;L++){var G=I[L];typeof G=="object"&&h.push(G)}},v=function(){for(var z=[],P=0;P<arguments.length;P++)z[P]=arguments[P];for(var L=0,I=z;L<I.length;L++){var G=I[L];if(typeof G=="object")for(var X in G){var U=G[X];typeof U=="object"&&h.push(U)}}},b=function(){for(var z=[],P=0;P<arguments.length;P++)z[P]=arguments[P];for(var L=0,I=z;L<I.length;L++){var G=I[L];if(Array.isArray(G))for(var X=0,U=G;X<U.length;X++){var ae=U[X];typeof ae=="object"&&h.push(ae)}}},C=function(z){for(var P=[];z.$ref;){var L=z.$ref,I=L.split("#",2);if(delete z.$ref,I[0].length>0){k.push(d(z,I[0],I[1],m,g));return}else P.indexOf(L)===-1&&(c(z,x,m,I[1]),P.push(L))}y(z.items,z.additionalProperties,z.not,z.contains,z.propertyNames,z.if,z.then,z.else),v(z.definitions,z.properties,z.patternProperties,z.dependencies),b(z.anyOf,z.allOf,z.oneOf,z.items)};h.length;){var B=h.pop();f.indexOf(B)>=0||(f.push(B),C(B))}return r.promise.all(k)};return E(i,i,a,t).then(function(p){return new MR(i,n)})},u.prototype.getSchemaForResource=function(e,a){if(a&&a.root&&a.root.type==="object"){var t=a.root.properties.filter(function(x){return x.keyNode.value==="$schema"&&x.valueNode&&x.valueNode.type==="string"});if(t.length>0){var r=bo(t[0].valueNode);if(r&&Gvu(r,".")&&this.contextService&&(r=this.contextService.resolveRelativePath(r,e)),r){var n=this.normalizeId(r);return this.getOrAddSchemaHandle(n).getResolvedSchema()}}}for(var i=Object.create(null),o=[],s=0,l=this.filePatternAssociations;s<l.length;s++){var c=l[s];if(c.matchesPattern(e))for(var d=0,E=c.getSchemas();d<E.length;d++){var p=E[d];i[p]||(o.push(p),i[p]=!0)}}return o.length>0?this.createCombinedSchema(e,o).getResolvedSchema():this.promise.resolve(null)},u.prototype.createCombinedSchema=function(e,a){if(a.length===1)return this.getOrAddSchemaHandle(a[0]);var t="schemaservice://combinedSchema/"+encodeURIComponent(e),r={allOf:a.map(function(n){return{$ref:n}})};return this.addSchemaHandle(t,r)},u})();var cku=(function(){function u(e,a){this.jsonSchemaService=e,this.promise=a,this.validationEnabled=!0}return u.prototype.configure=function(e){e&&(this.validationEnabled=e.validate,this.commentSeverity=e.allowComments?void 0:hu.Error)},u.prototype.doValidation=function(e,a,t,r){var n=this;if(!this.validationEnabled)return this.promise.resolve([]);var i=[],o={},s=function(d){var E=d.range.start.line+" "+d.range.start.character+" "+d.message;o[E]||(o[E]=!0,i.push(d))},l=function(d){var E=t?TR(t.trailingCommas):hu.Error,p=t?TR(t.comments):n.commentSeverity;if(d){if(d.errors.length&&a.root){var x=a.root,m=x.type==="object"?x.properties[0]:null;if(m&&m.keyNode.value==="$schema"){var g=m.valueNode||m,h=_u.create(e.positionAt(g.offset),e.positionAt(g.offset+g.length));s(hi.create(h,d.errors[0],hu.Warning,Pu.SchemaResolveError))}else{var h=_u.create(e.positionAt(x.offset),e.positionAt(x.offset+1));s(hi.create(h,d.errors[0],hu.Warning,Pu.SchemaResolveError))}}else{var f=a.validate(e,d.schema);f&&f.forEach(s)}WY(d.schema)&&(p=void 0),JY(d.schema)&&(E=void 0)}for(var k=0,y=a.syntaxErrors;k<y.length;k++){var v=y[k];if(v.code===Pu.TrailingComma){if(typeof E!="number")continue;v.severity=E}s(v)}if(typeof p=="number"){var b="Comments are not permitted in JSON.";a.comments.forEach(function(C){s(hi.create(C,b,p,Pu.CommentNotPermitted))})}return i};if(r){var c=r.id||"schemaservice://untitled/"+dku++;return this.jsonSchemaService.resolveSchemaContent(new g1(r),c,{}).then(function(d){return l(d)})}return this.jsonSchemaService.getSchemaForResource(e.uri,a).then(function(d){return l(d)})},u})(),dku=0;function WY(u){if(u&&typeof u=="object"){if(cn(u.allowComments))return u.allowComments;if(u.allOf)for(var e=0,a=u.allOf;e<a.length;e++){var t=a[e],r=WY(t);if(cn(r))return r}}}function JY(u){if(u&&typeof u=="object"){if(cn(u.allowTrailingCommas))return u.allowTrailingCommas;if(cn(u.allowsTrailingCommas))return u.allowsTrailingCommas;if(u.allOf)for(var e=0,a=u.allOf;e<a.length;e++){var t=a[e],r=JY(t);if(cn(r))return r}}}function TR(u){switch(u){case"error":return hu.Error;case"warning":return hu.Warning;case"ignore":return}}var $R=48,Eku=57,pku=65,Lh=97,mku=102;function Ta(u){return u<$R?0:u<=Eku?u-$R:(u<Lh&&(u+=Lh-pku),u>=Lh&&u<=mku?u-Lh+10:0)}function hku(u){if(u[0]!=="#")return null;switch(u.length){case 4:return{red:Ta(u.charCodeAt(1))*17/255,green:Ta(u.charCodeAt(2))*17/255,blue:Ta(u.charCodeAt(3))*17/255,alpha:1};case 5:return{red:Ta(u.charCodeAt(1))*17/255,green:Ta(u.charCodeAt(2))*17/255,blue:Ta(u.charCodeAt(3))*17/255,alpha:Ta(u.charCodeAt(4))*17/255};case 7:return{red:(Ta(u.charCodeAt(1))*16+Ta(u.charCodeAt(2)))/255,green:(Ta(u.charCodeAt(3))*16+Ta(u.charCodeAt(4)))/255,blue:(Ta(u.charCodeAt(5))*16+Ta(u.charCodeAt(6)))/255,alpha:1};case 9:return{red:(Ta(u.charCodeAt(1))*16+Ta(u.charCodeAt(2)))/255,green:(Ta(u.charCodeAt(3))*16+Ta(u.charCodeAt(4)))/255,blue:(Ta(u.charCodeAt(5))*16+Ta(u.charCodeAt(6)))/255,alpha:(Ta(u.charCodeAt(7))*16+Ta(u.charCodeAt(8)))/255}}return null}var xku=(function(){function u(e){this.schemaService=e}return u.prototype.findDocumentSymbols=function(e,a,t){var r=this;t===void 0&&(t={resultLimit:Number.MAX_VALUE});var n=a.root;if(!n)return null;var i=t.resultLimit,o=e.uri;if((o==="vscode://defaultsettings/keybindings.json"||EF(o.toLowerCase(),"/user/keybindings.json"))&&n.type==="array"){for(var s=[],l=0,c=n.items;l<c.length;l++){var d=c[l];if(d.type==="object")for(var E=0,p=d.properties;E<p.length;E++){var x=p[E];if(x.keyNode.value==="key"&&x.valueNode){var m=ic.create(e.uri,Zi(e,d));if(s.push({name:bo(x.valueNode),kind:Zr.Function,location:m}),i--,i<=0)return t&&t.onResultLimitExceeded&&t.onResultLimitExceeded(o),s}}}return s}var g=function(f,k,y){return i>=0&&(k.type==="array"?k.items.forEach(function(v){return g(f,v,y)}):k.type==="object"&&k.properties.forEach(function(v){if(i>=0){var b=v.valueNode;if(b){i--;var C=ic.create(e.uri,Zi(e,v)),B=y?y+"."+v.keyNode.value:v.keyNode.value;f.push({name:r.getKeyLabel(v),kind:r.getSymbolKind(b.type),location:C,containerName:y}),g(f,b,B)}}})),f},h=g([],n,void 0);return i<0&&(h.pop(),t&&t.onResultLimitExceeded&&t.onResultLimitExceeded(o)),h},u.prototype.findDocumentSymbols2=function(e,a,t){var r=this;t===void 0&&(t={resultLimit:Number.MAX_VALUE});var n=a.root;if(!n)return null;var i=t.resultLimit,o=e.uri;if((o==="vscode://defaultsettings/keybindings.json"||EF(o.toLowerCase(),"/user/keybindings.json"))&&n.type==="array"){for(var s=[],l=0,c=n.items;l<c.length;l++){var d=c[l];if(d.type==="object")for(var E=0,p=d.properties;E<p.length;E++){var x=p[E];if(x.keyNode.value==="key"&&x.valueNode){var m=Zi(e,d),g=Zi(e,x.keyNode);if(s.push({name:bo(x.valueNode),kind:Zr.Function,range:m,selectionRange:g}),i--,i<=0)return t&&t.onResultLimitExceeded&&t.onResultLimitExceeded(o),s}}}return s}var h=function(k,y){return i>=0&&(y.type==="array"?y.items.forEach(function(v,b){if(v&&i>=0){i--;var C=Zi(e,v),B=C,z=String(b),P=h([],v);k.push({name:z,kind:r.getSymbolKind(v.type),range:C,selectionRange:B,children:P})}}):y.type==="object"&&y.properties.forEach(function(v){var b=v.valueNode;if(b&&i>=0){i--;var C=Zi(e,v),B=Zi(e,v.keyNode),z=h([],b);k.push({name:r.getKeyLabel(v),kind:r.getSymbolKind(b.type),range:C,selectionRange:B,children:z})}})),k},f=h([],n);return i<0&&(f.pop(),t&&t.onResultLimitExceeded&&t.onResultLimitExceeded(o)),f},u.prototype.getSymbolKind=function(e){switch(e){case"object":return Zr.Module;case"string":return Zr.String;case"number":return Zr.Number;case"array":return Zr.Array;case"boolean":return Zr.Boolean;default:return Zr.Variable}},u.prototype.getKeyLabel=function(e){var a=e.keyNode.value;return a&&(a=a.replace(/[\n]/g,"↵")),a&&a.trim()?a:'"'+a+'"'},u.prototype.findDocumentColors=function(e,a,t){return this.schemaService.getSchemaForResource(e.uri,a).then(function(r){var n=[];if(r)for(var i=t&&typeof t.resultLimit=="number"?t.resultLimit:Number.MAX_VALUE,o=a.getMatchingSchemas(r.schema),s={},l=0,c=o;l<c.length;l++){var d=c[l];if(!d.inverted&&d.schema&&(d.schema.format==="color"||d.schema.format==="color-hex")&&d.node&&d.node.type==="string"){var E=String(d.node.offset);if(!s[E]){var p=hku(bo(d.node));if(p){var x=Zi(e,d.node);n.push({color:p,range:x})}if(s[E]=!0,i--,i<=0)return t&&t.onResultLimitExceeded&&t.onResultLimitExceeded(e.uri),n}}}return n})},u.prototype.getColorPresentations=function(e,a,t,r){var n=[],i=Math.round(t.red*255),o=Math.round(t.green*255),s=Math.round(t.blue*255);function l(d){var E=d.toString(16);return E.length!==2?"0"+E:E}var c;return t.alpha===1?c="#"+l(i)+l(o)+l(s):c="#"+l(i)+l(o)+l(s)+l(Math.round(t.alpha*255)),n.push({label:c,textEdit:Si.replace(r,JSON.stringify(c))}),n},u})();function Zi(u,e){return _u.create(u.positionAt(e.offset),u.positionAt(e.offset+e.length))}var Dku={schemaAssociations:{},schemas:{}};function fku(u,e){var a=[],t=[],r=[],n=-1,i=j1(u.getText(),!1),o=i.scan();function s(P){a.push(P),t.push(r.length)}for(;o!==17;){switch(o){case 1:case 3:{var l=u.positionAt(i.getTokenOffset()).line,c={startLine:l,endLine:l,kind:o===1?"object":"array"};r.push(c);break}case 2:case 4:{var d=o===2?"object":"array";if(r.length>0&&r[r.length-1].kind===d){var c=r.pop(),E=u.positionAt(i.getTokenOffset()).line;c&&E>c.startLine+1&&n!==c.startLine&&(c.endLine=E-1,s(c),n=c.startLine)}break}case 13:{var l=u.positionAt(i.getTokenOffset()).line,p=u.positionAt(i.getTokenOffset()+i.getTokenLength()).line;i.getTokenError()===1&&l+1<u.lineCount?i.setPosition(u.offsetAt(q0.create(l+1,0))):l<p&&(s({startLine:l,endLine:p,kind:bd.Comment}),n=l);break}case 12:{var x=u.getText().substr(i.getTokenOffset(),i.getTokenLength()),m=x.match(/^\/\/\s*#(region\b)|(endregion\b)/);if(m){var E=u.positionAt(i.getTokenOffset()).line;if(m[1]){var c={startLine:E,endLine:E,kind:bd.Region};r.push(c)}else{for(var g=r.length-1;g>=0&&r[g].kind!==bd.Region;)g--;if(g>=0){var c=r[g];r.length=g,E>c.startLine&&n!==c.startLine&&(c.endLine=E,s(c),n=c.startLine)}}}break}}o=i.scan()}var h=e&&e.rangeLimit;if(typeof h!="number"||a.length<=h)return a;e&&e.onRangeLimitExceeded&&e.onRangeLimitExceeded(u.uri);for(var f=[],k=0,y=t;k<y.length;k++){var v=y[k];v<30&&(f[v]=(f[v]||0)+1)}for(var b=0,C=0,g=0;g<f.length;g++){var B=f[g];if(B){if(B+b>h){C=g;break}b+=B}}for(var z=[],g=0;g<a.length;g++){var v=t[g];typeof v=="number"&&(v<C||v===C&&b++<h)&&z.push(a[g])}return z}function gku(u,e,a){function t(o){for(var s=u.offsetAt(o),l=a.getNodeFromOffset(s,!0),c=[];l;){switch(l.type){case"string":case"object":case"array":var d=l.offset+1,E=l.offset+l.length-1;d<E&&s>=d&&s<=E&&c.push(r(d,E)),c.push(r(l.offset,l.offset+l.length));break;case"number":case"boolean":case"null":case"property":c.push(r(l.offset,l.offset+l.length));break}if(l.type==="property"||l.parent&&l.parent.type==="array"){var p=i(l.offset+l.length,5);p!==-1&&c.push(r(l.offset,p))}l=l.parent}for(var x=void 0,m=c.length-1;m>=0;m--)x=jD.create(c[m],x);return x||(x=jD.create(_u.create(o,o))),x}function r(o,s){return _u.create(u.positionAt(o),u.positionAt(s))}var n=j1(u.getText(),!0);function i(o,s){n.setPosition(o);var l=n.scan();return l===s?n.getTokenOffset()+n.getTokenLength():-1}return e.map(t)}function UY(u){var e=u.promiseConstructor||Promise,a=new lku(u.schemaRequestService,u.workspaceContext,e);a.setSchemaContributions(Dku);var t=new Jvu(a,u.contributions,e,u.clientCapabilities),r=new Uvu(a,u.contributions,e),n=new xku(a),i=new cku(a,e);return{configure:function(o){a.clearExternalSchemas(),o.schemas&&o.schemas.forEach(function(s){a.registerExternalSchema(s.uri,s.fileMatch,s.schema)}),i.configure(o)},resetSchema:function(o){return a.onResourceChange(o)},doValidation:i.doValidation.bind(i),parseJSONDocument:function(o){return Vvu(o,{collectComments:!0})},newJSONDocument:function(o,s){return Kvu(o,s)},doComplete:t.doComplete.bind(t),findDocumentSymbols:n.findDocumentSymbols.bind(n),findDocumentSymbols2:n.findDocumentSymbols2.bind(n),findColorSymbols:function(o,s){return n.findDocumentColors(o,s).then(function(l){return l.map(function(c){return c.range})})},findDocumentColors:n.findDocumentColors.bind(n),getColorPresentations:n.getColorPresentations.bind(n),doHover:r.doHover.bind(r),getFoldingRanges:fku,getSelectionRanges:gku,format:function(o,s,l){var c=void 0;if(s){var d=o.offsetAt(s.start),E=o.offsetAt(s.end)-d;c={offset:d,length:E}}var p={tabSize:l?l.tabSize:4,insertSpaces:l?l.insertSpaces:!0,eol:`
524
- `};return Ovu(o.getText(),c,p).map(function(x){return Si.replace(_u.create(o.positionAt(x.offset),o.positionAt(x.offset+x.length)),x.content)})}}}function sl(){const{tabsState:u}=Su(),e=H.useCallback(({type:r,collectionId:n,workflowId:i,stepId:o,historyId:s})=>u.tabs.findIndex(l=>{const c=l.data.get();return Ka(c,r)?(!n||c.collectionId===n)&&(!i||c.workflowId===i)&&(!o||c.stepId===o)&&(!s||c.historyId===s):!1}),[u]),a=H.useCallback(({type:r,collectionId:n,workflowId:i,stepId:o,historyId:s})=>{const l=e({type:r,collectionId:n,workflowId:i,stepId:o,historyId:s});return l!==-1?u.tabs[l]:void 0},[e,u]),t=H.useCallback((r,n)=>{if(!(!r.collectionId||!n.collectionId||r.collectionId!==n.collectionId)&&!(!r.workflowId||!n.workflowId)){if(r.workflowId!==n.workflowId){u.tabs.forEach(i=>{const o=i.data.get();o.collectionId===r.collectionId&&((Ka(o,We.Workflow)||Ka(o,We.WorkflowRun))&&o.workflowId===r.workflowId&&i.data.workflowId.set(n.workflowId),Ka(o,We.Step)&&i.data.workflowId.set(n.workflowId))});return}if(!(!r.stepId||!n.stepId)&&r.stepId!==n.stepId){u.tabs.forEach(i=>{const o=i.data.get();o.collectionId===r.collectionId&&Ka(o,We.Step)&&o.workflowId===r.workflowId&&o.stepId===r.stepId&&i.data.stepId.set(n.stepId)});return}}},[u]);return{tabs:u.tabs,activeTabIdx:u.activeTabIdx,getExistingTabIndex:e,getExistingTab:a,handleIdChange:t}}function Ka(u,e){return u.type===e}const kg=UY({});let RR=null;function ZY(u){RR!==u&&(RR=u,kg.configure({validate:!0,schemas:[{uri:"stub://test",fileMatch:["*"],schema:u}]}))}function QY(u){const e=MD.create("stub.json","json",0,u),a=kg.parseJSONDocument(e);return{textDoc:e,jsonDoc:a}}const YY=Qa.define({create(){},update(u){return u}}),XY=u=>u.field(YY,!1),vku=({store:u,isResponse:e,apiOperation:a})=>{const r=L9(u).data.get();let n=a?.body?.mediaTypes?.[Mt.JSON]?.schema;if(Ka(r,We.Step)&&e){const i=r.response?.status;i&&(n=a?.responses?.[i]?.mediaTypes?.[Mt.JSON]?.schema)}return[YY.init(()=>({schema:Ei(n||{}),store:u}))]};function kku(){return async u=>{const{schema:e}=XY(u.state)||{};if(!e)return[];ZY(e);const a=u.state.doc,{textDoc:t,jsonDoc:r}=QY(a.toString());return(await kg.doValidation(t,r))?.map(i=>({from:hF(a,i.range.start),to:hF(a,i.range.end),message:i.message,severity:Cku[i.severity||3]}))}}const bku=Cn.highest(Ac.of([{key:"Tab",run:u=>DQ(u)}]));function yku(){return async function(e){const a={from:e.pos,to:e.pos,options:[],filter:!1},{schema:t}=XY(e.state)||{};if(!t)return a;ZY(t);const r=e.state.doc,n=hF.bind(null,r),{textDoc:i,jsonDoc:o}=QY(r.toString()),s=e.state.doc.lineAt(e.pos),l=s.number-1,c=e.pos-s.from,d=await kg.doComplete(i,{line:l,character:c},o);if(!d)return a;const E=e.state.sliceDoc(s.from,e.pos);if(E.trim().endsWith(",")||Fku(E))return a;a.options=d.items.map(m=>({label:m.label,info:m.documentation,apply:g=>{if(!m.textEdit||!("range"in m.textEdit))return;const h=m.textEdit.range,f=m.textEdit.newText.search(/(\$1|\${1:.*?})/);let k=m.textEdit.newText.replace(/(\$1|\${1:.*?})/,"");const y=f===-1?0:f-k.length;g.dispatch({changes:{from:n(h.start),to:n(h.end),insert:k}});const v=k.length-(h.end.character-h.start.character);g.dispatch({selection:Se.single(n(h.end)+v+y)})}}))||[];const p=e.state.wordAt(e.pos),x=p?.from?e.state.sliceDoc(p?.from,p?.to).toLowerCase():"";return x&&(a.options=a.options.filter(m=>m.label.toLowerCase().replace(/^"/,"").startsWith(x))),a}}const Cku={1:"error",2:"warning",3:"info",4:"hint"};function hF(u,e){return u.line(e.line+1).from+e.character}function Fku(u){try{return JSON.parse(`{${u}}`),!0}catch{return!1}}const eX=iu.define();function Pc(u){const e=u.activeEnvironmentId.get();return u.environments.find(a=>a.name.get()===e)?.get()||u.environments[0].get()}const xF=u=>ya.fromClass(class{decorations;constructor(e){this.decorations=this.buildDecorations(e,u)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=this.buildDecorations(e.view,u))}buildDecorations(e,a){const r=Pc(a.store)?.inputs,n=[],i=Ve.mark({attributes:{style:"background-color: var(--bg-color-active);"}}),o=s=>Ve.mark({attributes:{style:`color: var(--replay-${s?"undefined":"defined"}-variable-color); background-color: var(--replay-${s?"undefined":"defined"}-variable-bg-color);`}});for(const{from:s,to:l}of e.visibleRanges){const c=e.state.doc.sliceString(s,l),d=Uf(c);for(const E of d){const p=s+E.start,x=s+E.end;if(!(p>=x))if(E.prefix==="inputs"){const m=tA(E.match),h=!r?.find(f=>f.name===m)?.value;n.push({from:p,to:x,value:o(h)})}else n.push({from:p,to:x,value:i})}}return Ve.set(n,!0)}},{decorations:e=>e.decorations}),Aku=UY({});function Bku(u){if(!u||typeof u!="object")return!1;const e=u;return typeof e.type=="string"&&typeof e.offset=="number"&&typeof e.length=="number"}function Sku(u){const e=[];if(!u)return e;const a=[u];for(;a.length>0;){const t=a.pop();if(t.type==="property"){t.valueNode&&a.push(t.valueNode);continue}if(t.type==="string"){const r=t.offset,n=t.offset+t.length;n>r&&e.push({from:r,to:n})}if(t.children&&t.children.length)for(const r of t.children)a.push(r)}return e}const zku=u=>ya.fromClass(class{decorations;constructor(e){this.decorations=this.buildDecorations(e,u)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=this.buildDecorations(e.view,u))}buildDecorations(e,a){const t=e.state.doc.toString();let r;try{const d=MD.create("inmemory://model.json","json",0,t),p=Aku.parseJSONDocument(d)?.root;r=Bku(p)?p:void 0}catch{r=void 0}const i=Pc(a.store)?.inputs,o=Ve.mark({attributes:{style:"background-color: var(--bg-color-active);"}}),s=d=>Ve.mark({attributes:{style:`color: var(--replay-${d?"undefined":"defined"}-variable-color); background-color: var(--replay-${d?"undefined":"defined"}-variable-bg-color);`}}),l=[];if(!r)return Ve.set([],!0);const c=Sku(r);for(const d of c){if(!e.visibleRanges.some(h=>Math.max(h.from,d.from)<Math.min(h.to,d.to))||!(t[d.from]==='"'&&t[d.to-1]==='"'))continue;const p=d.from+1,x=d.to-1;if(x<=p)continue;const m=e.state.doc.sliceString(p,x),g=Uf(m);for(const h of g){const f=p+h.start,k=p+h.end;if(!(f>=k))if(h.prefix==="inputs"){const y=tA(h.match),b=!i?.find(C=>C.name===y)?.value;l.push({from:f,to:k,value:s(b)})}else l.push({from:f,to:k,value:o})}}return Ve.set(l,!0)}},{decorations:e=>e.decorations}),fn={[Mt.Text]:{name:"Text",extensions:[Me.lineWrapping],stateExtensions:[xF]},[Mt.JSON]:{name:"JSON",extensions:[jxu(),lgu(kku(),{delay:0,needsRefresh:u=>u.transactions.some(e=>e.effects.some(a=>a.is(eX)))}),UZ.data.of({autocomplete:yku()}),bku],stateExtensions:[vku,zku]},[Mt.XML]:{name:"XML",extensions:[Qfu()],stateExtensions:[xF]}},wku={[Mt.Image]:{name:"Image",extensions:[],stateExtensions:[]}},Oku={[Mt.HTML]:{name:"HTML",extensions:[Bfu()],stateExtensions:[xF]}},po={...fn,...wku,...Oku},uX={[Mt.FormData]:{name:"form-data",extensions:void 0},[Mt["application/x-www-form-urlencoded"]]:{name:"x-www-form-urlencoded",extensions:void 0}},aX={[Mt.Binary]:{name:"Binary",extensions:void 0}},Ws={...fn,...uX,...aX},Pku=Object.keys(fn),o9=Object.keys(uX),tX=Object.keys(aX);function rX(u=[],e){const a={};return u.forEach(t=>{const r=String(t[e]);a[r]||(a[r]=[]),a[r].push(t)}),a}const WE={active:!0,key:"",value:""};function mo(u,e){return[...u.map(t=>({id:crypto.randomUUID(),key:t.name,value:e.initializeWithInputs?`$inputs.${t.name}`:t.example?String(t.example):"",active:e.initializeWithInputs?!0:!!t.example,in:t.in})),Ba(e.in)]}function JE(u,e){const[a]=u.split("?"),t=e.slice(0,-1).filter(r=>r.active).map(r=>`${r.key}=${r.value}`).join("&");return`${a}${t?`?${t}`:""}`}function Y0(){return{id:crypto.randomUUID(),...WE}}function d0(){return{id:crypto.randomUUID(),...WE,description:""}}function Ba(u){return{...WE,id:crypto.randomUUID(),in:u}}function Ms(){return{id:crypto.randomUUID(),...WE,type:"text",files:null}}function s9(){return{id:crypto.randomUUID(),...WE,sendIn:jt.URL}}function Xk(u){return u.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function bg(u,e){return u.filter(a=>a.active&&a.value).map(({value:a})=>(e?Yu(a,e):a).trim())}function yo(u,e){const t=e.filter(r=>!!r).flatMap(r=>r).filter(r=>r.key&&r.active);return["path","header"].includes(u)?Array.from(new Map(t.map(r=>[r.key,r])).values()):t}function nX(u,e){return u.map(({value:a,...t})=>({...t,value:Yu(a,e)}))}function jku(u,e){if(!u.startsWith("$components.parameters."))return null;const a=u.replace("$components.parameters.","");return a&&e[a]||null}function Sa(u=[],e={}){const a=[];for(const t of u)if(xo(t)){const r=jku(t.reference,e);r&&a.push({...r,active:t.active,value:t.value||r.value})}else a.push(t);return a}function no(u){return Object.entries(u).map(([e,a])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:a}))}function Mku(u){return u.replace(/{/g,"{{").replace(/}/g,"}}")}const NR={documentedOAuth2Types:[],grantType:Fe.ClientCredentials,authRequestExtraParams:[Y0()],tokenRequestExtraParams:[s9()],[Fe.ClientCredentials]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[d0()],accessToken:""},[Fe.ClientCredentialsWithJwtAssertion]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[d0()],accessToken:""},[Fe.AuthorizationCode]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[d0()],codeVerifier:"",codeChallenge:"",accessToken:""},[Fe.AuthorizationCodeWithPkce]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[d0()],codeVerifier:"",codeChallenge:"",accessToken:""},[Fe.Implicit]:{clientId:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[d0()],accessToken:""},[Fe.Password]:{username:"",password:"",clientId:"",clientSecret:"",tokenUrl:"",accessToken:"",scopes:[d0()]}},Tku={securityType:ye.NoAuth,securitySchemeId:null,[ye.BasicAuth]:{username:"",password:""},[ye.JWT]:{token:""},[ye.DigestAuth]:{username:"",password:"",nc:"00000001",realm:"",nonce:"",opaque:"",qop:"",algorithm:"",cnonce:""},[ye.APIKey]:{location:P0.Header,name:"",key:""},[ye.OAuth2]:NR,[ye.OpenIDConnect]:{...NR,openIdConnectUrl:"",userInfoUrl:""}},DF="urn:ietf:params:oauth:client-assertion-type:jwt-bearer",$ku={[wt.SIMPLE]:{condition:"",type:wt.SIMPLE},[wt.REGEX]:{condition:"",type:wt.REGEX,context:""},[wt.JSONPATH]:{condition:"",type:wt.JSONPATH,context:""},[wt.XPATH]:{condition:"",type:wt.XPATH,context:""}};function TD(){return structuredClone({type:ut.Text,content:"",activeExampleName:"",formData:{"multipart/form-data":[Ms()],"application/x-www-form-urlencoded":[Ms()]},binary:null})}const Rku={method:"GET",url:"",security:[Sn()],body:TD(),queryParameters:[Y0()],headers:[Y0()],cookies:[Y0()],pathParameters:[Y0()]};function iX(){return structuredClone(Rku)}function Sn(){return Ei(Tku)}function Nku(u){return Ei({id:crypto.randomUUID(),...$ku[u]})}function oX(u,e,a){for(const t of a){const r=_R(u,t),n=_R(e,t);if(typeof r=="object"&&typeof n=="object"){if(!oX(r,n,a))return!1}else if(r!==n)return!1}return!0}function _R(u,e){const a=e.split("/");let t=u;for(const r of a)if(t&&typeof t=="object"&&r in t)t=t[r];else return;return t}function _ku(u,e){return u.length===e.length&&u.sort().join()===e.sort().join()}function Lku(u,e){return u.every(a=>e.includes(a))}function Iku(u){switch(u){case"query":return P0.Query;case"cookie":return P0.Cookie;case"header":return P0.Header;default:return}}function Kku(u,e,a){const{security:t}=e,r=T1u(u);if(!a)return!1;const n=l9(a),i=n.map(c=>c.securityType),o=t.map(c=>c.securityType);if(!_ku(i,o))return!0;let l=[];return t.forEach(c=>{const d=c.securityType,E=c[ye.OAuth2]?.grantType,p=i.includes(d),x=n.find(f=>f.securityType===d),m=!x||oX(c,x,Gku(d,E)),g=Vku(c,d,c[ye.OAuth2]?.grantType,r),h=!!(p&&x&&m&&g);l.push(!a.security?.length||h)}),l.includes(!1)}function Vku(u,e,a,t){if(e===ye.OAuth2&&(a===Fe.AuthorizationCode||a===Fe.AuthorizationCodeWithPkce||a===Fe.Implicit)){const r=u[ye.OAuth2][a]?.availableScopes,n=bg(u[ye.OAuth2][a]?.scopes,t);return Lku(n,r)}return!0}function Gku(u,e){return u===ye.APIKey?[`${ye.APIKey}/name`,`${ye.APIKey}/location`]:u===ye.OAuth2?[`${ye.OAuth2}/grantType`,...Hku(e)]:u===ye.OpenIDConnect?[`${ye.OpenIDConnect}/openIdConnectUrl`]:[]}function Hku(u){return u===Fe.ClientCredentials?[`${ye.OAuth2}/${Fe.ClientCredentials}/tokenUrl`]:u===Fe.Password?[`${ye.OAuth2}/${Fe.Password}/tokenUrl`]:u===Fe.Implicit?[`${ye.OAuth2}/${Fe.Implicit}/authorizationUrl`]:u===Fe.AuthorizationCode?[`${ye.OAuth2}/${Fe.AuthorizationCode}/tokenUrl`,`${ye.OAuth2}/${Fe.AuthorizationCode}/authorizationUrl`]:u===Fe.AuthorizationCodeWithPkce?[`${ye.OAuth2}/${Fe.AuthorizationCodeWithPkce}/tokenUrl`,`${ye.OAuth2}/${Fe.AuthorizationCodeWithPkce}/authorizationUrl`]:[]}function qku(u){return u.map(e=>{const a=e.map(t=>t.id).join("_");return e.map(t=>({...t,schemeId:a}))})}function Wku(u){const e=u.security||[],a=e.map(t=>{let r="";const n=[];return t.forEach((i,o)=>{r=o===0?`${i.id}`:`${r}_${i.id}`,n.push(c9(i))}),{id:r,security:n}});return e.length?a:[]}function Jku(u,e){const a=u.security||[];return a?.length?cX(a).map((t,r)=>c9(t)):[]}function l9(u){const a=(u.security||[])[0];return a?a.map(t=>c9(t)):[Sn()]}function c9(u,e){const a={...Sn(),securitySchemeId:u.id},t=yg(u);a.securityType=t;const r=u.id;if(u.id&&t!==ye.NoAuth&&(a[t].schemeName=u.id),t===ye.BasicAuth&&(a[ye.BasicAuth].username||(a[ye.BasicAuth].username=va(r+W.SecurityVariablesEnvSuffix.Username)),a[ye.BasicAuth].password||(a[ye.BasicAuth].password=va(r+W.SecurityVariablesEnvSuffix.Password))),t===ye.DigestAuth&&(a[ye.DigestAuth].username||(a[ye.DigestAuth].username=va(r+W.SecurityVariablesEnvSuffix.Username)),a[ye.DigestAuth].password||(a[ye.DigestAuth].password=va(r+W.SecurityVariablesEnvSuffix.Password))),t===ye.JWT&&!a[ye.JWT].token&&(a[ye.JWT].token=va(r+W.SecurityVariablesEnvSuffix.JWTToken)),t===ye.APIKey&&!a[ye.APIKey].key){a[ye.APIKey].name=u.name||"",a[ye.APIKey].key=va(r+W.SecurityVariablesEnvSuffix.APIKey);const n=Iku(u.in);n&&(a[ye.APIKey].location=n)}if(t===ye.OAuth2){const n=E9(u),i=va(r+W.SecurityVariablesEnvSuffix.Token),o=a[ye.OAuth2];o.grantType=n[0],n.forEach(s=>{s===Fe.AuthorizationCode&&!o[Fe.AuthorizationCode].accessToken&&(o[Fe.AuthorizationCode].accessToken=i,o[Fe.AuthorizationCode].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId),o[Fe.AuthorizationCode].authorizationUrl=u.flows?.authorizationCode?.authorizationUrl||"",o[Fe.AuthorizationCode].tokenUrl=u.flows?.authorizationCode?.tokenUrl||"",o[Fe.AuthorizationCode].clientSecret=va(r+W.SecurityVariablesEnvSuffix.ClientSecret),o[Fe.AuthorizationCode].availableScopes=Object.keys(u.flows?.authorizationCode?.scopes||{})||[],o[Fe.AuthorizationCode].scopes=[...no(u.flows?.authorizationCode?.scopes||{})||[],d0()]),s===Fe.AuthorizationCodeWithPkce&&!o[Fe.AuthorizationCodeWithPkce].accessToken&&(o[Fe.AuthorizationCodeWithPkce].accessToken=i,o[Fe.AuthorizationCodeWithPkce].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId),o[Fe.AuthorizationCodeWithPkce].authorizationUrl=u.flows?.authorizationCode?.authorizationUrl||"",o[Fe.AuthorizationCodeWithPkce].tokenUrl=u.flows?.authorizationCode?.tokenUrl||"",o[Fe.AuthorizationCodeWithPkce].clientSecret=va(r+W.SecurityVariablesEnvSuffix.ClientSecret),o[Fe.AuthorizationCodeWithPkce].availableScopes=Object.keys(u.flows?.authorizationCode?.scopes||{})||[],o[Fe.AuthorizationCodeWithPkce].scopes=[...no(u.flows?.authorizationCode?.scopes||{}),d0()]),s===Fe.ClientCredentials&&!o[Fe.ClientCredentials].accessToken&&(o[Fe.ClientCredentials].accessToken=i,o[Fe.ClientCredentials].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId),o[Fe.ClientCredentials].clientSecret=va(r+W.SecurityVariablesEnvSuffix.ClientSecret),o[Fe.ClientCredentials].tokenUrl=u.flows?.clientCredentials?.tokenUrl||"",o[Fe.ClientCredentials].scopes=[...no(u.flows?.clientCredentials?.scopes||{}),d0()]),s===Fe.ClientCredentialsWithJwtAssertion&&!o[Fe.ClientCredentialsWithJwtAssertion].accessToken&&(o[Fe.ClientCredentialsWithJwtAssertion].accessToken=i,o[Fe.ClientCredentialsWithJwtAssertion].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId),o[Fe.ClientCredentialsWithJwtAssertion].clientAssertion=va(r+W.SecurityVariablesEnvSuffix.ClientAssertion),o[Fe.ClientCredentialsWithJwtAssertion].scopes=[...no(u.flows?.clientCredentials?.scopes||{}),d0()]),s===Fe.Implicit&&!o[Fe.Implicit].accessToken&&(o[Fe.Implicit].accessToken=i,o[Fe.Implicit].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId),o[Fe.Implicit].authorizationUrl=u.flows?.implicit?.authorizationUrl||"",o[Fe.Implicit].availableScopes=Object.keys(u.flows?.implicit?.scopes||{})||[],o[Fe.Implicit].scopes=[...no(u.flows?.implicit?.scopes||{}),d0()]),s===Fe.Password&&!o[Fe.Password].accessToken&&(o[Fe.Password].accessToken=i,o[Fe.Password].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId),o[Fe.Password].clientSecret=va(r+W.SecurityVariablesEnvSuffix.ClientSecret),o[Fe.Password].tokenUrl=u.flows?.password?.tokenUrl||"",o[Fe.Password].scopes=[...no(u.flows?.password?.scopes||{}),d0()])})}if(t===ye.OpenIDConnect){const n=va(r+W.SecurityVariablesEnvSuffix.Token),i=a[ye.OpenIDConnect];i[Fe.AuthorizationCode].accessToken||(i[Fe.AuthorizationCode].accessToken=n,i[Fe.AuthorizationCode].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId),i[Fe.AuthorizationCode].clientSecret=va(r+W.SecurityVariablesEnvSuffix.ClientSecret),i[Fe.AuthorizationCode].tokenUrl=u.flows?.authorizationCode?.tokenUrl||""),i[Fe.AuthorizationCodeWithPkce].accessToken||(i[Fe.AuthorizationCodeWithPkce].accessToken=n,i[Fe.AuthorizationCodeWithPkce].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId),i[Fe.AuthorizationCodeWithPkce].clientSecret=va(r+W.SecurityVariablesEnvSuffix.ClientSecret),i[Fe.AuthorizationCodeWithPkce].tokenUrl=u.flows?.authorizationCode?.tokenUrl||""),i[Fe.Implicit].accessToken||(i[Fe.Implicit].accessToken=n,i[Fe.Implicit].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId))}return a}function Uku(u,e="",a){const t=rX(u.parameters,"in"),r=sX(u),n=l9(u),i=mo(t.query||[],{in:"query"});return{id:crypto.randomUUID(),name:u.name,operationId:u.operationId,collectionPath:a,apiPath:{path:u.path,method:u.method},apiId:e,request:{pathParameters:mo(t.path||[],{in:"path"}),method:u.method.toLocaleUpperCase(),url:JE(Mku(u.path),i),headers:mo(t.header||[],{in:"header"}),queryParameters:i,cookies:mo(t.cookie||[],{in:"cookie"}),body:r,security:n},response:null}}function d9(u){const e=rX(u.parameters,"in"),a=sX(u),t=l9(u);return{parameters:{queryParameters:mo(e.query||[],{in:"query"}),headers:mo(e.header||[],{in:"header"}),cookies:mo(e.cookie||[],{in:"cookie"}),pathParameters:mo(e.path||[],{initializeWithInputs:!0,in:"path"})},requestBody:a,security:t}}function sX(u){const e=u.body?.mediaTypes;if(!e||!Object.keys(e).length)return TD();const a=Zku(e,u),t=a?.name||"",r=!o9.includes(t)&&!tX.includes(t),n=fF(a),i=r&&n.length?JSON.stringify(n.find(({key:o})=>o===u.body?.activeExampleName)?.value,null,2)||JSON.stringify(n[0].value,null,2):"";return{...TD(),activeExampleName:u.body?.activeExampleName||n[0]?.key||"",...a&&{type:a.name},content:i,formData:{"multipart/form-data":LR(e[Mt.FormData]),"application/x-www-form-urlencoded":LR(e[Mt["application/x-www-form-urlencoded"]])}}}function lX(u){return u?{...(Object.keys(u?.body?.mediaTypes||{})||[]).reduce((a,t)=>(a[t]={name:t,extensions:void 0},a),{}),...Ws}:Ws}function LR(u){if(!u)return[Ms()];if(!u.parameters)return[Ms()];const e=u.parameters.map(a=>({id:crypto.randomUUID(),key:a.name,value:String(a.example)||"",active:!0,type:a.inputType,files:null}));return e.push(Ms()),e}function fF(u){const e=u?.examples;return Object.keys(e||{}).map(a=>{const t=e?.[a];return{name:W.isString(t?.summary)?t?.summary:t?.summary?.raw||a,key:a,value:e?.[a].value}})}function Zku(u,e){const a=lX(e),t=Object.keys(u).find(r=>!!a[r]);return t?u[t]:null}function Qku(u){return!u?.security?.length||!u?[]:Jku(u)}function cX(u){const e=new Set;return u.flat().filter(a=>e.has(a.id)?!1:(e.add(a.id),!0))}function yg(u){if(u.type==="http"){if(u.scheme==="bearer")return ye.JWT;if(u.scheme==="basic")return ye.BasicAuth;if(u.scheme==="digest")return ye.DigestAuth}else{if(u.type==="apiKey")return ye.APIKey;if(u.type==="oauth2")return ye.OAuth2;if(u.type==="openIdConnect")return ye.OpenIDConnect}return ye.NoAuth}function Yku(u,e){if(u==="clientCredentials"&&e&&"x-assertionType"in e&&e["x-assertionType"]===DF)return Fe.ClientCredentialsWithJwtAssertion;if(u==="authorizationCode"&&e&&"x-usePkce"in e&&e["x-usePkce"])return Fe.AuthorizationCodeWithPkce;switch(u){case"implicit":return Fe.Implicit;case"password":return Fe.Password;case"clientCredentials":return Fe.ClientCredentials;case"authorizationCode":return Fe.AuthorizationCode;default:return Fe.AuthorizationCode}}function Xku(u,e){const a=u?.security;if(!a?.length)return[];const n=qku(a).flat().filter(i=>i.schemeId===e).find(i=>yg(i)===ye.OAuth2);return E9(n)}function E9(u){return Object.entries(u?.flows||{}).map(([e,a])=>Yku(e,a)).filter(Boolean)}async function UE(u){try{const e=await o3u(u),a=await JJ(u);return{absolutePath:u,file:new File([e],a)}}catch(e){return console.error("Failed to init replay file",e),null}}async function dX(u){return(await Promise.allSettled(u.map(a=>UE(a)))).map(a=>a.status==="fulfilled"?a.value:null).filter(a=>a!==null)}async function ebu(u,e,a,t,r,n){const i=await Promise.all(u.sourceDescriptions.map(async s=>({name:s.name,url:s.url,type:s.type,apiId:await ubu({projectPath:t,apiUrl:s.url,collectionId:e})}))),o={inputs:u.components?.inputs||{},parameters:Object.fromEntries(Object.entries(u.components?.parameters||{}).map(([s,l])=>[s,{...l,key:l.name,value:l.value,id:crypto.randomUUID(),active:!0}]))};return{...u,id:e,srcType:a,state:Nu.Normal,sourceDescriptions:i,components:o,workflows:await Promise.all(u.workflows.map(async s=>({...s,state:Nu.Normal,parameters:UR(s.parameters,s["x-replay-disabled-parameters"],u.components?.parameters),outputs:WR(s.outputs),security:GR(s["x-security"]),steps:await Promise.all(s.steps.map(async l=>{const c=UR(l.parameters,l["x-replay-disabled-parameters"],u.components?.parameters),d=l["x-operation"]??null;d&&(d.url=JE(d.url,c.queryParameters.filter(LI)));const E=abu(l,i,r);let p;if(E&&n){const m=r?.find(g=>g.id===E.apiId);p=n(E.path,E.method,m)}delete l.operationId,delete l["x-operation"];const x=await sbu(l.requestBody,t);return{...l,state:Nu.Normal,parameters:c,outputs:WR(l.outputs),successCriteria:l.successCriteria?.map(m=>({...m,type:m.type??wt.SIMPLE}))||[],requestBody:x,xOperation:d,security:GR(l["x-security"],p),operation:E}}))})))}}async function ubu({projectPath:u,apiUrl:e,collectionId:a}){if(qJ(e))return e;if(await za.isAbsolute(e))return await za.relative(u,e);const t=await za.resolve(await za.join(u,a,"..",e));return await za.relative(u,t)}function abu(u,e,a){if(u["x-operation"])return null;const{path:t,method:r,apiId:n}=EX({operationPath:u.operationPath,parsedSourceDescriptions:e}),{operationId:i,apiId:o}=tbu({operationId:u.operationId,parsedSourceDescriptions:e}),s=o||n||e[0]?.apiId||"",l=a?.find(c=>c.id===s);if(i&&l&&!t&&!r){const c=cbu(i,l);return{apiId:s,path:c?.path??"",method:c?.method??"",operationId:i}}return{apiId:s,path:t??"",method:r??"",operationId:i}}function tbu({operationId:u,parsedSourceDescriptions:e}){if(!u)return{operationId:"",apiId:null};const a=u.split(".");if(a.length===1)return{operationId:u,apiId:e[0]?.apiId??""};const[,t,r=""]=a,n=e.find(({name:i})=>i===t);return{operationId:r,apiId:n?.apiId??""}}function IR(u){return"reference"in u&&typeof u.reference=="string"}function EX({operationPath:u,parsedSourceDescriptions:e}){if(!u)return{apiId:null,path:"",method:""};try{const a=u.split("#"),t=a.length>1?a[1]:a[0],r=a.length>1?a[0]:"";if(!t)return{path:"",method:"",apiId:null};let n=null,i=null;const o=/\$sourceDescriptions\.(.+)\.url/,s=r.match(o);if(s&&(n=s[1]),n){const E=e.find(({name:p})=>p===n);E&&(i=E.apiId)}const l=t.split("/"),c=l.pop()||"";return{path:Vf.unescape(l.pop()||""),method:c.toLowerCase(),apiId:i}}catch{return{path:"",method:"",apiId:null}}}function rbu(u){switch(u.type){case"apiKey":return ye.APIKey;case"oauth2":return ye.OAuth2;case"openIdConnect":return ye.OpenIDConnect;case"http":return u.scheme==="basic"?ye.BasicAuth:u.scheme==="digest"?ye.DigestAuth:u.scheme==="bearer"?ye.JWT:ye.NoAuth;default:return ye.NoAuth}}function pX(u,e){const a={clientCredentials:Fe.ClientCredentials,authorizationCode:Fe.AuthorizationCode,implicit:Fe.Implicit,password:Fe.Password,clientCredentialsWithJwtAssertion:Fe.ClientCredentialsWithJwtAssertion,authorizationCodeWithPkce:Fe.AuthorizationCodeWithPkce};return u==="clientCredentials"&&e["x-assertionType"]==="urn:ietf:params:oauth:client-assertion-type:jwt-bearer"?Fe.ClientCredentialsWithJwtAssertion:u==="authorizationCode"&&e["x-usePkce"]?Fe.AuthorizationCodeWithPkce:a[u]??null}function nbu(u){return{query:P0.Query,header:P0.Header,cookie:P0.Cookie}[u.toLowerCase()]||P0.Header}function ibu(u){return{body:jt.Body,header:jt.Header,url:jt.URL}[u.toLowerCase()]||jt.URL}function KR(u,e,a){return Object.keys(u).reduce((t,r)=>{const n=pX(r,u[r]);if(!n)return t;switch(n){case Fe.ClientCredentials:t[n]={...a[n],clientId:e.clientId??"",clientSecret:e.clientSecret??"",clientAssertion:e.clientAssertion??"",tokenUrl:u[r].tokenUrl??"",scopes:ps(u[r].scopes,u[r]["x-replay-disabled-scopes"]),accessToken:e.accessToken??""};break;case Fe.AuthorizationCode:t[n]={...a[n],clientId:e.clientId??"",clientSecret:e.clientSecret??"",tokenUrl:u[r].tokenUrl??"",authorizationUrl:u[r].authorizationUrl??"",callbackUrl:e.callbackUrl??"",availableScopes:u[r].availableScopes??[],scopes:ps(u[r].scopes,u[r]["x-replay-disabled-scopes"]),accessToken:e.accessToken??""};break;case Fe.Implicit:t[n]={...a[n],clientId:e.clientId??"",authorizationUrl:u[r].authorizationUrl??"",callbackUrl:e.callbackUrl??"",availableScopes:ps(u[r].availableScopes),scopes:ps(u[r].scopes,u[r]["x-replay-disabled-scopes"]),accessToken:e.accessToken??""};break;case Fe.Password:t[n]={...a[n],tokenUrl:u[r].tokenUrl??"",username:e.username??"",password:e.password??"",clientId:e.clientId??"",clientSecret:e.clientSecret??"",accessToken:e.accessToken??""};break;case Fe.ClientCredentialsWithJwtAssertion:t[n]={...a[n],clientAssertion:e.clientAssertion??"",tokenUrl:u[r].tokenUrl??"",scopes:ps(u[r].scopes,u[r]["x-replay-disabled-scopes"]),clientId:e.clientId??"",clientSecret:e.clientSecret??"",accessToken:e.accessToken??""};break;case Fe.AuthorizationCodeWithPkce:t[n]={...a[n],tokenUrl:u[r].tokenUrl??"",authorizationUrl:u[r].authorizationUrl??"",callbackUrl:e.callbackUrl??"",availableScopes:ps(u[r].availableScopes),scopes:ps(u[r].scopes,u[r]["x-replay-disabled-scopes"]),codeVerifier:e.codeVerifier??"",codeChallenge:e.codeChallenge??"",clientId:e.clientId??"",clientSecret:e.clientSecret??"",accessToken:e.accessToken??""};break}return t},a)}function VR(u,e,a){const r={...Sn(),securityType:u},n=Object.keys(e.flows||{})[0],i=pX(n,e.flows?.[n])??Fe.ClientCredentials;switch(u){case ye.BasicAuth:return{...r,[ye.BasicAuth]:{username:a.username,password:a.password,schemeName:e.id}};case ye.JWT:return{...r,[ye.JWT]:{token:a.token,schemeName:e.id}};case ye.DigestAuth:return{...r,[ye.DigestAuth]:{...r[ye.DigestAuth],username:a.username,password:a.password,schemeName:e.id}};case ye.APIKey:return{...r,[ye.APIKey]:{location:nbu(e.in),name:e.name,key:a.apiKey,schemeName:e.id}};case ye.OAuth2:return{...r,[ye.OAuth2]:{...r[ye.OAuth2],...KR(e.flows||{},a||{},r[ye.OAuth2]),authRequestExtraParams:HR(a.authRequestExtraParams),tokenRequestExtraParams:qR(a.tokenRequestExtraParams),grantType:i,schemeName:e.id}};case ye.OpenIDConnect:return{...r,[ye.OpenIDConnect]:{...r[ye.OpenIDConnect],...KR(a.flows||{},a||{},r[ye.OpenIDConnect]),openIdConnectUrl:a.openIdConnectUrl,userInfoUrl:a.userInfoUrl,authRequestExtraParams:HR(a.authRequestExtraParams),tokenRequestExtraParams:qR(a.tokenRequestExtraParams),grantType:i,schemeName:e.id}};default:return r}}function obu(u,e){return[...u.map(t=>{if("scheme"in t){const n=rbu(t.scheme);return VR(n,t.scheme,t.values)}const r=e.find(n=>n.id===t.schemeName);if(r){const n=yg(r),i=VR(n,r,t.values);return i.securitySchemeId=r.id,i}return Sn()})]}function GR(u=[],e){const a=cX(e?.security||[]);return u.length?obu(u,a):[Sn()]}function ps(u,e){const a=no(u||{}),t=no(e||{});return[...a,...t,d0()]}function HR(u){return(u||[]).map(e=>({id:crypto.randomUUID(),key:e.key??"",value:e.value??"",active:e.active??!0})).concat(Y0())}function qR(u){return(u||[]).map(e=>({id:crypto.randomUUID(),key:e.key??"",value:e.value??"",active:e.active??!0,sendIn:ibu(e.in)})).concat(s9())}function WR(u){if(!u)return[Y0()];const e=[];for(const a in u)e.push({id:crypto.randomUUID(),key:a,value:u[a],active:!0});return e.push(Y0()),e}const Ih={query:"queryParameters",path:"pathParameters",header:"headers",cookie:"cookies"};function JR(u,e){const a="$components.parameters.";if(u.reference.startsWith(a)){const t=u.reference.replace(a,"");return e?.[t]}}function UR(u,e,a){if(!u&&!e)return{pathParameters:[Ba("path")],queryParameters:[Ba("query")],headers:[Ba("header")],cookies:[Ba("cookie")]};const t={pathParameters:[],queryParameters:[],headers:[],cookies:[]};if(u)for(const r of u)if(IR(r)){const n=JR(r,a),i=Ih[n?.in];i&&t[i].push({reference:r.reference,active:!0,value:r.value})}else t[Ih[r.in]].push({id:crypto.randomUUID(),key:r.name,value:r.value,active:!0,in:r.in});if(e)for(const r of e)if(IR(r)){const n=JR(r,a),i=Ih[n?.in];i&&t[i].push({reference:r.reference,active:!1,value:r.value})}else t[Ih[r.in]].push({id:crypto.randomUUID(),key:r.name,value:r.value,active:!1,in:r.in});return t.pathParameters.push(Ba("path")),t.queryParameters.push(Ba("query")),t.headers.push(Ba("header")),t.cookies.push(Ba("cookie")),t}async function sbu(u,e){const a=iX().body;if(!u)return a;switch(u.contentType){case"application/x-www-form-urlencoded":case"multipart/form-data":return{...a,type:u.contentType,formData:await lbu(u,e)};case"application/octet-stream":const t=u.payload?await mX(u.payload,e):[],r=t.length>0?await UE(t[0]):null;return{...a,type:u.contentType,binary:r};case"application/json":case"application/ld+json":return{...a,type:u.contentType,content:QR(u.payload)};default:{const n=typeof u.payload=="string",i=u.contentType||(n?"text/plain":"application/json");return{...a,type:i,content:n?u.payload:QR(u.payload)}}}}async function ZR(u,e,a,t){const r=await mX(e,t),n=r.length>0||Array.isArray(e),i=n?await dX(r):void 0;return{id:crypto.randomUUID(),key:u,value:n?"":e,type:n?"file":"text",active:a,files:i}}async function lbu(u,e){const a=iX().body.formData,t=u.contentType,r=u.payload?await Promise.all(Object.entries(u.payload).map(([o,s])=>ZR(o,s,!0,e))):[],n=u["x-replay-disabled-payload"]?await Promise.all(Object.entries(u["x-replay-disabled-payload"]||{}).map(([o,s])=>ZR(o,s,!1,e))):[];return{...a,[t]:[...r,...n,Ms()]}}function QR(u){return u?JSON.stringify(u,null,2):""}function cbu(u,e){for(const a of Object.keys(e.paths)){const t=e.paths[a];for(const r of Object.keys(t)){const n=r.toLowerCase();if(["get","put","post","delete","options","head","patch","trace"].includes(n)&&t[n]?.operationId===u)return{method:n,path:a}}}return null}async function mX(u,e){return Array.isArray(u)?(await Promise.all(u.map(a=>YR(a,e)))).flat():typeof u=="string"?await YR(u,e):[]}async function YR(u,e){const a=/\$file\(['"](.+?)['"]\)/g,t=Array.from(u.matchAll(a));return Promise.all(t.map(r=>dbu(r[1],e)))}async function dbu(u,e){return await za.isAbsolute(u)?u:await za.resolve(await za.join(e,u))}const Qt=u=>!u||typeof u=="boolean"?{type:"object",properties:{}}:u.type?u:{...u,type:"object"},XR=(u,e,a)=>{if(!u.properties)return u;const t=u.properties[e],r=Qt(t);return{...u,properties:{...u.properties,[e]:{...r,...a}}}},Ebu=(u,e,a)=>{if(!u.properties||e===a||!a.trim())return null;const t={...u.properties};return t[a]?null:(t[a]=t[e],delete t[e],{...u,properties:t})},pbu=(u,e)=>{if(!u.properties)return u;const a={...u.properties};return delete a[e],{...u,properties:a}},mbu=(u,e,a={type:"string"})=>{const t=u.properties||{};return{...u,type:"object",properties:{...t,[e]:a}}};function eN(u){const e=Object.assign({},...(u||[]).filter(({key:a,active:t})=>a&&t).map(a=>({[a.key]:a.value})));if(Object.keys(e).length!==0)return e}function uN(u){if(!u)return{};const e={queryParameters:"query",headers:"header",cookies:"cookie",pathParameters:"path"},a=[],t=[];return Object.keys(e).forEach(r=>{const n=r;u[n].forEach(i=>{if(xo(i)){const o={reference:i.reference,value:i.value||void 0};i.active?a.push(o):t.push(o)}else{if(!i.key)return;const o={name:i.key,in:e[n],value:i.value};i.active?a.push(o):t.push(o)}})}),{parameters:a.length>0?a:void 0,"x-replay-disabled-parameters":t.length>0?t:void 0}}function hbu(u){const e=u?.map(a=>({condition:a.condition,context:a.context,type:a.type==wt.SIMPLE?void 0:a.type}));if(e?.length!==0)return e}function xbu(u){if(!(!u||u.length===0))return[...u]}async function hX(u,e){return u.absolutePath?`$file('${await za.relative(e,u.absolutePath)}')`:null}async function Dbu(u,e){const{type:a,value:t,files:r}=u;switch(a){case"text":return t;case"file":let n=[];return r&&(n=(await Promise.all(Object.values(r).map(i=>hX(i,e)))).filter(i=>i!==null)),n.length===0?"":n.length===1?n[0]:n}}async function fbu(u,e){const a=u.type,t=u.formData[a],r={},n={};return await Promise.all(t.map(async i=>{const{key:o,active:s}=i;if(!o)return;const l=await Dbu(i,e);s?r[o]=l:n[o]=l})),{payload:Object.keys(r).length>0?r:void 0,"x-replay-disabled-payload":Object.keys(n).length>0?n:void 0}}function gbu(u){if(!u)return u;try{const e=JSON.parse(u);return typeof e=="object"?e:u}catch{return u}}async function vbu(u,e){if(u)switch(u.type){case"application/x-www-form-urlencoded":case"multipart/form-data":return{contentType:u.type,...await fbu(u,e)};case"application/octet-stream":return{contentType:u.type,payload:u.binary?await hX(u.binary,e):null};case"application/json":case"application/ld+json":return u.content?{contentType:u.type,payload:gbu(u.content)}:void 0;default:return u.content?{contentType:u.type,payload:u.content}:void 0}}function kbu(u){return{...u.schemeName?{schemeName:u.schemeName}:{scheme:{type:"http",scheme:"basic"}},values:{username:u.username,password:u.password}}}function bbu(u){return{...u.schemeName?{schemeName:u.schemeName}:{scheme:{type:"apiKey",name:u.name,in:u.location.toLowerCase()}},values:{apiKey:u.key}}}function ybu(u){return{...u.schemeName?{schemeName:u.schemeName}:{scheme:{type:"http",scheme:"bearer"}},values:{token:u.token}}}function Cbu(u){return{...u.schemeName?{schemeName:u.schemeName}:{scheme:{type:"http",scheme:"digest"}},values:{username:u.username,password:u.password}}}function Fbu(u){const{flows:e,values:a}=fX(u);return{...u.schemeName?{schemeName:u.schemeName}:{scheme:{type:"openIdConnect",flows:e}},values:{...a,openIdConnectUrl:u.openIdConnectUrl,userInfoUrl:u.userInfoUrl,authRequestExtraParams:xX(u.authRequestExtraParams),tokenRequestExtraParams:DX(u.tokenRequestExtraParams)}}}function Abu(u){const{flows:e,values:a}=fX(u);return{...u.schemeName?{schemeName:u.schemeName}:{scheme:{type:"oauth2",flows:e}},values:{...a,authRequestExtraParams:xX(u.authRequestExtraParams),tokenRequestExtraParams:DX(u.tokenRequestExtraParams)}}}function Gl(u){const e={},a={};return u.forEach(t=>{t.value&&(t.active?e[t.value]=t.description:a[t.value]=t.description)}),{scopes:e,"x-replay-disabled-scopes":Object.keys(a).length>0?a:void 0}}function xX(u){return u.filter(e=>e.value||e.key).map(e=>({key:e.key,value:e.value,active:e.active}))}function DX(u){return u.filter(e=>e.value||e.key).map(e=>({key:e.key,value:e.value,active:e.active,in:e.sendIn.toLowerCase()}))}function fX(u){let e;switch(u.grantType){case Fe.ClientCredentials:return e=u[Fe.ClientCredentials],{flows:{clientCredentials:{tokenUrl:e.tokenUrl,...Gl(e.scopes)}},values:{clientId:e.clientId,clientSecret:e.clientSecret,accessToken:e.accessToken}};case Fe.Implicit:return e=u[Fe.Implicit],{flows:{implicit:{authorizationUrl:e.authorizationUrl,...Gl(e.scopes)}},values:{clientId:e.clientId,accessToken:e.accessToken,callbackUrl:e.callbackUrl}};case Fe.Password:return e=u[Fe.Password],{flows:{password:{tokenUrl:e.tokenUrl,...Gl(e.scopes)}},values:{clientId:e.clientId,clientSecret:e.clientSecret,username:e.username,password:e.password,accessToken:e.accessToken}};case Fe.AuthorizationCode:return e=u[Fe.AuthorizationCode],{flows:{authorizationCode:{tokenUrl:e.tokenUrl,authorizationUrl:e.authorizationUrl,...Gl(e.scopes)}},values:{accessToken:e.accessToken,clientId:e.clientId,callbackUrl:e.callbackUrl}};case Fe.ClientCredentialsWithJwtAssertion:return e=u[Fe.ClientCredentialsWithJwtAssertion],{flows:{clientCredentials:{tokenUrl:e.tokenUrl,...Gl(e.scopes),"x-assertionType":"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}},values:{clientId:e.clientId,clientAssertion:e.clientAssertion,accessToken:e.accessToken}};case Fe.AuthorizationCodeWithPkce:return e=u[Fe.AuthorizationCodeWithPkce],{flows:{authorizationCode:{tokenUrl:e.tokenUrl,authorizationUrl:e.authorizationUrl,...Gl(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 aN(u){const e=u.map(a=>{switch(a.securityType){case ye.OpenIDConnect:{const r=a[ye.OpenIDConnect];return Fbu(r)}case ye.OAuth2:{const r=a[ye.OAuth2];return Abu(r)}case ye.APIKey:{const r=a[ye.APIKey];return bbu(r)}case ye.BasicAuth:{const r=a[ye.BasicAuth];return kbu(r)}case ye.DigestAuth:{const r=a[ye.DigestAuth];return Cbu(r)}case ye.JWT:{const r=a[ye.JWT];return ybu(r)}default:return null}}).filter(a=>a!==null);return{"x-security":e.length?e:void 0}}function Bbu(u){const{inputs:e,parameters:a,...t}=u;let r=t;return Object.keys(e).length&&(r.inputs=e),Object.keys(a).length&&(r.parameters=Object.fromEntries(Object.entries(a).map(([n,{id:i,active:o,key:s,...l}])=>[n,{...l,name:s}]))),Object.keys(r).length||(r=void 0),r}async function Sbu(u,e){const{id:a,state:t,srcType:r,sourceDescriptions:n,workflows:i,components:o,...s}=u;return{arazzoObject:{...s,sourceDescriptions:n.map(l=>({name:l.name,url:l.url,type:l.type||"openapi"})),components:Bbu(o),workflows:await Promise.all(i.map(async({parameters:l,security:c,dependsOn:d,outputs:E,state:p,steps:x,inputs:m,...g})=>({...g,dependsOn:xbu(d),outputs:eN(E),inputs:m?Qt(m):void 0,...aN(c),...uN(l),steps:await Promise.all(x.map(async({parameters:h,security:f,operation:k,requestBody:y,successCriteria:v,outputs:b,state:C,xOperation:B,...z})=>{const P={operationId:void 0,operationPath:void 0,"x-operation":void 0};if(k){const L=u.sourceDescriptions.find(({apiId:I})=>I===k.apiId)||u.sourceDescriptions[0];if(k.operationId){const I=u.sourceDescriptions.length<=1;P.operationId=I?k.operationId:`$sourceDescriptions.${L.name}.${k.operationId}`}else P.operationPath=`{$sourceDescriptions.${L.name}.url}#/paths/${Vf.escape(k.path)}/${k.method}`}else B&&(P["x-operation"]={...B,url:B.url.split("?")[0]});return{...z,...P,...aN(f),...uN(h),requestBody:await vbu(y,e),successCriteria:hbu(v),outputs:eN(b)}}))})))}}}class zbu extends QJ{constructor(e,a){super(e),this.convertOperationToReplayValue=a}parse(e,a){return ebu(e.content,e.uri,e.type,this.storage.baseDir,a,this.convertOperationToReplayValue)}async stringify(e){const{arazzoObject:a}=await Sbu(e,this.storage.baseDir);return await za.extname(e.id)===".json"?JSON.stringify(a,null,2):gi.dump(a)}}class wbu{constructor(e,a){this.storage=e,this.localStorageSecretsProvider=a}default=[];async read(){const e=await this.storage.get("replay-environments.yaml"),a=await this.localStorageSecretsProvider.get();let t=null,r=null;if(!e)return this.default;try{t=gi.load(e),r=a?JSON.parse(a):null}catch(o){return console.error("Failed to parse environments file",o),this.default}return t?Object.keys(t).filter(o=>o!=="version").map(o=>({name:o,inputs:Object.entries(t[o].inputs).map(([s,l])=>{if(typeof l=="string")return{name:s,value:l,isSecret:!1};const c=r?.[o]?.[s]??"";return{name:s,value:c,isSecret:!0}}),servers:Object.entries(t[o].servers).map(([s,l])=>({apiId:s,value:l.value,variables:Object.entries(l.variables||{}).map(([c,d])=>({name:c,value:d}))})),state:Nu.Normal})):this.default}async write(e){const a=await this.localStorageSecretsProvider.get(),t=a?JSON.parse(a):{},r=e.reduce((n,i)=>(i.name&&(n[i.name]={inputs:i.inputs.reduce((o,s)=>(s.isSecret&&t?(t[i.name]||(t[i.name]={}),t[i.name][s.name]=s.value,o[s.name]={provider:"local"}):o[s.name]=s.value,o),{}),servers:i.servers.reduce((o,s)=>(o[s.apiId]={value:s.value,variables:Object.fromEntries(s.variables.map(l=>[l.name,l.value]))},o),{})}),n),{});this.localStorageSecretsProvider.set(JSON.stringify(t)),r&&this.storage.set("replay-environments.yaml",gi.dump(r))}}class Obu{constructor(e,a,t){this.storage=e,this.filePath=a,this.defaultValue=t}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 Pbu=(u,e)=>({data:u,version:e});class gF extends Obu{constructor(e,a,t,r){super(e,a,t),this.version=r}migrationMap={};migrate(e){if(!this.migrationMap[e.version])return this.defaultValue;const a=this.migrationMap[e.version](e);return a.version===this.version?a:this.migrate(a)}async parse(e){const a=JSON.parse(e);if(a.version!==this.version){const t=this.migrate(a);return await this.write(t.data),t.data}return a.data}stringify(e){return JSON.stringify(Pbu(e,this.version))}}function jbu(u){return{data:{...u.data,tabs:u.data.tabs.map(e=>e.data.type===We.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 tN=2,Mbu="tabs.json";class Tbu extends gF{migrationMap={1:jbu};constructor(e){super(e,Mbu,Ei(HJ),tN)}async parse(e){let a=JSON.parse(e);a.version!==tN&&(a=this.migrate(a));const t=await Promise.all(a.data.tabs.map(async r=>{if(r.data.type===We.Step&&r.data.draftStep){const n=r.data.draftStep.requestBody.formData;n["multipart/form-data"]=await rN(n["multipart/form-data"]),n["application/x-www-form-urlencoded"]=await rN(n["application/x-www-form-urlencoded"]),r.data.draftStep.requestBody.binary&&r.data.draftStep.requestBody.binary.absolutePath&&(r.data.draftStep.requestBody.binary=await UE(r.data.draftStep.requestBody.binary.absolutePath))}return r}));return{...a.data,tabs:t}}stringify(e){return super.stringify({...e,tabs:e.tabs.map(a=>a.data.type===We.Step?{...a,data:{...a.data,response:null}}:a.data.type===We.WorkflowRun?{...a,data:{...a.data,result:null}}:a)})}}async function rN(u){return Promise.all(u.map(async e=>{const a={...e};if(e.files){const t=e.files.map(r=>r.absolutePath).filter(r=>r!==null);a.files=await dX(t)}return a}))}const $bu=1,Rbu=1;class Nbu{constructor(e,a){this.project=e,this.convertOperationToReplayValue=a,this.localStorageSecretsProvider=new d3u(this.project.id),this.systemFilesStorage=this.isTauriApp?new uM(this.project.systemFilesDir):new Yj(this.project.systemFilesDir),this.userFilesStorage=this.isTauriApp?new uM(this.project.userFilesDir):new Yj(this.project.userFilesDir);const t=new u3u;this.historyStorage=new gF(this.systemFilesStorage,"history.json",[],$bu),this.activeEnvironmentIdStorage=new gF(this.systemFilesStorage,"active_environment_id.json",RE,Rbu),this.tabsStateStorage=new Tbu(this.systemFilesStorage),this.environmentsStorage=new wbu(this.userFilesStorage,this.localStorageSecretsProvider),this.collectionsStorage=new zbu(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new E3u(this.isTauriApp?this.userFilesStorage:t)}historyStorage;activeEnvironmentIdStorage;tabsStateStorage;environmentsStorage;collectionsStorage;apisStorage;isTauriApp=Cc();systemFilesStorage;localStorageSecretsProvider;userFilesStorage;async detectProjectFiles(){const a=(await this.userFilesStorage.ls()).filter(i=>/\.(ya?ml|json)$/.test(i)),t=[],r=[],n=new Set;return await Promise.all(a.map(async i=>{const o=await this.userFilesStorage.get(i);if(o)try{const s=gi.load(o);typeof s=="object"&&s!==null&&(typeof s.openapi=="string"?t.push({uri:i,type:mn.FS,content:s}):typeof s.arazzo=="string"&&(r.push({uri:i,type:mn.FS,content:s}),s.sourceDescriptions?.map(async l=>{const c=l.type,d=l.url,E=!c||c==="openapi",p=typeof d=="string"&&qJ(d);E&&p&&n.add(d)})))}catch(s){console.error(`Error parsing YAML/JSON file ${i}:`,s)}})),{apiFiles:t,collectionFiles:r,apiUrls:n}}async loadApis(e){const a=[];return await Promise.all(Array.from(e).map(async t=>{let r="";try{const n=await hn(uue({proxyUrl:IJ,resolvedUrl:t,ignoreProxy:this.isTauriApp}));r=await n.text(),n.ok||console.error(`Error fetching API from ${t}:`,n.status,r)}catch(n){console.error(`Error fetching API from ${t}:`,n)}try{const n=gi.load(r);typeof n=="object"&&n!==null&&typeof n.openapi=="string"&&a.push({uri:t,type:mn.WEB,content:n})}catch(n){console.error(`Error parsing YAML from ${t}:`,n)}})),a}async read(){const[e,a,t,r]=await Promise.all([this.historyStorage.read(),this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]),{apiFiles:n,collectionFiles:i,apiUrls:o}=await this.detectProjectFiles(),s=await this.loadApis(o),l=await this.apisStorage.parseMany([...n,...s]),c=await this.collectionsStorage.parseMany(i,l);return{project:this.project,history:e,activeEnvironmentId:a,tabsState:t,environments:r,apis:l,collections:c}}async update(e,a){switch(e.path[0]){case"history":this.historyStorage.write(a.history.get());break;case"activeEnvironmentId":this.activeEnvironmentIdStorage.write(a.activeEnvironmentId.get());break;case"tabsState":this.tabsStateStorage.write(a.tabsState.get());break;case"environments":this.environmentsStorage.write(a.environments.get());break;case"apis":this.isTauriApp&&await this.apisStorage.update(e,a.apis.get());break;case"collections":await this.collectionsStorage.update(e,a.collections.get());break}}}function gX(u=!1){let e,a=!1;return()=>({id:"RootStoragePlugin",onCreate:()=>({init:t=>async(r,n)=>{if(a||t.path.length>0)return{isInitialized:!1};if(a=!0,!u){e=new Nbu(r,n);const i=await e.read();t.merge(i)}return a=!1,{isInitialized:!0}}}),onSet(t,r,n){a||u||e.update(r,n)}})}function vX({defaultEnvironments:u}={}){return structuredClone({project:{id:"default",userFilesDir:"default",systemFilesDir:"default"},history:[],tabsState:Ei(HJ),activeEnvironmentId:RE,environments:u||GJ,collections:[],apis:[],requestController:null,apps:{apps:[],appsLoadingState:Ur.Idle},predefinedApiId:null,predefinedEnvironmentNames:new Set,predefinedInputNames:new Set})}const _bu=$I(vX(),RI(ZEu({key:"replay-root-store"}),gX())),p9=H.createContext(_bu),Lbu=p9.Provider;function Su(){const u=H.useContext(p9);return NI(u)}function Ibu(){return{theme:"light",disableCollectionsTab:!1,oAuth2RedirectURI:null,corsProxyUrl:void 0,mockServer:void 0,certificates:[],isApiBased:!1,generatedEnvironments:[],generatedInputs:[]}}const Kbu=Ibu(),Vbu=H.createContext(Kbu);function Pi(){const u=H.useContext(Vbu);return NI(u)}function Gbu(u,e){const{apps:{apiId:a}}=Su(),{corsProxyUrl:t,disableCollectionsTab:r,mockServer:n,oAuth2RedirectURI:i,certificates:o,storageKey:s,isApiBased:l}=Pi();t.set(u?.corsProxyUrl??IJ),n.set(u?.mockServer),a.set(u?.apiId),i.set(u?.oAuth2RedirectURI),r.set(!!u?.disableCollectionsTab),s.set(u?.storageKey),l.set(!!e),H.useEffect(()=>{o.set(u?.certificates||[])},[u?.certificates])}const Cg=H.createContext({});function ZE(){return H.useContext(Cg)||{}}const Hbu="0.18.0-next.12",qbu={version:Hbu};class Wbu{client;_isInitialized=!1;constructor(){this.client=new PEu}get isInitialized(){return this._isInitialized}init(e){if(this.isInitialized)return;const t={serviceName:"replay",serviceVersion:qbu.version,version:"1.0.0",tracerName:e?.tracerName||"desktop",collectorUrl:e?.collectorUrl||"",isProd:!0};this.client.init({otel:{...t,...e}}),this._isInitialized=!0}sendEvent(e,a){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}try{this.client.send(e,a)}catch(t){console.error("Failed to send telemetry event:",t)}}}const eb=new Wbu;function yu(){const{telemetry:u}=ZE();return eb.isInitialized||eb.init({tracerName:u?.tracerName,collectorUrl:u?.collectorUrl}),{sendEvent:(e,a)=>{eb.sendEvent(e,a)}}}const Tt=800;function Js(u){"@babel/helpers - typeof";return Js=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Js(u)}function Jbu(u,e){if(Js(u)!="object"||!u)return u;var a=u[Symbol.toPrimitive];if(a!==void 0){var t=a.call(u,e);if(Js(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(u)}function kX(u){var e=Jbu(u,"string");return Js(e)=="symbol"?e:e+""}function X4(u,e,a){return(e=kX(e))in u?Object.defineProperty(u,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):u[e]=a,u}function nN(u,e){var a=Object.keys(u);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(u);e&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(u,r).enumerable})),a.push.apply(a,t)}return a}function Ye(u){for(var e=1;e<arguments.length;e++){var a=arguments[e]!=null?arguments[e]:{};e%2?nN(Object(a),!0).forEach(function(t){X4(u,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(a)):nN(Object(a)).forEach(function(t){Object.defineProperty(u,t,Object.getOwnPropertyDescriptor(a,t))})}return u}function Ubu(u){if(Array.isArray(u))return u}function Zbu(u,e){var a=u==null?null:typeof Symbol<"u"&&u[Symbol.iterator]||u["@@iterator"];if(a!=null){var t,r,n,i,o=[],s=!0,l=!1;try{if(n=(a=a.call(u)).next,e===0){if(Object(a)!==a)return;s=!1}else for(;!(s=(t=n.call(a)).done)&&(o.push(t.value),o.length!==e);s=!0);}catch(c){l=!0,r=c}finally{try{if(!s&&a.return!=null&&(i=a.return(),Object(i)!==i))return}finally{if(l)throw r}}return o}}function vF(u,e){(e==null||e>u.length)&&(e=u.length);for(var a=0,t=Array(e);a<e;a++)t[a]=u[a];return t}function bX(u,e){if(u){if(typeof u=="string")return vF(u,e);var a={}.toString.call(u).slice(8,-1);return a==="Object"&&u.constructor&&(a=u.constructor.name),a==="Map"||a==="Set"?Array.from(u):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?vF(u,e):void 0}}function Qbu(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
524
+ `};return Ovu(o.getText(),c,p).map(function(x){return Si.replace(_u.create(o.positionAt(x.offset),o.positionAt(x.offset+x.length)),x.content)})}}}function sl(){const{tabsState:u}=Su(),e=H.useCallback(({type:r,collectionId:n,workflowId:i,stepId:o,historyId:s})=>u.tabs.findIndex(l=>{const c=l.data.get();return Ka(c,r)?(!n||c.collectionId===n)&&(!i||c.workflowId===i)&&(!o||c.stepId===o)&&(!s||c.historyId===s):!1}),[u]),a=H.useCallback(({type:r,collectionId:n,workflowId:i,stepId:o,historyId:s})=>{const l=e({type:r,collectionId:n,workflowId:i,stepId:o,historyId:s});return l!==-1?u.tabs[l]:void 0},[e,u]),t=H.useCallback((r,n)=>{if(!(!r.collectionId||!n.collectionId||r.collectionId!==n.collectionId)&&!(!r.workflowId||!n.workflowId)){if(r.workflowId!==n.workflowId){u.tabs.forEach(i=>{const o=i.data.get();o.collectionId===r.collectionId&&((Ka(o,We.Workflow)||Ka(o,We.WorkflowRun))&&o.workflowId===r.workflowId&&i.data.workflowId.set(n.workflowId),Ka(o,We.Step)&&i.data.workflowId.set(n.workflowId))});return}if(!(!r.stepId||!n.stepId)&&r.stepId!==n.stepId){u.tabs.forEach(i=>{const o=i.data.get();o.collectionId===r.collectionId&&Ka(o,We.Step)&&o.workflowId===r.workflowId&&o.stepId===r.stepId&&i.data.stepId.set(n.stepId)});return}}},[u]);return{tabs:u.tabs,activeTabIdx:u.activeTabIdx,getExistingTabIndex:e,getExistingTab:a,handleIdChange:t}}function Ka(u,e){return u.type===e}const kg=UY({});let RR=null;function ZY(u){RR!==u&&(RR=u,kg.configure({validate:!0,schemas:[{uri:"stub://test",fileMatch:["*"],schema:u}]}))}function QY(u){const e=MD.create("stub.json","json",0,u),a=kg.parseJSONDocument(e);return{textDoc:e,jsonDoc:a}}const YY=Qa.define({create(){},update(u){return u}}),XY=u=>u.field(YY,!1),vku=({store:u,isResponse:e,apiOperation:a})=>{const r=L9(u).data.get();let n=a?.body?.mediaTypes?.[Mt.JSON]?.schema;if(Ka(r,We.Step)&&e){const i=r.response?.status;i&&(n=a?.responses?.[i]?.mediaTypes?.[Mt.JSON]?.schema)}return[YY.init(()=>({schema:Ei(n||{}),store:u}))]};function kku(){return async u=>{const{schema:e}=XY(u.state)||{};if(!e)return[];ZY(e);const a=u.state.doc,{textDoc:t,jsonDoc:r}=QY(a.toString());return(await kg.doValidation(t,r))?.map(i=>({from:hF(a,i.range.start),to:hF(a,i.range.end),message:i.message,severity:Cku[i.severity||3]}))}}const bku=Cn.highest(Ac.of([{key:"Tab",run:u=>DQ(u)}]));function yku(){return async function(e){const a={from:e.pos,to:e.pos,options:[],filter:!1},{schema:t}=XY(e.state)||{};if(!t)return a;ZY(t);const r=e.state.doc,n=hF.bind(null,r),{textDoc:i,jsonDoc:o}=QY(r.toString()),s=e.state.doc.lineAt(e.pos),l=s.number-1,c=e.pos-s.from,d=await kg.doComplete(i,{line:l,character:c},o);if(!d)return a;const E=e.state.sliceDoc(s.from,e.pos);if(E.trim().endsWith(",")||Fku(E))return a;a.options=d.items.map(m=>({label:m.label,info:m.documentation,apply:g=>{if(!m.textEdit||!("range"in m.textEdit))return;const h=m.textEdit.range,f=m.textEdit.newText.search(/(\$1|\${1:.*?})/);let k=m.textEdit.newText.replace(/(\$1|\${1:.*?})/,"");const y=f===-1?0:f-k.length;g.dispatch({changes:{from:n(h.start),to:n(h.end),insert:k}});const v=k.length-(h.end.character-h.start.character);g.dispatch({selection:Se.single(n(h.end)+v+y)})}}))||[];const p=e.state.wordAt(e.pos),x=p?.from?e.state.sliceDoc(p?.from,p?.to).toLowerCase():"";return x&&(a.options=a.options.filter(m=>m.label.toLowerCase().replace(/^"/,"").startsWith(x))),a}}const Cku={1:"error",2:"warning",3:"info",4:"hint"};function hF(u,e){return u.line(e.line+1).from+e.character}function Fku(u){try{return JSON.parse(`{${u}}`),!0}catch{return!1}}const eX=iu.define();function Pc(u){const e=u.activeEnvironmentId.get();return u.environments.find(a=>a.name.get()===e)?.get()||u.environments[0].get()}const xF=u=>ya.fromClass(class{decorations;constructor(e){this.decorations=this.buildDecorations(e,u)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=this.buildDecorations(e.view,u))}buildDecorations(e,a){const r=Pc(a.store)?.inputs,n=[],i=Ve.mark({attributes:{style:"background-color: var(--bg-color-active);"}}),o=s=>Ve.mark({attributes:{style:`color: var(--replay-${s?"undefined":"defined"}-variable-color); background-color: var(--replay-${s?"undefined":"defined"}-variable-bg-color);`}});for(const{from:s,to:l}of e.visibleRanges){const c=e.state.doc.sliceString(s,l),d=Uf(c);for(const E of d){const p=s+E.start,x=s+E.end;if(!(p>=x))if(E.prefix==="inputs"){const m=tA(E.match),h=!r?.find(f=>f.name===m)?.value;n.push({from:p,to:x,value:o(h)})}else n.push({from:p,to:x,value:i})}}return Ve.set(n,!0)}},{decorations:e=>e.decorations}),Aku=UY({});function Bku(u){if(!u||typeof u!="object")return!1;const e=u;return typeof e.type=="string"&&typeof e.offset=="number"&&typeof e.length=="number"}function Sku(u){const e=[];if(!u)return e;const a=[u];for(;a.length>0;){const t=a.pop();if(t.type==="property"){t.valueNode&&a.push(t.valueNode);continue}if(t.type==="string"){const r=t.offset,n=t.offset+t.length;n>r&&e.push({from:r,to:n})}if(t.children&&t.children.length)for(const r of t.children)a.push(r)}return e}const zku=u=>ya.fromClass(class{decorations;constructor(e){this.decorations=this.buildDecorations(e,u)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=this.buildDecorations(e.view,u))}buildDecorations(e,a){const t=e.state.doc.toString();let r;try{const d=MD.create("inmemory://model.json","json",0,t),p=Aku.parseJSONDocument(d)?.root;r=Bku(p)?p:void 0}catch{r=void 0}const i=Pc(a.store)?.inputs,o=Ve.mark({attributes:{style:"background-color: var(--bg-color-active);"}}),s=d=>Ve.mark({attributes:{style:`color: var(--replay-${d?"undefined":"defined"}-variable-color); background-color: var(--replay-${d?"undefined":"defined"}-variable-bg-color);`}}),l=[];if(!r)return Ve.set([],!0);const c=Sku(r);for(const d of c){if(!e.visibleRanges.some(h=>Math.max(h.from,d.from)<Math.min(h.to,d.to))||!(t[d.from]==='"'&&t[d.to-1]==='"'))continue;const p=d.from+1,x=d.to-1;if(x<=p)continue;const m=e.state.doc.sliceString(p,x),g=Uf(m);for(const h of g){const f=p+h.start,k=p+h.end;if(!(f>=k))if(h.prefix==="inputs"){const y=tA(h.match),b=!i?.find(C=>C.name===y)?.value;l.push({from:f,to:k,value:s(b)})}else l.push({from:f,to:k,value:o})}}return Ve.set(l,!0)}},{decorations:e=>e.decorations}),fn={[Mt.Text]:{name:"Text",extensions:[Me.lineWrapping],stateExtensions:[xF]},[Mt.JSON]:{name:"JSON",extensions:[jxu(),lgu(kku(),{delay:0,needsRefresh:u=>u.transactions.some(e=>e.effects.some(a=>a.is(eX)))}),UZ.data.of({autocomplete:yku()}),bku],stateExtensions:[vku,zku]},[Mt.XML]:{name:"XML",extensions:[Qfu()],stateExtensions:[xF]}},wku={[Mt.Image]:{name:"Image",extensions:[],stateExtensions:[]}},Oku={[Mt.HTML]:{name:"HTML",extensions:[Bfu()],stateExtensions:[xF]}},po={...fn,...wku,...Oku},uX={[Mt.FormData]:{name:"form-data",extensions:void 0},[Mt["application/x-www-form-urlencoded"]]:{name:"x-www-form-urlencoded",extensions:void 0}},aX={[Mt.Binary]:{name:"Binary",extensions:void 0}},Ws={...fn,...uX,...aX},Pku=Object.keys(fn),o9=Object.keys(uX),tX=Object.keys(aX);function rX(u=[],e){const a={};return u.forEach(t=>{const r=String(t[e]);a[r]||(a[r]=[]),a[r].push(t)}),a}const WE={active:!0,key:"",value:""};function mo(u,e){return[...u.map(t=>({id:crypto.randomUUID(),key:t.name,value:e.initializeWithInputs?`$inputs.${t.name}`:t.example?String(t.example):"",active:e.initializeWithInputs?!0:!!t.example,in:t.in})),Ba(e.in)]}function JE(u,e){const[a]=u.split("?"),t=e.slice(0,-1).filter(r=>r.active).map(r=>`${r.key}=${r.value}`).join("&");return`${a}${t?`?${t}`:""}`}function Y0(){return{id:crypto.randomUUID(),...WE}}function d0(){return{id:crypto.randomUUID(),...WE,description:""}}function Ba(u){return{...WE,id:crypto.randomUUID(),in:u}}function Ms(){return{id:crypto.randomUUID(),...WE,type:"text",files:null}}function s9(){return{id:crypto.randomUUID(),...WE,sendIn:jt.URL}}function Xk(u){return u.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function bg(u,e){return u.filter(a=>a.active&&a.value).map(({value:a})=>(e?Yu(a,e):a).trim())}function yo(u,e){const t=e.filter(r=>!!r).flatMap(r=>r).filter(r=>r.key&&r.active);return["path","header"].includes(u)?Array.from(new Map(t.map(r=>[r.key,r])).values()):t}function nX(u,e){return u.map(({value:a,...t})=>({...t,value:Yu(a,e)}))}function jku(u,e){if(!u.startsWith("$components.parameters."))return null;const a=u.replace("$components.parameters.","");return a&&e[a]||null}function Sa(u=[],e={}){const a=[];for(const t of u)if(xo(t)){const r=jku(t.reference,e);r&&a.push({...r,active:t.active,value:t.value||r.value})}else a.push(t);return a}function no(u){return Object.entries(u).map(([e,a])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:a}))}function Mku(u){return u.replace(/{/g,"{{").replace(/}/g,"}}")}const NR={documentedOAuth2Types:[],grantType:Fe.ClientCredentials,authRequestExtraParams:[Y0()],tokenRequestExtraParams:[s9()],[Fe.ClientCredentials]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[d0()],accessToken:""},[Fe.ClientCredentialsWithJwtAssertion]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[d0()],accessToken:""},[Fe.AuthorizationCode]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[d0()],codeVerifier:"",codeChallenge:"",accessToken:""},[Fe.AuthorizationCodeWithPkce]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[d0()],codeVerifier:"",codeChallenge:"",accessToken:""},[Fe.Implicit]:{clientId:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[d0()],accessToken:""},[Fe.Password]:{username:"",password:"",clientId:"",clientSecret:"",tokenUrl:"",accessToken:"",scopes:[d0()]}},Tku={securityType:ye.NoAuth,securitySchemeId:null,[ye.BasicAuth]:{username:"",password:""},[ye.JWT]:{token:""},[ye.DigestAuth]:{username:"",password:"",nc:"00000001",realm:"",nonce:"",opaque:"",qop:"",algorithm:"",cnonce:""},[ye.APIKey]:{location:P0.Header,name:"",key:""},[ye.OAuth2]:NR,[ye.OpenIDConnect]:{...NR,openIdConnectUrl:"",userInfoUrl:""}},DF="urn:ietf:params:oauth:client-assertion-type:jwt-bearer",$ku={[wt.SIMPLE]:{condition:"",type:wt.SIMPLE},[wt.REGEX]:{condition:"",type:wt.REGEX,context:""},[wt.JSONPATH]:{condition:"",type:wt.JSONPATH,context:""},[wt.XPATH]:{condition:"",type:wt.XPATH,context:""}};function TD(){return structuredClone({type:ut.Text,content:"",activeExampleName:"",formData:{"multipart/form-data":[Ms()],"application/x-www-form-urlencoded":[Ms()]},binary:null})}const Rku={method:"GET",url:"",security:[Sn()],body:TD(),queryParameters:[Y0()],headers:[Y0()],cookies:[Y0()],pathParameters:[Y0()]};function iX(){return structuredClone(Rku)}function Sn(){return Ei(Tku)}function Nku(u){return Ei({id:crypto.randomUUID(),...$ku[u]})}function oX(u,e,a){for(const t of a){const r=_R(u,t),n=_R(e,t);if(typeof r=="object"&&typeof n=="object"){if(!oX(r,n,a))return!1}else if(r!==n)return!1}return!0}function _R(u,e){const a=e.split("/");let t=u;for(const r of a)if(t&&typeof t=="object"&&r in t)t=t[r];else return;return t}function _ku(u,e){return u.length===e.length&&u.sort().join()===e.sort().join()}function Lku(u,e){return u.every(a=>e.includes(a))}function Iku(u){switch(u){case"query":return P0.Query;case"cookie":return P0.Cookie;case"header":return P0.Header;default:return}}function Kku(u,e,a){const{security:t}=e,r=T1u(u);if(!a)return!1;const n=l9(a),i=n.map(c=>c.securityType),o=t.map(c=>c.securityType);if(!_ku(i,o))return!0;let l=[];return t.forEach(c=>{const d=c.securityType,E=c[ye.OAuth2]?.grantType,p=i.includes(d),x=n.find(f=>f.securityType===d),m=!x||oX(c,x,Gku(d,E)),g=Vku(c,d,c[ye.OAuth2]?.grantType,r),h=!!(p&&x&&m&&g);l.push(!a.security?.length||h)}),l.includes(!1)}function Vku(u,e,a,t){if(e===ye.OAuth2&&(a===Fe.AuthorizationCode||a===Fe.AuthorizationCodeWithPkce||a===Fe.Implicit)){const r=u[ye.OAuth2][a]?.availableScopes,n=bg(u[ye.OAuth2][a]?.scopes,t);return Lku(n,r)}return!0}function Gku(u,e){return u===ye.APIKey?[`${ye.APIKey}/name`,`${ye.APIKey}/location`]:u===ye.OAuth2?[`${ye.OAuth2}/grantType`,...Hku(e)]:u===ye.OpenIDConnect?[`${ye.OpenIDConnect}/openIdConnectUrl`]:[]}function Hku(u){return u===Fe.ClientCredentials?[`${ye.OAuth2}/${Fe.ClientCredentials}/tokenUrl`]:u===Fe.Password?[`${ye.OAuth2}/${Fe.Password}/tokenUrl`]:u===Fe.Implicit?[`${ye.OAuth2}/${Fe.Implicit}/authorizationUrl`]:u===Fe.AuthorizationCode?[`${ye.OAuth2}/${Fe.AuthorizationCode}/tokenUrl`,`${ye.OAuth2}/${Fe.AuthorizationCode}/authorizationUrl`]:u===Fe.AuthorizationCodeWithPkce?[`${ye.OAuth2}/${Fe.AuthorizationCodeWithPkce}/tokenUrl`,`${ye.OAuth2}/${Fe.AuthorizationCodeWithPkce}/authorizationUrl`]:[]}function qku(u){return u.map(e=>{const a=e.map(t=>t.id).join("_");return e.map(t=>({...t,schemeId:a}))})}function Wku(u){const e=u.security||[],a=e.map(t=>{let r="";const n=[];return t.forEach((i,o)=>{r=o===0?`${i.id}`:`${r}_${i.id}`,n.push(c9(i))}),{id:r,security:n}});return e.length?a:[]}function Jku(u,e){const a=u.security||[];return a?.length?cX(a).map((t,r)=>c9(t)):[]}function l9(u){const a=(u.security||[])[0];return a?a.map(t=>c9(t)):[Sn()]}function c9(u,e){const a={...Sn(),securitySchemeId:u.id},t=yg(u);a.securityType=t;const r=u.id;if(u.id&&t!==ye.NoAuth&&(a[t].schemeName=u.id),t===ye.BasicAuth&&(a[ye.BasicAuth].username||(a[ye.BasicAuth].username=va(r+W.SecurityVariablesEnvSuffix.Username)),a[ye.BasicAuth].password||(a[ye.BasicAuth].password=va(r+W.SecurityVariablesEnvSuffix.Password))),t===ye.DigestAuth&&(a[ye.DigestAuth].username||(a[ye.DigestAuth].username=va(r+W.SecurityVariablesEnvSuffix.Username)),a[ye.DigestAuth].password||(a[ye.DigestAuth].password=va(r+W.SecurityVariablesEnvSuffix.Password))),t===ye.JWT&&!a[ye.JWT].token&&(a[ye.JWT].token=va(r+W.SecurityVariablesEnvSuffix.JWTToken)),t===ye.APIKey&&!a[ye.APIKey].key){a[ye.APIKey].name=u.name||"",a[ye.APIKey].key=va(r+W.SecurityVariablesEnvSuffix.APIKey);const n=Iku(u.in);n&&(a[ye.APIKey].location=n)}if(t===ye.OAuth2){const n=E9(u),i=va(r+W.SecurityVariablesEnvSuffix.Token),o=a[ye.OAuth2];o.grantType=n[0],n.forEach(s=>{s===Fe.AuthorizationCode&&!o[Fe.AuthorizationCode].accessToken&&(o[Fe.AuthorizationCode].accessToken=i,o[Fe.AuthorizationCode].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId),o[Fe.AuthorizationCode].authorizationUrl=u.flows?.authorizationCode?.authorizationUrl||"",o[Fe.AuthorizationCode].tokenUrl=u.flows?.authorizationCode?.tokenUrl||"",o[Fe.AuthorizationCode].clientSecret=va(r+W.SecurityVariablesEnvSuffix.ClientSecret),o[Fe.AuthorizationCode].availableScopes=Object.keys(u.flows?.authorizationCode?.scopes||{})||[],o[Fe.AuthorizationCode].scopes=[...no(u.flows?.authorizationCode?.scopes||{})||[],d0()]),s===Fe.AuthorizationCodeWithPkce&&!o[Fe.AuthorizationCodeWithPkce].accessToken&&(o[Fe.AuthorizationCodeWithPkce].accessToken=i,o[Fe.AuthorizationCodeWithPkce].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId),o[Fe.AuthorizationCodeWithPkce].authorizationUrl=u.flows?.authorizationCode?.authorizationUrl||"",o[Fe.AuthorizationCodeWithPkce].tokenUrl=u.flows?.authorizationCode?.tokenUrl||"",o[Fe.AuthorizationCodeWithPkce].clientSecret=va(r+W.SecurityVariablesEnvSuffix.ClientSecret),o[Fe.AuthorizationCodeWithPkce].availableScopes=Object.keys(u.flows?.authorizationCode?.scopes||{})||[],o[Fe.AuthorizationCodeWithPkce].scopes=[...no(u.flows?.authorizationCode?.scopes||{}),d0()]),s===Fe.ClientCredentials&&!o[Fe.ClientCredentials].accessToken&&(o[Fe.ClientCredentials].accessToken=i,o[Fe.ClientCredentials].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId),o[Fe.ClientCredentials].clientSecret=va(r+W.SecurityVariablesEnvSuffix.ClientSecret),o[Fe.ClientCredentials].tokenUrl=u.flows?.clientCredentials?.tokenUrl||"",o[Fe.ClientCredentials].scopes=[...no(u.flows?.clientCredentials?.scopes||{}),d0()]),s===Fe.ClientCredentialsWithJwtAssertion&&!o[Fe.ClientCredentialsWithJwtAssertion].accessToken&&(o[Fe.ClientCredentialsWithJwtAssertion].accessToken=i,o[Fe.ClientCredentialsWithJwtAssertion].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId),o[Fe.ClientCredentialsWithJwtAssertion].clientAssertion=va(r+W.SecurityVariablesEnvSuffix.ClientAssertion),o[Fe.ClientCredentialsWithJwtAssertion].scopes=[...no(u.flows?.clientCredentials?.scopes||{}),d0()]),s===Fe.Implicit&&!o[Fe.Implicit].accessToken&&(o[Fe.Implicit].accessToken=i,o[Fe.Implicit].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId),o[Fe.Implicit].authorizationUrl=u.flows?.implicit?.authorizationUrl||"",o[Fe.Implicit].availableScopes=Object.keys(u.flows?.implicit?.scopes||{})||[],o[Fe.Implicit].scopes=[...no(u.flows?.implicit?.scopes||{}),d0()]),s===Fe.Password&&!o[Fe.Password].accessToken&&(o[Fe.Password].accessToken=i,o[Fe.Password].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId),o[Fe.Password].clientSecret=va(r+W.SecurityVariablesEnvSuffix.ClientSecret),o[Fe.Password].tokenUrl=u.flows?.password?.tokenUrl||"",o[Fe.Password].scopes=[...no(u.flows?.password?.scopes||{}),d0()])})}if(t===ye.OpenIDConnect){const n=va(r+W.SecurityVariablesEnvSuffix.Token),i=a[ye.OpenIDConnect];i[Fe.AuthorizationCode].accessToken||(i[Fe.AuthorizationCode].accessToken=n,i[Fe.AuthorizationCode].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId),i[Fe.AuthorizationCode].clientSecret=va(r+W.SecurityVariablesEnvSuffix.ClientSecret),i[Fe.AuthorizationCode].tokenUrl=u.flows?.authorizationCode?.tokenUrl||""),i[Fe.AuthorizationCodeWithPkce].accessToken||(i[Fe.AuthorizationCodeWithPkce].accessToken=n,i[Fe.AuthorizationCodeWithPkce].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId),i[Fe.AuthorizationCodeWithPkce].clientSecret=va(r+W.SecurityVariablesEnvSuffix.ClientSecret),i[Fe.AuthorizationCodeWithPkce].tokenUrl=u.flows?.authorizationCode?.tokenUrl||""),i[Fe.Implicit].accessToken||(i[Fe.Implicit].accessToken=n,i[Fe.Implicit].clientId=va(r+W.SecurityVariablesEnvSuffix.ClientId))}return a}function Uku(u,e="",a){const t=rX(u.parameters,"in"),r=sX(u),n=l9(u),i=mo(t.query||[],{in:"query"});return{id:crypto.randomUUID(),name:u.name,operationId:u.operationId,collectionPath:a,apiPath:{path:u.path,method:u.method},apiId:e,request:{pathParameters:mo(t.path||[],{in:"path"}),method:u.method.toLocaleUpperCase(),url:JE(Mku(u.path),i),headers:mo(t.header||[],{in:"header"}),queryParameters:i,cookies:mo(t.cookie||[],{in:"cookie"}),body:r,security:n},response:null}}function d9(u){const e=rX(u.parameters,"in"),a=sX(u),t=l9(u);return{parameters:{queryParameters:mo(e.query||[],{in:"query"}),headers:mo(e.header||[],{in:"header"}),cookies:mo(e.cookie||[],{in:"cookie"}),pathParameters:mo(e.path||[],{initializeWithInputs:!0,in:"path"})},requestBody:a,security:t}}function sX(u){const e=u.body?.mediaTypes;if(!e||!Object.keys(e).length)return TD();const a=Zku(e,u),t=a?.name||"",r=!o9.includes(t)&&!tX.includes(t),n=fF(a),i=r&&n.length?JSON.stringify(n.find(({key:o})=>o===u.body?.activeExampleName)?.value,null,2)||JSON.stringify(n[0].value,null,2):"";return{...TD(),activeExampleName:u.body?.activeExampleName||n[0]?.key||"",...a&&{type:a.name},content:i,formData:{"multipart/form-data":LR(e[Mt.FormData]),"application/x-www-form-urlencoded":LR(e[Mt["application/x-www-form-urlencoded"]])}}}function lX(u){return u?{...(Object.keys(u?.body?.mediaTypes||{})||[]).reduce((a,t)=>(a[t]={name:t,extensions:void 0},a),{}),...Ws}:Ws}function LR(u){if(!u)return[Ms()];if(!u.parameters)return[Ms()];const e=u.parameters.map(a=>({id:crypto.randomUUID(),key:a.name,value:String(a.example)||"",active:!0,type:a.inputType,files:null}));return e.push(Ms()),e}function fF(u){const e=u?.examples;return Object.keys(e||{}).map(a=>{const t=e?.[a];return{name:W.isString(t?.summary)?t?.summary:t?.summary?.raw||a,key:a,value:e?.[a].value}})}function Zku(u,e){const a=lX(e),t=Object.keys(u).find(r=>!!a[r]);return t?u[t]:null}function Qku(u){return!u?.security?.length||!u?[]:Jku(u)}function cX(u){const e=new Set;return u.flat().filter(a=>e.has(a.id)?!1:(e.add(a.id),!0))}function yg(u){if(u.type==="http"){if(u.scheme==="bearer")return ye.JWT;if(u.scheme==="basic")return ye.BasicAuth;if(u.scheme==="digest")return ye.DigestAuth}else{if(u.type==="apiKey")return ye.APIKey;if(u.type==="oauth2")return ye.OAuth2;if(u.type==="openIdConnect")return ye.OpenIDConnect}return ye.NoAuth}function Yku(u,e){if(u==="clientCredentials"&&e&&"x-assertionType"in e&&e["x-assertionType"]===DF)return Fe.ClientCredentialsWithJwtAssertion;if(u==="authorizationCode"&&e&&"x-usePkce"in e&&e["x-usePkce"])return Fe.AuthorizationCodeWithPkce;switch(u){case"implicit":return Fe.Implicit;case"password":return Fe.Password;case"clientCredentials":return Fe.ClientCredentials;case"authorizationCode":return Fe.AuthorizationCode;default:return Fe.AuthorizationCode}}function Xku(u,e){const a=u?.security;if(!a?.length)return[];const n=qku(a).flat().filter(i=>i.schemeId===e).find(i=>yg(i)===ye.OAuth2);return E9(n)}function E9(u){return Object.entries(u?.flows||{}).map(([e,a])=>Yku(e,a)).filter(Boolean)}async function UE(u){try{const e=await o3u(u),a=await JJ(u);return{absolutePath:u,file:new File([e],a)}}catch(e){return console.error("Failed to init replay file",e),null}}async function dX(u){return(await Promise.allSettled(u.map(a=>UE(a)))).map(a=>a.status==="fulfilled"?a.value:null).filter(a=>a!==null)}async function ebu(u,e,a,t,r,n){const i=await Promise.all(u.sourceDescriptions.map(async s=>({name:s.name,url:s.url,type:s.type,apiId:await ubu({projectPath:t,apiUrl:s.url,collectionId:e})}))),o={inputs:u.components?.inputs||{},parameters:Object.fromEntries(Object.entries(u.components?.parameters||{}).map(([s,l])=>[s,{...l,key:l.name,value:l.value,id:crypto.randomUUID(),active:!0}]))};return{...u,id:e,srcType:a,state:Nu.Normal,sourceDescriptions:i,components:o,workflows:await Promise.all(u.workflows.map(async s=>({...s,state:Nu.Normal,parameters:UR(s.parameters,s["x-replay-disabled-parameters"],u.components?.parameters),outputs:WR(s.outputs),security:GR(s["x-security"]),steps:await Promise.all(s.steps.map(async l=>{const c=UR(l.parameters,l["x-replay-disabled-parameters"],u.components?.parameters),d=l["x-operation"]??null;d&&(d.url=JE(d.url,c.queryParameters.filter(LI)));const E=abu(l,i,r);let p;if(E&&n){const m=r?.find(g=>g.id===E.apiId);p=n(E.path,E.method,m)}delete l.operationId,delete l["x-operation"];const x=await sbu(l.requestBody,t);return{...l,state:Nu.Normal,parameters:c,outputs:WR(l.outputs),successCriteria:l.successCriteria?.map(m=>({...m,type:m.type??wt.SIMPLE}))||[],requestBody:x,xOperation:d,security:GR(l["x-security"],p),operation:E}}))})))}}async function ubu({projectPath:u,apiUrl:e,collectionId:a}){if(qJ(e))return e;if(await za.isAbsolute(e))return await za.relative(u,e);const t=await za.resolve(await za.join(u,a,"..",e));return await za.relative(u,t)}function abu(u,e,a){if(u["x-operation"])return null;const{path:t,method:r,apiId:n}=EX({operationPath:u.operationPath,parsedSourceDescriptions:e}),{operationId:i,apiId:o}=tbu({operationId:u.operationId,parsedSourceDescriptions:e}),s=o||n||e[0]?.apiId||"",l=a?.find(c=>c.id===s);if(i&&l&&!t&&!r){const c=cbu(i,l);return{apiId:s,path:c?.path??"",method:c?.method??"",operationId:i}}return{apiId:s,path:t??"",method:r??"",operationId:i}}function tbu({operationId:u,parsedSourceDescriptions:e}){if(!u)return{operationId:"",apiId:null};const a=u.split(".");if(a.length===1)return{operationId:u,apiId:e[0]?.apiId??""};const[,t,r=""]=a,n=e.find(({name:i})=>i===t);return{operationId:r,apiId:n?.apiId??""}}function IR(u){return"reference"in u&&typeof u.reference=="string"}function EX({operationPath:u,parsedSourceDescriptions:e}){if(!u)return{apiId:null,path:"",method:""};try{const a=u.split("#"),t=a.length>1?a[1]:a[0],r=a.length>1?a[0]:"";if(!t)return{path:"",method:"",apiId:null};let n=null,i=null;const o=/\$sourceDescriptions\.(.+)\.url/,s=r.match(o);if(s&&(n=s[1]),n){const E=e.find(({name:p})=>p===n);E&&(i=E.apiId)}const l=t.split("/"),c=l.pop()||"";return{path:Vf.unescape(l.pop()||""),method:c.toLowerCase(),apiId:i}}catch{return{path:"",method:"",apiId:null}}}function rbu(u){switch(u.type){case"apiKey":return ye.APIKey;case"oauth2":return ye.OAuth2;case"openIdConnect":return ye.OpenIDConnect;case"http":return u.scheme==="basic"?ye.BasicAuth:u.scheme==="digest"?ye.DigestAuth:u.scheme==="bearer"?ye.JWT:ye.NoAuth;default:return ye.NoAuth}}function pX(u,e){const a={clientCredentials:Fe.ClientCredentials,authorizationCode:Fe.AuthorizationCode,implicit:Fe.Implicit,password:Fe.Password,clientCredentialsWithJwtAssertion:Fe.ClientCredentialsWithJwtAssertion,authorizationCodeWithPkce:Fe.AuthorizationCodeWithPkce};return u==="clientCredentials"&&e["x-assertionType"]==="urn:ietf:params:oauth:client-assertion-type:jwt-bearer"?Fe.ClientCredentialsWithJwtAssertion:u==="authorizationCode"&&e["x-usePkce"]?Fe.AuthorizationCodeWithPkce:a[u]??null}function nbu(u){return{query:P0.Query,header:P0.Header,cookie:P0.Cookie}[u.toLowerCase()]||P0.Header}function ibu(u){return{body:jt.Body,header:jt.Header,url:jt.URL}[u.toLowerCase()]||jt.URL}function KR(u,e,a){return Object.keys(u).reduce((t,r)=>{const n=pX(r,u[r]);if(!n)return t;switch(n){case Fe.ClientCredentials:t[n]={...a[n],clientId:e.clientId??"",clientSecret:e.clientSecret??"",clientAssertion:e.clientAssertion??"",tokenUrl:u[r].tokenUrl??"",scopes:ps(u[r].scopes,u[r]["x-replay-disabled-scopes"]),accessToken:e.accessToken??""};break;case Fe.AuthorizationCode:t[n]={...a[n],clientId:e.clientId??"",clientSecret:e.clientSecret??"",tokenUrl:u[r].tokenUrl??"",authorizationUrl:u[r].authorizationUrl??"",callbackUrl:e.callbackUrl??"",availableScopes:u[r].availableScopes??[],scopes:ps(u[r].scopes,u[r]["x-replay-disabled-scopes"]),accessToken:e.accessToken??""};break;case Fe.Implicit:t[n]={...a[n],clientId:e.clientId??"",authorizationUrl:u[r].authorizationUrl??"",callbackUrl:e.callbackUrl??"",availableScopes:ps(u[r].availableScopes),scopes:ps(u[r].scopes,u[r]["x-replay-disabled-scopes"]),accessToken:e.accessToken??""};break;case Fe.Password:t[n]={...a[n],tokenUrl:u[r].tokenUrl??"",username:e.username??"",password:e.password??"",clientId:e.clientId??"",clientSecret:e.clientSecret??"",accessToken:e.accessToken??""};break;case Fe.ClientCredentialsWithJwtAssertion:t[n]={...a[n],clientAssertion:e.clientAssertion??"",tokenUrl:u[r].tokenUrl??"",scopes:ps(u[r].scopes,u[r]["x-replay-disabled-scopes"]),clientId:e.clientId??"",clientSecret:e.clientSecret??"",accessToken:e.accessToken??""};break;case Fe.AuthorizationCodeWithPkce:t[n]={...a[n],tokenUrl:u[r].tokenUrl??"",authorizationUrl:u[r].authorizationUrl??"",callbackUrl:e.callbackUrl??"",availableScopes:ps(u[r].availableScopes),scopes:ps(u[r].scopes,u[r]["x-replay-disabled-scopes"]),codeVerifier:e.codeVerifier??"",codeChallenge:e.codeChallenge??"",clientId:e.clientId??"",clientSecret:e.clientSecret??"",accessToken:e.accessToken??""};break}return t},a)}function VR(u,e,a){const r={...Sn(),securityType:u},n=Object.keys(e.flows||{})[0],i=pX(n,e.flows?.[n])??Fe.ClientCredentials;switch(u){case ye.BasicAuth:return{...r,[ye.BasicAuth]:{username:a.username,password:a.password,schemeName:e.id}};case ye.JWT:return{...r,[ye.JWT]:{token:a.token,schemeName:e.id}};case ye.DigestAuth:return{...r,[ye.DigestAuth]:{...r[ye.DigestAuth],username:a.username,password:a.password,schemeName:e.id}};case ye.APIKey:return{...r,[ye.APIKey]:{location:nbu(e.in),name:e.name,key:a.apiKey,schemeName:e.id}};case ye.OAuth2:return{...r,[ye.OAuth2]:{...r[ye.OAuth2],...KR(e.flows||{},a||{},r[ye.OAuth2]),authRequestExtraParams:HR(a.authRequestExtraParams),tokenRequestExtraParams:qR(a.tokenRequestExtraParams),grantType:i,schemeName:e.id}};case ye.OpenIDConnect:return{...r,[ye.OpenIDConnect]:{...r[ye.OpenIDConnect],...KR(a.flows||{},a||{},r[ye.OpenIDConnect]),openIdConnectUrl:a.openIdConnectUrl,userInfoUrl:a.userInfoUrl,authRequestExtraParams:HR(a.authRequestExtraParams),tokenRequestExtraParams:qR(a.tokenRequestExtraParams),grantType:i,schemeName:e.id}};default:return r}}function obu(u,e){return[...u.map(t=>{if("scheme"in t){const n=rbu(t.scheme);return VR(n,t.scheme,t.values)}const r=e.find(n=>n.id===t.schemeName);if(r){const n=yg(r),i=VR(n,r,t.values);return i.securitySchemeId=r.id,i}return Sn()})]}function GR(u=[],e){const a=cX(e?.security||[]);return u.length?obu(u,a):[Sn()]}function ps(u,e){const a=no(u||{}),t=no(e||{});return[...a,...t,d0()]}function HR(u){return(u||[]).map(e=>({id:crypto.randomUUID(),key:e.key??"",value:e.value??"",active:e.active??!0})).concat(Y0())}function qR(u){return(u||[]).map(e=>({id:crypto.randomUUID(),key:e.key??"",value:e.value??"",active:e.active??!0,sendIn:ibu(e.in)})).concat(s9())}function WR(u){if(!u)return[Y0()];const e=[];for(const a in u)e.push({id:crypto.randomUUID(),key:a,value:u[a],active:!0});return e.push(Y0()),e}const Ih={query:"queryParameters",path:"pathParameters",header:"headers",cookie:"cookies"};function JR(u,e){const a="$components.parameters.";if(u.reference.startsWith(a)){const t=u.reference.replace(a,"");return e?.[t]}}function UR(u,e,a){if(!u&&!e)return{pathParameters:[Ba("path")],queryParameters:[Ba("query")],headers:[Ba("header")],cookies:[Ba("cookie")]};const t={pathParameters:[],queryParameters:[],headers:[],cookies:[]};if(u)for(const r of u)if(IR(r)){const n=JR(r,a),i=Ih[n?.in];i&&t[i].push({reference:r.reference,active:!0,value:r.value})}else t[Ih[r.in]].push({id:crypto.randomUUID(),key:r.name,value:r.value,active:!0,in:r.in});if(e)for(const r of e)if(IR(r)){const n=JR(r,a),i=Ih[n?.in];i&&t[i].push({reference:r.reference,active:!1,value:r.value})}else t[Ih[r.in]].push({id:crypto.randomUUID(),key:r.name,value:r.value,active:!1,in:r.in});return t.pathParameters.push(Ba("path")),t.queryParameters.push(Ba("query")),t.headers.push(Ba("header")),t.cookies.push(Ba("cookie")),t}async function sbu(u,e){const a=iX().body;if(!u)return a;switch(u.contentType){case"application/x-www-form-urlencoded":case"multipart/form-data":return{...a,type:u.contentType,formData:await lbu(u,e)};case"application/octet-stream":const t=u.payload?await mX(u.payload,e):[],r=t.length>0?await UE(t[0]):null;return{...a,type:u.contentType,binary:r};case"application/json":case"application/ld+json":return{...a,type:u.contentType,content:QR(u.payload)};default:{const n=typeof u.payload=="string",i=u.contentType||(n?"text/plain":"application/json");return{...a,type:i,content:n?u.payload:QR(u.payload)}}}}async function ZR(u,e,a,t){const r=await mX(e,t),n=r.length>0||Array.isArray(e),i=n?await dX(r):void 0;return{id:crypto.randomUUID(),key:u,value:n?"":e,type:n?"file":"text",active:a,files:i}}async function lbu(u,e){const a=iX().body.formData,t=u.contentType,r=u.payload?await Promise.all(Object.entries(u.payload).map(([o,s])=>ZR(o,s,!0,e))):[],n=u["x-replay-disabled-payload"]?await Promise.all(Object.entries(u["x-replay-disabled-payload"]||{}).map(([o,s])=>ZR(o,s,!1,e))):[];return{...a,[t]:[...r,...n,Ms()]}}function QR(u){return u?JSON.stringify(u,null,2):""}function cbu(u,e){for(const a of Object.keys(e.paths)){const t=e.paths[a];for(const r of Object.keys(t)){const n=r.toLowerCase();if(["get","put","post","delete","options","head","patch","trace"].includes(n)&&t[n]?.operationId===u)return{method:n,path:a}}}return null}async function mX(u,e){return Array.isArray(u)?(await Promise.all(u.map(a=>YR(a,e)))).flat():typeof u=="string"?await YR(u,e):[]}async function YR(u,e){const a=/\$file\(['"](.+?)['"]\)/g,t=Array.from(u.matchAll(a));return Promise.all(t.map(r=>dbu(r[1],e)))}async function dbu(u,e){return await za.isAbsolute(u)?u:await za.resolve(await za.join(e,u))}const Qt=u=>!u||typeof u=="boolean"?{type:"object",properties:{}}:u.type?u:{...u,type:"object"},XR=(u,e,a)=>{if(!u.properties)return u;const t=u.properties[e],r=Qt(t);return{...u,properties:{...u.properties,[e]:{...r,...a}}}},Ebu=(u,e,a)=>{if(!u.properties||e===a||!a.trim())return null;const t={...u.properties};return t[a]?null:(t[a]=t[e],delete t[e],{...u,properties:t})},pbu=(u,e)=>{if(!u.properties)return u;const a={...u.properties};return delete a[e],{...u,properties:a}},mbu=(u,e,a={type:"string"})=>{const t=u.properties||{};return{...u,type:"object",properties:{...t,[e]:a}}};function eN(u){const e=Object.assign({},...(u||[]).filter(({key:a,active:t})=>a&&t).map(a=>({[a.key]:a.value})));if(Object.keys(e).length!==0)return e}function uN(u){if(!u)return{};const e={queryParameters:"query",headers:"header",cookies:"cookie",pathParameters:"path"},a=[],t=[];return Object.keys(e).forEach(r=>{const n=r;u[n].forEach(i=>{if(xo(i)){const o={reference:i.reference,value:i.value||void 0};i.active?a.push(o):t.push(o)}else{if(!i.key)return;const o={name:i.key,in:e[n],value:i.value};i.active?a.push(o):t.push(o)}})}),{parameters:a.length>0?a:void 0,"x-replay-disabled-parameters":t.length>0?t:void 0}}function hbu(u){const e=u?.map(a=>({condition:a.condition,context:a.context,type:a.type==wt.SIMPLE?void 0:a.type}));if(e?.length!==0)return e}function xbu(u){if(!(!u||u.length===0))return[...u]}async function hX(u,e){return u.absolutePath?`$file('${await za.relative(e,u.absolutePath)}')`:null}async function Dbu(u,e){const{type:a,value:t,files:r}=u;switch(a){case"text":return t;case"file":let n=[];return r&&(n=(await Promise.all(Object.values(r).map(i=>hX(i,e)))).filter(i=>i!==null)),n.length===0?"":n.length===1?n[0]:n}}async function fbu(u,e){const a=u.type,t=u.formData[a],r={},n={};return await Promise.all(t.map(async i=>{const{key:o,active:s}=i;if(!o)return;const l=await Dbu(i,e);s?r[o]=l:n[o]=l})),{payload:Object.keys(r).length>0?r:void 0,"x-replay-disabled-payload":Object.keys(n).length>0?n:void 0}}function gbu(u){if(!u)return u;try{const e=JSON.parse(u);return typeof e=="object"?e:u}catch{return u}}async function vbu(u,e){if(u)switch(u.type){case"application/x-www-form-urlencoded":case"multipart/form-data":return{contentType:u.type,...await fbu(u,e)};case"application/octet-stream":return{contentType:u.type,payload:u.binary?await hX(u.binary,e):null};case"application/json":case"application/ld+json":return u.content?{contentType:u.type,payload:gbu(u.content)}:void 0;default:return u.content?{contentType:u.type,payload:u.content}:void 0}}function kbu(u){return{...u.schemeName?{schemeName:u.schemeName}:{scheme:{type:"http",scheme:"basic"}},values:{username:u.username,password:u.password}}}function bbu(u){return{...u.schemeName?{schemeName:u.schemeName}:{scheme:{type:"apiKey",name:u.name,in:u.location.toLowerCase()}},values:{apiKey:u.key}}}function ybu(u){return{...u.schemeName?{schemeName:u.schemeName}:{scheme:{type:"http",scheme:"bearer"}},values:{token:u.token}}}function Cbu(u){return{...u.schemeName?{schemeName:u.schemeName}:{scheme:{type:"http",scheme:"digest"}},values:{username:u.username,password:u.password}}}function Fbu(u){const{flows:e,values:a}=fX(u);return{...u.schemeName?{schemeName:u.schemeName}:{scheme:{type:"openIdConnect",flows:e}},values:{...a,openIdConnectUrl:u.openIdConnectUrl,userInfoUrl:u.userInfoUrl,authRequestExtraParams:xX(u.authRequestExtraParams),tokenRequestExtraParams:DX(u.tokenRequestExtraParams)}}}function Abu(u){const{flows:e,values:a}=fX(u);return{...u.schemeName?{schemeName:u.schemeName}:{scheme:{type:"oauth2",flows:e}},values:{...a,authRequestExtraParams:xX(u.authRequestExtraParams),tokenRequestExtraParams:DX(u.tokenRequestExtraParams)}}}function Gl(u){const e={},a={};return u.forEach(t=>{t.value&&(t.active?e[t.value]=t.description:a[t.value]=t.description)}),{scopes:e,"x-replay-disabled-scopes":Object.keys(a).length>0?a:void 0}}function xX(u){return u.filter(e=>e.value||e.key).map(e=>({key:e.key,value:e.value,active:e.active}))}function DX(u){return u.filter(e=>e.value||e.key).map(e=>({key:e.key,value:e.value,active:e.active,in:e.sendIn.toLowerCase()}))}function fX(u){let e;switch(u.grantType){case Fe.ClientCredentials:return e=u[Fe.ClientCredentials],{flows:{clientCredentials:{tokenUrl:e.tokenUrl,...Gl(e.scopes)}},values:{clientId:e.clientId,clientSecret:e.clientSecret,accessToken:e.accessToken}};case Fe.Implicit:return e=u[Fe.Implicit],{flows:{implicit:{authorizationUrl:e.authorizationUrl,...Gl(e.scopes)}},values:{clientId:e.clientId,accessToken:e.accessToken,callbackUrl:e.callbackUrl}};case Fe.Password:return e=u[Fe.Password],{flows:{password:{tokenUrl:e.tokenUrl,...Gl(e.scopes)}},values:{clientId:e.clientId,clientSecret:e.clientSecret,username:e.username,password:e.password,accessToken:e.accessToken}};case Fe.AuthorizationCode:return e=u[Fe.AuthorizationCode],{flows:{authorizationCode:{tokenUrl:e.tokenUrl,authorizationUrl:e.authorizationUrl,...Gl(e.scopes)}},values:{accessToken:e.accessToken,clientId:e.clientId,callbackUrl:e.callbackUrl}};case Fe.ClientCredentialsWithJwtAssertion:return e=u[Fe.ClientCredentialsWithJwtAssertion],{flows:{clientCredentials:{tokenUrl:e.tokenUrl,...Gl(e.scopes),"x-assertionType":"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}},values:{clientId:e.clientId,clientAssertion:e.clientAssertion,accessToken:e.accessToken}};case Fe.AuthorizationCodeWithPkce:return e=u[Fe.AuthorizationCodeWithPkce],{flows:{authorizationCode:{tokenUrl:e.tokenUrl,authorizationUrl:e.authorizationUrl,...Gl(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 aN(u){const e=u.map(a=>{switch(a.securityType){case ye.OpenIDConnect:{const r=a[ye.OpenIDConnect];return Fbu(r)}case ye.OAuth2:{const r=a[ye.OAuth2];return Abu(r)}case ye.APIKey:{const r=a[ye.APIKey];return bbu(r)}case ye.BasicAuth:{const r=a[ye.BasicAuth];return kbu(r)}case ye.DigestAuth:{const r=a[ye.DigestAuth];return Cbu(r)}case ye.JWT:{const r=a[ye.JWT];return ybu(r)}default:return null}}).filter(a=>a!==null);return{"x-security":e.length?e:void 0}}function Bbu(u){const{inputs:e,parameters:a,...t}=u;let r=t;return Object.keys(e).length&&(r.inputs=e),Object.keys(a).length&&(r.parameters=Object.fromEntries(Object.entries(a).map(([n,{id:i,active:o,key:s,...l}])=>[n,{...l,name:s}]))),Object.keys(r).length||(r=void 0),r}async function Sbu(u,e){const{id:a,state:t,srcType:r,sourceDescriptions:n,workflows:i,components:o,...s}=u;return{arazzoObject:{...s,sourceDescriptions:n.map(l=>({name:l.name,url:l.url,type:l.type||"openapi"})),components:Bbu(o),workflows:await Promise.all(i.map(async({parameters:l,security:c,dependsOn:d,outputs:E,state:p,steps:x,inputs:m,...g})=>({...g,dependsOn:xbu(d),outputs:eN(E),inputs:m?Qt(m):void 0,...aN(c),...uN(l),steps:await Promise.all(x.map(async({parameters:h,security:f,operation:k,requestBody:y,successCriteria:v,outputs:b,state:C,xOperation:B,...z})=>{const P={operationId:void 0,operationPath:void 0,"x-operation":void 0};if(k){const L=u.sourceDescriptions.find(({apiId:I})=>I===k.apiId)||u.sourceDescriptions[0];if(k.operationId){const I=u.sourceDescriptions.length<=1;P.operationId=I?k.operationId:`$sourceDescriptions.${L.name}.${k.operationId}`}else P.operationPath=`{$sourceDescriptions.${L.name}.url}#/paths/${Vf.escape(k.path)}/${k.method}`}else B&&(P["x-operation"]={...B,url:B.url.split("?")[0]});return{...z,...P,...aN(f),...uN(h),requestBody:await vbu(y,e),successCriteria:hbu(v),outputs:eN(b)}}))})))}}}class zbu extends QJ{constructor(e,a){super(e),this.convertOperationToReplayValue=a}parse(e,a){return ebu(e.content,e.uri,e.type,this.storage.baseDir,a,this.convertOperationToReplayValue)}async stringify(e){const{arazzoObject:a}=await Sbu(e,this.storage.baseDir);return await za.extname(e.id)===".json"?JSON.stringify(a,null,2):gi.dump(a)}}class wbu{constructor(e,a){this.storage=e,this.localStorageSecretsProvider=a}default=[];async read(){const e=await this.storage.get("replay-environments.yaml"),a=await this.localStorageSecretsProvider.get();let t=null,r=null;if(!e)return this.default;try{t=gi.load(e),r=a?JSON.parse(a):null}catch(o){return console.error("Failed to parse environments file",o),this.default}return t?Object.keys(t).filter(o=>o!=="version").map(o=>({name:o,inputs:Object.entries(t[o].inputs).map(([s,l])=>{if(typeof l=="string")return{name:s,value:l,isSecret:!1};const c=r?.[o]?.[s]??"";return{name:s,value:c,isSecret:!0}}),servers:Object.entries(t[o].servers).map(([s,l])=>({apiId:s,value:l.value,variables:Object.entries(l.variables||{}).map(([c,d])=>({name:c,value:d}))})),state:Nu.Normal})):this.default}async write(e){const a=await this.localStorageSecretsProvider.get(),t=a?JSON.parse(a):{},r=e.reduce((n,i)=>(i.name&&(n[i.name]={inputs:i.inputs.reduce((o,s)=>(s.isSecret&&t?(t[i.name]||(t[i.name]={}),t[i.name][s.name]=s.value,o[s.name]={provider:"local"}):o[s.name]=s.value,o),{}),servers:i.servers.reduce((o,s)=>(o[s.apiId]={value:s.value,variables:Object.fromEntries(s.variables.map(l=>[l.name,l.value]))},o),{})}),n),{});this.localStorageSecretsProvider.set(JSON.stringify(t)),r&&this.storage.set("replay-environments.yaml",gi.dump(r))}}class Obu{constructor(e,a,t){this.storage=e,this.filePath=a,this.defaultValue=t}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 Pbu=(u,e)=>({data:u,version:e});class gF extends Obu{constructor(e,a,t,r){super(e,a,t),this.version=r}migrationMap={};migrate(e){if(!this.migrationMap[e.version])return this.defaultValue;const a=this.migrationMap[e.version](e);return a.version===this.version?a:this.migrate(a)}async parse(e){const a=JSON.parse(e);if(a.version!==this.version){const t=this.migrate(a);return await this.write(t.data),t.data}return a.data}stringify(e){return JSON.stringify(Pbu(e,this.version))}}function jbu(u){return{data:{...u.data,tabs:u.data.tabs.map(e=>e.data.type===We.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 tN=2,Mbu="tabs.json";class Tbu extends gF{migrationMap={1:jbu};constructor(e){super(e,Mbu,Ei(HJ),tN)}async parse(e){let a=JSON.parse(e);a.version!==tN&&(a=this.migrate(a));const t=await Promise.all(a.data.tabs.map(async r=>{if(r.data.type===We.Step&&r.data.draftStep){const n=r.data.draftStep.requestBody.formData;n["multipart/form-data"]=await rN(n["multipart/form-data"]),n["application/x-www-form-urlencoded"]=await rN(n["application/x-www-form-urlencoded"]),r.data.draftStep.requestBody.binary&&r.data.draftStep.requestBody.binary.absolutePath&&(r.data.draftStep.requestBody.binary=await UE(r.data.draftStep.requestBody.binary.absolutePath))}return r}));return{...a.data,tabs:t}}stringify(e){return super.stringify({...e,tabs:e.tabs.map(a=>a.data.type===We.Step?{...a,data:{...a.data,response:null}}:a.data.type===We.WorkflowRun?{...a,data:{...a.data,result:null}}:a)})}}async function rN(u){return Promise.all(u.map(async e=>{const a={...e};if(e.files){const t=e.files.map(r=>r.absolutePath).filter(r=>r!==null);a.files=await dX(t)}return a}))}const $bu=1,Rbu=1;class Nbu{constructor(e,a){this.project=e,this.convertOperationToReplayValue=a,this.localStorageSecretsProvider=new d3u(this.project.id),this.systemFilesStorage=this.isTauriApp?new uM(this.project.systemFilesDir):new Yj(this.project.systemFilesDir),this.userFilesStorage=this.isTauriApp?new uM(this.project.userFilesDir):new Yj(this.project.userFilesDir);const t=new u3u;this.historyStorage=new gF(this.systemFilesStorage,"history.json",[],$bu),this.activeEnvironmentIdStorage=new gF(this.systemFilesStorage,"active_environment_id.json",RE,Rbu),this.tabsStateStorage=new Tbu(this.systemFilesStorage),this.environmentsStorage=new wbu(this.userFilesStorage,this.localStorageSecretsProvider),this.collectionsStorage=new zbu(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new E3u(this.isTauriApp?this.userFilesStorage:t)}historyStorage;activeEnvironmentIdStorage;tabsStateStorage;environmentsStorage;collectionsStorage;apisStorage;isTauriApp=Cc();systemFilesStorage;localStorageSecretsProvider;userFilesStorage;async detectProjectFiles(){const a=(await this.userFilesStorage.ls()).filter(i=>/\.(ya?ml|json)$/.test(i)),t=[],r=[],n=new Set;return await Promise.all(a.map(async i=>{const o=await this.userFilesStorage.get(i);if(o)try{const s=gi.load(o);typeof s=="object"&&s!==null&&(typeof s.openapi=="string"?t.push({uri:i,type:mn.FS,content:s}):typeof s.arazzo=="string"&&(r.push({uri:i,type:mn.FS,content:s}),s.sourceDescriptions?.map(async l=>{const c=l.type,d=l.url,E=!c||c==="openapi",p=typeof d=="string"&&qJ(d);E&&p&&n.add(d)})))}catch(s){console.error(`Error parsing YAML/JSON file ${i}:`,s)}})),{apiFiles:t,collectionFiles:r,apiUrls:n}}async loadApis(e){const a=[];return await Promise.all(Array.from(e).map(async t=>{let r="";try{const n=await hn(uue({proxyUrl:IJ,resolvedUrl:t,ignoreProxy:this.isTauriApp}));r=await n.text(),n.ok||console.error(`Error fetching API from ${t}:`,n.status,r)}catch(n){console.error(`Error fetching API from ${t}:`,n)}try{const n=gi.load(r);typeof n=="object"&&n!==null&&typeof n.openapi=="string"&&a.push({uri:t,type:mn.WEB,content:n})}catch(n){console.error(`Error parsing YAML from ${t}:`,n)}})),a}async read(){const[e,a,t,r]=await Promise.all([this.historyStorage.read(),this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]),{apiFiles:n,collectionFiles:i,apiUrls:o}=await this.detectProjectFiles(),s=await this.loadApis(o),l=await this.apisStorage.parseMany([...n,...s]),c=await this.collectionsStorage.parseMany(i,l);return{project:this.project,history:e,activeEnvironmentId:a,tabsState:t,environments:r,apis:l,collections:c}}async update(e,a){switch(e.path[0]){case"history":this.historyStorage.write(a.history.get());break;case"activeEnvironmentId":this.activeEnvironmentIdStorage.write(a.activeEnvironmentId.get());break;case"tabsState":this.tabsStateStorage.write(a.tabsState.get());break;case"environments":this.environmentsStorage.write(a.environments.get());break;case"apis":this.isTauriApp&&await this.apisStorage.update(e,a.apis.get());break;case"collections":await this.collectionsStorage.update(e,a.collections.get());break}}}function gX(u=!1){let e,a=!1;return()=>({id:"RootStoragePlugin",onCreate:()=>({init:t=>async(r,n)=>{if(a||t.path.length>0)return{isInitialized:!1};if(a=!0,!u){e=new Nbu(r,n);const i=await e.read();t.merge(i)}return a=!1,{isInitialized:!0}}}),onSet(t,r,n){a||u||e.update(r,n)}})}function vX({defaultEnvironments:u}={}){return structuredClone({project:{id:"default",userFilesDir:"default",systemFilesDir:"default"},history:[],tabsState:Ei(HJ),activeEnvironmentId:RE,environments:u||GJ,collections:[],apis:[],requestController:null,apps:{apps:[],appsLoadingState:Ur.Idle},predefinedApiId:null,predefinedEnvironmentNames:new Set,predefinedInputNames:new Set})}const _bu=$I(vX(),RI(ZEu({key:"replay-root-store"}),gX())),p9=H.createContext(_bu),Lbu=p9.Provider;function Su(){const u=H.useContext(p9);return NI(u)}function Ibu(){return{theme:"light",disableCollectionsTab:!1,oAuth2RedirectURI:null,corsProxyUrl:void 0,mockServer:void 0,certificates:[],isApiBased:!1,generatedEnvironments:[],generatedInputs:[]}}const Kbu=Ibu(),Vbu=H.createContext(Kbu);function Pi(){const u=H.useContext(Vbu);return NI(u)}function Gbu(u,e){const{apps:{apiId:a}}=Su(),{corsProxyUrl:t,disableCollectionsTab:r,mockServer:n,oAuth2RedirectURI:i,certificates:o,storageKey:s,isApiBased:l}=Pi();t.set(u?.corsProxyUrl??IJ),n.set(u?.mockServer),a.set(u?.apiId),i.set(u?.oAuth2RedirectURI),r.set(!!u?.disableCollectionsTab),s.set(u?.storageKey),l.set(!!e),H.useEffect(()=>{o.set(u?.certificates||[])},[u?.certificates])}const Cg=H.createContext({});function ZE(){return H.useContext(Cg)||{}}const Hbu="0.18.0-next.13",qbu={version:Hbu};class Wbu{client;_isInitialized=!1;constructor(){this.client=new PEu}get isInitialized(){return this._isInitialized}init(e){if(this.isInitialized)return;const t={serviceName:"replay",serviceVersion:qbu.version,version:"1.0.0",tracerName:e?.tracerName||"desktop",collectorUrl:e?.collectorUrl||"",isProd:!0};this.client.init({otel:{...t,...e}}),this._isInitialized=!0}sendEvent(e,a){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}try{this.client.send(e,a)}catch(t){console.error("Failed to send telemetry event:",t)}}}const eb=new Wbu;function yu(){const{telemetry:u}=ZE();return eb.isInitialized||eb.init({tracerName:u?.tracerName,collectorUrl:u?.collectorUrl}),{sendEvent:(e,a)=>{eb.sendEvent(e,a)}}}const Tt=800;function Js(u){"@babel/helpers - typeof";return Js=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Js(u)}function Jbu(u,e){if(Js(u)!="object"||!u)return u;var a=u[Symbol.toPrimitive];if(a!==void 0){var t=a.call(u,e);if(Js(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(u)}function kX(u){var e=Jbu(u,"string");return Js(e)=="symbol"?e:e+""}function X4(u,e,a){return(e=kX(e))in u?Object.defineProperty(u,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):u[e]=a,u}function nN(u,e){var a=Object.keys(u);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(u);e&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(u,r).enumerable})),a.push.apply(a,t)}return a}function Ye(u){for(var e=1;e<arguments.length;e++){var a=arguments[e]!=null?arguments[e]:{};e%2?nN(Object(a),!0).forEach(function(t){X4(u,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(a)):nN(Object(a)).forEach(function(t){Object.defineProperty(u,t,Object.getOwnPropertyDescriptor(a,t))})}return u}function Ubu(u){if(Array.isArray(u))return u}function Zbu(u,e){var a=u==null?null:typeof Symbol<"u"&&u[Symbol.iterator]||u["@@iterator"];if(a!=null){var t,r,n,i,o=[],s=!0,l=!1;try{if(n=(a=a.call(u)).next,e===0){if(Object(a)!==a)return;s=!1}else for(;!(s=(t=n.call(a)).done)&&(o.push(t.value),o.length!==e);s=!0);}catch(c){l=!0,r=c}finally{try{if(!s&&a.return!=null&&(i=a.return(),Object(i)!==i))return}finally{if(l)throw r}}return o}}function vF(u,e){(e==null||e>u.length)&&(e=u.length);for(var a=0,t=Array(e);a<e;a++)t[a]=u[a];return t}function bX(u,e){if(u){if(typeof u=="string")return vF(u,e);var a={}.toString.call(u).slice(8,-1);return a==="Object"&&u.constructor&&(a=u.constructor.name),a==="Map"||a==="Set"?Array.from(u):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?vF(u,e):void 0}}function Qbu(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
525
525
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xi(u,e){return Ubu(u)||Zbu(u,e)||bX(u,e)||Qbu()}function Ybu(u,e){if(u==null)return{};var a={};for(var t in u)if({}.hasOwnProperty.call(u,t)){if(e.indexOf(t)!==-1)continue;a[t]=u[t]}return a}function ji(u,e){if(u==null)return{};var a,t,r=Ybu(u,e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(u);for(t=0;t<n.length;t++)a=n[t],e.indexOf(a)===-1&&{}.propertyIsEnumerable.call(u,a)&&(r[a]=u[a])}return r}var Xbu=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function eyu(u){var e=u.defaultInputValue,a=e===void 0?"":e,t=u.defaultMenuIsOpen,r=t===void 0?!1:t,n=u.defaultValue,i=n===void 0?null:n,o=u.inputValue,s=u.menuIsOpen,l=u.onChange,c=u.onInputChange,d=u.onMenuClose,E=u.onMenuOpen,p=u.value,x=ji(u,Xbu),m=H.useState(o!==void 0?o:a),g=xi(m,2),h=g[0],f=g[1],k=H.useState(s!==void 0?s:r),y=xi(k,2),v=y[0],b=y[1],C=H.useState(p!==void 0?p:i),B=xi(C,2),z=B[0],P=B[1],L=H.useCallback(function(re,he){typeof l=="function"&&l(re,he),P(re)},[l]),I=H.useCallback(function(re,he){var j;typeof c=="function"&&(j=c(re,he)),f(j!==void 0?j:re)},[c]),G=H.useCallback(function(){typeof E=="function"&&E(),b(!0)},[E]),X=H.useCallback(function(){typeof d=="function"&&d(),b(!1)},[d]),U=o!==void 0?o:h,ae=s!==void 0?s:v,Ee=p!==void 0?p:z;return Ye(Ye({},x),{},{inputValue:U,menuIsOpen:ae,onChange:L,onInputChange:I,onMenuClose:X,onMenuOpen:G,value:Ee})}function tu(){return tu=Object.assign?Object.assign.bind():function(u){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var t in a)({}).hasOwnProperty.call(a,t)&&(u[t]=a[t])}return u},tu.apply(null,arguments)}function uyu(u,e){if(!(u instanceof e))throw new TypeError("Cannot call a class as a function")}function iN(u,e){for(var a=0;a<e.length;a++){var t=e[a];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(u,kX(t.key),t)}}function ayu(u,e,a){return e&&iN(u.prototype,e),a&&iN(u,a),Object.defineProperty(u,"prototype",{writable:!1}),u}function kF(u,e){return kF=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,t){return a.__proto__=t,a},kF(u,e)}function tyu(u,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");u.prototype=Object.create(e&&e.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),Object.defineProperty(u,"prototype",{writable:!1}),e&&kF(u,e)}function $D(u){return $D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},$D(u)}function yX(){try{var u=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yX=function(){return!!u})()}function ryu(u){if(u===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u}function nyu(u,e){if(e&&(Js(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ryu(u)}function iyu(u){var e=yX();return function(){var a,t=$D(u);if(e){var r=$D(this).constructor;a=Reflect.construct(t,arguments,r)}else a=t.apply(this,arguments);return nyu(this,a)}}function oyu(u){if(Array.isArray(u))return vF(u)}function syu(u){if(typeof Symbol<"u"&&u[Symbol.iterator]!=null||u["@@iterator"]!=null)return Array.from(u)}function lyu(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
526
526
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function m9(u){return oyu(u)||syu(u)||bX(u)||lyu()}function cyu(u){if(u.sheet)return u.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===u)return document.styleSheets[e]}function dyu(u){var e=document.createElement("style");return e.setAttribute("data-emotion",u.key),u.nonce!==void 0&&e.setAttribute("nonce",u.nonce),e.appendChild(document.createTextNode("")),e.setAttribute("data-s",""),e}var Eyu=(function(){function u(a){var t=this;this._insertTag=function(r){var n;t.tags.length===0?t.insertionPoint?n=t.insertionPoint.nextSibling:t.prepend?n=t.container.firstChild:n=t.before:n=t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(r,n),t.tags.push(r)},this.isSpeedy=a.speedy===void 0?process.env.NODE_ENV==="production":a.speedy,this.tags=[],this.ctr=0,this.nonce=a.nonce,this.key=a.key,this.container=a.container,this.prepend=a.prepend,this.insertionPoint=a.insertionPoint,this.before=null}var e=u.prototype;return e.hydrate=function(t){t.forEach(this._insertTag)},e.insert=function(t){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(dyu(this));var r=this.tags[this.tags.length-1];if(process.env.NODE_ENV!=="production"){var n=t.charCodeAt(0)===64&&t.charCodeAt(1)===105;n&&this._alreadyInsertedOrderInsensitiveRule&&console.error(`You're attempting to insert the following rule:
527
527
  `+t+"\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules."),this._alreadyInsertedOrderInsensitiveRule=this._alreadyInsertedOrderInsensitiveRule||!n}if(this.isSpeedy){var i=cyu(r);try{i.insertRule(t,i.cssRules.length)}catch(o){process.env.NODE_ENV!=="production"&&!/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear|-ms-expand|-ms-reveal){/.test(t)&&console.error('There was a problem inserting the following rule: "'+t+'"',o)}}else r.appendChild(document.createTextNode(t));this.ctr++},e.flush=function(){this.tags.forEach(function(t){return t.parentNode&&t.parentNode.removeChild(t)}),this.tags=[],this.ctr=0,process.env.NODE_ENV!=="production"&&(this._alreadyInsertedOrderInsensitiveRule=!1)},u})(),At="-ms-",RD="-moz-",Vu="-webkit-",h9="comm",x9="rule",D9="decl",pyu="@import",CX="@keyframes",myu=Math.abs,Fg=String.fromCharCode,hyu=Object.assign;function xyu(u,e){return pt(u,0)^45?(((e<<2^pt(u,0))<<2^pt(u,1))<<2^pt(u,2))<<2^pt(u,3):0}function FX(u){return u.trim()}function Dyu(u,e){return(u=e.exec(u))?u[0]:u}function Zu(u,e,a){return u.replace(e,a)}function bF(u,e){return u.indexOf(e)}function pt(u,e){return u.charCodeAt(e)|0}function pE(u,e,a){return u.slice(e,a)}function en(u){return u.length}function f9(u){return u.length}function Kh(u,e){return e.push(u),u}function fyu(u,e){return u.map(e).join("")}var Ag=1,lc=1,AX=0,m0=0,La=0,jc="";function Bg(u,e,a,t,r,n,i){return{value:u,root:e,parent:a,type:t,props:r,children:n,line:Ag,column:lc,length:i,return:""}}function j4(u,e){return hyu(Bg("",null,null,"",null,null,0),u,{length:-u.length},e)}function gyu(){return La}function vyu(){return La=m0>0?pt(jc,--m0):0,lc--,La===10&&(lc=1,Ag--),La}function M0(){return La=m0<AX?pt(jc,m0++):0,lc++,La===10&&(lc=1,Ag++),La}function gn(){return pt(jc,m0)}function Rx(){return m0}function QE(u,e){return pE(jc,u,e)}function mE(u){switch(u){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function BX(u){return Ag=lc=1,AX=en(jc=u),m0=0,[]}function SX(u){return jc="",u}function Nx(u){return FX(QE(m0-1,yF(u===91?u+2:u===40?u+1:u)))}function kyu(u){for(;(La=gn())&&La<33;)M0();return mE(u)>2||mE(La)>3?"":" "}function byu(u,e){for(;--e&&M0()&&!(La<48||La>102||La>57&&La<65||La>70&&La<97););return QE(u,Rx()+(e<6&&gn()==32&&M0()==32))}function yF(u){for(;M0();)switch(La){case u:return m0;case 34:case 39:u!==34&&u!==39&&yF(La);break;case 40:u===41&&yF(u);break;case 92:M0();break}return m0}function yyu(u,e){for(;M0()&&u+La!==57;)if(u+La===84&&gn()===47)break;return"/*"+QE(e,m0-1)+"*"+Fg(u===47?u:M0())}function Cyu(u){for(;!mE(gn());)M0();return QE(u,m0)}function Fyu(u){return SX(_x("",null,null,null,[""],u=BX(u),0,[0],u))}function _x(u,e,a,t,r,n,i,o,s){for(var l=0,c=0,d=i,E=0,p=0,x=0,m=1,g=1,h=1,f=0,k="",y=r,v=n,b=t,C=k;g;)switch(x=f,f=M0()){case 40:if(x!=108&&pt(C,d-1)==58){bF(C+=Zu(Nx(f),"&","&\f"),"&\f")!=-1&&(h=-1);break}case 34:case 39:case 91:C+=Nx(f);break;case 9:case 10:case 13:case 32:C+=kyu(x);break;case 92:C+=byu(Rx()-1,7);continue;case 47:switch(gn()){case 42:case 47:Kh(Ayu(yyu(M0(),Rx()),e,a),s);break;default:C+="/"}break;case 123*m:o[l++]=en(C)*h;case 125*m:case 59:case 0:switch(f){case 0:case 125:g=0;case 59+c:p>0&&en(C)-d&&Kh(p>32?sN(C+";",t,a,d-1):sN(Zu(C," ","")+";",t,a,d-2),s);break;case 59:C+=";";default:if(Kh(b=oN(C,e,a,l,c,r,o,k,y=[],v=[],d),n),f===123)if(c===0)_x(C,e,b,b,y,n,d,o,v);else switch(E===99&&pt(C,3)===110?100:E){case 100:case 109:case 115:_x(u,b,b,t&&Kh(oN(u,b,b,0,0,r,o,k,r,y=[],d),v),r,v,d,o,t?y:v);break;default:_x(C,b,b,b,[""],v,0,o,v)}}l=c=p=0,m=h=1,k=C="",d=i;break;case 58:d=1+en(C),p=x;default:if(m<1){if(f==123)--m;else if(f==125&&m++==0&&vyu()==125)continue}switch(C+=Fg(f),f*m){case 38:h=c>0?1:(C+="\f",-1);break;case 44:o[l++]=(en(C)-1)*h,h=1;break;case 64:gn()===45&&(C+=Nx(M0())),E=gn(),c=d=en(k=C+=Cyu(Rx())),f++;break;case 45:x===45&&en(C)==2&&(m=0)}}return n}function oN(u,e,a,t,r,n,i,o,s,l,c){for(var d=r-1,E=r===0?n:[""],p=f9(E),x=0,m=0,g=0;x<t;++x)for(var h=0,f=pE(u,d+1,d=myu(m=i[x])),k=u;h<p;++h)(k=FX(m>0?E[h]+" "+f:Zu(f,/&\f/g,E[h])))&&(s[g++]=k);return Bg(u,e,a,r===0?x9:o,s,l,c)}function Ayu(u,e,a){return Bg(u,e,a,h9,Fg(gyu()),pE(u,2,-2),0)}function sN(u,e,a,t){return Bg(u,e,a,D9,pE(u,0,t),pE(u,t+1,-1),t)}function M1(u,e){for(var a="",t=f9(u),r=0;r<t;r++)a+=e(u[r],r,u,e)||"";return a}function Byu(u,e,a,t){switch(u.type){case pyu:case D9:return u.return=u.return||u.value;case h9:return"";case CX:return u.return=u.value+"{"+M1(u.children,t)+"}";case x9:u.value=u.props.join(",")}return en(a=M1(u.children,t))?u.return=u.value+"{"+a+"}":""}function Syu(u){var e=f9(u);return function(a,t,r,n){for(var i="",o=0;o<e;o++)i+=u[o](a,t,r,n)||"";return i}}function zyu(u){return function(e){e.root||(e=e.return)&&u(e)}}function wyu(u){var e=Object.create(null);return function(a){return e[a]===void 0&&(e[a]=u(a)),e[a]}}var Oyu=function(e,a,t){for(var r=0,n=0;r=n,n=gn(),r===38&&n===12&&(a[t]=1),!mE(n);)M0();return QE(e,m0)},Pyu=function(e,a){var t=-1,r=44;do switch(mE(r)){case 0:r===38&&gn()===12&&(a[t]=1),e[t]+=Oyu(m0-1,a,t);break;case 2:e[t]+=Nx(r);break;case 4:if(r===44){e[++t]=gn()===58?"&\f":"",a[t]=e[t].length;break}default:e[t]+=Fg(r)}while(r=M0());return e},jyu=function(e,a){return SX(Pyu(BX(e),a))},lN=new WeakMap,Myu=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var a=e.value,t=e.parent,r=e.column===t.column&&e.line===t.line;t.type!=="rule";)if(t=t.parent,!t)return;if(!(e.props.length===1&&a.charCodeAt(0)!==58&&!lN.get(t))&&!r){lN.set(e,!0);for(var n=[],i=jyu(a,n),o=t.props,s=0,l=0;s<i.length;s++)for(var c=0;c<o.length;c++,l++)e.props[l]=n[s]?i[s].replace(/&\f/g,o[c]):o[c]+" "+i[s]}}},Tyu=function(e){if(e.type==="decl"){var a=e.value;a.charCodeAt(0)===108&&a.charCodeAt(2)===98&&(e.return="",e.value="")}},$yu="emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason",Ryu=function(e){return e.type==="comm"&&e.children.indexOf($yu)>-1},Nyu=function(e){return function(a,t,r){if(!(a.type!=="rule"||e.compat)){var n=a.value.match(/(:first|:nth|:nth-last)-child/g);if(n){for(var i=a.parent===r[0],o=i?r[0].children:r,s=o.length-1;s>=0;s--){var l=o[s];if(l.line<a.line)break;if(l.column<a.column){if(Ryu(l))return;break}}n.forEach(function(c){console.error('The pseudo class "'+c+'" is potentially unsafe when doing server-side rendering. Try changing it to "'+c.split("-child")[0]+'-of-type".')})}}}},zX=function(e){return e.type.charCodeAt(1)===105&&e.type.charCodeAt(0)===64},_yu=function(e,a){for(var t=e-1;t>=0;t--)if(!zX(a[t]))return!0;return!1},cN=function(e){e.type="",e.value="",e.return="",e.children="",e.props=""},Lyu=function(e,a,t){zX(e)&&(e.parent?(console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles."),cN(e)):_yu(a,t)&&(console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules."),cN(e)))};function wX(u,e){switch(xyu(u,e)){case 5103:return Vu+"print-"+u+u;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Vu+u+u;case 5349:case 4246:case 4810:case 6968:case 2756:return Vu+u+RD+u+At+u+u;case 6828:case 4268:return Vu+u+At+u+u;case 6165:return Vu+u+At+"flex-"+u+u;case 5187:return Vu+u+Zu(u,/(\w+).+(:[^]+)/,Vu+"box-$1$2"+At+"flex-$1$2")+u;case 5443:return Vu+u+At+"flex-item-"+Zu(u,/flex-|-self/,"")+u;case 4675:return Vu+u+At+"flex-line-pack"+Zu(u,/align-content|flex-|-self/,"")+u;case 5548:return Vu+u+At+Zu(u,"shrink","negative")+u;case 5292:return Vu+u+At+Zu(u,"basis","preferred-size")+u;case 6060:return Vu+"box-"+Zu(u,"-grow","")+Vu+u+At+Zu(u,"grow","positive")+u;case 4554:return Vu+Zu(u,/([^-])(transform)/g,"$1"+Vu+"$2")+u;case 6187:return Zu(Zu(Zu(u,/(zoom-|grab)/,Vu+"$1"),/(image-set)/,Vu+"$1"),u,"")+u;case 5495:case 3959:return Zu(u,/(image-set\([^]*)/,Vu+"$1$`$1");case 4968:return Zu(Zu(u,/(.+:)(flex-)?(.*)/,Vu+"box-pack:$3"+At+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Vu+u+u;case 4095:case 3583:case 4068:case 2532:return Zu(u,/(.+)-inline(.+)/,Vu+"$1$2")+u;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(en(u)-1-e>6)switch(pt(u,e+1)){case 109:if(pt(u,e+4)!==45)break;case 102:return Zu(u,/(.+:)(.+)-([^]+)/,"$1"+Vu+"$2-$3$1"+RD+(pt(u,e+3)==108?"$3":"$2-$3"))+u;case 115:return~bF(u,"stretch")?wX(Zu(u,"stretch","fill-available"),e)+u:u}break;case 4949:if(pt(u,e+1)!==115)break;case 6444:switch(pt(u,en(u)-3-(~bF(u,"!important")&&10))){case 107:return Zu(u,":",":"+Vu)+u;case 101:return Zu(u,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Vu+(pt(u,14)===45?"inline-":"")+"box$3$1"+Vu+"$2$3$1"+At+"$2box$3")+u}break;case 5936:switch(pt(u,e+11)){case 114:return Vu+u+At+Zu(u,/[svh]\w+-[tblr]{2}/,"tb")+u;case 108:return Vu+u+At+Zu(u,/[svh]\w+-[tblr]{2}/,"tb-rl")+u;case 45:return Vu+u+At+Zu(u,/[svh]\w+-[tblr]{2}/,"lr")+u}return Vu+u+At+u+u}return u}var Iyu=function(e,a,t,r){if(e.length>-1&&!e.return)switch(e.type){case D9:e.return=wX(e.value,e.length);break;case CX:return M1([j4(e,{value:Zu(e.value,"@","@"+Vu)})],r);case x9:if(e.length)return fyu(e.props,function(n){switch(Dyu(n,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return M1([j4(e,{props:[Zu(n,/:(read-\w+)/,":"+RD+"$1")]})],r);case"::placeholder":return M1([j4(e,{props:[Zu(n,/:(plac\w+)/,":"+Vu+"input-$1")]}),j4(e,{props:[Zu(n,/:(plac\w+)/,":"+RD+"$1")]}),j4(e,{props:[Zu(n,/:(plac\w+)/,At+"input-$1")]})],r)}return""})}},Kyu=[Iyu],Vyu=function(e){var a=e.key;if(process.env.NODE_ENV!=="production"&&!a)throw new Error(`You have to configure \`key\` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.
@@ -2039,7 +2039,7 @@ Use the data prop if you want to provide your own handlers.`);if(u.initialData){
2039
2039
  gap: var(--spacing-xs);
2040
2040
  `,Xx={[wt.SIMPLE]:{label:"Simple",tooltipContent:"Success criteria conditions in the form of basic literals, operators, and loose comparisons"},[wt.REGEX]:{label:"Regex",tooltipContent:"Regex patterns used as success criteria conditions"},[wt.JSONPATH]:{label:"JSONPath",tooltipContent:"JSONPath expressions as success criteria conditions"},[wt.XPATH]:{label:"XPath",tooltipContent:"XPath expressions as success criteria conditions"}},wTu=Object.keys(Xx);function OTu({successCriteria:u}){const{sendEvent:e}=yu(),a=n=>{e("button.click",{source:"workflow",action:"add_success_criteria",success_criteria_type:n}),u.set(i=>[...i||[],{...Nku(n)}])},t=H.useMemo(()=>u.filter(n=>n.get()!==void 0),[u]),r=n=>{e("button.click",{source:"workflow",action:"remove_success_criteria",success_criteria_type:n.get().type,condition:n.get().condition}),n.set(lu)};return D.jsxs(D.Fragment,{children:[D.jsxs(J0,{children:["Success criteria",D.jsx(br,{content:"List of conditions required to complete the step."})]}),t.map(n=>D.jsx(H.Fragment,{children:D.jsx(FTu,{successCriteria:n,label:Xx[n.get().type].label,tooltipContent:Xx[n.get().type].tooltipContent,additionalActions:D.jsx(Yt,{"data-testid":"remove-success-criteria-button",variant:"text",icon:D.jsx(W.TrashCanIcon,{}),onClick:()=>r(n)})})},n.get().id)),D.jsx(PTu,{renderInput:()=>D.jsx(W.Button,{variant:"outlined",icon:D.jsx(W.AddIcon,{}),iconPosition:"left",size:"small",children:"Add success criteria"}),dataTestId:"workflow-step-success-criteria-select",options:wTu.map(n=>({element:Xx[n].label,label:n,value:n})),onChange:n=>{a(n)},placement:"top",hideCheckmarkIcon:!0})]})}const PTu=N(W.Select)`
2041
2041
  border-radius: var(--border-radius-md);
2042
- `;function jTu({step:u,workflowId:e,collectionId:a}){const{handleIdChange:t}=sl(),r=u.stepId.get();return D.jsx(D.Fragment,{children:D.jsxs(Zae,{children:[D.jsx(J0,{children:"Info"}),D.jsxs(Lu,{children:[D.jsxs(Lu.Row,{children:[D.jsx(Lu.Cell,{children:D.jsxs(J0,{children:["Step ID",D.jsx(br,{content:"This step's unique identifier"})]})}),D.jsx(Lu.Cell,{$readonly:!0,children:D.jsx(TF,{attribute:u.stepId,editorTitle:"Change step ID",placeholder:"Add step ID",onSave:n=>{a&&e&&t({collectionId:a,workflowId:e,stepId:r},{collectionId:a,workflowId:e,stepId:n})}})})]}),D.jsxs(Lu.Row,{children:[D.jsx(Lu.Cell,{children:D.jsxs(J0,{children:["Description",D.jsx(br,{content:"The step's purpose in the workflow."})]})}),D.jsx(Lu.Cell,{children:D.jsx(V9,{state:u.description,placeholder:"Add description"})})]})]}),D.jsxs(N1,{children:[D.jsx(J0,{children:"Operation"}),D.jsx(fTu,{step:u,collectionId:a})]}),D.jsx(N1,{children:D.jsx(Qae,{outputs:u.outputs,tooltipText:"Data generated in this step that can be used in the next steps."})}),D.jsx(N1,{children:D.jsx(OTu,{successCriteria:u.successCriteria})})]})})}function MTu({onParameterChange:u,files:e}){const a=H.useRef(null),t=o=>{o.target.files?.length&&u(Array.from(o.target.files).map(s=>({absolutePath:null,file:s})))},r=async()=>{if(Cc())try{const{open:o}=await Promise.resolve().then(()=>require("./replay-index-BE1z41ZI.js")),s=await o({multiple:!0});if(!s)return;const c=(Array.isArray(s)?s:[s]).map(UE),E=(await Promise.all(c)).filter(p=>p!==null);u(E)}catch(o){console.error("Failed to open file dialog or read file:",o)}else a.current?.click()},n=H.useCallback(()=>{u(null)},[u]),i=H.useMemo(()=>{if(!e)return null;if(e.length===1)return D.jsx($L,{icon:D.jsx(W.CloseIcon,{}),variant:"secondary",onClick:n,iconPosition:"right",size:"small",children:D.jsx(RL,{children:e[0].file.name})});if(e.length>1)return D.jsx($L,{icon:D.jsx(W.CloseIcon,{}),variant:"secondary",onClick:n,iconPosition:"right",size:"small",children:D.jsxs(RL,{children:[e.length," files"]})})},[e,n]);return D.jsx(TTu,{children:D.jsxs($Tu,{children:[D.jsx(RTu,{children:i||D.jsx(_Tu,{children:"Add files here"})}),D.jsxs(NTu,{children:[D.jsx(X2u,{onClick:r,variant:"text","data-testid":"add-button",icon:D.jsx(W.AddIcon,{color:"--text-color-secondary"})}),D.jsx("input",{"data-testid":"file-input",hidden:!0,ref:a,type:"file",multiple:!0,accept:"files/*",onChange:t})]})]})})}const TTu=N.div`
2042
+ `;function jTu({step:u,workflowId:e,collectionId:a}){const{handleIdChange:t}=sl(),r=u.stepId.get();return D.jsx(D.Fragment,{children:D.jsxs(Zae,{children:[D.jsx(J0,{children:"Info"}),D.jsxs(Lu,{children:[D.jsxs(Lu.Row,{children:[D.jsx(Lu.Cell,{children:D.jsxs(J0,{children:["Step ID",D.jsx(br,{content:"This step's unique identifier"})]})}),D.jsx(Lu.Cell,{$readonly:!0,children:D.jsx(TF,{attribute:u.stepId,editorTitle:"Change step ID",placeholder:"Add step ID",onSave:n=>{a&&e&&t({collectionId:a,workflowId:e,stepId:r},{collectionId:a,workflowId:e,stepId:n})}})})]}),D.jsxs(Lu.Row,{children:[D.jsx(Lu.Cell,{children:D.jsxs(J0,{children:["Description",D.jsx(br,{content:"The step's purpose in the workflow."})]})}),D.jsx(Lu.Cell,{children:D.jsx(V9,{state:u.description,placeholder:"Add description"})})]})]}),D.jsxs(N1,{children:[D.jsx(J0,{children:"Operation"}),D.jsx(fTu,{step:u,collectionId:a})]}),D.jsx(N1,{children:D.jsx(Qae,{outputs:u.outputs,tooltipText:"Data generated in this step that can be used in the next steps."})}),D.jsx(N1,{children:D.jsx(OTu,{successCriteria:u.successCriteria})})]})})}function MTu({onParameterChange:u,files:e}){const a=H.useRef(null),t=o=>{o.target.files?.length&&u(Array.from(o.target.files).map(s=>({absolutePath:null,file:s})))},r=async()=>{if(Cc())try{const{open:o}=await Promise.resolve().then(()=>require("./replay-index-JnWaTeEL.js")),s=await o({multiple:!0});if(!s)return;const c=(Array.isArray(s)?s:[s]).map(UE),E=(await Promise.all(c)).filter(p=>p!==null);u(E)}catch(o){console.error("Failed to open file dialog or read file:",o)}else a.current?.click()},n=H.useCallback(()=>{u(null)},[u]),i=H.useMemo(()=>{if(!e)return null;if(e.length===1)return D.jsx($L,{icon:D.jsx(W.CloseIcon,{}),variant:"secondary",onClick:n,iconPosition:"right",size:"small",children:D.jsx(RL,{children:e[0].file.name})});if(e.length>1)return D.jsx($L,{icon:D.jsx(W.CloseIcon,{}),variant:"secondary",onClick:n,iconPosition:"right",size:"small",children:D.jsxs(RL,{children:[e.length," files"]})})},[e,n]);return D.jsx(TTu,{children:D.jsxs($Tu,{children:[D.jsx(RTu,{children:i||D.jsx(_Tu,{children:"Add files here"})}),D.jsxs(NTu,{children:[D.jsx(X2u,{onClick:r,variant:"text","data-testid":"add-button",icon:D.jsx(W.AddIcon,{color:"--text-color-secondary"})}),D.jsx("input",{"data-testid":"file-input",hidden:!0,ref:a,type:"file",multiple:!0,accept:"files/*",onChange:t})]})]})})}const TTu=N.div`
2043
2043
  position: relative;
2044
2044
  display: flex;
2045
2045
  flex-grow: 1;
@@ -2166,7 +2166,7 @@ Use the data prop if you want to provide your own handlers.`);if(u.initialData){
2166
2166
  `,XTu=N.div`
2167
2167
  display: flex;
2168
2168
  justify-content: center;
2169
- `;function e$u({data:u,type:e,editable:a}){const t=pa(),r=u[e];function n(o,s){s&&r.merge([Ms()])}function i(o){r[o].set(lu)}return D.jsx(ITu,{keyName:"Param",formElements:r,onParameterChange:n,environment:t,enableInputTypeSelection:e!==Mt["application/x-www-form-urlencoded"],editable:a,actions:o=>D.jsx(Yt,{onClick:()=>i(o),variant:"text",icon:D.jsx(W.TrashCanIcon,{})})})}const u$u=({data:u})=>{const e=u.get(),[a,t]=H.useState(!1),r=H.useRef(null),n=l=>{const c=l.target.files?.[0];if(c){t(!0);const d=new FileReader;d.onload=()=>{t(!1),u.set({absolutePath:null,file:c})},d.readAsDataURL(c)}},i=async l=>{if(l?.preventDefault(),Cc())try{const{open:c}=await Promise.resolve().then(()=>require("./replay-index-BE1z41ZI.js")),d=await c();if(!d)return;const E=await UE(d);u.set(E)}catch(c){console.error("Failed to open file dialog or read file:",c)}else r.current?.click()},o=l=>{l.key==="Enter"&&(l.preventDefault(),i())},s=()=>{u.set(null)};return a?D.jsxs(a$u,{children:[D.jsx(W.SpinnerIcon,{}),"Loading..."]}):e&&e.file?.name?D.jsxs(t$u,{children:[D.jsxs(r$u,{children:[D.jsx(W.DocumentBlankIcon,{size:"16px"}),D.jsx(n$u,{children:e.file?.name})]}),D.jsx(Yt,{onClick:s,icon:D.jsx(W.TrashCanIcon,{})})]}):D.jsx(Yae,{children:!e&&D.jsxs(i$u,{tabIndex:0,role:"button",onKeyDown:o,onClick:i,children:[D.jsx("input",{type:"file",onChange:n,ref:r}),D.jsx(W.CloudUploadIcon,{}),"Upload file"]})})},Yae=N.div`
2169
+ `;function e$u({data:u,type:e,editable:a}){const t=pa(),r=u[e];function n(o,s){s&&r.merge([Ms()])}function i(o){r[o].set(lu)}return D.jsx(ITu,{keyName:"Param",formElements:r,onParameterChange:n,environment:t,enableInputTypeSelection:e!==Mt["application/x-www-form-urlencoded"],editable:a,actions:o=>D.jsx(Yt,{onClick:()=>i(o),variant:"text",icon:D.jsx(W.TrashCanIcon,{})})})}const u$u=({data:u})=>{const e=u.get(),[a,t]=H.useState(!1),r=H.useRef(null),n=l=>{const c=l.target.files?.[0];if(c){t(!0);const d=new FileReader;d.onload=()=>{t(!1),u.set({absolutePath:null,file:c})},d.readAsDataURL(c)}},i=async l=>{if(l?.preventDefault(),Cc())try{const{open:c}=await Promise.resolve().then(()=>require("./replay-index-JnWaTeEL.js")),d=await c();if(!d)return;const E=await UE(d);u.set(E)}catch(c){console.error("Failed to open file dialog or read file:",c)}else r.current?.click()},o=l=>{l.key==="Enter"&&(l.preventDefault(),i())},s=()=>{u.set(null)};return a?D.jsxs(a$u,{children:[D.jsx(W.SpinnerIcon,{}),"Loading..."]}):e&&e.file?.name?D.jsxs(t$u,{children:[D.jsxs(r$u,{children:[D.jsx(W.DocumentBlankIcon,{size:"16px"}),D.jsx(n$u,{children:e.file?.name})]}),D.jsx(Yt,{onClick:s,icon:D.jsx(W.TrashCanIcon,{})})]}):D.jsx(Yae,{children:!e&&D.jsxs(i$u,{tabIndex:0,role:"button",onKeyDown:o,onClick:i,children:[D.jsx("input",{type:"file",onChange:n,ref:r}),D.jsx(W.CloudUploadIcon,{}),"Upload file"]})})},Yae=N.div`
2170
2170
  display: flex;
2171
2171
  align-items: center;
2172
2172
  justify-content: flex-start;
@@ -3099,7 +3099,7 @@ Use the data prop if you want to provide your own handlers.`);if(u.initialData){
3099
3099
  padding: var(--spacing-xs) var(--spacing-sm);
3100
3100
  }
3101
3101
  `,z_u={info:u=>{},error:u=>{},warn:u=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(u,e)=>u,output:u=>u};class w_u extends If{constructor(){super()}resolveExternalRef(e,a){return vx(a)?a:e&&vx(e)?new URL(a,e).href:e?Ns.resolve(Ns.dirname(e),a):a}async loadExternalRef(e){if(vx(e)){const{body:a,mimeType:t}=await QI(e,{...this.config.http,customFetch:hn});return new V1(e,a,t)}else{if(!await ZJ(e))throw new Error(`File not found at ${e}.`);try{throw await UJ(e),new Error(`Expected a file but received a folder at ${e}.`)}catch(r){if(r instanceof Error&&r.message.includes("Expected a file but received a folder"))throw r}const t=await hA(e);return new V1(e,t.replace(/\r\n/g,`
3102
- `))}}}async function O_u({collectionId:u,workflowId:e,projectDir:a,inputsObject:t,serversObject:r,sourceDescriptions:n,severitySettings:i}){const o=`${a}/${u}`,s=new w_u,l=t.map(E=>JSON.stringify({[E.name]:E.value})),c=P_u(r,n),{run:d}=await Promise.resolve().then(()=>require("./replay-index-CzsRCIiz.js"));return await d({files:[o],workflow:e?[e]:[],fetch:hn,logger:z_u,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async E=>{if(!await ZJ(E))throw new Error(`File ${E} doesn't exist or isn't readable.`);try{const x=await hA(E),m=new TextEncoder().encode(x);return new File([m],await JJ(E))}catch(x){throw new Error(`Failed to read file ${E}: ${x}`)}}},envVariables:{},config:await WH({}),externalRefResolver:s,input:l,server:c,severity:JSON.stringify(i),skipLint:!0})}function P_u(u,e){return e.map(a=>{const t=u.find(n=>n.apiId===a.apiId);if(!t)return null;let r=t.value;if(t.variables)for(const n of t.variables){const i=new RegExp(`\\{${n.name}\\}`,"g");r=r.replace(i,n.value)}return`${a.name}=${r}`}).filter(a=>a!==null)}function kB(u){return u==null?"N/A":u<1e3?`${u} ms`:u<1e4?`${(u/1e3).toFixed(1)} s`:`${Math.round(u/1e3)} s`}function Bte({checks:u}){const e=u.filter(p=>p.severity!=="off"),a=e.filter(p=>p.passed).length,t=e.filter(p=>p.severity==="warn"&&!p.passed).length,r=e.length,n=r-a-t,i=a===r,o=a===0,[s,l]=ge.default.useState(n>0||t>0),c=()=>i?"All checks passed":o?"All checks failed":`Some ${r>1?"checks were":"check was"} not successful`,d=()=>i?D.jsx(W.CheckmarkFilledIcon,{color:"var(--color-success-base)"}):n>0?D.jsx(W.ErrorFilledIcon,{color:"var(--color-error-base)"}):D.jsx(W.WarningFilledIcon,{color:"var(--color-warning-base)"}),E=p=>{p.stopPropagation(),l(!s)};return!e||e.length===0?null:D.jsxs(j_u,{children:[D.jsxs(M_u,{onClick:E,children:[D.jsxs(T_u,{children:[D.jsx($_u,{children:D.jsx(R_u,{children:d()})}),D.jsxs(N_u,{children:[D.jsx(__u,{children:c()}),D.jsxs(L_u,{children:[a," successful",t>0&&D.jsxs(D.Fragment,{children:[", ",t," ",t===1?"warning":"warnings"]}),n>0&&D.jsxs(D.Fragment,{children:[", ",n," failed"]})]})]})]}),D.jsx(I_u,{isExpanded:s,children:s?D.jsx(W.ChevronDownIcon,{}):D.jsx(W.ChevronRightIcon,{})})]}),D.jsx(K_u,{isExpanded:s,children:e.map((p,x)=>D.jsxs(V_u,{children:[D.jsx(G_u,{children:p.passed?D.jsx(W.CheckmarkIcon,{color:"var(--color-success-base)",size:"14px"}):!p.passed&&["warn"].includes(p.severity)?D.jsx(W.WarningFilledIcon,{color:"var(--color-warning-base)",size:"14px"}):D.jsx(W.CloseOutlineIcon,{color:"var(--color-error-base)",size:"14px"})}),D.jsxs(H_u,{children:[D.jsx(q_u,{children:p.name}),p.message&&D.jsx(W_u,{children:p.message})]})]},x))})]})}const j_u=N.div`
3102
+ `))}}}async function O_u({collectionId:u,workflowId:e,projectDir:a,inputsObject:t,serversObject:r,sourceDescriptions:n,severitySettings:i}){const o=`${a}/${u}`,s=new w_u,l=t.map(E=>JSON.stringify({[E.name]:E.value})),c=P_u(r,n),{run:d}=await Promise.resolve().then(()=>require("./replay-index-B2jm6Iyk.js"));return await d({files:[o],workflow:e?[e]:[],fetch:hn,logger:z_u,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async E=>{if(!await ZJ(E))throw new Error(`File ${E} doesn't exist or isn't readable.`);try{const x=await hA(E),m=new TextEncoder().encode(x);return new File([m],await JJ(E))}catch(x){throw new Error(`Failed to read file ${E}: ${x}`)}}},envVariables:{},config:await WH({}),externalRefResolver:s,input:l,server:c,severity:JSON.stringify(i),skipLint:!0})}function P_u(u,e){return e.map(a=>{const t=u.find(n=>n.apiId===a.apiId);if(!t)return null;let r=t.value;if(t.variables)for(const n of t.variables){const i=new RegExp(`\\{${n.name}\\}`,"g");r=r.replace(i,n.value)}return`${a.name}=${r}`}).filter(a=>a!==null)}function kB(u){return u==null?"N/A":u<1e3?`${u} ms`:u<1e4?`${(u/1e3).toFixed(1)} s`:`${Math.round(u/1e3)} s`}function Bte({checks:u}){const e=u.filter(p=>p.severity!=="off"),a=e.filter(p=>p.passed).length,t=e.filter(p=>p.severity==="warn"&&!p.passed).length,r=e.length,n=r-a-t,i=a===r,o=a===0,[s,l]=ge.default.useState(n>0||t>0),c=()=>i?"All checks passed":o?"All checks failed":`Some ${r>1?"checks were":"check was"} not successful`,d=()=>i?D.jsx(W.CheckmarkFilledIcon,{color:"var(--color-success-base)"}):n>0?D.jsx(W.ErrorFilledIcon,{color:"var(--color-error-base)"}):D.jsx(W.WarningFilledIcon,{color:"var(--color-warning-base)"}),E=p=>{p.stopPropagation(),l(!s)};return!e||e.length===0?null:D.jsxs(j_u,{children:[D.jsxs(M_u,{onClick:E,children:[D.jsxs(T_u,{children:[D.jsx($_u,{children:D.jsx(R_u,{children:d()})}),D.jsxs(N_u,{children:[D.jsx(__u,{children:c()}),D.jsxs(L_u,{children:[a," successful",t>0&&D.jsxs(D.Fragment,{children:[", ",t," ",t===1?"warning":"warnings"]}),n>0&&D.jsxs(D.Fragment,{children:[", ",n," failed"]})]})]})]}),D.jsx(I_u,{isExpanded:s,children:s?D.jsx(W.ChevronDownIcon,{}):D.jsx(W.ChevronRightIcon,{})})]}),D.jsx(K_u,{isExpanded:s,children:e.map((p,x)=>D.jsxs(V_u,{children:[D.jsx(G_u,{children:p.passed?D.jsx(W.CheckmarkIcon,{color:"var(--color-success-base)",size:"14px"}):!p.passed&&["warn"].includes(p.severity)?D.jsx(W.WarningFilledIcon,{color:"var(--color-warning-base)",size:"14px"}):D.jsx(W.CloseOutlineIcon,{color:"var(--color-error-base)",size:"14px"})}),D.jsxs(H_u,{children:[D.jsx(q_u,{children:p.name}),p.message&&D.jsx(W_u,{children:p.message})]})]},x))})]})}const j_u=N.div`
3103
3103
  margin-bottom: 0;
3104
3104
  margin-top: var(--spacing-xxs);
3105
3105
  `,M_u=N.div`